method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public SearchSourceBuilder postFilter(QueryBuilder postFilter) {
this.postQueryBuilder = postFilter;
return this;
} | SearchSourceBuilder function(QueryBuilder postFilter) { this.postQueryBuilder = postFilter; return this; } | /**
* Sets a filter that will be executed after the query has been executed and
* only has affect on the search hits (not aggregations). This filter is
* always executed as last filtering mechanism.
*/ | Sets a filter that will be executed after the query has been executed and only has affect on the search hits (not aggregations). This filter is always executed as last filtering mechanism | postFilter | {
"repo_name": "gfyoung/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java",
"license": "apache-2.0",
"size": 62076
} | [
"org.elasticsearch.index.query.QueryBuilder"
] | import org.elasticsearch.index.query.QueryBuilder; | import org.elasticsearch.index.query.*; | [
"org.elasticsearch.index"
] | org.elasticsearch.index; | 1,289,654 |
String s = ByteString.fromUtf8(new byte[] { (byte) 0x80, -1, 0x20 });
assertEquals("\ufffd\ufffd ", s);
} | String s = ByteString.fromUtf8(new byte[] { (byte) 0x80, -1, 0x20 }); assertEquals(STR, s); } | /**
* test what happens with a string that invalid UTF8 sequences.
*/ | test what happens with a string that invalid UTF8 sequences | testInvalidUtf8 | {
"repo_name": "sarah-happy/happy-archive",
"path": "archive/src/main/java/org/yi/happy/archive/ByteStringTest.java",
"license": "apache-2.0",
"size": 563
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,959,018 |
public CustomerProcessingType getCustomerSpecialProcessing() {
return customerSpecialProcessing;
} | CustomerProcessingType function() { return customerSpecialProcessing; } | /**
* Gets the customerSpecialProcessing attribute.
*
* @return Returns the customerSpecialProcessing
*/ | Gets the customerSpecialProcessing attribute | getCustomerSpecialProcessing | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/ar/document/CustomerInvoiceDocument.java",
"license": "apache-2.0",
"size": 76460
} | [
"org.kuali.kfs.module.ar.businessobject.CustomerProcessingType"
] | import org.kuali.kfs.module.ar.businessobject.CustomerProcessingType; | import org.kuali.kfs.module.ar.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 2,754,854 |
@Test
public void whenWeAddMoreValuesThenInListItAutomaticallyIncrease() {
SimpleArrayList list = new SimpleArrayList();
list.add("1");
list.add("1");
list.add("1");
list.add("1");
list.add("1");
list.add("1");
list.add("1");
list.add("1");
list.add("1");
list.add("1");
list.add("11");
list.add("12");
Assert.assertThat(list.get(10), is("11"));
Assert.assertThat(list.get(11), is("12"));
} | void function() { SimpleArrayList list = new SimpleArrayList(); list.add("1"); list.add("1"); list.add("1"); list.add("1"); list.add("1"); list.add("1"); list.add("1"); list.add("1"); list.add("1"); list.add("1"); list.add("11"); list.add("12"); Assert.assertThat(list.get(10), is("11")); Assert.assertThat(list.get(11), is("12")); } | /**
* Test of automatically increasing of array size.
*/ | Test of automatically increasing of array size | whenWeAddMoreValuesThenInListItAutomaticallyIncrease | {
"repo_name": "Kilanov/java-a-to-z",
"path": "chapter_005/src/test/java/ru/skilanov/io/list/SimpleArrayListTest.java",
"license": "apache-2.0",
"size": 2351
} | [
"org.hamcrest.Matchers",
"org.junit.Assert"
] | import org.hamcrest.Matchers; import org.junit.Assert; | import org.hamcrest.*; import org.junit.*; | [
"org.hamcrest",
"org.junit"
] | org.hamcrest; org.junit; | 903,698 |
@Test(dataProvider = "light administrator privilege test cases")
public void testModifyGroupPrivilegeCreationViaAdmin(boolean isAdmin, boolean isRestricted, boolean isSudo) throws Exception {
final boolean isExpectSuccess = isAdmin && !isRestricted;
loginNewActor(isAdmin, isSudo ? loginNewAdmin(true, null).userName : null,
isRestricted ? AdminPrivilegeModifyGroup.value : null);
final ExperimenterGroup newGroup = new ExperimenterGroupI();
newGroup.setLdap(omero.rtypes.rbool(false));
newGroup.setName(omero.rtypes.rstring(UUID.randomUUID().toString()));
try {
iAdmin.createGroup(newGroup);
Assert.assertTrue(isExpectSuccess);
} catch (ServerError se) {
Assert.assertFalse(isExpectSuccess);
}
} | @Test(dataProvider = STR) void function(boolean isAdmin, boolean isRestricted, boolean isSudo) throws Exception { final boolean isExpectSuccess = isAdmin && !isRestricted; loginNewActor(isAdmin, isSudo ? loginNewAdmin(true, null).userName : null, isRestricted ? AdminPrivilegeModifyGroup.value : null); final ExperimenterGroup newGroup = new ExperimenterGroupI(); newGroup.setLdap(omero.rtypes.rbool(false)); newGroup.setName(omero.rtypes.rstring(UUID.randomUUID().toString())); try { iAdmin.createGroup(newGroup); Assert.assertTrue(isExpectSuccess); } catch (ServerError se) { Assert.assertFalse(isExpectSuccess); } } | /**
* Test that users may modify groups only if they are a member of the <tt>system</tt> group and
* have the <tt>ModifyGroup</tt> privilege. Attempts creation of new group via {@link omero.api.IAdminPrx}.
* @param isAdmin if to test a member of the <tt>system</tt> group
* @param isRestricted if to test a user who does <em>not</em> have the <tt>ModifyGroup</tt> privilege
* @param isSudo if to test attempt to subvert privilege by sudo to an unrestricted member of the <tt>system</tt> group
* @throws Exception unexpected
*/ | Test that users may modify groups only if they are a member of the system group and have the ModifyGroup privilege. Attempts creation of new group via <code>omero.api.IAdminPrx</code> | testModifyGroupPrivilegeCreationViaAdmin | {
"repo_name": "MontpellierRessourcesImagerie/openmicroscopy",
"path": "components/tools/OmeroJava/test/integration/LightAdminPrivilegesTest.java",
"license": "gpl-2.0",
"size": 169987
} | [
"java.util.UUID",
"org.testng.Assert",
"org.testng.annotations.Test"
] | import java.util.UUID; import org.testng.Assert; import org.testng.annotations.Test; | import java.util.*; import org.testng.*; import org.testng.annotations.*; | [
"java.util",
"org.testng",
"org.testng.annotations"
] | java.util; org.testng; org.testng.annotations; | 2,448,227 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
annieTabbedPane = new SimpleTabbedPane();
acceptedAnnotationsPanel = new javax.swing.JPanel();
annotationTypeLabel = new SimpleLabel();
typesPanel = new javax.swing.JPanel();
allCheckBox = new SimpleCheckBox();
jSeparator = new javax.swing.JSeparator();
checkboxesPanel = new javax.swing.JPanel();
checkboxesPanel1 = new javax.swing.JPanel();
firstPersonCheckBox = new SimpleCheckBox();
lookupCheckBox = new SimpleCheckBox();
personCheckBox = new SimpleCheckBox();
sentenceCheckBox = new SimpleCheckBox();
spaceTokenCheckBox = new SimpleCheckBox();
splitCheckBox = new SimpleCheckBox();
tokenCheckBox = new SimpleCheckBox();
unknownCheckBox = new SimpleCheckBox();
dateCheckBox = new SimpleCheckBox();
checkboxesPanel2 = new javax.swing.JPanel();
jobTitleCheckBox = new SimpleCheckBox();
locationCheckBox = new SimpleCheckBox();
organizationCheckBox = new SimpleCheckBox();
tempCheckBox = new SimpleCheckBox();
identifierCheckBox = new SimpleCheckBox();
moneyCheckBox = new SimpleCheckBox();
percentCheckBox = new SimpleCheckBox();
titleCheckBox = new SimpleCheckBox();
otherPanel = new javax.swing.JPanel();
otherLabel = new SimpleLabel();
otherTextField = new SimpleField();
buttonPanel = new javax.swing.JPanel();
buttonFillerPanel = new javax.swing.JPanel();
okButton = new SimpleButton();
cancelButton = new SimpleButton();
setTitle("Configure GATE Annie extractor");
getContentPane().setLayout(new java.awt.GridBagLayout());
acceptedAnnotationsPanel.setLayout(new java.awt.GridBagLayout());
annotationTypeLabel.setText("<html>Select annotation types which Wandora should convert to topics and associations. Write additional types to 'Other' field as a comma separated list. Selecting 'Accept ALL' includes also nonlisted annotation types.</html>");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(6, 6, 12, 6);
acceptedAnnotationsPanel.add(annotationTypeLabel, gridBagConstraints);
typesPanel.setLayout(new java.awt.GridBagLayout());
allCheckBox.setText("Accept ALL annotation types");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
typesPanel.add(allCheckBox, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
typesPanel.add(jSeparator, gridBagConstraints);
checkboxesPanel.setLayout(new java.awt.GridBagLayout());
checkboxesPanel1.setLayout(new java.awt.GridBagLayout());
firstPersonCheckBox.setSelected(true);
firstPersonCheckBox.setText("FirstPerson");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
checkboxesPanel1.add(firstPersonCheckBox, gridBagConstraints);
lookupCheckBox.setSelected(true);
lookupCheckBox.setText("Lookup");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
checkboxesPanel1.add(lookupCheckBox, gridBagConstraints);
personCheckBox.setSelected(true);
personCheckBox.setText("Person");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
checkboxesPanel1.add(personCheckBox, gridBagConstraints);
sentenceCheckBox.setText("Sentence");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
checkboxesPanel1.add(sentenceCheckBox, gridBagConstraints);
spaceTokenCheckBox.setText("SpaceToken");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
checkboxesPanel1.add(spaceTokenCheckBox, gridBagConstraints);
splitCheckBox.setText("Split");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
checkboxesPanel1.add(splitCheckBox, gridBagConstraints);
tokenCheckBox.setText("Token");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
checkboxesPanel1.add(tokenCheckBox, gridBagConstraints);
unknownCheckBox.setSelected(true);
unknownCheckBox.setText("Unknown");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
checkboxesPanel1.add(unknownCheckBox, gridBagConstraints);
dateCheckBox.setSelected(true);
dateCheckBox.setText("Date");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
checkboxesPanel1.add(dateCheckBox, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
checkboxesPanel.add(checkboxesPanel1, gridBagConstraints);
checkboxesPanel2.setLayout(new java.awt.GridBagLayout());
jobTitleCheckBox.setText("JobTitle");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
checkboxesPanel2.add(jobTitleCheckBox, gridBagConstraints);
locationCheckBox.setSelected(true);
locationCheckBox.setText("Location");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
checkboxesPanel2.add(locationCheckBox, gridBagConstraints);
organizationCheckBox.setSelected(true);
organizationCheckBox.setText("Organization");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
checkboxesPanel2.add(organizationCheckBox, gridBagConstraints);
tempCheckBox.setText("Temp");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
checkboxesPanel2.add(tempCheckBox, gridBagConstraints);
identifierCheckBox.setSelected(true);
identifierCheckBox.setText("Identifier");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
checkboxesPanel2.add(identifierCheckBox, gridBagConstraints);
moneyCheckBox.setText("Money");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
checkboxesPanel2.add(moneyCheckBox, gridBagConstraints);
percentCheckBox.setText("Percent");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
checkboxesPanel2.add(percentCheckBox, gridBagConstraints);
titleCheckBox.setSelected(true);
titleCheckBox.setText("Title");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
checkboxesPanel2.add(titleCheckBox, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
checkboxesPanel.add(checkboxesPanel2, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0);
typesPanel.add(checkboxesPanel, gridBagConstraints);
otherPanel.setLayout(new java.awt.GridBagLayout());
otherLabel.setText("Other");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
otherPanel.add(otherLabel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
otherPanel.add(otherTextField, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
typesPanel.add(otherPanel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 12, 6, 12);
acceptedAnnotationsPanel.add(typesPanel, gridBagConstraints);
annieTabbedPane.addTab("Annotation types", acceptedAnnotationsPanel);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
getContentPane().add(annieTabbedPane, gridBagConstraints);
buttonPanel.setLayout(new java.awt.GridBagLayout());
javax.swing.GroupLayout buttonFillerPanelLayout = new javax.swing.GroupLayout(buttonFillerPanel);
buttonFillerPanel.setLayout(buttonFillerPanelLayout);
buttonFillerPanelLayout.setHorizontalGroup(
buttonFillerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
buttonFillerPanelLayout.setVerticalGroup(
buttonFillerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
buttonPanel.add(buttonFillerPanel, gridBagConstraints); | @SuppressWarnings(STR) void function() { java.awt.GridBagConstraints gridBagConstraints; annieTabbedPane = new SimpleTabbedPane(); acceptedAnnotationsPanel = new javax.swing.JPanel(); annotationTypeLabel = new SimpleLabel(); typesPanel = new javax.swing.JPanel(); allCheckBox = new SimpleCheckBox(); jSeparator = new javax.swing.JSeparator(); checkboxesPanel = new javax.swing.JPanel(); checkboxesPanel1 = new javax.swing.JPanel(); firstPersonCheckBox = new SimpleCheckBox(); lookupCheckBox = new SimpleCheckBox(); personCheckBox = new SimpleCheckBox(); sentenceCheckBox = new SimpleCheckBox(); spaceTokenCheckBox = new SimpleCheckBox(); splitCheckBox = new SimpleCheckBox(); tokenCheckBox = new SimpleCheckBox(); unknownCheckBox = new SimpleCheckBox(); dateCheckBox = new SimpleCheckBox(); checkboxesPanel2 = new javax.swing.JPanel(); jobTitleCheckBox = new SimpleCheckBox(); locationCheckBox = new SimpleCheckBox(); organizationCheckBox = new SimpleCheckBox(); tempCheckBox = new SimpleCheckBox(); identifierCheckBox = new SimpleCheckBox(); moneyCheckBox = new SimpleCheckBox(); percentCheckBox = new SimpleCheckBox(); titleCheckBox = new SimpleCheckBox(); otherPanel = new javax.swing.JPanel(); otherLabel = new SimpleLabel(); otherTextField = new SimpleField(); buttonPanel = new javax.swing.JPanel(); buttonFillerPanel = new javax.swing.JPanel(); okButton = new SimpleButton(); cancelButton = new SimpleButton(); setTitle(STR); getContentPane().setLayout(new java.awt.GridBagLayout()); acceptedAnnotationsPanel.setLayout(new java.awt.GridBagLayout()); annotationTypeLabel.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(6, 6, 12, 6); acceptedAnnotationsPanel.add(annotationTypeLabel, gridBagConstraints); typesPanel.setLayout(new java.awt.GridBagLayout()); allCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; typesPanel.add(allCheckBox, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); typesPanel.add(jSeparator, gridBagConstraints); checkboxesPanel.setLayout(new java.awt.GridBagLayout()); checkboxesPanel1.setLayout(new java.awt.GridBagLayout()); firstPersonCheckBox.setSelected(true); firstPersonCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; checkboxesPanel1.add(firstPersonCheckBox, gridBagConstraints); lookupCheckBox.setSelected(true); lookupCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; checkboxesPanel1.add(lookupCheckBox, gridBagConstraints); personCheckBox.setSelected(true); personCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; checkboxesPanel1.add(personCheckBox, gridBagConstraints); sentenceCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; checkboxesPanel1.add(sentenceCheckBox, gridBagConstraints); spaceTokenCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; checkboxesPanel1.add(spaceTokenCheckBox, gridBagConstraints); splitCheckBox.setText("Split"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; checkboxesPanel1.add(splitCheckBox, gridBagConstraints); tokenCheckBox.setText("Token"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; checkboxesPanel1.add(tokenCheckBox, gridBagConstraints); unknownCheckBox.setSelected(true); unknownCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; checkboxesPanel1.add(unknownCheckBox, gridBagConstraints); dateCheckBox.setSelected(true); dateCheckBox.setText("Date"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; checkboxesPanel1.add(dateCheckBox, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; checkboxesPanel.add(checkboxesPanel1, gridBagConstraints); checkboxesPanel2.setLayout(new java.awt.GridBagLayout()); jobTitleCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; checkboxesPanel2.add(jobTitleCheckBox, gridBagConstraints); locationCheckBox.setSelected(true); locationCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; checkboxesPanel2.add(locationCheckBox, gridBagConstraints); organizationCheckBox.setSelected(true); organizationCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; checkboxesPanel2.add(organizationCheckBox, gridBagConstraints); tempCheckBox.setText("Temp"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; checkboxesPanel2.add(tempCheckBox, gridBagConstraints); identifierCheckBox.setSelected(true); identifierCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; checkboxesPanel2.add(identifierCheckBox, gridBagConstraints); moneyCheckBox.setText("Money"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; checkboxesPanel2.add(moneyCheckBox, gridBagConstraints); percentCheckBox.setText(STR); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; checkboxesPanel2.add(percentCheckBox, gridBagConstraints); titleCheckBox.setSelected(true); titleCheckBox.setText("Title"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; checkboxesPanel2.add(titleCheckBox, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; checkboxesPanel.add(checkboxesPanel2, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 6, 0); typesPanel.add(checkboxesPanel, gridBagConstraints); otherPanel.setLayout(new java.awt.GridBagLayout()); otherLabel.setText("Other"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4); otherPanel.add(otherLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; otherPanel.add(otherTextField, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 1.0; typesPanel.add(otherPanel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 12, 6, 12); acceptedAnnotationsPanel.add(typesPanel, gridBagConstraints); annieTabbedPane.addTab(STR, acceptedAnnotationsPanel); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; getContentPane().add(annieTabbedPane, gridBagConstraints); buttonPanel.setLayout(new java.awt.GridBagLayout()); javax.swing.GroupLayout buttonFillerPanelLayout = new javax.swing.GroupLayout(buttonFillerPanel); buttonFillerPanel.setLayout(buttonFillerPanelLayout); buttonFillerPanelLayout.setHorizontalGroup( buttonFillerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); buttonFillerPanelLayout.setVerticalGroup( buttonFillerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; buttonPanel.add(buttonFillerPanel, gridBagConstraints); | /** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/ | This method is called from within the constructor to initialize the form. always regenerated by the Form Editor | initComponents | {
"repo_name": "wandora-team/wandora",
"path": "src/org/wandora/application/tools/extractors/gate/AnnieConfiguration.java",
"license": "gpl-3.0",
"size": 23688
} | [
"org.wandora.application.gui.simple.SimpleButton",
"org.wandora.application.gui.simple.SimpleCheckBox",
"org.wandora.application.gui.simple.SimpleField",
"org.wandora.application.gui.simple.SimpleLabel",
"org.wandora.application.gui.simple.SimpleTabbedPane"
] | import org.wandora.application.gui.simple.SimpleButton; import org.wandora.application.gui.simple.SimpleCheckBox; import org.wandora.application.gui.simple.SimpleField; import org.wandora.application.gui.simple.SimpleLabel; import org.wandora.application.gui.simple.SimpleTabbedPane; | import org.wandora.application.gui.simple.*; | [
"org.wandora.application"
] | org.wandora.application; | 2,446,120 |
TransformationInfo transformationInfo = super.build();
transformationInfo.setType(TransformationType.valueOf(transformation.getType().name()));
transformationInfo.setInputFileFormat(transformation.getInputFileFormat());
transformationInfo.setOutputFileFormat(transformation.getOutputFileFormat());
return transformationInfo;
} | TransformationInfo transformationInfo = super.build(); transformationInfo.setType(TransformationType.valueOf(transformation.getType().name())); transformationInfo.setInputFileFormat(transformation.getInputFileFormat()); transformationInfo.setOutputFileFormat(transformation.getOutputFileFormat()); return transformationInfo; } | /**
* Builds a transformation.
*
* @return transformation
*/ | Builds a transformation | build | {
"repo_name": "psnc-dl/darceo",
"path": "wrdz/wrdz-zmkd/common/src/main/java/pl/psnc/synat/wrdz/zmkd/plan/execution/TransformationInfoBuilder.java",
"license": "gpl-3.0",
"size": 1908
} | [
"pl.psnc.synat.wrdz.ru.composition.TransformationType"
] | import pl.psnc.synat.wrdz.ru.composition.TransformationType; | import pl.psnc.synat.wrdz.ru.composition.*; | [
"pl.psnc.synat"
] | pl.psnc.synat; | 2,040,028 |
@ApiModelProperty(example = "null", value = "Internal server error message")
public String getError() {
return error;
} | @ApiModelProperty(example = "null", value = STR) String function() { return error; } | /**
* Internal server error message
* @return error
**/ | Internal server error message | getError | {
"repo_name": "Tmin10/EVE-Security-Service",
"path": "server-api/src/main/java/ru/tmin10/EVESecurityService/serverApi/model/GetUniverseGroupsGroupIdInternalServerError.java",
"license": "gpl-3.0",
"size": 2274
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,105,345 |
public static ByteBuffer createByteBuffer(int size) {
ByteBuffer buf = ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder());
buf.clear();
return buf;
}
| static ByteBuffer function(int size) { ByteBuffer buf = ByteBuffer.allocateDirect(size).order(ByteOrder.nativeOrder()); buf.clear(); return buf; } | /**
* Create a new ByteBuffer of the specified size.
*
* @param size required number of ints to store.
*
* @return the new IntBuffer
*/ | Create a new ByteBuffer of the specified size | createByteBuffer | {
"repo_name": "nppotdar/touchtable-menu",
"path": "src/org/mt4j/util/math/ToolsBuffers.java",
"license": "gpl-2.0",
"size": 16305
} | [
"java.nio.ByteBuffer",
"java.nio.ByteOrder"
] | import java.nio.ByteBuffer; import java.nio.ByteOrder; | import java.nio.*; | [
"java.nio"
] | java.nio; | 2,004,967 |
@Test
public void test_setImportId() {
String value = "new_value";
instance.setImportId(value);
assertEquals("'setImportId' should be correct.",
value, TestsHelper.getField(instance, "importId"));
} | void function() { String value = STR; instance.setImportId(value); assertEquals(STR, value, TestsHelper.getField(instance, STR)); } | /**
* <p>
* Accuracy test for the method <code>setImportId(String importId)</code>.<br>
* The value should be properly set.
* </p>
*/ | Accuracy test for the method <code>setImportId(String importId)</code>. The value should be properly set. | test_setImportId | {
"repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application",
"path": "Code/FACES/src/java/tests/gov/opm/scrd/entities/application/PaymentUnitTests.java",
"license": "apache-2.0",
"size": 46209
} | [
"gov.opm.scrd.TestsHelper",
"org.junit.Assert"
] | import gov.opm.scrd.TestsHelper; import org.junit.Assert; | import gov.opm.scrd.*; import org.junit.*; | [
"gov.opm.scrd",
"org.junit"
] | gov.opm.scrd; org.junit; | 696,267 |
public void removeConfiguration(final String key) {
getDelegateeForModification().removeValue(Bytes.toBytes(key));
} | void function(final String key) { getDelegateeForModification().removeValue(Bytes.toBytes(key)); } | /**
* Remove a config setting represented by the key from the map
*/ | Remove a config setting represented by the key from the map | removeConfiguration | {
"repo_name": "HubSpot/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java",
"license": "apache-2.0",
"size": 33339
} | [
"org.apache.hadoop.hbase.util.Bytes"
] | import org.apache.hadoop.hbase.util.Bytes; | import org.apache.hadoop.hbase.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 769,204 |
private Set<String> getNeededRomFiles(MachineRomSetFormat format) {
Set<String> romSets = new HashSet<>();
// If this machine is a clone of another, only include cloned machine roms
// if format is merged (clones are included in parent roms on merged
// romsets)
if (!this.roms.isEmpty() && (this.clonedMachine == null
|| format.equals(MachineRomSetFormat.SPLIT))) {
romSets.add(this.name);
}
// This machine is a clone of another which needs roms ?
if (this.clonedMachine != null) {
Set<String> psRomSets = this.clonedMachine.getNeededRomFiles(format);
if (!psRomSets.isEmpty()) {
romSets.addAll(psRomSets);
}
}
// This machine if a "rom" of another (ex neogeo) ?
if (this.romOfMachine != null) {
Set<String> psRomSets = this.romOfMachine.getNeededRomFiles(format);
if (!psRomSets.isEmpty()) {
romSets.addAll(psRomSets);
}
}
// Any sub machine componants of this machine need roms ?
for (Machine subm : this.getSubMachines()) {
Set<String> submRomSets = subm.getNeededRomFiles(format);
if (!submRomSets.isEmpty()) {
romSets.addAll(submRomSets);
}
}
return romSets;
} | Set<String> function(MachineRomSetFormat format) { Set<String> romSets = new HashSet<>(); if (!this.roms.isEmpty() && (this.clonedMachine == null format.equals(MachineRomSetFormat.SPLIT))) { romSets.add(this.name); } if (this.clonedMachine != null) { Set<String> psRomSets = this.clonedMachine.getNeededRomFiles(format); if (!psRomSets.isEmpty()) { romSets.addAll(psRomSets); } } if (this.romOfMachine != null) { Set<String> psRomSets = this.romOfMachine.getNeededRomFiles(format); if (!psRomSets.isEmpty()) { romSets.addAll(psRomSets); } } for (Machine subm : this.getSubMachines()) { Set<String> submRomSets = subm.getNeededRomFiles(format); if (!submRomSets.isEmpty()) { romSets.addAll(submRomSets); } } return romSets; } | /**
* Generate and return a list of needed rom files
*/ | Generate and return a list of needed rom files | getNeededRomFiles | {
"repo_name": "TiBeN/ia-mame",
"path": "src/main/java/org/tibennetwork/iarcade/mame/Machine.java",
"license": "apache-2.0",
"size": 7356
} | [
"java.util.HashSet",
"java.util.Set",
"org.tibennetwork.iarcade.internetarchive.MachineRomSet"
] | import java.util.HashSet; import java.util.Set; import org.tibennetwork.iarcade.internetarchive.MachineRomSet; | import java.util.*; import org.tibennetwork.iarcade.internetarchive.*; | [
"java.util",
"org.tibennetwork.iarcade"
] | java.util; org.tibennetwork.iarcade; | 1,264,794 |
public JSONArray getAllDatafariUsers() throws DatafariServerException {
try {
final JSONArray users = new JSONArray();
final Map<String, JSONObject> listJsonUsers = new HashMap<String, JSONObject>();
final ResultSet userResults = session.execute("SELECT " + USERNAMECOLUMN + ", " + ISIMPORTEDCOLUMN + " FROM " + USERCOLLECTION + " WHERE " + ISIMPORTEDCOLUMN + "=false");
for (final Row row : userResults) {
final String username = row.getString(USERNAMECOLUMN);
final boolean isImported = row.getBoolean(ISIMPORTEDCOLUMN);
final JSONObject userJ = new JSONObject();
userJ.put(USERNAMECOLUMN, username);
userJ.put(ISIMPORTEDCOLUMN, isImported);
userJ.put("roles", new JSONArray());
if (!listJsonUsers.containsKey(username)) {
listJsonUsers.put(username, userJ);
}
}
final ResultSet roleResults = session.execute("SELECT * FROM " + ROLECOLLECTION);
for (final Row row : roleResults) {
final String username = row.getString(USERNAMECOLUMN);
if (listJsonUsers.containsKey(username)) {
final JSONArray userRoles = (JSONArray) listJsonUsers.get(username).get("roles");
userRoles.add(row.getString(ROLECOLUMN));
}
}
listJsonUsers.values().forEach(userJ -> {
users.add(userJ);
});
return users;
} catch (final DriverException e) {
logger.warn("Unable to get all AD users : " + e.getMessage());
// TODO catch specific exception
throw new DatafariServerException(CodesReturned.PROBLEMCONNECTIONDATABASE, e.getMessage());
}
} | JSONArray function() throws DatafariServerException { try { final JSONArray users = new JSONArray(); final Map<String, JSONObject> listJsonUsers = new HashMap<String, JSONObject>(); final ResultSet userResults = session.execute(STR + USERNAMECOLUMN + STR + ISIMPORTEDCOLUMN + STR + USERCOLLECTION + STR + ISIMPORTEDCOLUMN + STR); for (final Row row : userResults) { final String username = row.getString(USERNAMECOLUMN); final boolean isImported = row.getBoolean(ISIMPORTEDCOLUMN); final JSONObject userJ = new JSONObject(); userJ.put(USERNAMECOLUMN, username); userJ.put(ISIMPORTEDCOLUMN, isImported); userJ.put("roles", new JSONArray()); if (!listJsonUsers.containsKey(username)) { listJsonUsers.put(username, userJ); } } final ResultSet roleResults = session.execute(STR + ROLECOLLECTION); for (final Row row : roleResults) { final String username = row.getString(USERNAMECOLUMN); if (listJsonUsers.containsKey(username)) { final JSONArray userRoles = (JSONArray) listJsonUsers.get(username).get("roles"); userRoles.add(row.getString(ROLECOLUMN)); } } listJsonUsers.values().forEach(userJ -> { users.add(userJ); }); return users; } catch (final DriverException e) { logger.warn(STR + e.getMessage()); throw new DatafariServerException(CodesReturned.PROBLEMCONNECTIONDATABASE, e.getMessage()); } } | /**
* get all Datafari users with their corresponding roles
*
* @param db instance of the database that contains the identifier collection
* @return Map of <username, list of roles>
* @throws Exception if there's a problem with Cassandra
*/ | get all Datafari users with their corresponding roles | getAllDatafariUsers | {
"repo_name": "francelabs/datafari",
"path": "datafari-webapp/src/main/java/com/francelabs/datafari/service/db/UserDataService.java",
"license": "apache-2.0",
"size": 17189
} | [
"com.datastax.oss.driver.api.core.DriverException",
"com.datastax.oss.driver.api.core.cql.ResultSet",
"com.datastax.oss.driver.api.core.cql.Row",
"com.francelabs.datafari.exception.CodesReturned",
"com.francelabs.datafari.exception.DatafariServerException",
"java.util.HashMap",
"java.util.Map",
"org.j... | import com.datastax.oss.driver.api.core.DriverException; import com.datastax.oss.driver.api.core.cql.ResultSet; import com.datastax.oss.driver.api.core.cql.Row; import com.francelabs.datafari.exception.CodesReturned; import com.francelabs.datafari.exception.DatafariServerException; import java.util.HashMap; import java.util.Map; import org.json.simple.JSONArray; import org.json.simple.JSONObject; | import com.datastax.oss.driver.api.core.*; import com.datastax.oss.driver.api.core.cql.*; import com.francelabs.datafari.exception.*; import java.util.*; import org.json.simple.*; | [
"com.datastax.oss",
"com.francelabs.datafari",
"java.util",
"org.json.simple"
] | com.datastax.oss; com.francelabs.datafari; java.util; org.json.simple; | 554,452 |
@Test
public void testFetchOfBadIntent() {
makeDefaultIntents();
final ClientResource client = new ClientResource(getHighRestIntentUrl() + "/2334");
try {
getIntent(client);
// The get operation should have thrown a ResourceException.
// Fail because the Exception was not seen.
Assert.fail("Invalid intent fetch did not cause an exception");
} catch (ResourceException resourceError) {
// The HTTP status should be NOT FOUND
assertThat(client, hasStatusOf(Status.CLIENT_ERROR_NOT_FOUND));
}
} | void function() { makeDefaultIntents(); final ClientResource client = new ClientResource(getHighRestIntentUrl() + "/2334"); try { getIntent(client); Assert.fail(STR); } catch (ResourceException resourceError) { assertThat(client, hasStatusOf(Status.CLIENT_ERROR_NOT_FOUND)); } } | /**
* Test that the GET of a single Intent REST call returns the proper result
* when given a bad Intent id. The call to get the Intent should return a
* status of NOT_FOUND.
*/ | Test that the GET of a single Intent REST call returns the proper result when given a bad Intent id. The call to get the Intent should return a status of NOT_FOUND | testFetchOfBadIntent | {
"repo_name": "opennetworkinglab/spring-open",
"path": "src/test/java/net/onrc/onos/api/rest/TestRestIntentHighGet.java",
"license": "apache-2.0",
"size": 7379
} | [
"net.onrc.onos.api.rest.ClientResourceStatusMatcher",
"org.hamcrest.MatcherAssert",
"org.junit.Assert",
"org.restlet.data.Status",
"org.restlet.resource.ClientResource",
"org.restlet.resource.ResourceException"
] | import net.onrc.onos.api.rest.ClientResourceStatusMatcher; import org.hamcrest.MatcherAssert; import org.junit.Assert; import org.restlet.data.Status; import org.restlet.resource.ClientResource; import org.restlet.resource.ResourceException; | import net.onrc.onos.api.rest.*; import org.hamcrest.*; import org.junit.*; import org.restlet.data.*; import org.restlet.resource.*; | [
"net.onrc.onos",
"org.hamcrest",
"org.junit",
"org.restlet.data",
"org.restlet.resource"
] | net.onrc.onos; org.hamcrest; org.junit; org.restlet.data; org.restlet.resource; | 525,973 |
public void startRM() {
resourceManager = new ResourceManagerBuilder(this).build();
} | void function() { resourceManager = new ResourceManagerBuilder(this).build(); } | /**
* Starts the resource manager. Must be called separately from the
* constructor after the system property mechanism is initialized
* since the builder will consult system options to determine the
* proper RM to use.
*/ | Starts the resource manager. Must be called separately from the constructor after the system property mechanism is initialized since the builder will consult system options to determine the proper RM to use | startRM | {
"repo_name": "apache/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/server/DrillbitContext.java",
"license": "apache-2.0",
"size": 11516
} | [
"org.apache.drill.exec.work.foreman.rm.ResourceManagerBuilder"
] | import org.apache.drill.exec.work.foreman.rm.ResourceManagerBuilder; | import org.apache.drill.exec.work.foreman.rm.*; | [
"org.apache.drill"
] | org.apache.drill; | 2,590,496 |
@NonNull
private SurfaceConfig.ConfigType getConfigType(int imageFormat) {
if (imageFormat == ImageFormat.YUV_420_888) {
return SurfaceConfig.ConfigType.YUV;
} else if (imageFormat == ImageFormat.JPEG) {
return SurfaceConfig.ConfigType.JPEG;
} else if (imageFormat == ImageFormat.RAW_SENSOR) {
return SurfaceConfig.ConfigType.RAW;
} else {
return SurfaceConfig.ConfigType.PRIV;
}
} | SurfaceConfig.ConfigType function(int imageFormat) { if (imageFormat == ImageFormat.YUV_420_888) { return SurfaceConfig.ConfigType.YUV; } else if (imageFormat == ImageFormat.JPEG) { return SurfaceConfig.ConfigType.JPEG; } else if (imageFormat == ImageFormat.RAW_SENSOR) { return SurfaceConfig.ConfigType.RAW; } else { return SurfaceConfig.ConfigType.PRIV; } } | /**
* Gets {@link ConfigType} from image format.
*
* <p> PRIV refers to any target whose available sizes are found using
* StreamConfigurationMap.getOutputSizes(Class) with no direct application-visible format,
* YUV refers to a target Surface using the ImageFormat.YUV_420_888 format, JPEG refers to
* the ImageFormat.JPEG format, and RAW refers to the ImageFormat.RAW_SENSOR format.
*/ | Gets <code>ConfigType</code> from image format. PRIV refers to any target whose available sizes are found using StreamConfigurationMap.getOutputSizes(Class) with no direct application-visible format, YUV refers to a target Surface using the ImageFormat.YUV_420_888 format, JPEG refers to the ImageFormat.JPEG format, and RAW refers to the ImageFormat.RAW_SENSOR format | getConfigType | {
"repo_name": "AndroidX/androidx",
"path": "camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/SupportedSurfaceCombination.java",
"license": "apache-2.0",
"size": 63668
} | [
"android.graphics.ImageFormat",
"androidx.camera.core.impl.SurfaceConfig"
] | import android.graphics.ImageFormat; import androidx.camera.core.impl.SurfaceConfig; | import android.graphics.*; import androidx.camera.core.impl.*; | [
"android.graphics",
"androidx.camera"
] | android.graphics; androidx.camera; | 1,010,465 |
private AlarmManager getAlarmMgr () {
return (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
} | AlarmManager function () { return (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); } | /**
* Alarm manager for the application.
*/ | Alarm manager for the application | getAlarmMgr | {
"repo_name": "Telerik-Verified-Plugins/LocalNotification",
"path": "src/android/notification/Notification.java",
"license": "apache-2.0",
"size": 9380
} | [
"android.app.AlarmManager",
"android.content.Context"
] | import android.app.AlarmManager; import android.content.Context; | import android.app.*; import android.content.*; | [
"android.app",
"android.content"
] | android.app; android.content; | 2,841,799 |
@Override
public void doSaveAs() {
SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
saveAsDialog.open();
IPath path = saveAsDialog.getResult();
if (path != null) {
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
if (file != null) {
doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
}
}
} | void function() { SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); saveAsDialog.open(); IPath path = saveAsDialog.getResult(); if (path != null) { IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (file != null) { doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); } } } | /**
* This also changes the editor's input.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This also changes the editor's input. | doSaveAs | {
"repo_name": "markus1978/citygml4emf",
"path": "de.hub.citygml.emf.ecore.editor/src/net/opengis/citygml/building/presentation/BuildingEditor.java",
"license": "apache-2.0",
"size": 56379
} | [
"org.eclipse.core.resources.IFile",
"org.eclipse.core.resources.ResourcesPlugin",
"org.eclipse.core.runtime.IPath",
"org.eclipse.emf.common.util.URI",
"org.eclipse.ui.dialogs.SaveAsDialog",
"org.eclipse.ui.part.FileEditorInput"
] | import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.emf.common.util.URI; import org.eclipse.ui.dialogs.SaveAsDialog; import org.eclipse.ui.part.FileEditorInput; | import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.emf.common.util.*; import org.eclipse.ui.dialogs.*; import org.eclipse.ui.part.*; | [
"org.eclipse.core",
"org.eclipse.emf",
"org.eclipse.ui"
] | org.eclipse.core; org.eclipse.emf; org.eclipse.ui; | 382,401 |
@Test
public void testCompareWithSdSamePrefixDifferentCols() throws MetaException {
Partition p1 = new PartitionBuilder()
.setDbName("DB_NAME")
.setTableName(TABLE_NAME)
.setLocation("l1")
.addCol("a", "int")
.addValue("val1")
.build(null);
Partition p2 = new PartitionBuilder()
.setDbName("DB_NAME")
.setTableName(TABLE_NAME)
.setLocation("l2")
.addCol("b", "int")
.addValue("val1")
.build(null);
Partition p3 = new PartitionBuilder()
.setDbName("DB_NAME")
.setTableName(TABLE_NAME)
.setLocation("l2")
.addCol("a", "int")
.addValue("val1")
.build(null);
assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()),
IsNot.not(new MetaStoreServerUtils.StorageDescriptorKey("a", p2.getSd())));
assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()),
is(new MetaStoreServerUtils.StorageDescriptorKey("a", p3.getSd())));
} | void function() throws MetaException { Partition p1 = new PartitionBuilder() .setDbName(STR) .setTableName(TABLE_NAME) .setLocation("l1") .addCol("a", "int") .addValue("val1") .build(null); Partition p2 = new PartitionBuilder() .setDbName(STR) .setTableName(TABLE_NAME) .setLocation("l2") .addCol("b", "int") .addValue("val1") .build(null); Partition p3 = new PartitionBuilder() .setDbName(STR) .setTableName(TABLE_NAME) .setLocation("l2") .addCol("a", "int") .addValue("val1") .build(null); assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()), IsNot.not(new MetaStoreServerUtils.StorageDescriptorKey("a", p2.getSd()))); assertThat(new MetaStoreServerUtils.StorageDescriptorKey("a", p1.getSd()), is(new MetaStoreServerUtils.StorageDescriptorKey("a", p3.getSd()))); } | /**
* Two StorageDescriptorKey objects with the same base location
* should be equal iff their columns are equal
*/ | Two StorageDescriptorKey objects with the same base location should be equal iff their columns are equal | testCompareWithSdSamePrefixDifferentCols | {
"repo_name": "vineetgarg02/hive",
"path": "standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/utils/TestMetaStoreServerUtils.java",
"license": "apache-2.0",
"size": 33931
} | [
"org.apache.hadoop.hive.metastore.api.MetaException",
"org.apache.hadoop.hive.metastore.api.Partition",
"org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder",
"org.hamcrest.core.Is",
"org.hamcrest.core.IsNot",
"org.junit.Assert"
] | import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.Partition; import org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder; import org.hamcrest.core.Is; import org.hamcrest.core.IsNot; import org.junit.Assert; | import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.hive.metastore.client.builder.*; import org.hamcrest.core.*; import org.junit.*; | [
"org.apache.hadoop",
"org.hamcrest.core",
"org.junit"
] | org.apache.hadoop; org.hamcrest.core; org.junit; | 2,851,003 |
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
| void function(DictionaryService dictionaryService) { this.dictionaryService = dictionaryService; } | /**
* Set the dictionary service
*
* @param dictionaryService the dictionary service
*/ | Set the dictionary service | setDictionaryService | {
"repo_name": "Alfresco/community-edition",
"path": "projects/repository/source/java/org/alfresco/repo/action/executer/BlogAction.java",
"license": "lgpl-3.0",
"size": 6372
} | [
"org.alfresco.service.cmr.dictionary.DictionaryService"
] | import org.alfresco.service.cmr.dictionary.DictionaryService; | import org.alfresco.service.cmr.dictionary.*; | [
"org.alfresco.service"
] | org.alfresco.service; | 1,222,462 |
private void processImgReq(HttpReuqest httReq, Response response, ResponseCallback respCallback) {
InputStream inStream = response.body().byteStream();
Bitmap bitmap = BitmapFactory.decodeStream(inStream);
String filName = MD5Util.getMD5String(httReq.url);
File file = new File( Constant.IMAGE_CACHE_DIR + "/" + filName + ".png");
File restFile = CompressUtil.compressAndSaveBitmap(bitmap, file);
file.setLastModified(System.currentTimeMillis());
String destPath = restFile.getPath();
if (!StringUtil.isNullOrEmpty(destPath)){
sendSuccessResultCallback(destPath,respCallback);
}
CommUtil.deleteRedundancyImgs();
} | void function(HttpReuqest httReq, Response response, ResponseCallback respCallback) { InputStream inStream = response.body().byteStream(); Bitmap bitmap = BitmapFactory.decodeStream(inStream); String filName = MD5Util.getMD5String(httReq.url); File file = new File( Constant.IMAGE_CACHE_DIR + "/" + filName + ".png"); File restFile = CompressUtil.compressAndSaveBitmap(bitmap, file); file.setLastModified(System.currentTimeMillis()); String destPath = restFile.getPath(); if (!StringUtil.isNullOrEmpty(destPath)){ sendSuccessResultCallback(destPath,respCallback); } CommUtil.deleteRedundancyImgs(); } | /**
* handle image downlaod request, cache emoji to local
* if the content beyond buffer size, remove the old emoji
*/ | handle image downlaod request, cache emoji to local if the content beyond buffer size, remove the old emoji | processImgReq | {
"repo_name": "xinmei365/Emojier-Andriod",
"path": "emojsdk/src/main/java/com/xinmei365/emojsdk/network/HttpManager.java",
"license": "apache-2.0",
"size": 6112
} | [
"android.graphics.Bitmap",
"android.graphics.BitmapFactory",
"com.squareup.okhttp.Response",
"com.xinmei365.emojsdk.domain.Constant",
"com.xinmei365.emojsdk.utils.CommUtil",
"com.xinmei365.emojsdk.utils.CompressUtil",
"com.xinmei365.emojsdk.utils.MD5Util",
"com.xinmei365.emojsdk.utils.StringUtil",
"... | import android.graphics.Bitmap; import android.graphics.BitmapFactory; import com.squareup.okhttp.Response; import com.xinmei365.emojsdk.domain.Constant; import com.xinmei365.emojsdk.utils.CommUtil; import com.xinmei365.emojsdk.utils.CompressUtil; import com.xinmei365.emojsdk.utils.MD5Util; import com.xinmei365.emojsdk.utils.StringUtil; import java.io.File; import java.io.InputStream; | import android.graphics.*; import com.squareup.okhttp.*; import com.xinmei365.emojsdk.domain.*; import com.xinmei365.emojsdk.utils.*; import java.io.*; | [
"android.graphics",
"com.squareup.okhttp",
"com.xinmei365.emojsdk",
"java.io"
] | android.graphics; com.squareup.okhttp; com.xinmei365.emojsdk; java.io; | 928,794 |
private BitSet parseTasksToProfile(String tasksToProfileInVertex) {
BitSet profiledTaskSet = new BitSet();
if (Strings.isNullOrEmpty(tasksToProfileInVertex)) {
return profiledTaskSet;
}
Iterable<String> tasksInVertex =
Splitter.on(",").omitEmptyStrings().trimResults().split(tasksToProfileInVertex);
for (String task : tasksInVertex) {
if (task.endsWith(":") || task.startsWith(":")) {
//invalid range. e.g :20, 6: are not supported.
LOG.warn("Partial range is considered as an invalid option");
return null;
}
Matcher taskMatcher = RANGE_REGEX.matcher(task);
if (taskMatcher.find()) {
int start = Integer.parseInt((taskMatcher.group(1).trim()));
int end = Integer.parseInt((taskMatcher.group(2).trim()));
for (int i = Math.min(start, end); i <= Math.max(start, end); i++) {
profiledTaskSet.set(i);
}
} else {
profiledTaskSet.set(Integer.parseInt(task.trim()));
}
}
return profiledTaskSet;
} | BitSet function(String tasksToProfileInVertex) { BitSet profiledTaskSet = new BitSet(); if (Strings.isNullOrEmpty(tasksToProfileInVertex)) { return profiledTaskSet; } Iterable<String> tasksInVertex = Splitter.on(",").omitEmptyStrings().trimResults().split(tasksToProfileInVertex); for (String task : tasksInVertex) { if (task.endsWith(":") task.startsWith(":")) { LOG.warn(STR); return null; } Matcher taskMatcher = RANGE_REGEX.matcher(task); if (taskMatcher.find()) { int start = Integer.parseInt((taskMatcher.group(1).trim())); int end = Integer.parseInt((taskMatcher.group(2).trim())); for (int i = Math.min(start, end); i <= Math.max(start, end); i++) { profiledTaskSet.set(i); } } else { profiledTaskSet.set(Integer.parseInt(task.trim())); } } return profiledTaskSet; } | /**
* Get the set of tasks to be profiled within a vertex
*
* @param tasksToProfileInVertex
* @return Set<Integer> containing the task indexes to be profiled
*/ | Get the set of tasks to be profiled within a vertex | parseTasksToProfile | {
"repo_name": "apache/incubator-tez",
"path": "tez-dag/src/main/java/org/apache/tez/dag/utils/JavaProfilerOptions.java",
"license": "apache-2.0",
"size": 6735
} | [
"com.google.common.base.Splitter",
"com.google.common.base.Strings",
"java.util.BitSet",
"java.util.regex.Matcher"
] | import com.google.common.base.Splitter; import com.google.common.base.Strings; import java.util.BitSet; import java.util.regex.Matcher; | import com.google.common.base.*; import java.util.*; import java.util.regex.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 2,004,706 |
public static Border createEtchedBorder (int etchType)
{
return new EtchedBorder (etchType);
} | static Border function (int etchType) { return new EtchedBorder (etchType); } | /**
* Create a border with an "etched" look using the component's current
* background color for highlighting and shading.
*
* @return The Border object
*/ | Create a border with an "etched" look using the component's current background color for highlighting and shading | createEtchedBorder | {
"repo_name": "unofficial-opensource-apple/gcc_40",
"path": "libjava/javax/swing/BorderFactory.java",
"license": "gpl-2.0",
"size": 16495
} | [
"javax.swing.border.Border",
"javax.swing.border.EtchedBorder"
] | import javax.swing.border.Border; import javax.swing.border.EtchedBorder; | import javax.swing.border.*; | [
"javax.swing"
] | javax.swing; | 499,187 |
@Test
public void testSerializable() throws IOException, ClassNotFoundException {
Object value = new Date();
columnExt.putClientProperty("date", value);
TableColumnExt serialized = SerializableSupport.serialize(columnExt);
assertTrue(serialized.isVisible());
assertEquals(value, serialized.getClientProperty("date"));
assertEquals(15, serialized.getMinWidth());
assertTrue(serialized.getResizable());
} | void function() throws IOException, ClassNotFoundException { Object value = new Date(); columnExt.putClientProperty("date", value); TableColumnExt serialized = SerializableSupport.serialize(columnExt); assertTrue(serialized.isVisible()); assertEquals(value, serialized.getClientProperty("date")); assertEquals(15, serialized.getMinWidth()); assertTrue(serialized.getResizable()); } | /**
* Sanity test Serializable.
*
* @throws ClassNotFoundException
* @throws IOException
*
*/ | Sanity test Serializable | testSerializable | {
"repo_name": "syncer/swingx",
"path": "swingx-core/src/test/java/org/jdesktop/swingx/table/TableColumnExtTest.java",
"license": "lgpl-2.1",
"size": 15946
} | [
"java.io.IOException",
"java.util.Date",
"org.jdesktop.test.SerializableSupport"
] | import java.io.IOException; import java.util.Date; import org.jdesktop.test.SerializableSupport; | import java.io.*; import java.util.*; import org.jdesktop.test.*; | [
"java.io",
"java.util",
"org.jdesktop.test"
] | java.io; java.util; org.jdesktop.test; | 324,467 |
private PDAnnotationTextMarkup makeNewAnnotation(PDAnnotationTextMarkup comment, PdfComment userComment, String messageWithLink) {
PDAnnotationTextMarkup newComment = new PDAnnotationTextMarkup(PDAnnotationTextMarkup.SUB_TYPE_HIGHLIGHT);
List<Tag> tags = userComment.getTags();
if (tags.contains(Tag.CONSIDER_FIX) || tags.contains(Tag.POSITIVE)) {
newComment.setColor(GREEN);
} else if (tags.contains(Tag.MUST_FIX)) {
newComment.setColor(ORANGE);
} else {
newComment.setColor(YELLOW);
}
newComment.setContents(messageWithLink);
newComment.setRectangle(comment.getRectangle()); //both rectangle and quadpoints are needed... don't know why
newComment.setQuadPoints(comment.getQuadPoints());
newComment.setSubject(comment.getSubject());
newComment.setTitlePopup(comment.getTitlePopup()); //author name
return newComment;
}
| PDAnnotationTextMarkup function(PDAnnotationTextMarkup comment, PdfComment userComment, String messageWithLink) { PDAnnotationTextMarkup newComment = new PDAnnotationTextMarkup(PDAnnotationTextMarkup.SUB_TYPE_HIGHLIGHT); List<Tag> tags = userComment.getTags(); if (tags.contains(Tag.CONSIDER_FIX) tags.contains(Tag.POSITIVE)) { newComment.setColor(GREEN); } else if (tags.contains(Tag.MUST_FIX)) { newComment.setColor(ORANGE); } else { newComment.setColor(YELLOW); } newComment.setContents(messageWithLink); newComment.setRectangle(comment.getRectangle()); newComment.setQuadPoints(comment.getQuadPoints()); newComment.setSubject(comment.getSubject()); newComment.setTitlePopup(comment.getTitlePopup()); return newComment; } | /**
* Makes a brand new text annotation that is almost exactly like the one passed in.
* this is the only way I could get the annotations to actually change color.
* @param comment original PDAnnotation object
* @param userComment PdfComment object of original PDAnnotation object
* @param messageWithLink comment message with link to issue in GitHub
* @return PDAnnotationTextMarkup representing the original annotation with
* new colors and an issue link.
*/ | Makes a brand new text annotation that is almost exactly like the one passed in. this is the only way I could get the annotations to actually change color | makeNewAnnotation | {
"repo_name": "DeveloperLiberationFront/Pdf-Reviewer",
"path": "src/main/java/edu/ncsu/dlf/model/Pdf.java",
"license": "apache-2.0",
"size": 10617
} | [
"edu.ncsu.dlf.model.PdfComment",
"java.util.List",
"org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup"
] | import edu.ncsu.dlf.model.PdfComment; import java.util.List; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationTextMarkup; | import edu.ncsu.dlf.model.*; import java.util.*; import org.apache.pdfbox.pdmodel.interactive.annotation.*; | [
"edu.ncsu.dlf",
"java.util",
"org.apache.pdfbox"
] | edu.ncsu.dlf; java.util; org.apache.pdfbox; | 1,878,756 |
private void displayAnnotations(List list) {
annotationToDisplay = list;
boolean enabled = model.canAnnotate();
if (enabled && model.isMultiSelection()) {
enabled = !model.isAcrossGroups();
}
commentArea.setEnabled(enabled);
buildGUI();
if (!CollectionUtils.isEmpty(list)) {
for (Object obj : annotationToDisplay) {
TextualAnnotationData data = (TextualAnnotationData) obj;
if (filter == Filter.SHOW_ALL
|| (filter == Filter.ADDED_BY_ME
&& model.isLinkOwner(data) || (filter == Filter.ADDED_BY_OTHERS && model
.isAnnotatedByOther(data)))) {
TextualAnnotationComponent comp = new TextualAnnotationComponent(
model, data);
comp.addPropertyChangeListener(controller);
comp.setAreaColor(bgColor);
add(comp, constraints);
constraints.gridy++;
if (bgColor == UIUtilities.BACKGROUND_COLOUR_ODD)
bgColor = UIUtilities.BACKGROUND_COLOUR_EVEN;
else
bgColor = UIUtilities.BACKGROUND_COLOUR_ODD;
}
}
}
revalidate();
repaint();
} | void function(List list) { annotationToDisplay = list; boolean enabled = model.canAnnotate(); if (enabled && model.isMultiSelection()) { enabled = !model.isAcrossGroups(); } commentArea.setEnabled(enabled); buildGUI(); if (!CollectionUtils.isEmpty(list)) { for (Object obj : annotationToDisplay) { TextualAnnotationData data = (TextualAnnotationData) obj; if (filter == Filter.SHOW_ALL (filter == Filter.ADDED_BY_ME && model.isLinkOwner(data) (filter == Filter.ADDED_BY_OTHERS && model .isAnnotatedByOther(data)))) { TextualAnnotationComponent comp = new TextualAnnotationComponent( model, data); comp.addPropertyChangeListener(controller); comp.setAreaColor(bgColor); add(comp, constraints); constraints.gridy++; if (bgColor == UIUtilities.BACKGROUND_COLOUR_ODD) bgColor = UIUtilities.BACKGROUND_COLOUR_EVEN; else bgColor = UIUtilities.BACKGROUND_COLOUR_ODD; } } } revalidate(); repaint(); } | /**
* Displays the annotations.
*
* @param list
* The annotations to display.
*/ | Displays the annotations | displayAnnotations | {
"repo_name": "dominikl/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/editor/CommentsTaskPaneUI.java",
"license": "gpl-2.0",
"size": 13018
} | [
"java.util.List",
"org.apache.commons.collections.CollectionUtils",
"org.openmicroscopy.shoola.util.ui.UIUtilities"
] | import java.util.List; import org.apache.commons.collections.CollectionUtils; import org.openmicroscopy.shoola.util.ui.UIUtilities; | import java.util.*; import org.apache.commons.collections.*; import org.openmicroscopy.shoola.util.ui.*; | [
"java.util",
"org.apache.commons",
"org.openmicroscopy.shoola"
] | java.util; org.apache.commons; org.openmicroscopy.shoola; | 531,604 |
private javax.swing.JScrollPane getStatusAreaPanel()
{
if (statusAreaPanel == null)
{
try
{
statusAreaPanel = new javax.swing.JScrollPane();
statusAreaPanel.setName("JScrollPane1");
statusAreaPanel.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
statusAreaPanel.setPreferredSize(new java.awt.Dimension(50, 50));
statusAreaPanel.setMinimumSize(new java.awt.Dimension(50, 50));
statusAreaPanel.setViewportView(messageTextArea);
statusAreaPanel.setVisible(false);
}
catch (java.lang.Throwable ivjExc)
{
handleException(ivjExc);
}
}
return statusAreaPanel;
}
| javax.swing.JScrollPane function() { if (statusAreaPanel == null) { try { statusAreaPanel = new javax.swing.JScrollPane(); statusAreaPanel.setName(STR); statusAreaPanel.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); statusAreaPanel.setPreferredSize(new java.awt.Dimension(50, 50)); statusAreaPanel.setMinimumSize(new java.awt.Dimension(50, 50)); statusAreaPanel.setViewportView(messageTextArea); statusAreaPanel.setVisible(false); } catch (java.lang.Throwable ivjExc) { handleException(ivjExc); } } return statusAreaPanel; } | /**
* Returns the JScrollPane1 property value.
* @return javax.swing.JScrollPane
*/ | Returns the JScrollPane1 property value | getStatusAreaPanel | {
"repo_name": "ACS-Community/ACS",
"path": "LGPL/CommonSoftware/acsGUIs/jlog/src/com/cosylab/logging/LoggingClient.java",
"license": "lgpl-2.1",
"size": 66213
} | [
"java.awt.Dimension",
"javax.swing.JScrollPane"
] | import java.awt.Dimension; import javax.swing.JScrollPane; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 305,755 |
public final synchronized void removeMediaSource(
int index, @Nullable Runnable actionOnCompletion) {
mediaSourcesPublic.remove(index);
if (player != null) {
player
.createMessage(this)
.setType(MSG_REMOVE)
.setPayload(new MessageData<>(index, null, actionOnCompletion))
.send();
} else if (actionOnCompletion != null) {
actionOnCompletion.run();
}
} | final synchronized void function( int index, @Nullable Runnable actionOnCompletion) { mediaSourcesPublic.remove(index); if (player != null) { player .createMessage(this) .setType(MSG_REMOVE) .setPayload(new MessageData<>(index, null, actionOnCompletion)) .send(); } else if (actionOnCompletion != null) { actionOnCompletion.run(); } } | /**
* Removes a {@link MediaSource} from the playlist and executes a custom action on completion.
*
* <p>Note: If you want to move the instance, it's preferable to use {@link #moveMediaSource(int,
* int)} instead.
*
* @param index The index at which the media source will be removed. This index must be in the
* range of 0 <= index < {@link #getSize()}.
* @param actionOnCompletion A {@link Runnable} which is executed immediately after the media
* source has been removed from the playlist.
*/ | Removes a <code>MediaSource</code> from the playlist and executes a custom action on completion. Note: If you want to move the instance, it's preferable to use <code>#moveMediaSource(int, int)</code> instead | removeMediaSource | {
"repo_name": "MaTriXy/ExoPlayer",
"path": "library/core/src/main/java/com/google/android/exoplayer2/source/ConcatenatingMediaSource.java",
"license": "apache-2.0",
"size": 34907
} | [
"android.support.annotation.Nullable"
] | import android.support.annotation.Nullable; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 1,316,898 |
@Override
public List<String> getMangaList(){
List<String> names = new ArrayList<String>(mangaList[0].length);
names.addAll(Arrays.asList(mangaList[0]));
return names;
} | List<String> function(){ List<String> names = new ArrayList<String>(mangaList[0].length); names.addAll(Arrays.asList(mangaList[0])); return names; } | /**
* Generates a list of all available manga on the site
* @return the list as a List<String>
*/ | Generates a list of all available manga on the site | getMangaList | {
"repo_name": "Skylion007/java-manga-reader",
"path": "src/org/skylion/mangareader/mangaengine/MangaHereAPI.java",
"license": "gpl-3.0",
"size": 15359
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 307,895 |
public CmsMailSettings getMailSettings() {
return m_mailSettings;
} | CmsMailSettings function() { return m_mailSettings; } | /**
* Returns the configured mail settings.<p>
*
* @return the configured mail settings
*/ | Returns the configured mail settings | getMailSettings | {
"repo_name": "sbonoc/opencms-core",
"path": "src/org/opencms/configuration/CmsSystemConfiguration.java",
"license": "lgpl-2.1",
"size": 113574
} | [
"org.opencms.mail.CmsMailSettings"
] | import org.opencms.mail.CmsMailSettings; | import org.opencms.mail.*; | [
"org.opencms.mail"
] | org.opencms.mail; | 2,045,775 |
public void setOutput (Writer writer,String _encoding)
{
if (writer == null) {
output = new OutputStreamWriter(System.out);
} else {
output = writer;
}
encoding = _encoding;
} | void function (Writer writer,String _encoding) { if (writer == null) { output = new OutputStreamWriter(System.out); } else { output = writer; } encoding = _encoding; } | /**
* Set a new output destination for the document.
*
* @param writer The output destination, or null to use
* standard output.
* @see #flush()
*/ | Set a new output destination for the document | setOutput | {
"repo_name": "samskivert/ikvm-openjdk",
"path": "build/linux-amd64/impsrc/com/sun/xml/internal/bind/marshaller/XMLWriter.java",
"license": "gpl-2.0",
"size": 31867
} | [
"java.io.OutputStreamWriter",
"java.io.Writer"
] | import java.io.OutputStreamWriter; import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 4,315 |
public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
// Calculate ratios of height and width to requested height and width
final int heightRatio = Math.round((float) height / (float) reqHeight);
final int widthRatio = Math.round((float) width / (float) reqWidth);
// Choose the smallest ratio as inSampleSize value, this will guarantee
// a final image with both dimensions larger than or equal to the
// requested height and width.
inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio;
}
return inSampleSize;
} | static int function(BitmapFactory.Options options, int reqWidth, int reqHeight) { final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height > reqHeight width > reqWidth) { final int heightRatio = Math.round((float) height / (float) reqHeight); final int widthRatio = Math.round((float) width / (float) reqWidth); inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio; } return inSampleSize; } | /**
* Calculate a sample size value that is a power of two based on a target width and height
* @param options Bitmap options
* @param reqWidth Width used to sub-sample image
* @param reqHeight Height used to sub-sample image
* @return Sample size value
*/ | Calculate a sample size value that is a power of two based on a target width and height | calculateInSampleSize | {
"repo_name": "VijayJaybhay/GalleryView",
"path": "galleryview/src/main/java/me/vijayjaybhay/galleryview/utils/BitmapUtility.java",
"license": "apache-2.0",
"size": 3296
} | [
"android.graphics.BitmapFactory"
] | import android.graphics.BitmapFactory; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 90,587 |
public K minKey() {
if (size == 0) throw new NoSuchElementException("Priority queue underflow");
return keys[pq[1]];
} | K function() { if (size == 0) throw new NoSuchElementException(STR); return keys[pq[1]]; } | /**
* Returns a minimum key.
*
* @return a minimum key
* @throws NoSuchElementException if this priority queue is empty
*/ | Returns a minimum key | minKey | {
"repo_name": "FrankBian/Java-Utils-Collection",
"path": "com-gansuer-algorithm/src/main/java/com/gansuer/algorithms/sort/queue/IndexMinPQ.java",
"license": "apache-2.0",
"size": 7767
} | [
"java.util.NoSuchElementException"
] | import java.util.NoSuchElementException; | import java.util.*; | [
"java.util"
] | java.util; | 1,935,645 |
public static void boundingBox(List<Point3D_F64> points, Box3D_F64 bounding) {
double minX = Double.MAX_VALUE, maxX = -Double.MAX_VALUE;
double minY = Double.MAX_VALUE, maxY = -Double.MAX_VALUE;
double minZ = Double.MAX_VALUE, maxZ = -Double.MAX_VALUE;
for (int i = 0; i < points.size(); i++) {
Point3D_F64 p = points.get(i);
if (p.x < minX)
minX = p.x;
if (p.x > maxX)
maxX = p.x;
if (p.y < minY)
minY = p.y;
if (p.y > maxY)
maxY = p.y;
if (p.z < minZ)
minZ = p.z;
if (p.z > maxZ)
maxZ = p.z;
}
bounding.p0.setTo(minX, minY, minZ);
bounding.p1.setTo(maxX, maxY, maxZ);
} | static void function(List<Point3D_F64> points, Box3D_F64 bounding) { double minX = Double.MAX_VALUE, maxX = -Double.MAX_VALUE; double minY = Double.MAX_VALUE, maxY = -Double.MAX_VALUE; double minZ = Double.MAX_VALUE, maxZ = -Double.MAX_VALUE; for (int i = 0; i < points.size(); i++) { Point3D_F64 p = points.get(i); if (p.x < minX) minX = p.x; if (p.x > maxX) maxX = p.x; if (p.y < minY) minY = p.y; if (p.y > maxY) maxY = p.y; if (p.z < minZ) minZ = p.z; if (p.z > maxZ) maxZ = p.z; } bounding.p0.setTo(minX, minY, minZ); bounding.p1.setTo(maxX, maxY, maxZ); } | /**
* Finds the minimal volume {@link Box3D_F64} which contains all the points.
*
* @param points Input: List of points.
* @param bounding Output: Bounding box
*/ | Finds the minimal volume <code>Box3D_F64</code> which contains all the points | boundingBox | {
"repo_name": "lessthanoptimal/GeoRegression",
"path": "main/src/georegression/geometry/UtilPoint3D_F64.java",
"license": "apache-2.0",
"size": 8801
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,071,916 |
public static <T> T toPseudoEnum(@Nullable Object obj, Class<T> pseudoEnumClass, Class<?> dictionaryClass, T defaultValue) {
checkNotNull(pseudoEnumClass, "pseudoEnumClass");
checkNotNull(dictionaryClass, "dictionaryClass");
checkNotNull(defaultValue, "defaultValue");
if (obj == null) {
return defaultValue;
}
if (pseudoEnumClass.isAssignableFrom(obj.getClass())) {
@SuppressWarnings("unchecked")
T enumObj = (T)obj;
return enumObj;
}
String strObj = obj.toString().trim();
try {
for (Field field : dictionaryClass.getFields()) {
if ((field.getModifiers() & Modifier.STATIC) != 0 && pseudoEnumClass.isAssignableFrom(field.getType())) {
String fieldName = field.getName();
@SuppressWarnings("unchecked")
T entry = (T)field.get(null);
if (strObj.equalsIgnoreCase(fieldName)) {
return entry;
}
}
}
} catch (Exception ex) {
// well that went badly
}
return defaultValue;
} | static <T> T function(@Nullable Object obj, Class<T> pseudoEnumClass, Class<?> dictionaryClass, T defaultValue) { checkNotNull(pseudoEnumClass, STR); checkNotNull(dictionaryClass, STR); checkNotNull(defaultValue, STR); if (obj == null) { return defaultValue; } if (pseudoEnumClass.isAssignableFrom(obj.getClass())) { @SuppressWarnings(STR) T enumObj = (T)obj; return enumObj; } String strObj = obj.toString().trim(); try { for (Field field : dictionaryClass.getFields()) { if ((field.getModifiers() & Modifier.STATIC) != 0 && pseudoEnumClass.isAssignableFrom(field.getType())) { String fieldName = field.getName(); @SuppressWarnings(STR) T entry = (T)field.get(null); if (strObj.equalsIgnoreCase(fieldName)) { return entry; } } } } catch (Exception ex) { } return defaultValue; } | /**
* Coerce the specified object to the specified pseudo-enum type using the
* supplied pseudo-enum dictionary class.
*
* @param obj Object to coerce
* @param pseudoEnumClass The pseudo-enum class
* @param dictionaryClass Pseudo-enum dictionary class to look in
* @param defaultValue Value to return if lookup fails
* @param <T> pseudo-enum type
* @return Coerced value or default if coercion fails
*/ | Coerce the specified object to the specified pseudo-enum type using the supplied pseudo-enum dictionary class | toPseudoEnum | {
"repo_name": "joshgarde/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/util/Coerce.java",
"license": "mit",
"size": 25945
} | [
"com.google.common.base.Preconditions",
"java.lang.reflect.Field",
"java.lang.reflect.Modifier",
"javax.annotation.Nullable"
] | import com.google.common.base.Preconditions; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import javax.annotation.Nullable; | import com.google.common.base.*; import java.lang.reflect.*; import javax.annotation.*; | [
"com.google.common",
"java.lang",
"javax.annotation"
] | com.google.common; java.lang; javax.annotation; | 1,110,035 |
private ProviderName getProviderName(String name) throws ConfigurationException {
ProviderName providerName = ProviderName.parse(name);
if (providerName == null) {
throw new ConfigurationException("weather",
"Provider with name '" + name + "' not found, please check your openhab.cfg!");
}
return providerName;
} | ProviderName function(String name) throws ConfigurationException { ProviderName providerName = ProviderName.parse(name); if (providerName == null) { throw new ConfigurationException(STR, STR + name + STR); } return providerName; } | /**
* Parse a ProviderName from a string.
*/ | Parse a ProviderName from a string | getProviderName | {
"repo_name": "vgoldman/openhab",
"path": "bundles/binding/org.openhab.binding.weather/src/main/java/org/openhab/binding/weather/internal/common/WeatherConfig.java",
"license": "epl-1.0",
"size": 9199
} | [
"org.openhab.binding.weather.internal.model.ProviderName",
"org.osgi.service.cm.ConfigurationException"
] | import org.openhab.binding.weather.internal.model.ProviderName; import org.osgi.service.cm.ConfigurationException; | import org.openhab.binding.weather.internal.model.*; import org.osgi.service.cm.*; | [
"org.openhab.binding",
"org.osgi.service"
] | org.openhab.binding; org.osgi.service; | 2,821,751 |
private Result processTask() {
Node subtree = getTask();
try {
if (subtree == null) {
return null;
} else {
return taskSupply.get().processSubtree(subtree);
}
} catch (Exception e) {
Result r = new Result(true);
r.exceptions.add(e);
return r;
}
} | Result function() { Node subtree = getTask(); try { if (subtree == null) { return null; } else { return taskSupply.get().processSubtree(subtree); } } catch (Exception e) { Result r = new Result(true); r.exceptions.add(e); return r; } } | /**
* Get a subtree from the work list and work on it. This method makes a call
* to the supplier which is also assumed thread-safe. It also calls
* getTask() which is synchronized.
*
* @return The result of performing the task specified by the task supplier
* on the next subtree from the work list. {@code null} if there are no more
* work load from the work list.
*/ | Get a subtree from the work list and work on it. This method makes a call to the supplier which is also assumed thread-safe. It also calls getTask() which is synchronized | processTask | {
"repo_name": "bramstein/closure-compiler-inline",
"path": "src/com/google/javascript/jscomp/ParallelCompilerPass.java",
"license": "apache-2.0",
"size": 6937
} | [
"com.google.javascript.rhino.Node"
] | import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,515,723 |
private int renamePartition(Hive db, RenamePartitionDesc renamePartitionDesc) throws HiveException {
Table tbl = db.getTable(renamePartitionDesc.getTableName());
LinkedHashMap<String, String> oldPartSpec = renamePartitionDesc.getOldPartSpec();
Partition oldPart = db.getPartition(tbl, oldPartSpec, false);
if (oldPart == null) {
String partName = FileUtils.makePartName(new ArrayList<String>(oldPartSpec.keySet()),
new ArrayList<String>(oldPartSpec.values()));
throw new HiveException("Rename partition: source partition [" + partName
+ "] does not exist.");
}
Partition part = db.getPartition(tbl, oldPartSpec, false);
part.setValues(renamePartitionDesc.getNewPartSpec());
db.renamePartition(tbl, oldPartSpec, part);
Partition newPart = db
.getPartition(tbl, renamePartitionDesc.getNewPartSpec(), false);
work.getInputs().add(new ReadEntity(oldPart));
// We've already obtained a lock on the table, don't lock the partition too
work.getOutputs().add(new WriteEntity(newPart, WriteEntity.WriteType.DDL_NO_LOCK));
return 0;
} | int function(Hive db, RenamePartitionDesc renamePartitionDesc) throws HiveException { Table tbl = db.getTable(renamePartitionDesc.getTableName()); LinkedHashMap<String, String> oldPartSpec = renamePartitionDesc.getOldPartSpec(); Partition oldPart = db.getPartition(tbl, oldPartSpec, false); if (oldPart == null) { String partName = FileUtils.makePartName(new ArrayList<String>(oldPartSpec.keySet()), new ArrayList<String>(oldPartSpec.values())); throw new HiveException(STR + partName + STR); } Partition part = db.getPartition(tbl, oldPartSpec, false); part.setValues(renamePartitionDesc.getNewPartSpec()); db.renamePartition(tbl, oldPartSpec, part); Partition newPart = db .getPartition(tbl, renamePartitionDesc.getNewPartSpec(), false); work.getInputs().add(new ReadEntity(oldPart)); work.getOutputs().add(new WriteEntity(newPart, WriteEntity.WriteType.DDL_NO_LOCK)); return 0; } | /**
* Rename a partition in a table
*
* @param db
* Database to rename the partition.
* @param renamePartitionDesc
* rename old Partition to new one.
* @return Returns 0 when execution succeeds and above 0 if it fails.
* @throws HiveException
*/ | Rename a partition in a table | renamePartition | {
"repo_name": "BUPTAnderson/apache-hive-2.1.1-src",
"path": "ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java",
"license": "apache-2.0",
"size": 173241
} | [
"java.util.ArrayList",
"java.util.LinkedHashMap",
"org.apache.hadoop.hive.common.FileUtils",
"org.apache.hadoop.hive.ql.hooks.ReadEntity",
"org.apache.hadoop.hive.ql.hooks.WriteEntity",
"org.apache.hadoop.hive.ql.metadata.Hive",
"org.apache.hadoop.hive.ql.metadata.HiveException",
"org.apache.hadoop.hi... | import java.util.ArrayList; import java.util.LinkedHashMap; import org.apache.hadoop.hive.common.FileUtils; import org.apache.hadoop.hive.ql.hooks.ReadEntity; import org.apache.hadoop.hive.ql.hooks.WriteEntity; import org.apache.hadoop.hive.ql.metadata.Hive; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.metadata.Partition; import org.apache.hadoop.hive.ql.metadata.Table; import org.apache.hadoop.hive.ql.plan.RenamePartitionDesc; | import java.util.*; import org.apache.hadoop.hive.common.*; import org.apache.hadoop.hive.ql.hooks.*; import org.apache.hadoop.hive.ql.metadata.*; import org.apache.hadoop.hive.ql.plan.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,392,716 |
private void copyACls(final AccessControlLevelsList<AccessControlLevel> newAccessControlLevels) {
for (AccessControlLevel acl : this.accessControlLevels) {
newAccessControlLevels.addItem(new AccessControlLevel(acl), false);
}
}
| void function(final AccessControlLevelsList<AccessControlLevel> newAccessControlLevels) { for (AccessControlLevel acl : this.accessControlLevels) { newAccessControlLevels.addItem(new AccessControlLevel(acl), false); } } | /**
* Copies ACL for new configuration.
*
* @param newAccessControlLevels new configuration ACL list.
*/ | Copies ACL for new configuration | copyACls | {
"repo_name": "ahwxl/deep",
"path": "src/main/java/com/ckfinder/connector/configuration/Configuration.java",
"license": "apache-2.0",
"size": 35832
} | [
"com.ckfinder.connector.data.AccessControlLevel"
] | import com.ckfinder.connector.data.AccessControlLevel; | import com.ckfinder.connector.data.*; | [
"com.ckfinder.connector"
] | com.ckfinder.connector; | 2,610,465 |
@Override
public List<TWorkItemBean> loadByUuids(List<String> uuids) {
List<TWorkItemBean> workItemList = new ArrayList<TWorkItemBean>();
if (uuids==null || uuids.isEmpty()) {
return workItemList;
}
Criteria criteria;
List<List<String>> workItemIDChunksList = GeneralUtils.getListOfStringChunks(uuids);
if (workItemIDChunksList==null) {
return workItemList;
}
Iterator<List<String>> iterator = workItemIDChunksList.iterator();
int i = 0;
while (iterator.hasNext()) {
i++;
List<String> workItemIDChunk = iterator.next();
criteria = new Criteria();
criteria.addIn(TPUUID, workItemIDChunk);
try {
workItemList.addAll(convertTorqueListToBeanList(doSelect(criteria)));
} catch(Exception e) {
LOGGER.error("Loading the workItemBeans by uuids and the chunk number " +
i + " of length " + workItemIDChunk.size() + failedWith + e.getMessage());
LOGGER.debug(ExceptionUtils.getStackTrace(e));
}
}
return workItemList;
}
| List<TWorkItemBean> function(List<String> uuids) { List<TWorkItemBean> workItemList = new ArrayList<TWorkItemBean>(); if (uuids==null uuids.isEmpty()) { return workItemList; } Criteria criteria; List<List<String>> workItemIDChunksList = GeneralUtils.getListOfStringChunks(uuids); if (workItemIDChunksList==null) { return workItemList; } Iterator<List<String>> iterator = workItemIDChunksList.iterator(); int i = 0; while (iterator.hasNext()) { i++; List<String> workItemIDChunk = iterator.next(); criteria = new Criteria(); criteria.addIn(TPUUID, workItemIDChunk); try { workItemList.addAll(convertTorqueListToBeanList(doSelect(criteria))); } catch(Exception e) { LOGGER.error(STR + i + STR + workItemIDChunk.size() + failedWith + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } return workItemList; } | /**
* Loads a list with {@link TWorkItemBean}s as specified by the uuids in parameter.
* @param uuids - the list of object uuids for the TWorkItemBeans to be retrieved.
* <p/>
* @return A list with {@link TWorkItemBean}s.
*/ | Loads a list with <code>TWorkItemBean</code>s as specified by the uuids in parameter | loadByUuids | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/TWorkItemPeer.java",
"license": "gpl-3.0",
"size": 84464
} | [
"com.aurel.track.beans.TWorkItemBean",
"com.aurel.track.util.GeneralUtils",
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List",
"org.apache.commons.lang3.exception.ExceptionUtils",
"org.apache.torque.util.Criteria"
] | import com.aurel.track.beans.TWorkItemBean; import com.aurel.track.util.GeneralUtils; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.torque.util.Criteria; | import com.aurel.track.beans.*; import com.aurel.track.util.*; import java.util.*; import org.apache.commons.lang3.exception.*; import org.apache.torque.util.*; | [
"com.aurel.track",
"java.util",
"org.apache.commons",
"org.apache.torque"
] | com.aurel.track; java.util; org.apache.commons; org.apache.torque; | 44,177 |
@Override public void onResume() {
super.onResume();
if (!mAccount.isAvailable(this)) {
Log.i(K9.LOG_TAG, "account unavaliabale, not showing folder-list but account-list");
Accounts.listAccounts(this);
finish();
return;
}
if (mAdapter == null)
initializeActivityView();
mHandler.refreshTitle();
MessagingController.getInstance(getApplication()).addListener(mAdapter.mListener);
//mAccount.refresh(Preferences.getPreferences(this));
MessagingController.getInstance(getApplication()).getAccountStats(this, mAccount, mAdapter.mListener);
onRefresh(!REFRESH_REMOTE);
MessagingController.getInstance(getApplication()).cancelNotificationsForAccount(mAccount);
mAdapter.mListener.onResume(this);
} | @Override void function() { super.onResume(); if (!mAccount.isAvailable(this)) { Log.i(K9.LOG_TAG, STR); Accounts.listAccounts(this); finish(); return; } if (mAdapter == null) initializeActivityView(); mHandler.refreshTitle(); MessagingController.getInstance(getApplication()).addListener(mAdapter.mListener); MessagingController.getInstance(getApplication()).getAccountStats(this, mAccount, mAdapter.mListener); onRefresh(!REFRESH_REMOTE); MessagingController.getInstance(getApplication()).cancelNotificationsForAccount(mAccount); mAdapter.mListener.onResume(this); } | /**
* On resume we refresh the folder list (in the background) and we refresh the
* messages for any folder that is currently open. This guarantees that things
* like unread message count and read status are updated.
*/ | On resume we refresh the folder list (in the background) and we refresh the messages for any folder that is currently open. This guarantees that things like unread message count and read status are updated | onResume | {
"repo_name": "GuillaumeSmaha/k-9",
"path": "k9mail/src/main/java/com/fsck/k9/activity/FolderList.java",
"license": "apache-2.0",
"size": 45047
} | [
"android.util.Log",
"com.fsck.k9.controller.MessagingController"
] | import android.util.Log; import com.fsck.k9.controller.MessagingController; | import android.util.*; import com.fsck.k9.controller.*; | [
"android.util",
"com.fsck.k9"
] | android.util; com.fsck.k9; | 242,235 |
public void setIndentLen(int indentLen) {
this.indentLen = indentLen;
Preconditions.checkState(0 <= indentLen && indentLen <= MAX_INDENT_LEN);
indent = SPACES.substring(0, indentLen);
} | void function(int indentLen) { this.indentLen = indentLen; Preconditions.checkState(0 <= indentLen && indentLen <= MAX_INDENT_LEN); indent = SPACES.substring(0, indentLen); } | /**
* Sets the indent length.
* @param indentLen The new indent length.
*/ | Sets the indent length | setIndentLen | {
"repo_name": "prop/closure-templates",
"path": "java/src/com/google/template/soy/base/IndentedLinesBuilder.java",
"license": "apache-2.0",
"size": 6161
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,163,974 |
@Override
public void onResponse(JSONObject response, int callback) {
switch (callback) {
case Const.USER_IMAGES_CALLBACK:
if (response.has(Const.ERRORS)) {
try {
Toast.makeText(this, response.getString(Const.ERRORS), Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
} | void function(JSONObject response, int callback) { switch (callback) { case Const.USER_IMAGES_CALLBACK: if (response.has(Const.ERRORS)) { try { Toast.makeText(this, response.getString(Const.ERRORS), Toast.LENGTH_SHORT).show(); } catch (JSONException e) { e.printStackTrace(); } } } } | /**
* On Response - JSON Object
*
* @param response,callback
*/ | On Response - JSON Object | onResponse | {
"repo_name": "DawnImpulse/Wallup",
"path": "app/src/main/java/com/stonevire/wallup/activities/UserProfileActivity.java",
"license": "apache-2.0",
"size": 10335
} | [
"android.widget.Toast",
"com.stonevire.wallup.utils.Const",
"org.json.JSONException",
"org.json.JSONObject"
] | import android.widget.Toast; import com.stonevire.wallup.utils.Const; import org.json.JSONException; import org.json.JSONObject; | import android.widget.*; import com.stonevire.wallup.utils.*; import org.json.*; | [
"android.widget",
"com.stonevire.wallup",
"org.json"
] | android.widget; com.stonevire.wallup; org.json; | 2,203,543 |
static int indexOfImpl(List<?> list, @Nullable Object element) {
ListIterator<?> listIterator = list.listIterator();
while (listIterator.hasNext()) {
if (Objects.equal(element, listIterator.next())) {
return listIterator.previousIndex();
}
}
return -1;
} | static int indexOfImpl(List<?> list, @Nullable Object element) { ListIterator<?> listIterator = list.listIterator(); while (listIterator.hasNext()) { if (Objects.equal(element, listIterator.next())) { return listIterator.previousIndex(); } } return -1; } | /**
* An implementation of {@link List#indexOf(Object)}.
*/ | An implementation of <code>List#indexOf(Object)</code> | indexOfImpl | {
"repo_name": "npvincent/guava",
"path": "guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Lists.java",
"license": "apache-2.0",
"size": 34206
} | [
"com.google.common.base.Objects",
"java.util.List",
"java.util.ListIterator",
"javax.annotation.Nullable"
] | import com.google.common.base.Objects; import java.util.List; import java.util.ListIterator; import javax.annotation.Nullable; | import com.google.common.base.*; import java.util.*; import javax.annotation.*; | [
"com.google.common",
"java.util",
"javax.annotation"
] | com.google.common; java.util; javax.annotation; | 755,882 |
public Object openConnection(String endpointUri) throws ConnectionException {
try {
Map<String,String> params = getRequestParameters();
if (params != null && !params.isEmpty()) {
StringBuffer query = new StringBuffer();
query.append(endpointUri.indexOf('?') < 0 ? '?' : '&');
int count = 0;
for (String name : params.keySet()) {
if (count > 0)
query.append('&');
String encoding = getUrlEncoding();
query.append(encoding == null ? name : URLEncoder.encode(name, encoding)).append("=");
query.append(encoding == null ? params.get(name) : URLEncoder.encode(params.get(name), encoding));
count++;
}
endpointUri += query;
}
URL url = new URL(endpointUri);
HttpConnection httpConnection;
if ("PATCH".equals(getHttpMethod()))
httpConnection = new HttpAltConnection(url);
else
httpConnection = new HttpConnection(url);
httpConnection.open();
return httpConnection;
}
catch (Exception ex) {
throw new ConnectionException(ConnectionException.CONNECTION_DOWN, ex.getMessage(), ex);
}
} | Object function(String endpointUri) throws ConnectionException { try { Map<String,String> params = getRequestParameters(); if (params != null && !params.isEmpty()) { StringBuffer query = new StringBuffer(); query.append(endpointUri.indexOf('?') < 0 ? '?' : '&'); int count = 0; for (String name : params.keySet()) { if (count > 0) query.append('&'); String encoding = getUrlEncoding(); query.append(encoding == null ? name : URLEncoder.encode(name, encoding)).append("="); query.append(encoding == null ? params.get(name) : URLEncoder.encode(params.get(name), encoding)); count++; } endpointUri += query; } URL url = new URL(endpointUri); HttpConnection httpConnection; if ("PATCH".equals(getHttpMethod())) httpConnection = new HttpAltConnection(url); else httpConnection = new HttpConnection(url); httpConnection.open(); return httpConnection; } catch (Exception ex) { throw new ConnectionException(ConnectionException.CONNECTION_DOWN, ex.getMessage(), ex); } } | /**
* Returns an HttpConnection based on the configured endpoint, which
* includes the resource path. Override for HTTPS or other connection type.
*/ | Returns an HttpConnection based on the configured endpoint, which includes the resource path. Override for HTTPS or other connection type | openConnection | {
"repo_name": "CenturyLinkCloud/mdw",
"path": "mdw-workflow/src/com/centurylink/mdw/workflow/adapter/rest/MultiRestServiceAdapter.java",
"license": "apache-2.0",
"size": 7120
} | [
"com.centurylink.mdw.adapter.ConnectionException",
"com.centurylink.mdw.util.HttpAltConnection",
"com.centurylink.mdw.util.HttpConnection",
"java.net.URLEncoder",
"java.util.Map"
] | import com.centurylink.mdw.adapter.ConnectionException; import com.centurylink.mdw.util.HttpAltConnection; import com.centurylink.mdw.util.HttpConnection; import java.net.URLEncoder; import java.util.Map; | import com.centurylink.mdw.adapter.*; import com.centurylink.mdw.util.*; import java.net.*; import java.util.*; | [
"com.centurylink.mdw",
"java.net",
"java.util"
] | com.centurylink.mdw; java.net; java.util; | 1,170,043 |
public void putTile( String tableName, int tx, int ty, int zoom, byte[] tileData ) throws Exception {
String sql = format(INSERTQUERY, tableName);
sqliteDb.execOnConnection(connection -> {
try (IHMPreparedStatement pstmt = connection.prepareStatement(sql)) {
pstmt.setInt(1, zoom);
pstmt.setInt(2, tx);
pstmt.setInt(3, ty);
pstmt.setBytes(4, tileData);
pstmt.executeUpdate();
return null;
}
});
} | void function( String tableName, int tx, int ty, int zoom, byte[] tileData ) throws Exception { String sql = format(INSERTQUERY, tableName); sqliteDb.execOnConnection(connection -> { try (IHMPreparedStatement pstmt = connection.prepareStatement(sql)) { pstmt.setInt(1, zoom); pstmt.setInt(2, tx); pstmt.setInt(3, ty); pstmt.setBytes(4, tileData); pstmt.executeUpdate(); return null; } }); } | /**
* Add a tile to the geopackage.
*
* @param tableName the tabel into which to insert the tile.
* @param tx the col of the tile.
* @param ty the row of the tile.
* @param zoom the zoomlevel of the tile.
* @param tileData the tile image data.
* @throws Exception
*/ | Add a tile to the geopackage | putTile | {
"repo_name": "moovida/jgrasstools",
"path": "dbs/src/main/java/org/hortonmachine/dbs/geopackage/GeopackageCommonDb.java",
"license": "gpl-3.0",
"size": 69232
} | [
"java.lang.String",
"org.hortonmachine.dbs.compat.IHMPreparedStatement"
] | import java.lang.String; import org.hortonmachine.dbs.compat.IHMPreparedStatement; | import java.lang.*; import org.hortonmachine.dbs.compat.*; | [
"java.lang",
"org.hortonmachine.dbs"
] | java.lang; org.hortonmachine.dbs; | 3,477 |
protected String getSysLogFormattedDate() {
SimpleDateFormat df = new SimpleDateFormat("MMM dd HH:mm:ss", Locale.US);
Date now = new Date();
return df.format(now);
} | String function() { SimpleDateFormat df = new SimpleDateFormat(STR, Locale.US); Date now = new Date(); return df.format(now); } | /**
* syslog style date formatter
* @return Current time in syslog format.
*/ | syslog style date formatter | getSysLogFormattedDate | {
"repo_name": "percolate/foam",
"path": "Foam/foam/src/main/java/com/percolate/foam/UDPLoggingService.java",
"license": "bsd-3-clause",
"size": 4488
} | [
"java.text.SimpleDateFormat",
"java.util.Date",
"java.util.Locale"
] | import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; | import java.text.*; import java.util.*; | [
"java.text",
"java.util"
] | java.text; java.util; | 354,123 |
public void printErrors() {
final int size = _errors.size();
if (size > 0) {
System.err.println(new ErrorMsg(ErrorMsg.COMPILER_ERROR_KEY));
for (int i = 0; i < size; i++) {
System.err.println(" " + _errors.get(i));
}
}
} | void function() { final int size = _errors.size(); if (size > 0) { System.err.println(new ErrorMsg(ErrorMsg.COMPILER_ERROR_KEY)); for (int i = 0; i < size; i++) { System.err.println(" " + _errors.get(i)); } } } | /**
* Prints all compile-time errors
*/ | Prints all compile-time errors | printErrors | {
"repo_name": "MeFisto94/openjdk",
"path": "jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java",
"license": "gpl-2.0",
"size": 56863
} | [
"com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg"
] | import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; | import com.sun.org.apache.xalan.internal.xsltc.compiler.util.*; | [
"com.sun.org"
] | com.sun.org; | 2,846,291 |
public static void testThreadedTileDao(final GeoPackage geoPackage)
throws SQLException {
final int threads = 30;
final int attemptsPerThread = 50;
TileMatrixSetDao tileMatrixSetDao = geoPackage.getTileMatrixSetDao();
if (tileMatrixSetDao.isTableExists()) {
List<TileMatrixSet> results = tileMatrixSetDao.queryForAll();
results = TestUtils.getRandomList(results, 3);
for (TileMatrixSet tileMatrixSet : results) {
threadedTileDaoError = false;
final String tableName = tileMatrixSet.getTableName();
Runnable task = new Runnable() { | static void function(final GeoPackage geoPackage) throws SQLException { final int threads = 30; final int attemptsPerThread = 50; TileMatrixSetDao tileMatrixSetDao = geoPackage.getTileMatrixSetDao(); if (tileMatrixSetDao.isTableExists()) { List<TileMatrixSet> results = tileMatrixSetDao.queryForAll(); results = TestUtils.getRandomList(results, 3); for (TileMatrixSet tileMatrixSet : results) { threadedTileDaoError = false; final String tableName = tileMatrixSet.getTableName(); Runnable task = new Runnable() { | /**
* Test threaded tile dao
*
* @param geoPackage GeoPackage
* @throws SQLException upon error
*/ | Test threaded tile dao | testThreadedTileDao | {
"repo_name": "ngageoint/geopackage-android",
"path": "geopackage-sdk/src/androidTest/java/mil/nga/geopackage/tiles/user/TileUtils.java",
"license": "mit",
"size": 61428
} | [
"java.sql.SQLException",
"java.util.List",
"mil.nga.geopackage.GeoPackage",
"mil.nga.geopackage.TestUtils",
"mil.nga.geopackage.tiles.matrixset.TileMatrixSet",
"mil.nga.geopackage.tiles.matrixset.TileMatrixSetDao"
] | import java.sql.SQLException; import java.util.List; import mil.nga.geopackage.GeoPackage; import mil.nga.geopackage.TestUtils; import mil.nga.geopackage.tiles.matrixset.TileMatrixSet; import mil.nga.geopackage.tiles.matrixset.TileMatrixSetDao; | import java.sql.*; import java.util.*; import mil.nga.geopackage.*; import mil.nga.geopackage.tiles.matrixset.*; | [
"java.sql",
"java.util",
"mil.nga.geopackage"
] | java.sql; java.util; mil.nga.geopackage; | 2,735,454 |
public List<ContextDescriptorCategoryItem> getItems() {
return items;
} | List<ContextDescriptorCategoryItem> function() { return items; } | /**
* Returns categories.
* @return categories
*/ | Returns categories | getItems | {
"repo_name": "b-cuts/esper",
"path": "esper/src/main/java/com/espertech/esper/client/soda/ContextDescriptorCategory.java",
"license": "gpl-2.0",
"size": 2567
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,085,116 |
public AnjiNet newAnjiNet(Chromosome genotype) throws TranscriberException {
if (genotype.getAlleles().isEmpty()) throw new IllegalArgumentException("Genotype has no alleles...");
Map<Long, Neuron> allNeurons = new HashMap<Long, Neuron>();
// input neurons
SortedMap<Long, NeuronAllele> inNeuronAlleles = NeatChromosomeUtility.getNeuronMap(genotype.getAlleles(), NeuronType.INPUT);
if (inNeuronAlleles.isEmpty()) throw new IllegalArgumentException("An AnjiNet must have at least one input neuron.");
List<Neuron> inNeurons = new ArrayList<Neuron>();
for (NeuronAllele neuronAllele : inNeuronAlleles.values()) {
Neuron n = new Neuron(ActivationFunctionFactory.getInstance().get(neuronAllele.getActivationType()), neuronAllele.getBias());
n.setId(neuronAllele.getInnovationId().longValue());
inNeurons.add(n);
allNeurons.put(neuronAllele.getInnovationId(), n);
}
// output neurons
SortedMap<Long, NeuronAllele> outNeuronAlleles = NeatChromosomeUtility.getNeuronMap(genotype.getAlleles(), NeuronType.OUTPUT);
if (outNeuronAlleles.isEmpty()) throw new IllegalArgumentException("An AnjiNet must have at least one output neuron.");
List<Neuron> outNeurons = new ArrayList<Neuron>();
for (NeuronAllele neuronAllele : outNeuronAlleles.values()) {
Neuron n = new Neuron(ActivationFunctionFactory.getInstance().get(neuronAllele.getActivationType()), neuronAllele.getBias());
n.setId(neuronAllele.getInnovationId().longValue());
outNeurons.add(n);
allNeurons.put(neuronAllele.getInnovationId(), n);
}
// hidden neurons
SortedMap<Long, NeuronAllele> hiddenNeuronAlleles = NeatChromosomeUtility.getNeuronMap(genotype.getAlleles(), NeuronType.HIDDEN);
for (NeuronAllele neuronAllele : hiddenNeuronAlleles.values()) {
Neuron n = new Neuron(ActivationFunctionFactory.valueOf(neuronAllele.getActivationType()), neuronAllele.getBias());
n.setId(neuronAllele.getInnovationId().longValue());
allNeurons.put(neuronAllele.getInnovationId(), n);
}
// connections
//
// Starting with output layer, gather connections and neurons to which it is immediately
// connected, creating a logical layer of neurons. Assign each connection its input (source)
// neuron, and each destination neuron its input connections. Recurrency is handled depending
// on policy:
//
// RecurrencyPolicy.LAZY - all connections CacheNeuronConnection
//
// RecurrencyPolicy.DISALLOWED - no connections CacheNeuronConnection (assumes topology sans
// loops)
//
// RecurrencyPolicy.BEST_GUESS - any connection where the source neuron is in the same or
// later (i.e., nearer output layer) as the destination is a CacheNeuronConnection
List<CacheNeuronConnection> recurrentConns = new ArrayList<CacheNeuronConnection>();
List<ConnectionAllele> remainingConnAlleles = NeatChromosomeUtility.getConnectionList(genotype.getAlleles());
Set<Long> currentNeuronInnovationIds = new HashSet<Long>(outNeuronAlleles.keySet());
Set<Long> traversedNeuronInnovationIds = new HashSet<Long>(currentNeuronInnovationIds);
Set<Long> nextNeuronInnovationIds = new HashSet<Long>();
while (!remainingConnAlleles.isEmpty() && !currentNeuronInnovationIds.isEmpty()) {
nextNeuronInnovationIds.clear();
Collection<ConnectionAllele> connAlleles = NeatChromosomeUtility.extractConnectionAllelesForDestNeurons(remainingConnAlleles, currentNeuronInnovationIds);
for (ConnectionAllele connAllele : connAlleles) {
Neuron src = allNeurons.get(connAllele.getSrcNeuronId());
Neuron dest = allNeurons.get(connAllele.getDestNeuronId());
if (src == null)
throw new TranscriberException("connection with missing src neuron: " + connAllele.toString());
if (dest == null)
throw new TranscriberException("connection with missing dest neuron: " + connAllele.toString());
// handle recurrency processing
boolean cached = false;
if (RecurrencyPolicy.LAZY.equals(recurrencyPolicy))
cached = true;
else if (RecurrencyPolicy.BEST_GUESS.equals(recurrencyPolicy)) {
boolean maybeRecurrent = (traversedNeuronInnovationIds.contains(connAllele.getSrcNeuronId()));
cached = maybeRecurrent || recurrencyPolicy.equals(RecurrencyPolicy.LAZY);
}
NeuronConnection conn = null;
if (cached) {
conn = new CacheNeuronConnection(src, (float) connAllele.getWeight());
recurrentConns.add((CacheNeuronConnection) conn);
} else {
conn = new NeuronConnection(src, (float) connAllele.getWeight());
}
conn.setId(connAllele.getInnovationId().longValue());
dest.addIncomingConnection(conn);
nextNeuronInnovationIds.add(connAllele.getSrcNeuronId());
}
traversedNeuronInnovationIds.addAll(nextNeuronInnovationIds);
currentNeuronInnovationIds.clear();
currentNeuronInnovationIds.addAll(nextNeuronInnovationIds);
remainingConnAlleles.removeAll(connAlleles);
}
// make sure we traversed all connections and nodes; input neurons are automatically
// considered "traversed" since they should be realized regardless of their connectivity to
// the rest of the network
if (!remainingConnAlleles.isEmpty()) {
logger.warn("not all connection genes handled: " + genotype.toString() + (genotype.getMaterial().pruned ? " " : " not") + " pruned");
}
traversedNeuronInnovationIds.addAll(inNeuronAlleles.keySet());
if (traversedNeuronInnovationIds.size() != allNeurons.size()) {
logger.warn("did not traverse all neurons: " + genotype.toString() + (genotype.getMaterial().pruned ? " " : " not") + " pruned");
}
// build network
Collection<Neuron> allNeuronsCol = allNeurons.values();
String id = genotype.getId().toString();
return new AnjiNet(allNeuronsCol, inNeurons, outNeurons, recurrentConns, id);
} | AnjiNet function(Chromosome genotype) throws TranscriberException { if (genotype.getAlleles().isEmpty()) throw new IllegalArgumentException(STR); Map<Long, Neuron> allNeurons = new HashMap<Long, Neuron>(); SortedMap<Long, NeuronAllele> inNeuronAlleles = NeatChromosomeUtility.getNeuronMap(genotype.getAlleles(), NeuronType.INPUT); if (inNeuronAlleles.isEmpty()) throw new IllegalArgumentException(STR); List<Neuron> inNeurons = new ArrayList<Neuron>(); for (NeuronAllele neuronAllele : inNeuronAlleles.values()) { Neuron n = new Neuron(ActivationFunctionFactory.getInstance().get(neuronAllele.getActivationType()), neuronAllele.getBias()); n.setId(neuronAllele.getInnovationId().longValue()); inNeurons.add(n); allNeurons.put(neuronAllele.getInnovationId(), n); } SortedMap<Long, NeuronAllele> outNeuronAlleles = NeatChromosomeUtility.getNeuronMap(genotype.getAlleles(), NeuronType.OUTPUT); if (outNeuronAlleles.isEmpty()) throw new IllegalArgumentException(STR); List<Neuron> outNeurons = new ArrayList<Neuron>(); for (NeuronAllele neuronAllele : outNeuronAlleles.values()) { Neuron n = new Neuron(ActivationFunctionFactory.getInstance().get(neuronAllele.getActivationType()), neuronAllele.getBias()); n.setId(neuronAllele.getInnovationId().longValue()); outNeurons.add(n); allNeurons.put(neuronAllele.getInnovationId(), n); } SortedMap<Long, NeuronAllele> hiddenNeuronAlleles = NeatChromosomeUtility.getNeuronMap(genotype.getAlleles(), NeuronType.HIDDEN); for (NeuronAllele neuronAllele : hiddenNeuronAlleles.values()) { Neuron n = new Neuron(ActivationFunctionFactory.valueOf(neuronAllele.getActivationType()), neuronAllele.getBias()); n.setId(neuronAllele.getInnovationId().longValue()); allNeurons.put(neuronAllele.getInnovationId(), n); } List<CacheNeuronConnection> recurrentConns = new ArrayList<CacheNeuronConnection>(); List<ConnectionAllele> remainingConnAlleles = NeatChromosomeUtility.getConnectionList(genotype.getAlleles()); Set<Long> currentNeuronInnovationIds = new HashSet<Long>(outNeuronAlleles.keySet()); Set<Long> traversedNeuronInnovationIds = new HashSet<Long>(currentNeuronInnovationIds); Set<Long> nextNeuronInnovationIds = new HashSet<Long>(); while (!remainingConnAlleles.isEmpty() && !currentNeuronInnovationIds.isEmpty()) { nextNeuronInnovationIds.clear(); Collection<ConnectionAllele> connAlleles = NeatChromosomeUtility.extractConnectionAllelesForDestNeurons(remainingConnAlleles, currentNeuronInnovationIds); for (ConnectionAllele connAllele : connAlleles) { Neuron src = allNeurons.get(connAllele.getSrcNeuronId()); Neuron dest = allNeurons.get(connAllele.getDestNeuronId()); if (src == null) throw new TranscriberException(STR + connAllele.toString()); if (dest == null) throw new TranscriberException(STR + connAllele.toString()); boolean cached = false; if (RecurrencyPolicy.LAZY.equals(recurrencyPolicy)) cached = true; else if (RecurrencyPolicy.BEST_GUESS.equals(recurrencyPolicy)) { boolean maybeRecurrent = (traversedNeuronInnovationIds.contains(connAllele.getSrcNeuronId())); cached = maybeRecurrent recurrencyPolicy.equals(RecurrencyPolicy.LAZY); } NeuronConnection conn = null; if (cached) { conn = new CacheNeuronConnection(src, (float) connAllele.getWeight()); recurrentConns.add((CacheNeuronConnection) conn); } else { conn = new NeuronConnection(src, (float) connAllele.getWeight()); } conn.setId(connAllele.getInnovationId().longValue()); dest.addIncomingConnection(conn); nextNeuronInnovationIds.add(connAllele.getSrcNeuronId()); } traversedNeuronInnovationIds.addAll(nextNeuronInnovationIds); currentNeuronInnovationIds.clear(); currentNeuronInnovationIds.addAll(nextNeuronInnovationIds); remainingConnAlleles.removeAll(connAlleles); } if (!remainingConnAlleles.isEmpty()) { logger.warn(STR + genotype.toString() + (genotype.getMaterial().pruned ? " " : STR) + STR); } traversedNeuronInnovationIds.addAll(inNeuronAlleles.keySet()); if (traversedNeuronInnovationIds.size() != allNeurons.size()) { logger.warn(STR + genotype.toString() + (genotype.getMaterial().pruned ? " " : STR) + STR); } Collection<Neuron> allNeuronsCol = allNeurons.values(); String id = genotype.getId().toString(); return new AnjiNet(allNeuronsCol, inNeurons, outNeurons, recurrentConns, id); } | /**
* create new <code>AnjiNet</code> from <code>genotype</code>
*
* @param genotype chromosome to transcribe
* @return phenotype
* @throws TranscriberException
*/ | create new <code>AnjiNet</code> from <code>genotype</code> | newAnjiNet | {
"repo_name": "Fumaloko92/MSc-Thesis",
"path": "17-05-2017/neuralturingmachines-master/src/com/anji_ahni/integration/AnjiNetTranscriber.java",
"license": "mit",
"size": 9707
} | [
"com.anji_ahni.neat.ConnectionAllele",
"com.anji_ahni.neat.NeatChromosomeUtility",
"com.anji_ahni.neat.NeuronAllele",
"com.anji_ahni.neat.NeuronType",
"com.anji_ahni.nn.AnjiNet",
"com.anji_ahni.nn.CacheNeuronConnection",
"com.anji_ahni.nn.Neuron",
"com.anji_ahni.nn.NeuronConnection",
"com.anji_ahni.... | import com.anji_ahni.neat.ConnectionAllele; import com.anji_ahni.neat.NeatChromosomeUtility; import com.anji_ahni.neat.NeuronAllele; import com.anji_ahni.neat.NeuronType; import com.anji_ahni.nn.AnjiNet; import com.anji_ahni.nn.CacheNeuronConnection; import com.anji_ahni.nn.Neuron; import com.anji_ahni.nn.NeuronConnection; import com.anji_ahni.nn.RecurrencyPolicy; import com.anji_ahni.nn.activationfunction.ActivationFunctionFactory; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; import org.jgapcustomised.Chromosome; | import com.anji_ahni.neat.*; import com.anji_ahni.nn.*; import com.anji_ahni.nn.activationfunction.*; import java.util.*; import org.jgapcustomised.*; | [
"com.anji_ahni.neat",
"com.anji_ahni.nn",
"java.util",
"org.jgapcustomised"
] | com.anji_ahni.neat; com.anji_ahni.nn; java.util; org.jgapcustomised; | 1,726,297 |
@Override
public Adapter createFastXSLTMediatorInputConnectorAdapter() {
if (fastXSLTMediatorInputConnectorItemProvider == null) {
fastXSLTMediatorInputConnectorItemProvider = new FastXSLTMediatorInputConnectorItemProvider(this);
}
return fastXSLTMediatorInputConnectorItemProvider;
}
protected FastXSLTMediatorOutputConnectorItemProvider fastXSLTMediatorOutputConnectorItemProvider; | Adapter function() { if (fastXSLTMediatorInputConnectorItemProvider == null) { fastXSLTMediatorInputConnectorItemProvider = new FastXSLTMediatorInputConnectorItemProvider(this); } return fastXSLTMediatorInputConnectorItemProvider; } protected FastXSLTMediatorOutputConnectorItemProvider fastXSLTMediatorOutputConnectorItemProvider; | /**
* This creates an adapter for a {@link org.wso2.developerstudio.eclipse.gmf.esb.FastXSLTMediatorInputConnector}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This creates an adapter for a <code>org.wso2.developerstudio.eclipse.gmf.esb.FastXSLTMediatorInputConnector</code>. | createFastXSLTMediatorInputConnectorAdapter | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/EsbItemProviderAdapterFactory.java",
"license": "apache-2.0",
"size": 339597
} | [
"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,300,418 |
ClientConfig cc = new DefaultClientConfig();
cc.getClasses().add(JacksonJsonProvider.class);
cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
return Client.create(cc);
} | ClientConfig cc = new DefaultClientConfig(); cc.getClasses().add(JacksonJsonProvider.class); cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); return Client.create(cc); } | /**
* Creates a {@link Client}.
*
* @return a {@link Client} instanceO
*/ | Creates a <code>Client</code> | getWebClient | {
"repo_name": "sopeco/LPE-Common",
"path": "org.lpe.common.utils/src/org/lpe/common/util/web/LpeWebUtils.java",
"license": "apache-2.0",
"size": 7884
} | [
"com.sun.jersey.api.client.Client",
"com.sun.jersey.api.client.config.ClientConfig",
"com.sun.jersey.api.client.config.DefaultClientConfig",
"com.sun.jersey.api.json.JSONConfiguration",
"org.codehaus.jackson.jaxrs.JacksonJsonProvider"
] | import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.config.ClientConfig; import com.sun.jersey.api.client.config.DefaultClientConfig; import com.sun.jersey.api.json.JSONConfiguration; import org.codehaus.jackson.jaxrs.JacksonJsonProvider; | import com.sun.jersey.api.client.*; import com.sun.jersey.api.client.config.*; import com.sun.jersey.api.json.*; import org.codehaus.jackson.jaxrs.*; | [
"com.sun.jersey",
"org.codehaus.jackson"
] | com.sun.jersey; org.codehaus.jackson; | 266,585 |
public void addInput(AttachmentKey<?> in) {
if (input == null)
input = new HashSet<AttachmentKey<?>>();
input.add(in);
} | void function(AttachmentKey<?> in) { if (input == null) input = new HashSet<AttachmentKey<?>>(); input.add(in); } | /**
* Add an input requirement.
*/ | Add an input requirement | addInput | {
"repo_name": "jbosgi/jbosgi-deployment",
"path": "src/main/java/org/jboss/osgi/deployment/interceptor/AbstractLifecycleInterceptor.java",
"license": "lgpl-2.1",
"size": 3213
} | [
"java.util.HashSet",
"org.jboss.osgi.spi.AttachmentKey"
] | import java.util.HashSet; import org.jboss.osgi.spi.AttachmentKey; | import java.util.*; import org.jboss.osgi.spi.*; | [
"java.util",
"org.jboss.osgi"
] | java.util; org.jboss.osgi; | 733,641 |
public Vector<String> getItemNamesById(String rfId) {
return itemIdNameMap.get(rfId);
} | Vector<String> function(String rfId) { return itemIdNameMap.get(rfId); } | /**
* get the list of item names that use the same RfId
*
* @param id
* @return
*/ | get the list of item names that use the same RfId | getItemNamesById | {
"repo_name": "openhab/openhab",
"path": "bundles/binding/org.openhab.binding.zibase/src/main/java/org/openhab/binding/zibase/internal/ZibaseGenericBindingProvider.java",
"license": "epl-1.0",
"size": 4936
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 1,135,608 |
public FriendsGetQueryWithFields get(UserActor actor, UserField... fields) {
return new FriendsGetQueryWithFields(getClient(), actor, fields);
} | FriendsGetQueryWithFields function(UserActor actor, UserField... fields) { return new FriendsGetQueryWithFields(getClient(), actor, fields); } | /**
* Returns a list of user IDs or detailed information about a user's friends.
*/ | Returns a list of user IDs or detailed information about a user's friends | get | {
"repo_name": "kokorin/vk-java-sdk",
"path": "sdk/src/main/java/com/vk/api/sdk/actions/Friends.java",
"license": "mit",
"size": 9415
} | [
"com.vk.api.sdk.client.actors.UserActor",
"com.vk.api.sdk.queries.friends.FriendsGetQueryWithFields",
"com.vk.api.sdk.queries.users.UserField"
] | import com.vk.api.sdk.client.actors.UserActor; import com.vk.api.sdk.queries.friends.FriendsGetQueryWithFields; import com.vk.api.sdk.queries.users.UserField; | import com.vk.api.sdk.client.actors.*; import com.vk.api.sdk.queries.friends.*; import com.vk.api.sdk.queries.users.*; | [
"com.vk.api"
] | com.vk.api; | 1,864,042 |
public Call<ResponseBody> putIntAsync(IntWrapper complexBody, final ServiceCallback<Void> serviceCallback) {
if (complexBody == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter complexBody is required and cannot be null.")));
} | Call<ResponseBody> function(IntWrapper complexBody, final ServiceCallback<Void> serviceCallback) { if (complexBody == null) { serviceCallback.failure(new ServiceException( new IllegalArgumentException(STR))); } | /**
* Put complex types with integer properties
*
* @param complexBody Please put -1 and 2
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
*/ | Put complex types with integer properties | putIntAsync | {
"repo_name": "BretJohnson/autorest",
"path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/PrimitiveImpl.java",
"license": "mit",
"size": 48767
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceException",
"com.squareup.okhttp.ResponseBody"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceException; import com.squareup.okhttp.ResponseBody; | import com.microsoft.rest.*; import com.squareup.okhttp.*; | [
"com.microsoft.rest",
"com.squareup.okhttp"
] | com.microsoft.rest; com.squareup.okhttp; | 1,693,318 |
public static boolean includeJspAndSave(String jspUriPath,String saveFullFilename){
ServletRequest request=getServletRequest();
ServletResponse response=getServletResponse();
return includeJspAndSave(jspUriPath,saveFullFilename,request,response);
} | static boolean function(String jspUriPath,String saveFullFilename){ ServletRequest request=getServletRequest(); ServletResponse response=getServletResponse(); return includeJspAndSave(jspUriPath,saveFullFilename,request,response); } | /**
* include jsp and save,for servlet(ActionListener) use.
* @param jspUriPath
* @param saveFullFilename
* @return boolean
*/ | include jsp and save,for servlet(ActionListener) use | includeJspAndSave | {
"repo_name": "oneliang/frame-common-java",
"path": "src/main/java/com/oneliang/frame/servlet/ActionUtil.java",
"license": "apache-2.0",
"size": 6823
} | [
"javax.servlet.ServletRequest",
"javax.servlet.ServletResponse"
] | import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; | import javax.servlet.*; | [
"javax.servlet"
] | javax.servlet; | 753,391 |
public void createReport(String name)
{
Browser browser = model.getBrowser();
List<ImageNode> nodes = browser.getVisibleImageNodes();
if (nodes == null || nodes.size() == 0) {
UserNotifier un = DataBrowserAgent.getRegistry().getUserNotifier();
un.notifyInfo("Create Report", "No images displayed");
return;
}
List<Class> types = new ArrayList<Class>();
model.fireReportLoading(nodes, types, name);
} | void function(String name) { Browser browser = model.getBrowser(); List<ImageNode> nodes = browser.getVisibleImageNodes(); if (nodes == null nodes.size() == 0) { UserNotifier un = DataBrowserAgent.getRegistry().getUserNotifier(); un.notifyInfo(STR, STR); return; } List<Class> types = new ArrayList<Class>(); model.fireReportLoading(nodes, types, name); } | /**
* Implemented as specified by the {@link DataBrowser} interface.
* @see DataBrowser#createReport(String)
*/ | Implemented as specified by the <code>DataBrowser</code> interface | createReport | {
"repo_name": "jballanc/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/dataBrowser/view/DataBrowserComponent.java",
"license": "gpl-2.0",
"size": 56258
} | [
"java.util.ArrayList",
"java.util.List",
"org.openmicroscopy.shoola.agents.dataBrowser.DataBrowserAgent",
"org.openmicroscopy.shoola.agents.dataBrowser.browser.Browser",
"org.openmicroscopy.shoola.agents.dataBrowser.browser.ImageNode",
"org.openmicroscopy.shoola.env.ui.UserNotifier"
] | import java.util.ArrayList; import java.util.List; import org.openmicroscopy.shoola.agents.dataBrowser.DataBrowserAgent; import org.openmicroscopy.shoola.agents.dataBrowser.browser.Browser; import org.openmicroscopy.shoola.agents.dataBrowser.browser.ImageNode; import org.openmicroscopy.shoola.env.ui.UserNotifier; | import java.util.*; import org.openmicroscopy.shoola.agents.*; import org.openmicroscopy.shoola.env.ui.*; | [
"java.util",
"org.openmicroscopy.shoola"
] | java.util; org.openmicroscopy.shoola; | 127,534 |
@Test
public void testIsLocationDefinedPath() {
final FileHandler handler = new FileHandler();
handler.setPath(createTestFile().getAbsolutePath());
assertTrue("Location not defined", handler.isLocationDefined());
} | void function() { final FileHandler handler = new FileHandler(); handler.setPath(createTestFile().getAbsolutePath()); assertTrue(STR, handler.isLocationDefined()); } | /**
* Tests isLocationDefined() if a path has been set.
*/ | Tests isLocationDefined() if a path has been set | testIsLocationDefinedPath | {
"repo_name": "apache/commons-configuration",
"path": "src/test/java/org/apache/commons/configuration2/io/TestFileHandler.java",
"license": "apache-2.0",
"size": 52995
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,062,779 |
ResponseEntity<String> build(AuthenticationResult result, HttpServletRequest request) throws Exception; | ResponseEntity<String> build(AuthenticationResult result, HttpServletRequest request) throws Exception; | /**
* Build response response entity.
*
* @param result the result
* @param request the request
* @return the response entity
* @throws Exception the exception
*/ | Build response response entity | build | {
"repo_name": "tduehr/cas",
"path": "core/cas-server-core-rest/src/main/java/org/apereo/cas/rest/factory/UserAuthenticationResourceEntityResponseFactory.java",
"license": "apache-2.0",
"size": 717
} | [
"javax.servlet.http.HttpServletRequest",
"org.apereo.cas.authentication.AuthenticationResult",
"org.springframework.http.ResponseEntity"
] | import javax.servlet.http.HttpServletRequest; import org.apereo.cas.authentication.AuthenticationResult; import org.springframework.http.ResponseEntity; | import javax.servlet.http.*; import org.apereo.cas.authentication.*; import org.springframework.http.*; | [
"javax.servlet",
"org.apereo.cas",
"org.springframework.http"
] | javax.servlet; org.apereo.cas; org.springframework.http; | 1,435,755 |
private static boolean hasCommonDynamicPropsToBind(Component component, Object content) {
return component.hasCommonDynamicProps() && content instanceof View;
} | static boolean function(Component component, Object content) { return component.hasCommonDynamicProps() && content instanceof View; } | /**
* Common dynamic props could only be bound to Views. To make it work for the LayoutSpec and
* MountDrawableSpec components we create a wrapping HostComponent and copy the dynamic props
* there. Thus DynamicPropsManager should ignore non-MountViewSpecs
*
* @param component Component to consider
* @return true if Component has common dynamic props, that DynamicPropsManager should take an
* action on
*/ | Common dynamic props could only be bound to Views. To make it work for the LayoutSpec and MountDrawableSpec components we create a wrapping HostComponent and copy the dynamic props there. Thus DynamicPropsManager should ignore non-MountViewSpecs | hasCommonDynamicPropsToBind | {
"repo_name": "facebook/litho",
"path": "litho-core/src/main/java/com/facebook/litho/DynamicPropsManager.java",
"license": "apache-2.0",
"size": 10109
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,720,374 |
public void setUsersConfigurationFile(String usersConfigurationFile) {
m_usersConfigurationFile = usersConfigurationFile;
UserFactory.setInstance(null);
} | void function(String usersConfigurationFile) { m_usersConfigurationFile = usersConfigurationFile; UserFactory.setInstance(null); } | /**
* Sets the users configuration file.
*
* @param usersConfigurationFile the new users configuration file
*/ | Sets the users configuration file | setUsersConfigurationFile | {
"repo_name": "aihua/opennms",
"path": "features/springframework-security/src/main/java/org/opennms/web/springframework/security/SpringSecurityUserDaoImpl.java",
"license": "agpl-3.0",
"size": 8965
} | [
"org.opennms.netmgt.config.UserFactory"
] | import org.opennms.netmgt.config.UserFactory; | import org.opennms.netmgt.config.*; | [
"org.opennms.netmgt"
] | org.opennms.netmgt; | 1,628,276 |
public static HiveSerDeWrapper get(String serDeType, Optional<String> inputFormatClassName,
Optional<String> outputFormatClassName) {
Optional<BuiltInHiveSerDe> hiveSerDe = Enums.getIfPresent(BuiltInHiveSerDe.class, serDeType.toUpperCase());
if (hiveSerDe.isPresent()) {
return new HiveSerDeWrapper(hiveSerDe.get());
} else {
Preconditions.checkArgument(inputFormatClassName.isPresent(),
"Missing input format class name for SerDe " + serDeType);
Preconditions.checkArgument(outputFormatClassName.isPresent(),
"Missing output format class name for SerDe " + serDeType);
return new HiveSerDeWrapper(serDeType, inputFormatClassName.get(), outputFormatClassName.get());
}
} | static HiveSerDeWrapper function(String serDeType, Optional<String> inputFormatClassName, Optional<String> outputFormatClassName) { Optional<BuiltInHiveSerDe> hiveSerDe = Enums.getIfPresent(BuiltInHiveSerDe.class, serDeType.toUpperCase()); if (hiveSerDe.isPresent()) { return new HiveSerDeWrapper(hiveSerDe.get()); } else { Preconditions.checkArgument(inputFormatClassName.isPresent(), STR + serDeType); Preconditions.checkArgument(outputFormatClassName.isPresent(), STR + serDeType); return new HiveSerDeWrapper(serDeType, inputFormatClassName.get(), outputFormatClassName.get()); } } | /**
* Get an instance of {@link HiveSerDeWrapper}.
*
* @param serDeType The SerDe type. If serDeType is one of the available {@link HiveSerDeWrapper.BuiltInHiveSerDe},
* the other three parameters are not used. Otherwise, serDeType should be the class name of a {@link SerDe},
* and the other three parameters must be present.
*/ | Get an instance of <code>HiveSerDeWrapper</code> | get | {
"repo_name": "sahooamit/bigdata",
"path": "gobblin-core/src/main/java/gobblin/serde/HiveSerDeWrapper.java",
"license": "apache-2.0",
"size": 7776
} | [
"com.google.common.base.Enums",
"com.google.common.base.Optional",
"com.google.common.base.Preconditions"
] | import com.google.common.base.Enums; import com.google.common.base.Optional; import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,894,740 |
@Test
public void pipeline_Fi_12() throws IOException {
final String methodName = FiTestUtil.getMethodName();
runStatusReadTest(methodName, 1, new OomAction(methodName, 1));
} | void function() throws IOException { final String methodName = FiTestUtil.getMethodName(); runStatusReadTest(methodName, 1, new OomAction(methodName, 1)); } | /**
* Pipeline setup, DN1 throws an OutOfMemoryException right after it
* received a setup ack from DN2.
* Client gets an IOException and determine DN1 bad.
*/ | Pipeline setup, DN1 throws an OutOfMemoryException right after it received a setup ack from DN2. Client gets an IOException and determine DN1 bad | pipeline_Fi_12 | {
"repo_name": "tseen/Federated-HDFS",
"path": "tseenliu/FedHDFS-hadoop-src/hadoop-hdfs-project/hadoop-hdfs/src/test/aop/org/apache/hadoop/hdfs/server/datanode/TestFiDataTransferProtocol.java",
"license": "apache-2.0",
"size": 11123
} | [
"java.io.IOException",
"org.apache.hadoop.fi.DataTransferTestUtil",
"org.apache.hadoop.fi.FiTestUtil"
] | import java.io.IOException; import org.apache.hadoop.fi.DataTransferTestUtil; import org.apache.hadoop.fi.FiTestUtil; | import java.io.*; import org.apache.hadoop.fi.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,293,839 |
public SortedSet<String> getReferencedClassnames()
{
SortedSet<String> set = new TreeSet<String>();
List<ConstantInfo> list = constantPoolMap.get(ConstantInfo.Clazz.class);
if (list != null)
{
for (ConstantInfo ci : list)
{
ConstantInfo.Clazz cls = (Clazz) ci;
int ni = cls.getName_index();
String name = getString(ni);
if (name.startsWith("["))
{
for (int ii=1;ii<name.length();ii++)
{
if (name.charAt(ii) == 'L')
{
name = name.substring(ii+1, name.length()-1);
set.add(name);
break;
}
}
}
else
{
set.add(name);
}
}
}
return set;
} | SortedSet<String> function() { SortedSet<String> set = new TreeSet<String>(); List<ConstantInfo> list = constantPoolMap.get(ConstantInfo.Clazz.class); if (list != null) { for (ConstantInfo ci : list) { ConstantInfo.Clazz cls = (Clazz) ci; int ni = cls.getName_index(); String name = getString(ni); if (name.startsWith("[")) { for (int ii=1;ii<name.length();ii++) { if (name.charAt(ii) == 'L') { name = name.substring(ii+1, name.length()-1); set.add(name); break; } } } else { set.add(name); } } } return set; } | /**
* Returns all classnames (in internal form) that this class references
* @return
*/ | Returns all classnames (in internal form) that this class references | getReferencedClassnames | {
"repo_name": "tvesalainen/bcc",
"path": "src/main/java/org/vesalainen/bcc/ClassFile.java",
"license": "gpl-3.0",
"size": 26742
} | [
"java.util.List",
"java.util.SortedSet",
"java.util.TreeSet",
"org.vesalainen.bcc.ConstantInfo"
] | import java.util.List; import java.util.SortedSet; import java.util.TreeSet; import org.vesalainen.bcc.ConstantInfo; | import java.util.*; import org.vesalainen.bcc.*; | [
"java.util",
"org.vesalainen.bcc"
] | java.util; org.vesalainen.bcc; | 1,841,993 |
for (ParkingRegionType t: ParkingRegionType.values()) {
if (t.name.equals(name)) {
return t;
}
}
LOGGER.severe("Could not find parking region type with name: " + name);
return null;
}
}
// App utils
private static Logger LOGGER = Logger.getLogger(ParkingRegion.class
.getName());
private int parkingRegionID;
private float angle;
protected LinkedList<ParkingSpot> parkingSpots;
private Deck deck;
public final ParkingRegionType type;
public ParkingRegion(ParkingRegionType type, float angle) {
this.type = type;
this.angle = angle;
this.parkingSpots = new LinkedList<ParkingSpot>();
addToDeck();
} | for (ParkingRegionType t: ParkingRegionType.values()) { if (t.name.equals(name)) { return t; } } LOGGER.severe(STR + name); return null; } } private static Logger LOGGER = Logger.getLogger(ParkingRegion.class .getName()); private int parkingRegionID; private float angle; protected LinkedList<ParkingSpot> parkingSpots; private Deck deck; public final ParkingRegionType type; public ParkingRegion(ParkingRegionType type, float angle) { this.type = type; this.angle = angle; this.parkingSpots = new LinkedList<ParkingSpot>(); addToDeck(); } | /**
* Returns corresponding parking region given name or null.
* @param name
* @return
*/ | Returns corresponding parking region given name or null | stringToParkingRegion | {
"repo_name": "MUG-CSAIL/DeckViewer",
"path": "src/edu/mit/kacquah/deckviewer/environment/ParkingRegion.java",
"license": "mit",
"size": 6965
} | [
"java.util.LinkedList",
"java.util.logging.Logger"
] | import java.util.LinkedList; import java.util.logging.Logger; | import java.util.*; import java.util.logging.*; | [
"java.util"
] | java.util; | 828,759 |
private void cleanupExpiredInflightRequests() {
Iterator<Map.Entry<Integer, DeleteRequestInfo>> itr = deleteRequestInfos.entrySet().iterator();
while (itr.hasNext()) {
Map.Entry<Integer, DeleteRequestInfo> deleteRequestInfoEntry = itr.next();
DeleteRequestInfo deleteRequestInfo = deleteRequestInfoEntry.getValue();
if (time.milliseconds() - deleteRequestInfo.startTimeMs > routerConfig.routerRequestTimeoutMs) {
itr.remove();
logger.trace("Delete Request with correlationid {} in flight has expired for replica {} ",
deleteRequestInfoEntry.getKey(), deleteRequestInfo.replica.getDataNodeId());
// Do not notify this as a failure to the response handler, as this timeout could simply be due to
// connection unavailability. If there is indeed a network error, the NetworkClient will provide an error
// response and the response handler will be notified accordingly.
updateOperationState(deleteRequestInfo.replica, RouterErrorCode.OperationTimedOut);
}
}
}
/**
* Processes {@link ServerErrorCode} received from {@code replica}. This method maps a {@link ServerErrorCode} | void function() { Iterator<Map.Entry<Integer, DeleteRequestInfo>> itr = deleteRequestInfos.entrySet().iterator(); while (itr.hasNext()) { Map.Entry<Integer, DeleteRequestInfo> deleteRequestInfoEntry = itr.next(); DeleteRequestInfo deleteRequestInfo = deleteRequestInfoEntry.getValue(); if (time.milliseconds() - deleteRequestInfo.startTimeMs > routerConfig.routerRequestTimeoutMs) { itr.remove(); logger.trace(STR, deleteRequestInfoEntry.getKey(), deleteRequestInfo.replica.getDataNodeId()); updateOperationState(deleteRequestInfo.replica, RouterErrorCode.OperationTimedOut); } } } /** * Processes {@link ServerErrorCode} received from {@code replica}. This method maps a {@link ServerErrorCode} | /**
* Goes through the inflight request list of this {@code DeleteOperation} and remove those that
* have been timed out.
*/ | Goes through the inflight request list of this DeleteOperation and remove those that have been timed out | cleanupExpiredInflightRequests | {
"repo_name": "pnarayanan/ambry",
"path": "ambry-router/src/main/java/com.github.ambry.router/DeleteOperation.java",
"license": "apache-2.0",
"size": 18606
} | [
"com.github.ambry.commons.ServerErrorCode",
"java.util.Iterator",
"java.util.Map"
] | import com.github.ambry.commons.ServerErrorCode; import java.util.Iterator; import java.util.Map; | import com.github.ambry.commons.*; import java.util.*; | [
"com.github.ambry",
"java.util"
] | com.github.ambry; java.util; | 1,415,145 |
Map<TypeDescription, Class<?>> load(T classLoader, Map<TypeDescription, byte[]> types);
enum Default implements Configurable<ClassLoader> {
WRAPPER(new WrappingDispatcher(ByteArrayClassLoader.PersistenceHandler.LATENT, WrappingDispatcher.PARENT_FIRST)),
WRAPPER_PERSISTENT(new WrappingDispatcher(ByteArrayClassLoader.PersistenceHandler.MANIFEST, WrappingDispatcher.PARENT_FIRST)),
CHILD_FIRST(new WrappingDispatcher(ByteArrayClassLoader.PersistenceHandler.LATENT, WrappingDispatcher.CHILD_FIRST)),
CHILD_FIRST_PERSISTENT(new WrappingDispatcher(ByteArrayClassLoader.PersistenceHandler.MANIFEST, WrappingDispatcher.CHILD_FIRST)),
INJECTION(new InjectionDispatcher());
private static final boolean DEFAULT_FORBID_EXISTING = true;
private final Configurable<ClassLoader> dispatcher;
Default(Configurable<ClassLoader> dispatcher) {
this.dispatcher = dispatcher;
}
/**
* {@inheritDoc} | Map<TypeDescription, Class<?>> load(T classLoader, Map<TypeDescription, byte[]> types); enum Default implements Configurable<ClassLoader> { WRAPPER(new WrappingDispatcher(ByteArrayClassLoader.PersistenceHandler.LATENT, WrappingDispatcher.PARENT_FIRST)), WRAPPER_PERSISTENT(new WrappingDispatcher(ByteArrayClassLoader.PersistenceHandler.MANIFEST, WrappingDispatcher.PARENT_FIRST)), CHILD_FIRST(new WrappingDispatcher(ByteArrayClassLoader.PersistenceHandler.LATENT, WrappingDispatcher.CHILD_FIRST)), CHILD_FIRST_PERSISTENT(new WrappingDispatcher(ByteArrayClassLoader.PersistenceHandler.MANIFEST, WrappingDispatcher.CHILD_FIRST)), INJECTION(new InjectionDispatcher()); private static final boolean DEFAULT_FORBID_EXISTING = true; private final Configurable<ClassLoader> dispatcher; Default(Configurable<ClassLoader> dispatcher) { this.dispatcher = dispatcher; } /** * {@inheritDoc} | /**
* Loads a given collection of classes given their binary representation.
*
* @param classLoader The class loader to used for loading the classes.
* @param types Byte array representations of the types to be loaded mapped by their descriptions,
* where an iteration order defines an order in which they are supposed to be loaded,
* if relevant.
* @return A collection of the loaded classes which will be initialized in the iteration order of the
* returned collection.
*/ | Loads a given collection of classes given their binary representation | load | {
"repo_name": "DALDEI/byte-buddy",
"path": "byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassLoadingStrategy.java",
"license": "apache-2.0",
"size": 23480
} | [
"java.util.Map",
"net.bytebuddy.description.type.TypeDescription"
] | import java.util.Map; import net.bytebuddy.description.type.TypeDescription; | import java.util.*; import net.bytebuddy.description.type.*; | [
"java.util",
"net.bytebuddy.description"
] | java.util; net.bytebuddy.description; | 2,304,504 |
public TeamMemberInfo start() throws MembersSetProfileException, DbxException
{
MembersSetProfileArg arg = new MembersSetProfileArg(user, newEmail, newExternalId, newGivenName, newSurname);
return DbxTeam.this.membersSetProfile(arg);
}
}
/**
* Updates a team member's profile. Permission : Team member management
*
* @param user Identity of user whose profile will be set. {@code user} | TeamMemberInfo function() throws MembersSetProfileException, DbxException { MembersSetProfileArg arg = new MembersSetProfileArg(user, newEmail, newExternalId, newGivenName, newSurname); return DbxTeam.this.membersSetProfile(arg); } } /** * Updates a team member's profile. Permission : Team member management * * @param user Identity of user whose profile will be set. {@code user} | /**
* Issues the request.
*/ | Issues the request | start | {
"repo_name": "hunchee/dropbox-sdk-java",
"path": "src/com/dropbox/core/v2/DbxTeam.java",
"license": "mit",
"size": 1014346
} | [
"com.dropbox.core.DbxException"
] | import com.dropbox.core.DbxException; | import com.dropbox.core.*; | [
"com.dropbox.core"
] | com.dropbox.core; | 987,633 |
public static byte[] rename(String dottedNewName, byte[] classbytes, String... retargets) {
ClassReader fileReader = new ClassReader(classbytes);
RenameAdapter renameAdapter = new RenameAdapter(dottedNewName, retargets);
fileReader.accept(renameAdapter, 0);
byte[] renamed = renameAdapter.getBytes();
return renamed;
}
static class RenameAdapter extends ClassVisitor implements Opcodes {
private ClassWriter cw;
private String oldname;
private String newname;
private Map<String, String> retargets = new HashMap<String, String>();
public RenameAdapter(String newname, String[] retargets) {
super(ASM5, new ClassWriter(0));
cw = (ClassWriter) cv;
this.newname = newname.replace('.', '/');
if (retargets != null) {
for (String retarget : retargets) {
int i = retarget.indexOf(":");
this.retargets.put(retarget.substring(0, i).replace('.', '/'),
retarget.substring(i + 1).replace('.', '/'));
}
}
} | static byte[] function(String dottedNewName, byte[] classbytes, String... retargets) { ClassReader fileReader = new ClassReader(classbytes); RenameAdapter renameAdapter = new RenameAdapter(dottedNewName, retargets); fileReader.accept(renameAdapter, 0); byte[] renamed = renameAdapter.getBytes(); return renamed; } static class RenameAdapter extends ClassVisitor implements Opcodes { private ClassWriter cw; private String oldname; private String newname; private Map<String, String> retargets = new HashMap<String, String>(); public RenameAdapter(String newname, String[] retargets) { super(ASM5, new ClassWriter(0)); cw = (ClassWriter) cv; this.newname = newname.replace('.', '/'); if (retargets != null) { for (String retarget : retargets) { int i = retarget.indexOf(":"); this.retargets.put(retarget.substring(0, i).replace('.', '/'), retarget.substring(i + 1).replace('.', '/')); } } } | /**
* Rename a type - changing it to specified new name (which should be the dotted form of the name). Retargets are an
* optional sequence of retargets to also perform during the rename. Retargets take the form of "a.b:a.c" which will
* change all references to a.b to a.c.
*
* @param dottedNewName dotted name, e.g. com.foo.Bar
* @param classbytes the bytecode for the class to be renamed
* @param retargets retarget rules for references, of the form "a.b:b.a","c.d:d.c"
* @return bytecode for the modified class
*/ | Rename a type - changing it to specified new name (which should be the dotted form of the name). Retargets are an optional sequence of retargets to also perform during the rename. Retargets take the form of "a.b:a.c" which will change all references to a.b to a.c | rename | {
"repo_name": "drunklite/spring-loaded",
"path": "springloaded/src/main/java/org/springsource/loaded/ClassRenamer.java",
"license": "apache-2.0",
"size": 9751
} | [
"java.util.HashMap",
"java.util.Map",
"org.objectweb.asm.ClassReader",
"org.objectweb.asm.ClassVisitor",
"org.objectweb.asm.ClassWriter",
"org.objectweb.asm.Opcodes"
] | import java.util.HashMap; import java.util.Map; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; | import java.util.*; import org.objectweb.asm.*; | [
"java.util",
"org.objectweb.asm"
] | java.util; org.objectweb.asm; | 2,079,882 |
static boolean isPossibleFP(String val) {
final int length = val.length();
for (int i = 0; i < length; ++i) {
char c = val.charAt(i);
if (!(c >= '0' && c <= '9' || c == '.' ||
c == '-' || c == '+' || c == 'E' || c == 'e')) {
return false;
}
}
return true;
}
private static final class XDouble implements XSDouble {
private double value;
public XDouble(String s) throws NumberFormatException {
if (isPossibleFP(s)) {
value = Double.parseDouble(s);
}
else if ( s.equals("INF") ) {
value = Double.POSITIVE_INFINITY;
}
else if ( s.equals("-INF") ) {
value = Double.NEGATIVE_INFINITY;
}
else if ( s.equals("NaN" ) ) {
value = Double.NaN;
}
else {
throw new NumberFormatException(s);
}
} | static boolean isPossibleFP(String val) { final int length = val.length(); for (int i = 0; i < length; ++i) { char c = val.charAt(i); if (!(c >= '0' && c <= '9' c == '.' c == '-' c == '+' c == 'E' c == 'e')) { return false; } } return true; } private static final class XDouble implements XSDouble { private double value; public XDouble(String s) throws NumberFormatException { if (isPossibleFP(s)) { value = Double.parseDouble(s); } else if ( s.equals("INF") ) { value = Double.POSITIVE_INFINITY; } else if ( s.equals("-INF") ) { value = Double.NEGATIVE_INFINITY; } else if ( s.equals("NaN" ) ) { value = Double.NaN; } else { throw new NumberFormatException(s); } } | /**
* Returns true if it's possible that the given
* string represents a valid floating point value
* (excluding NaN, INF and -INF).
*/ | Returns true if it's possible that the given string represents a valid floating point value (excluding NaN, INF and -INF) | isPossibleFP | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jaxp/drop_included/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/dv/xs/DoubleDV.java",
"license": "gpl-2.0",
"size": 9650
} | [
"com.sun.org.apache.xerces.internal.xs.datatypes.XSDouble"
] | import com.sun.org.apache.xerces.internal.xs.datatypes.XSDouble; | import com.sun.org.apache.xerces.internal.xs.datatypes.*; | [
"com.sun.org"
] | com.sun.org; | 2,637,155 |
public Timestamp getUpdated();
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; | Timestamp function(); public static final String COLUMNNAME_UpdatedBy = STR; | /** Get Updated.
* Date this record was updated
*/ | Get Updated. Date this record was updated | getUpdated | {
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/model/I_PA_Report.java",
"license": "gpl-2.0",
"size": 8677
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 20,454 |
public ServerListResult withValue(List<ServerInner> value) {
this.value = value;
return this;
} | ServerListResult function(List<ServerInner> value) { this.value = value; return this; } | /**
* Set the value property: The list of flexible servers.
*
* @param value the value value to set.
* @return the ServerListResult object itself.
*/ | Set the value property: The list of flexible servers | withValue | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerListResult.java",
"license": "mit",
"size": 2247
} | [
"com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner",
"java.util.List"
] | import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; import java.util.List; | import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.*; import java.util.*; | [
"com.azure.resourcemanager",
"java.util"
] | com.azure.resourcemanager; java.util; | 1,789,480 |
public List<ConfigurationStep> undo(ConfigurationStep step) throws ConfigurationEngineException {
return undo(steps.indexOf(step)+1);
}
| List<ConfigurationStep> function(ConfigurationStep step) throws ConfigurationEngineException { return undo(steps.indexOf(step)+1); } | /******************************************************************************************************
* UNDO - 2
*******************************************************************************************************/ | UNDO - 2 | undo | {
"repo_name": "SINTEF-9012/SPLCATool",
"path": "SPLAR/src/splar/core/fm/configuration/ConfigurationEngine.java",
"license": "epl-1.0",
"size": 11502
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,823,642 |
@Generated
@Selector("gain")
public native double gain(); | @Selector("gain") native double function(); | /**
* [@property] gain
* <p>
* Linear gain scalar.
* [@note]
* Values are clamped to the range [0, 1]. Default value is 1.
*/ | [@property] gain Linear gain scalar. [@note] Values are clamped to the range [0, 1]. Default value is 1 | gain | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/phase/PHASESource.java",
"license": "apache-2.0",
"size": 5962
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 1,438,846 |
protected String signatureToLongString(final Signature sig) {
String signatureString = this.signatureCache.get(sig);
if (null != signatureString) {
return signatureString;
} else {
if (sig instanceof MethodSignature) {
final MethodSignature signature = (MethodSignature) sig;
final StringBuilder sb = new StringBuilder(256);
// modifiers
final String modString = Modifier.toString(signature.getModifiers());
sb.append(modString);
if (modString.length() > 0) {
sb.append(' ');
}
// return
this.addType(sb, signature.getReturnType());
sb.append(' ')
.append(signature.getDeclaringTypeName()) // component
.append('.')
.append(signature.getName()) // name
.append('(');
// parameters
this.addTypeList(sb, signature.getParameterTypes());
sb.append(')');
// throws
// this.addTypeList(sb, signature.getExceptionTypes());
signatureString = sb.toString();
} else if (sig instanceof ConstructorSignature) {
final ConstructorSignature signature = (ConstructorSignature) sig;
final StringBuilder sb = new StringBuilder(256);
// modifiers
final String modString = Modifier.toString(signature.getModifiers());
sb.append(modString);
if (modString.length() > 0) {
sb.append(' ');
}
// component
sb.append(signature.getDeclaringTypeName())
.append('.')
.append(signature.getName())// name
.append('(');
// parameters
this.addTypeList(sb, signature.getParameterTypes());
sb.append(')');
// throws
// this.addTypeList(sb, signature.getExceptionTypes());
signatureString = sb.toString();
} else {
signatureString = sig.toLongString();
}
}
this.signatureCache.putIfAbsent(sig, signatureString);
return signatureString;
} | String function(final Signature sig) { String signatureString = this.signatureCache.get(sig); if (null != signatureString) { return signatureString; } else { if (sig instanceof MethodSignature) { final MethodSignature signature = (MethodSignature) sig; final StringBuilder sb = new StringBuilder(256); final String modString = Modifier.toString(signature.getModifiers()); sb.append(modString); if (modString.length() > 0) { sb.append(' '); } this.addType(sb, signature.getReturnType()); sb.append(' ') .append(signature.getDeclaringTypeName()) .append('.') .append(signature.getName()) .append('('); this.addTypeList(sb, signature.getParameterTypes()); sb.append(')'); signatureString = sb.toString(); } else if (sig instanceof ConstructorSignature) { final ConstructorSignature signature = (ConstructorSignature) sig; final StringBuilder sb = new StringBuilder(256); final String modString = Modifier.toString(signature.getModifiers()); sb.append(modString); if (modString.length() > 0) { sb.append(' '); } sb.append(signature.getDeclaringTypeName()) .append('.') .append(signature.getName()) .append('('); this.addTypeList(sb, signature.getParameterTypes()); sb.append(')'); signatureString = sb.toString(); } else { signatureString = sig.toLongString(); } } this.signatureCache.putIfAbsent(sig, signatureString); return signatureString; } | /**
* Better handling of AspectJ Signature.toLongString (especially with constructors).
*
* @param sig
* an AspectJ Signature
* @return LongString representation of the signature
*/ | Better handling of AspectJ Signature.toLongString (especially with constructors) | signatureToLongString | {
"repo_name": "kieker-monitoring/kieker",
"path": "kieker-monitoring/src/kieker/monitoring/probe/aspectj/AbstractAspectJProbe.java",
"license": "apache-2.0",
"size": 5285
} | [
"java.lang.reflect.Modifier",
"org.aspectj.lang.Signature",
"org.aspectj.lang.reflect.ConstructorSignature",
"org.aspectj.lang.reflect.MethodSignature"
] | import java.lang.reflect.Modifier; import org.aspectj.lang.Signature; import org.aspectj.lang.reflect.ConstructorSignature; import org.aspectj.lang.reflect.MethodSignature; | import java.lang.reflect.*; import org.aspectj.lang.*; import org.aspectj.lang.reflect.*; | [
"java.lang",
"org.aspectj.lang"
] | java.lang; org.aspectj.lang; | 2,376,821 |
protected int getMaximumNumberOfErrorsAllowed() {
String maxBenefitGenerationErrorsStr = parameterService.getParameterValueAsString(LaborEnterpriseFeedStep.class,
LaborConstants.BenefitCalculation.MAX_NUMBER_OF_ERRORS_ALLOWED_PARAMETER);
int maxBenefitGenerationErrors = 0;
if (StringUtils.isNumeric(maxBenefitGenerationErrorsStr)) {
maxBenefitGenerationErrors = Integer.parseInt(maxBenefitGenerationErrorsStr);
}
return maxBenefitGenerationErrors;
} | int function() { String maxBenefitGenerationErrorsStr = parameterService.getParameterValueAsString(LaborEnterpriseFeedStep.class, LaborConstants.BenefitCalculation.MAX_NUMBER_OF_ERRORS_ALLOWED_PARAMETER); int maxBenefitGenerationErrors = 0; if (StringUtils.isNumeric(maxBenefitGenerationErrorsStr)) { maxBenefitGenerationErrors = Integer.parseInt(maxBenefitGenerationErrorsStr); } return maxBenefitGenerationErrors; } | /**
* Retrieves the system parameter value that indicates the maximum number of
* errors that are allowed to occur in benefit generation
*
* @return int max number of errors
*/ | Retrieves the system parameter value that indicates the maximum number of errors that are allowed to occur in benefit generation | getMaximumNumberOfErrorsAllowed | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-ld/src/main/java/org/kuali/kfs/module/ld/batch/service/impl/FileEnterpriseFeederServiceImpl.java",
"license": "agpl-3.0",
"size": 20863
} | [
"org.apache.commons.lang.StringUtils",
"org.kuali.kfs.module.ld.LaborConstants",
"org.kuali.kfs.module.ld.batch.LaborEnterpriseFeedStep"
] | import org.apache.commons.lang.StringUtils; import org.kuali.kfs.module.ld.LaborConstants; import org.kuali.kfs.module.ld.batch.LaborEnterpriseFeedStep; | import org.apache.commons.lang.*; import org.kuali.kfs.module.ld.*; import org.kuali.kfs.module.ld.batch.*; | [
"org.apache.commons",
"org.kuali.kfs"
] | org.apache.commons; org.kuali.kfs; | 849,797 |
Calendar calendar = CALENDAR;
synchronized(calendar) {
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MILLISECOND, 999);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MINUTE, 59);
return calendar.getTime();
}
} | Calendar calendar = CALENDAR; synchronized(calendar) { calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MILLISECOND, 999); calendar.set(Calendar.SECOND, 59); calendar.set(Calendar.MINUTE, 59); return calendar.getTime(); } } | /**
* Returns the last millisecond of the specified date.
*
* @param date Date to calculate end of day from
* @return Last millisecond of <code>date</code>
*/ | Returns the last millisecond of the specified date | endOfDay | {
"repo_name": "charlycoste/TreeD",
"path": "src/org/jdesktop/swingx/calendar/DateUtils.java",
"license": "gpl-2.0",
"size": 12585
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 1,388,841 |
public void subscribe(String[] topics, byte[] qoss) {
// Ensure the subscribedTopics isn't null
if (subscribedTopics == null)
subscribedTopics = new HashSet<>();
for(int i = 0; i < topics.length; i++) {
HashSet<String> newTopics = new HashSet<>();
if(!subscribedTopics.contains(topics[i])) {
newTopics.add(topics[i]);
}
topics = newTopics.toArray(new String[0]);
}
if(topics.length == 0) {
return;
}
int id = mMqttIdentifierHelper.getIdentifier();
MQTTSubscribe subscribe = MQTTSubscribe.newInstance(topics, qoss, id);
sendMessage(subscribe);
subscribedTopics.addAll(Arrays.asList(topics));
mMqttIdentifierHelper.addSentPackage(subscribe);
}
// public synchronized void start() {
// if (DEBUG)
// Log.d(TAG, "start");
//
// // Cancel any thread attempting to make a connection
// if (mConnectThread != null) {
// mConnectThread.cancel();
// mConnectThread = null;
// }
//
// // Cancel any thread currently running a connection
// if (mConnectedThread != null) {
// mConnectedThread.cancel();
// mConnectedThread = null;
// }
//
// setState(STATE_NONE);
//
// // if (host != null)
// // connect(host, port);
// } | void function(String[] topics, byte[] qoss) { if (subscribedTopics == null) subscribedTopics = new HashSet<>(); for(int i = 0; i < topics.length; i++) { HashSet<String> newTopics = new HashSet<>(); if(!subscribedTopics.contains(topics[i])) { newTopics.add(topics[i]); } topics = newTopics.toArray(new String[0]); } if(topics.length == 0) { return; } int id = mMqttIdentifierHelper.getIdentifier(); MQTTSubscribe subscribe = MQTTSubscribe.newInstance(topics, qoss, id); sendMessage(subscribe); subscribedTopics.addAll(Arrays.asList(topics)); mMqttIdentifierHelper.addSentPackage(subscribe); } | /**
* Subscribe to multiple topics
*
* @param topics Topic to subscribe to
* @param qoss Quality of service, can be {@link se.wetcat.qatja.MQTTConstants#AT_MOST_ONCE},
* {@link se.wetcat.qatja.MQTTConstants#AT_LEAST_ONCE}, or
* {@link se.wetcat.qatja.MQTTConstants#EXACTLY_ONCE}.
*/ | Subscribe to multiple topics | subscribe | {
"repo_name": "Qatja/android",
"path": "qatja-android/src/main/java/se/wetcat/qatja/android/QatjaService.java",
"license": "apache-2.0",
"size": 35522
} | [
"java.util.Arrays",
"java.util.HashSet",
"se.wetcat.qatja.messages.MQTTSubscribe"
] | import java.util.Arrays; import java.util.HashSet; import se.wetcat.qatja.messages.MQTTSubscribe; | import java.util.*; import se.wetcat.qatja.messages.*; | [
"java.util",
"se.wetcat.qatja"
] | java.util; se.wetcat.qatja; | 550,167 |
public T1 caseENumericResourceDef(ENumericResourceDef object) {
return null;
} | T1 function(ENumericResourceDef object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>ENumeric Resource Def</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>ENumeric Resource Def</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'ENumeric Resource Def'. This implementation returns null; returning a non-null result will terminate the switch. | caseENumericResourceDef | {
"repo_name": "nasa/OpenSPIFe",
"path": "gov.nasa.ensemble.dictionary/src/gov/nasa/ensemble/dictionary/util/DictionarySwitch.java",
"license": "apache-2.0",
"size": 46564
} | [
"gov.nasa.ensemble.dictionary.ENumericResourceDef"
] | import gov.nasa.ensemble.dictionary.ENumericResourceDef; | import gov.nasa.ensemble.dictionary.*; | [
"gov.nasa.ensemble"
] | gov.nasa.ensemble; | 2,612,986 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<DdosProtectionPlanInner> createOrUpdateAsync(
String resourceGroupName, String ddosProtectionPlanName, DdosProtectionPlanInner parameters) {
return beginCreateOrUpdateAsync(resourceGroupName, ddosProtectionPlanName, parameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<DdosProtectionPlanInner> function( String resourceGroupName, String ddosProtectionPlanName, DdosProtectionPlanInner parameters) { return beginCreateOrUpdateAsync(resourceGroupName, ddosProtectionPlanName, parameters) .last() .flatMap(this.client::getLroFinalResultOrError); } | /**
* Creates or updates a DDoS protection plan.
*
* @param resourceGroupName The name of the resource group.
* @param ddosProtectionPlanName The name of the DDoS protection plan.
* @param parameters Parameters supplied to the create or update operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a DDoS protection plan in a resource group on successful completion of {@link Mono}.
*/ | Creates or updates a DDoS protection plan | createOrUpdateAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/DdosProtectionPlansClientImpl.java",
"license": "mit",
"size": 73865
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.network.fluent.models.DdosProtectionPlanInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.network.fluent.models.DdosProtectionPlanInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.network.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,399,607 |
void setTempDirectory(File tempDirectory); | void setTempDirectory(File tempDirectory); | /**
* Set the temporary directory used to deploy applications.
*
* @param tempDirectory
* File
*/ | Set the temporary directory used to deploy applications | setTempDirectory | {
"repo_name": "teknux-org/jetty-bootstrap",
"path": "jetty-bootstrap/src/main/java/org/teknux/jettybootstrap/configuration/IJettyConfiguration.java",
"license": "apache-2.0",
"size": 13453
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,086,800 |
@Test
public void testEncodeUriBlankCharsetType(){
assertEquals(PATH, URIUtil.encodeUri(PATH, " "));
} | void function(){ assertEquals(PATH, URIUtil.encodeUri(PATH, " ")); } | /**
* Test encode uri blank charset type.
*/ | Test encode uri blank charset type | testEncodeUriBlankCharsetType | {
"repo_name": "venusdrogon/feilong-core",
"path": "src/test/java/com/feilong/core/net/uriutiltest/EncodeUriTest.java",
"license": "apache-2.0",
"size": 3077
} | [
"com.feilong.core.net.URIUtil",
"org.junit.Assert"
] | import com.feilong.core.net.URIUtil; import org.junit.Assert; | import com.feilong.core.net.*; import org.junit.*; | [
"com.feilong.core",
"org.junit"
] | com.feilong.core; org.junit; | 1,054,075 |
public void testGetRoutedConnection_with_a_null_partition() throws Exception {
RoutingDataSourceConfiguration config = new RoutingDataSourceConfiguration();
config.setProperty("url", "jdbc:hsqldb:mem:core");
config.setProperty("username", "sa");
config.setProperty("password", "");
config.setPartitioningCriteria(new MockPartitioningCriteria());
RoutingDataSource rds = new RoutingDataSource(config);
Connection con = null;
PreparedStatement pStmt = null;
//
// With a null partition the default datasource must be always used
//
boolean partitionOK = true;
try {
con = rds.getRoutedConnection(null);
pStmt = con.prepareStatement("select * from core;");
pStmt.execute();
} catch (Exception e) {
e.printStackTrace();
partitionOK = false;
} finally {
DBTools.close(con, pStmt, null);
}
assertTrue(partitionOK);
} | void function() throws Exception { RoutingDataSourceConfiguration config = new RoutingDataSourceConfiguration(); config.setProperty("url", STR); config.setProperty(STR, "sa"); config.setProperty(STR, STRselect * from core;"); pStmt.execute(); } catch (Exception e) { e.printStackTrace(); partitionOK = false; } finally { DBTools.close(con, pStmt, null); } assertTrue(partitionOK); } | /**
* Test of getRoutedConnection method, of class RoutingDataSource.
*/ | Test of getRoutedConnection method, of class RoutingDataSource | testGetRoutedConnection_with_a_null_partition | {
"repo_name": "accesstest3/cfunambol",
"path": "common/server-framework/src/test/java/com/funambol/server/db/RoutingDataSourceTest.java",
"license": "agpl-3.0",
"size": 14564
} | [
"com.funambol.framework.tools.DBTools"
] | import com.funambol.framework.tools.DBTools; | import com.funambol.framework.tools.*; | [
"com.funambol.framework"
] | com.funambol.framework; | 2,658,821 |
public QName toQName() {
return new QName(nsUri,localName);
} | QName function() { return new QName(nsUri,localName); } | /**
* Creates a {@link QName} from this.
*/ | Creates a <code>QName</code> from this | toQName | {
"repo_name": "GeeQuery/cxf-plus",
"path": "src/main/java/com/github/cxfplus/com/sun/xml/bind/v2/runtime/Name.java",
"license": "apache-2.0",
"size": 3881
} | [
"javax.xml.namespace.QName"
] | import javax.xml.namespace.QName; | import javax.xml.namespace.*; | [
"javax.xml"
] | javax.xml; | 2,418,214 |
public Optional<String> getRepositoryURL() {
return Optional.fromNullable(remoteURI);
}
/**
* @param username user name for the repository
* @return {@code this} | Optional<String> function() { return Optional.fromNullable(remoteURI); } /** * @param username user name for the repository * @return {@code this} | /**
* Get the repository URL to be cloned
*/ | Get the repository URL to be cloned | getRepositoryURL | {
"repo_name": "jdgarrett/geogig",
"path": "src/core/src/main/java/org/locationtech/geogig/porcelain/CloneOp.java",
"license": "bsd-3-clause",
"size": 7971
} | [
"com.google.common.base.Optional"
] | import com.google.common.base.Optional; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,674,047 |
params.add(new Tuple<String, Tuple<String, String>>(name, new Tuple<String, String>(value, URLEncoder.encode(value, "UTF-8"))));
return this;
} | params.add(new Tuple<String, Tuple<String, String>>(name, new Tuple<String, String>(value, URLEncoder.encode(value, "UTF-8")))); return this; } | /**
* Appends a parameter to the query
*
* @param name Parameter name
* @param value Parameter value
* @throws java.io.UnsupportedEncodingException If the provided value cannot be URL Encoded
*/ | Appends a parameter to the query | append | {
"repo_name": "edgehosting/jira-dvcs-connector",
"path": "jira-dvcs-connector-gitlab/src/main/java/org/gitlab/api/http/Query.java",
"license": "bsd-2-clause",
"size": 3213
} | [
"java.net.URLEncoder"
] | import java.net.URLEncoder; | import java.net.*; | [
"java.net"
] | java.net; | 1,298,260 |
@Test(expected = IllegalArgumentException.class)
public void testLoadResourceErrorPropertyNotFound() throws Exception
{
Resource resource;
resource = new ClassPathResource(Q_NAME_FILE_ERROR_PROP_ERROR);
registry.loadFromResource(resource);
} | @Test(expected = IllegalArgumentException.class) void function() throws Exception { Resource resource; resource = new ClassPathResource(Q_NAME_FILE_ERROR_PROP_ERROR); registry.loadFromResource(resource); } | /**
* Test {@link SetRegistryDefaultImpl#loadFromResource(org.springframework.core.io.Resource)} with undefined
* properties.
*/ | Test <code>SetRegistryDefaultImpl#loadFromResource(org.springframework.core.io.Resource)</code> with undefined properties | testLoadResourceErrorPropertyNotFound | {
"repo_name": "albirar/framework",
"path": "core/src/test/java/cat/albirar/framework/sets/registry/impl/SetRegistryDefaultImplTest.java",
"license": "gpl-3.0",
"size": 19918
} | [
"org.junit.Test",
"org.springframework.core.io.ClassPathResource",
"org.springframework.core.io.Resource"
] | import org.junit.Test; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; | import org.junit.*; import org.springframework.core.io.*; | [
"org.junit",
"org.springframework.core"
] | org.junit; org.springframework.core; | 1,738,585 |
void onMarksDone(Set<T> aSucceeded, Set<T> aErrors);
}
private final ICallback<T> pCallback;
private boolean pCalled;
private final Set<T> pElements;
private final Set<T> pErrors = new LinkedHashSet<>();
private final LogService pLogger;
private final Set<T> pSuccesses = new LinkedHashSet<>();
public MarksCallback(final Collection<T> aElements,
final ICallback<T> aCallback, final LogService aLogger) {
pElements = new LinkedHashSet<>(aElements);
pCallback = aCallback;
pLogger = aLogger;
} | void onMarksDone(Set<T> aSucceeded, Set<T> aErrors); } private final ICallback<T> pCallback; private boolean pCalled; private final Set<T> pElements; private final Set<T> pErrors = new LinkedHashSet<>(); private final LogService pLogger; private final Set<T> pSuccesses = new LinkedHashSet<>(); public MarksCallback(final Collection<T> aElements, final ICallback<T> aCallback, final LogService aLogger) { pElements = new LinkedHashSet<>(aElements); pCallback = aCallback; pLogger = aLogger; } | /**
* Method call when all elements have been marked
*
* @param aSucceeded
* The list of succeeded elements
* @param aErrors
* The list of elements marked with an error
*/ | Method call when all elements have been marked | onMarksDone | {
"repo_name": "isandlaTech/cohorte-herald",
"path": "java/org.cohorte.herald.xmpp/src/org/cohorte/herald/xmpp/impl/MarksCallback.java",
"license": "apache-2.0",
"size": 4696
} | [
"java.util.Collection",
"java.util.LinkedHashSet",
"java.util.Set",
"org.osgi.service.log.LogService"
] | import java.util.Collection; import java.util.LinkedHashSet; import java.util.Set; import org.osgi.service.log.LogService; | import java.util.*; import org.osgi.service.log.*; | [
"java.util",
"org.osgi.service"
] | java.util; org.osgi.service; | 2,526,707 |
public Observable<ServiceResponse<FirewallPolicyInner>> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (firewallPolicyName == null) {
throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
} | Observable<ServiceResponse<FirewallPolicyInner>> function(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (firewallPolicyName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (parameters == null) { throw new IllegalArgumentException(STR); } | /**
* Creates or updates the specified Firewall Policy.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param parameters Parameters supplied to the create or update Firewall Policy operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the FirewallPolicyInner object
*/ | Creates or updates the specified Firewall Policy | beginCreateOrUpdateWithServiceResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/network/v2019_08_01/implementation/FirewallPoliciesInner.java",
"license": "mit",
"size": 69669
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 278,435 |
@NotNull
PsiStatement createStatementFromText(@NotNull @NonNls String text, PsiElement context) throws IncorrectOperationException; | PsiStatement createStatementFromText(@NotNull @NonNls String text, PsiElement context) throws IncorrectOperationException; | /**
* Creates a Java statement from the specified text.
*
* @param text the text of the statement to create.
* @param context the PSI element used as context for resolving references from the statement.
* @return the created statement instance.
* @throws com.intellij.util.IncorrectOperationException if the text does not specify a valid statement.
*/ | Creates a Java statement from the specified text | createStatementFromText | {
"repo_name": "jexp/idea2",
"path": "java/openapi/src/com/intellij/psi/PsiJavaParserFacade.java",
"license": "apache-2.0",
"size": 9079
} | [
"com.intellij.util.IncorrectOperationException",
"org.jetbrains.annotations.NonNls",
"org.jetbrains.annotations.NotNull"
] | import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; | import com.intellij.util.*; import org.jetbrains.annotations.*; | [
"com.intellij.util",
"org.jetbrains.annotations"
] | com.intellij.util; org.jetbrains.annotations; | 2,566,849 |
@Test
public void testSetAuthId() {
System.out.println("setAuthId");
String origAuthId = instance.getAuthId();
String authId = "newAuthId";
instance.setAuthId(authId);
assertEquals(instance.getAuthId(), authId);
instance.setAuthId(origAuthId);
} | void function() { System.out.println(STR); String origAuthId = instance.getAuthId(); String authId = STR; instance.setAuthId(authId); assertEquals(instance.getAuthId(), authId); instance.setAuthId(origAuthId); } | /**
* Test of setAuthId method, of class AuthAccess.
*/ | Test of setAuthId method, of class AuthAccess | testSetAuthId | {
"repo_name": "UCL/EIDP-4",
"path": "eidpauth/src/test/java/uk/ac/ucl/eidp/auth/AuthAccessNgTest.java",
"license": "apache-2.0",
"size": 2809
} | [
"org.testng.Assert"
] | import org.testng.Assert; | import org.testng.*; | [
"org.testng"
] | org.testng; | 599,361 |
public boolean setValue(PropertyEditor editor, Object value) {
editor.setValue(value);
return true;
} | boolean function(PropertyEditor editor, Object value) { editor.setValue(value); return true; } | /**
* Sets the editor value.
*
* @param editor the editor to update
* @param value the object to set
* @return true if successfully set
*/ | Sets the editor value | setValue | {
"repo_name": "automenta/adams-core",
"path": "src/main/java/adams/gui/goe/AdamsGenericObjectEditorHandler.java",
"license": "gpl-3.0",
"size": 3918
} | [
"java.beans.PropertyEditor"
] | import java.beans.PropertyEditor; | import java.beans.*; | [
"java.beans"
] | java.beans; | 2,335,490 |
public static String loadNativeLibrary( String nativeLibPath, String libName ) {
try {
String name = "las_c";
if (libName == null)
libName = name;
if (nativeLibPath != null) {
NativeLibrary.addSearchPath(libName, nativeLibPath);
}
WRAPPER = (LiblasJNALibrary) Native.loadLibrary(libName, LiblasJNALibrary.class);
} catch (UnsatisfiedLinkError e) {
return e.getLocalizedMessage();
}
return null;
} | static String function( String nativeLibPath, String libName ) { try { String name = "las_c"; if (libName == null) libName = name; if (nativeLibPath != null) { NativeLibrary.addSearchPath(libName, nativeLibPath); } WRAPPER = (LiblasJNALibrary) Native.loadLibrary(libName, LiblasJNALibrary.class); } catch (UnsatisfiedLinkError e) { return e.getLocalizedMessage(); } return null; } | /**
* Loads the native libs creating the native wrapper.
*
* @param nativeLibPath the path to add or <code>null</code>.
* @param libName the lib name or <code>null</code>, in which case "las_c" is used.
* @return <code>null</code>, if the lib could be loaded, the error string else.
*/ | Loads the native libs creating the native wrapper | loadNativeLibrary | {
"repo_name": "silviafranceschi/jgrasstools",
"path": "jgrassgears/src/main/java/org/jgrasstools/gears/io/las/core/liblas/LiblasWrapper.java",
"license": "gpl-3.0",
"size": 2365
} | [
"com.sun.jna.Native",
"com.sun.jna.NativeLibrary"
] | import com.sun.jna.Native; import com.sun.jna.NativeLibrary; | import com.sun.jna.*; | [
"com.sun.jna"
] | com.sun.jna; | 1,613,611 |
public void writeBinary(int value, int numBits) throws IOException {
bitSink.writeBinary(value, numBits);
} | void function(int value, int numBits) throws IOException { bitSink.writeBinary(value, numBits); } | /**
* Writes a certain number of bits to the output stream
*
* @param value The value to write to the output stream, must be smaller than 2<sup>numBits</sup>
* @param numBits The number of bits to be written to the output stream
* @throws java.io.IOException If an underlying IOException occurs while writing to the stream
*/ | Writes a certain number of bits to the output stream | writeBinary | {
"repo_name": "jfim/bitio",
"path": "src/main/java/im/jeanfrancois/bitio/BitOutputStream.java",
"license": "lgpl-3.0",
"size": 4213
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 423,693 |
new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();
} | new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); } | /**
* Tests equality of objects of class StatefulIPv4LspIdentifiersTlv.
*/ | Tests equality of objects of class StatefulIPv4LspIdentifiersTlv | basics | {
"repo_name": "VinodKumarS-Huawei/ietf96yang",
"path": "protocols/pcep/pcepio/src/test/java/org/onosproject/pcepio/types/StatefulIPv4LspIdentifiersTlvTest.java",
"license": "apache-2.0",
"size": 2235
} | [
"com.google.common.testing.EqualsTester"
] | import com.google.common.testing.EqualsTester; | import com.google.common.testing.*; | [
"com.google.common"
] | com.google.common; | 397,415 |
public static void obtainAndCacheToken(final Connection conn,
User user)
throws IOException, InterruptedException {
try {
Token<AuthenticationTokenIdentifier> token = obtainToken(conn, user);
if (token == null) {
throw new IOException("No token returned for user " + user.getName());
}
if (LOG.isDebugEnabled()) {
LOG.debug("Obtained token " + token.getKind().toString() + " for user " +
user.getName());
}
user.addToken(token);
} catch (IOException ioe) {
throw ioe;
} catch (InterruptedException ie) {
throw ie;
} catch (RuntimeException re) {
throw re;
} catch (Exception e) {
throw new UndeclaredThrowableException(e,
"Unexpected exception obtaining token for user " + user.getName());
}
} | static void function(final Connection conn, User user) throws IOException, InterruptedException { try { Token<AuthenticationTokenIdentifier> token = obtainToken(conn, user); if (token == null) { throw new IOException(STR + user.getName()); } if (LOG.isDebugEnabled()) { LOG.debug(STR + token.getKind().toString() + STR + user.getName()); } user.addToken(token); } catch (IOException ioe) { throw ioe; } catch (InterruptedException ie) { throw ie; } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new UndeclaredThrowableException(e, STR + user.getName()); } } | /**
* Obtain an authentication token for the given user and add it to the
* user's credentials.
* @param conn The HBase cluster connection
* @param user The user for whom to obtain the token
* @throws IOException If making a remote call to the authentication service fails
* @throws InterruptedException If executing as the given user is interrupted
*/ | Obtain an authentication token for the given user and add it to the user's credentials | obtainAndCacheToken | {
"repo_name": "Eshcar/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java",
"license": "apache-2.0",
"size": 13148
} | [
"java.io.IOException",
"java.lang.reflect.UndeclaredThrowableException",
"org.apache.hadoop.hbase.client.Connection",
"org.apache.hadoop.hbase.security.User",
"org.apache.hadoop.security.token.Token"
] | import java.io.IOException; import java.lang.reflect.UndeclaredThrowableException; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.security.token.Token; | import java.io.*; import java.lang.reflect.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.security.*; import org.apache.hadoop.security.token.*; | [
"java.io",
"java.lang",
"org.apache.hadoop"
] | java.io; java.lang; org.apache.hadoop; | 841,889 |
public float computeNearestApproachPositions(Agent agent, float time) {
Vector3f agentVelocity = velocity;
Vector3f otherVelocity = agent.getVelocity();
if (agentVelocity == null) {
agentVelocity = new Vector3f();
}
if (otherVelocity == null) {
otherVelocity = new Vector3f();
}
Vector3f myTravel = agentVelocity.mult(time);
Vector3f otherTravel = otherVelocity.mult(time);
return myTravel.distance(otherTravel);
} | float function(Agent agent, float time) { Vector3f agentVelocity = velocity; Vector3f otherVelocity = agent.getVelocity(); if (agentVelocity == null) { agentVelocity = new Vector3f(); } if (otherVelocity == null) { otherVelocity = new Vector3f(); } Vector3f myTravel = agentVelocity.mult(time); Vector3f otherTravel = otherVelocity.mult(time); return myTravel.distance(otherTravel); } | /**
* Given the time until nearest approach (predictNearestApproachTime)
* determine position of each vehicle at that time, and the distance between
* them.
*
* @param agent Other agent
* @param time The time until nearest approach
* @return The time until nearest approach
*
* @see Agent#predictNearestApproachTime(com.jme3.ai.agents.Agent)
*/ | Given the time until nearest approach (predictNearestApproachTime) determine position of each vehicle at that time, and the distance between them | computeNearestApproachPositions | {
"repo_name": "MeFisto94/MonkeyBrains",
"path": "src/com/jme3/ai/agents/Agent.java",
"license": "bsd-3-clause",
"size": 12007
} | [
"com.jme3.math.Vector3f"
] | import com.jme3.math.Vector3f; | import com.jme3.math.*; | [
"com.jme3.math"
] | com.jme3.math; | 510,107 |
public static int getPeriodOfReference(Context context) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
String p = sharedPreferences.getString("report_reference_period", "0");
return Integer.parseInt(p);
}
| static int function(Context context) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); String p = sharedPreferences.getString(STR, "0"); return Integer.parseInt(p); } | /**
* Gets the period of reference (number of Months to display the 2D report) registered on preferences.
* @param context The activity context
* @return The number of months registered as a period of reference to display chart reports or 0 if not configured yet.
*/ | Gets the period of reference (number of Months to display the 2D report) registered on preferences | getPeriodOfReference | {
"repo_name": "kunaldeo/financisto",
"path": "src/ru/orangesoftware/financisto/utils/MyPreferences.java",
"license": "gpl-2.0",
"size": 27678
} | [
"android.content.Context",
"android.content.SharedPreferences",
"android.preference.PreferenceManager"
] | import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; | import android.content.*; import android.preference.*; | [
"android.content",
"android.preference"
] | android.content; android.preference; | 1,188,735 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.