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 OffsetDateTime expirationDate() {
return this.innerProperties() == null ? null : this.innerProperties().expirationDate();
} | OffsetDateTime function() { return this.innerProperties() == null ? null : this.innerProperties().expirationDate(); } | /**
* Get the expirationDate property: The date when the agreement expires.
*
* @return the expirationDate value.
*/ | Get the expirationDate property: The date when the agreement expires | expirationDate | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/AgreementInner.java",
"license": "mit",
"size": 4046
} | [
"java.time.OffsetDateTime"
] | import java.time.OffsetDateTime; | import java.time.*; | [
"java.time"
] | java.time; | 705,995 |
public boolean selectItem(int dataIndex, boolean select) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "selectItem [%d] select [%b]", dataIndex, select);
if (dataIndex < 0 || dataIndex >= mContent.size()) {
throw new IndexOutOfBoundsException("Selection index [" + dataIndex + "] is out of bounds!");
}
updateSelectedItemsList(dataIndex, select);
ListItemHostWidget hostWidget = getHostView(dataIndex, false);
if (hostWidget != null) {
hostWidget.setSelected(select);
hostWidget.requestLayout();
return true;
}
return false;
} | boolean function(int dataIndex, boolean select) { Log.d(Log.SUBSYSTEM.LAYOUT, TAG, STR, dataIndex, select); if (dataIndex < 0 dataIndex >= mContent.size()) { throw new IndexOutOfBoundsException(STR + dataIndex + STR); } updateSelectedItemsList(dataIndex, select); ListItemHostWidget hostWidget = getHostView(dataIndex, false); if (hostWidget != null) { hostWidget.setSelected(select); hostWidget.requestLayout(); return true; } return false; } | /**
* Select or deselect an item at position {@code pos}.
*
* @param dataIndex
* item position in the adapter
* @param select
* operation to perform select or deselect.
* @return {@code true} if the requested operation is successful,
* {@code false} otherwise.
*/ | Select or deselect an item at position pos | selectItem | {
"repo_name": "NolaDonato/GearVRf",
"path": "GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java",
"license": "apache-2.0",
"size": 59214
} | [
"org.gearvrf.widgetlib.log.Log"
] | import org.gearvrf.widgetlib.log.Log; | import org.gearvrf.widgetlib.log.*; | [
"org.gearvrf.widgetlib"
] | org.gearvrf.widgetlib; | 980,178 |
private void configureSigning(final Client clientProxy) {
final WSS4JOutInterceptor wssOut = createSigningInterceptor();
clientProxy.getOutInterceptors().add(wssOut);
final WSS4JInInterceptor wssIn = createValidatingInterceptor();
clientProxy.getInInterceptors().add(wssIn);
clientProxy.getInInterceptors().add(new SignatureFaultInterceptor());
} | void function(final Client clientProxy) { final WSS4JOutInterceptor wssOut = createSigningInterceptor(); clientProxy.getOutInterceptors().add(wssOut); final WSS4JInInterceptor wssIn = createValidatingInterceptor(); clientProxy.getInInterceptors().add(wssIn); clientProxy.getInInterceptors().add(new SignatureFaultInterceptor()); } | /**
* Sign our request with the client key par.
*/ | Sign our request with the client key par | configureSigning | {
"repo_name": "PavelCibulka/eet-client",
"path": "src/main/java/cz/tomasdvorak/eet/client/security/SecureEETCommunication.java",
"license": "mit",
"size": 8262
} | [
"org.apache.cxf.endpoint.Client",
"org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor",
"org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"
] | import org.apache.cxf.endpoint.Client; import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor; import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; | import org.apache.cxf.endpoint.*; import org.apache.cxf.ws.security.wss4j.*; | [
"org.apache.cxf"
] | org.apache.cxf; | 1,991,806 |
private Class extractClass(final Object obj) {
if (obj instanceof Integer) {
return Integer.TYPE;
}
if (obj instanceof Boolean) {
return Boolean.TYPE;
}
if (obj instanceof Float) {
return Float.TYPE;
}
if (obj instanceof Character) {
return Character.TYPE;
}
if (obj instanceof Short) {
return Short.TYPE;
}
if (obj instanceof Long) {
return Long.TYPE;
}
if (obj instanceof Double) {
return Double.TYPE;
}
if (obj instanceof Byte) {
return Byte.TYPE;
}
if (obj instanceof Void) {
return Void.TYPE;
}
if (obj instanceof UIResource) {
return obj.getClass().getSuperclass();
}
return obj.getClass();
}
}
private static final String CREATE_UI_METHOD_NAME = "createUI";
private Locale defaultLocale = Locale.getDefault();
private SwingPropertyChangeSupport propertyChangeSupport = new SwingPropertyChangeSupport(this);
private List resourceBundles = new ArrayList();
public UIDefaults() {
}
public UIDefaults(final Object[] array) {
putDefaults(array);
} | Class function(final Object obj) { if (obj instanceof Integer) { return Integer.TYPE; } if (obj instanceof Boolean) { return Boolean.TYPE; } if (obj instanceof Float) { return Float.TYPE; } if (obj instanceof Character) { return Character.TYPE; } if (obj instanceof Short) { return Short.TYPE; } if (obj instanceof Long) { return Long.TYPE; } if (obj instanceof Double) { return Double.TYPE; } if (obj instanceof Byte) { return Byte.TYPE; } if (obj instanceof Void) { return Void.TYPE; } if (obj instanceof UIResource) { return obj.getClass().getSuperclass(); } return obj.getClass(); } } private static final String CREATE_UI_METHOD_NAME = STR; private Locale defaultLocale = Locale.getDefault(); private SwingPropertyChangeSupport propertyChangeSupport = new SwingPropertyChangeSupport(this); private List resourceBundles = new ArrayList(); public UIDefaults() { } public UIDefaults(final Object[] array) { putDefaults(array); } | /**
* Extract class from the object
* @param Object obj
* @return Class result
*/ | Extract class from the object | extractClass | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/java/classlib/modules/swing/src/main/java/common/javax/swing/UIDefaults.java",
"license": "apache-2.0",
"size": 15074
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Locale",
"javax.swing.event.SwingPropertyChangeSupport",
"javax.swing.plaf.UIResource"
] | import java.util.ArrayList; import java.util.List; import java.util.Locale; import javax.swing.event.SwingPropertyChangeSupport; import javax.swing.plaf.UIResource; | import java.util.*; import javax.swing.event.*; import javax.swing.plaf.*; | [
"java.util",
"javax.swing"
] | java.util; javax.swing; | 1,756,301 |
public static final boolean addLinks(@NonNull Spannable text, @NonNull Pattern pattern,
@Nullable String scheme) {
return addLinks(text, pattern, scheme, null, null, null);
} | static final boolean function(@NonNull Spannable text, @NonNull Pattern pattern, @Nullable String scheme) { return addLinks(text, pattern, scheme, null, null, null); } | /**
* Applies a regex to a Spannable turning the matches into
* links.
*
* @param text Spannable whose text is to be marked-up with links
* @param pattern Regex pattern to be used for finding links
* @param scheme URL scheme string (eg <code>http://</code>) to be
* prepended to the links that do not start with this scheme.
*/ | Applies a regex to a Spannable turning the matches into links | addLinks | {
"repo_name": "xorware/android_frameworks_base",
"path": "core/java/android/text/util/Linkify.java",
"license": "apache-2.0",
"size": 24052
} | [
"android.annotation.NonNull",
"android.annotation.Nullable",
"android.text.Spannable",
"java.util.regex.Pattern"
] | import android.annotation.NonNull; import android.annotation.Nullable; import android.text.Spannable; import java.util.regex.Pattern; | import android.annotation.*; import android.text.*; import java.util.regex.*; | [
"android.annotation",
"android.text",
"java.util"
] | android.annotation; android.text; java.util; | 2,018,433 |
public InnerHitBuilder setDocValueFields(List<String> docValueFields) {
this.docValueFields = docValueFields;
return this;
} | InnerHitBuilder function(List<String> docValueFields) { this.docValueFields = docValueFields; return this; } | /**
* Sets the stored fields to load from the docvalue and return.
*/ | Sets the stored fields to load from the docvalue and return | setDocValueFields | {
"repo_name": "strapdata/elassandra5-rc",
"path": "core/src/main/java/org/elasticsearch/index/query/InnerHitBuilder.java",
"license": "apache-2.0",
"size": 21817
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,062,984 |
public static FSArray addToFSArray(FSArray fsArray, TOP featureStructureToAdd, JCas jcas) {
if (fsArray == null) {
fsArray = new FSArray(jcas, 0);
}
FSArray fsArrayToReturn = new FSArray(jcas, fsArray.size() + 1);
for (int i = 0; i < fsArray.size(); i++) {
fsArrayToReturn.set(i, fsArray.get(i));
}
fsArrayToReturn.set(fsArray.size(), featureStructureToAdd);
return fsArrayToReturn;
} | static FSArray function(FSArray fsArray, TOP featureStructureToAdd, JCas jcas) { if (fsArray == null) { fsArray = new FSArray(jcas, 0); } FSArray fsArrayToReturn = new FSArray(jcas, fsArray.size() + 1); for (int i = 0; i < fsArray.size(); i++) { fsArrayToReturn.set(i, fsArray.get(i)); } fsArrayToReturn.set(fsArray.size(), featureStructureToAdd); return fsArrayToReturn; } | /**
* Adds a single feature structure to a FSArray
*
* @param fsArray
* @param featureStructureToAdd
* @param jcas
* @return
*/ | Adds a single feature structure to a FSArray | addToFSArray | {
"repo_name": "UCDenver-ccp/ccp-nlp",
"path": "ccp-nlp-uima/src/main/java/edu/ucdenver/ccp/nlp/uima/util/UIMA_Util.java",
"license": "bsd-3-clause",
"size": 91302
} | [
"org.apache.uima.jcas.JCas",
"org.apache.uima.jcas.cas.FSArray"
] | import org.apache.uima.jcas.JCas; import org.apache.uima.jcas.cas.FSArray; | import org.apache.uima.jcas.*; import org.apache.uima.jcas.cas.*; | [
"org.apache.uima"
] | org.apache.uima; | 1,783,916 |
public void setProperties(Properties props) {
props_ = props;
} | void function(Properties props) { props_ = props; } | /**
* Set additional properties for the coordinate or variable.
*/ | Set additional properties for the coordinate or variable | setProperties | {
"repo_name": "OceanAtlas/JOA",
"path": "gov/noaa/pmel/sgt/dm/SGTMetaData.java",
"license": "gpl-2.0",
"size": 3783
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 2,244,758 |
@Test
public void appendListQueryParams() throws Exception {
assertEquals(
"http://test.com/?foo[]=bar&foo[]=baz",
HttpRequest.append("http://test.com",
Collections.singletonMap("foo", Arrays.asList(new String[] { "bar", "baz" }))));
assertEquals(
"http://test.com/?a[]=1&a[]=2",
HttpRequest.append("http://test.com",
Collections.singletonMap("a", Arrays.asList(new Integer[] { 1, 2 }))));
assertEquals(
"http://test.com/?a[]=1",
HttpRequest.append("http://test.com",
Collections.singletonMap("a", Arrays.asList(new Integer[] { 1 }))));
assertEquals(
"http://test.com/?",
HttpRequest.append("http://test.com",
Collections.singletonMap("a", Arrays.asList(new Integer[] { }))));
assertEquals(
"http://test.com/?foo[]=bar&foo[]=baz&a[]=1&a[]=2",
HttpRequest.append("http://test.com",
"foo", Arrays.asList(new String[] { "bar", "baz" }),
"a", Arrays.asList(new Integer[] { 1, 2 })));
} | void function() throws Exception { assertEquals( STRhttp: Collections.singletonMap("foo", Arrays.asList(new String[] { "bar", "baz" })))); assertEquals( STRhttp: Collections.singletonMap("a", Arrays.asList(new Integer[] { 1, 2 })))); assertEquals( STRhttp: Collections.singletonMap("a", Arrays.asList(new Integer[] { 1 })))); assertEquals( STRhttp: Collections.singletonMap("a", Arrays.asList(new Integer[] { })))); assertEquals( STRhttp: "foo", Arrays.asList(new String[] { "bar", "baz" }), "a", Arrays.asList(new Integer[] { 1, 2 }))); } | /**
* Append list parameter
*
* @throws Exception
*/ | Append list parameter | appendListQueryParams | {
"repo_name": "shulei1/http-request",
"path": "lib/src/test/java/com/github/kevinsawicki/http/HttpRequestTest.java",
"license": "mit",
"size": 108437
} | [
"java.util.Arrays",
"java.util.Collections",
"org.junit.Assert"
] | import java.util.Arrays; import java.util.Collections; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 2,947 |
EClass getDefinition(); | EClass getDefinition(); | /**
* Returns the meta object for class '{@link org.xtext.example.delphi.astm.Definition <em>Definition</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Definition</em>'.
* @see org.xtext.example.delphi.astm.Definition
* @generated
*/ | Returns the meta object for class '<code>org.xtext.example.delphi.astm.Definition Definition</code>'. | getDefinition | {
"repo_name": "adolfosbh/cs2as",
"path": "org.xtext.example.delphi/emf-gen/org/xtext/example/delphi/astm/AstmPackage.java",
"license": "epl-1.0",
"size": 670467
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,037,228 |
void removeConfiguration(Artifact configName); | void removeConfiguration(Artifact configName); | /**
* Removes all record of the specified configuration from the configuration
* list. This is somewhat unusual -- normally you want to remember the
* settings in case the configuration is deployed again later.
*/ | Removes all record of the specified configuration from the configuration list. This is somewhat unusual -- normally you want to remember the settings in case the configuration is deployed again later | removeConfiguration | {
"repo_name": "apache/geronimo",
"path": "framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/PersistentConfigurationList.java",
"license": "apache-2.0",
"size": 3827
} | [
"org.apache.geronimo.kernel.repository.Artifact"
] | import org.apache.geronimo.kernel.repository.Artifact; | import org.apache.geronimo.kernel.repository.*; | [
"org.apache.geronimo"
] | org.apache.geronimo; | 22,366 |
public static String decodeString(String str) throws IOException {
sun.misc.BASE64Decoder dec = new sun.misc.BASE64Decoder();
String value = new String(dec.decodeBuffer(str));
return (value);
} | static String function(String str) throws IOException { sun.misc.BASE64Decoder dec = new sun.misc.BASE64Decoder(); String value = new String(dec.decodeBuffer(str)); return (value); } | /**
* Decode a string using Base64 encoding.
*
* @param str
* @return String
* @throws IOException
*/ | Decode a string using Base64 encoding | decodeString | {
"repo_name": "paulnguyen/cmpe279",
"path": "eclipse/Roller/src/org/apache/roller/ui/rendering/velocity/deprecated/OldUtilities.java",
"license": "apache-2.0",
"size": 26301
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,394,734 |
private void displayEmployeeInfo(EmployeeInfo employee) {
// Set the value of all text field and combo box to that of the employee
empInfoFirstName.setText(employee.getFirstName());
empInfoLastName.setText(employee.getLastName());
empInfoEmpnum.setText(Integer.toString(employee.getEmployeeNumber()));
empInfoComboBoxGender.setSelectedItem(employee.getGender());
// Display the double as a percentage rounded to at most 2 decimal digits
// This is added to prevent a java internal error related to binary representation of decimals
empInfoDeductionRate.setText(Double.toString((roundDouble(employee.getDeductionsRate() * 100D))));
empInfoComboBoxLocation.setSelectedItem(employee.getLocation());
// All text field for money will be formatted to two decimal places
NumberFormat moneyFormatter = new DecimalFormat("#0.00");
// Check if the employee is part time or full time
if (employee instanceof FullTimeEmployee) {
// For full time employee, set and display the full time panel
fullTimeRadioButton.setSelected(true);
selectWagePanel();
FullTimeEmployee fullEmployee = (FullTimeEmployee) employee;
// Display the double values, all of them are rounded to at most 2 decimal places
fullTimeSalaryTextField.setText(moneyFormatter.format(roundDouble(fullEmployee.getYearlySalary())));
fullTimeIncomeTextField.setText(moneyFormatter.format(roundDouble(fullEmployee.calcAnnualIncome())));
// Remove all temporary values stored on partTimeWagePanel
partTimeHourlyWageTextField.setText("");
partTimeHoursWorkedTextField.setText("");
partTimeWeeksWorkedTextField.setText("");
partTimeIncomeTextField.setText("");
} else {
if (employee instanceof PartTimeEmployee) {
// For part time employee, set and display the part time panel
partTimeRadioButton.setSelected(true);
selectWagePanel();
PartTimeEmployee partEmployee = (PartTimeEmployee) employee;
// Display the double values, all of them are rounded to at most 2 decimal places
partTimeHourlyWageTextField.setText(moneyFormatter.format(roundDouble(partEmployee.getHourlyWage())));
partTimeHoursWorkedTextField.setText(Double.toString(roundDouble(partEmployee.getHoursPerWeek())));
partTimeWeeksWorkedTextField.setText(Double.toString(roundDouble(partEmployee.getWeeksPerYear())));
partTimeIncomeTextField.setText(moneyFormatter.format(roundDouble(partEmployee.calcAnnualIncome())));
// Remove all temporary values stored on fullTimeWagePanel
fullTimeSalaryTextField.setText("");
fullTimeIncomeTextField.setText("");
}
}
} | void function(EmployeeInfo employee) { empInfoFirstName.setText(employee.getFirstName()); empInfoLastName.setText(employee.getLastName()); empInfoEmpnum.setText(Integer.toString(employee.getEmployeeNumber())); empInfoComboBoxGender.setSelectedItem(employee.getGender()); empInfoDeductionRate.setText(Double.toString((roundDouble(employee.getDeductionsRate() * 100D)))); empInfoComboBoxLocation.setSelectedItem(employee.getLocation()); NumberFormat moneyFormatter = new DecimalFormat("#0.00"); if (employee instanceof FullTimeEmployee) { fullTimeRadioButton.setSelected(true); selectWagePanel(); FullTimeEmployee fullEmployee = (FullTimeEmployee) employee; fullTimeSalaryTextField.setText(moneyFormatter.format(roundDouble(fullEmployee.getYearlySalary()))); fullTimeIncomeTextField.setText(moneyFormatter.format(roundDouble(fullEmployee.calcAnnualIncome()))); partTimeHourlyWageTextField.setText(STRSTRSTRSTRSTR"); } } } | /**
* Display the selected employee on the information section on the right
*
* @param employee
* the employee to display
*/ | Display the selected employee on the information section on the right | displayEmployeeInfo | {
"repo_name": "qwertysam/Employee-Database",
"path": "src/gui/MainUI.java",
"license": "gpl-3.0",
"size": 58185
} | [
"java.text.DecimalFormat",
"java.text.NumberFormat"
] | import java.text.DecimalFormat; import java.text.NumberFormat; | import java.text.*; | [
"java.text"
] | java.text; | 2,080,839 |
if (length == null) {
length = Expressions.numberOperation(Double.class, SpatialOps.LENGTH, mixin);
}
return length;
} | if (length == null) { length = Expressions.numberOperation(Double.class, SpatialOps.LENGTH, mixin); } return length; } | /**
* The length of this Curve in its associated spatial reference.
*
* @return length
*/ | The length of this Curve in its associated spatial reference | length | {
"repo_name": "balazs-zsoldos/querydsl",
"path": "querydsl-spatial/src/main/java/com/querydsl/spatial/jts/JTSCurveExpression.java",
"license": "apache-2.0",
"size": 3496
} | [
"com.querydsl.core.types.dsl.Expressions",
"com.querydsl.spatial.SpatialOps"
] | import com.querydsl.core.types.dsl.Expressions; import com.querydsl.spatial.SpatialOps; | import com.querydsl.core.types.dsl.*; import com.querydsl.spatial.*; | [
"com.querydsl.core",
"com.querydsl.spatial"
] | com.querydsl.core; com.querydsl.spatial; | 1,660,788 |
@Test(timeout = 2000)
public void testNodesEmptyXML() throws Exception {
List<NodesInfo> responses = performGetCalls(
RM_WEB_SERVICE_PATH + NODES, NodesInfo.class, null, null);
NodesInfo routerResponse = responses.get(0);
NodesInfo rmResponse = responses.get(1);
assertNotNull(routerResponse);
assertNotNull(rmResponse);
assertEquals(
rmResponse.getNodes().size(),
routerResponse.getNodes().size());
} | @Test(timeout = 2000) void function() throws Exception { List<NodesInfo> responses = performGetCalls( RM_WEB_SERVICE_PATH + NODES, NodesInfo.class, null, null); NodesInfo routerResponse = responses.get(0); NodesInfo rmResponse = responses.get(1); assertNotNull(routerResponse); assertNotNull(rmResponse); assertEquals( rmResponse.getNodes().size(), routerResponse.getNodes().size()); } | /**
* This test validates the correctness of
* {@link RMWebServiceProtocol#getNodes()} inside Router.
*/ | This test validates the correctness of <code>RMWebServiceProtocol#getNodes()</code> inside Router | testNodesEmptyXML | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestRouterWebServicesREST.java",
"license": "apache-2.0",
"size": 48882
} | [
"java.util.List",
"org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfo",
"org.junit.Assert",
"org.junit.Test"
] | import java.util.List; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.NodesInfo; import org.junit.Assert; import org.junit.Test; | import java.util.*; import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.*; import org.junit.*; | [
"java.util",
"org.apache.hadoop",
"org.junit"
] | java.util; org.apache.hadoop; org.junit; | 999,706 |
public Iterator<Symbolizer> iterator() {
return _iterator;
} | Iterator<Symbolizer> function() { return _iterator; } | /**
* Gets the iterator to access the created PointSymbolizer objects. Its size can
* inferred from the number of classes passed by argument in
* {@link PointSymbolizerFactory#PointSymbolizerFactory(int, int, int)}.
*/ | Gets the iterator to access the created PointSymbolizer objects. Its size can inferred from the number of classes passed by argument in <code>PointSymbolizerFactory#PointSymbolizerFactory(int, int, int)</code> | iterator | {
"repo_name": "landryb/georchestra",
"path": "mapfishapp/src/main/java/org/georchestra/mapfishapp/ws/classif/PointSymbolizerFactory.java",
"license": "gpl-3.0",
"size": 9199
} | [
"java.util.Iterator",
"org.geotools.styling.Symbolizer"
] | import java.util.Iterator; import org.geotools.styling.Symbolizer; | import java.util.*; import org.geotools.styling.*; | [
"java.util",
"org.geotools.styling"
] | java.util; org.geotools.styling; | 689,415 |
public Iterator<Input> iterateInput(); | Iterator<Input> function(); | /**
* Iterate through the inputs
* @return an iterator
*/ | Iterate through the inputs | iterateInput | {
"repo_name": "CecileBONIN/Silverpeas-Core",
"path": "ejb-core/formtemplate/src/main/java/com/silverpeas/workflow/api/model/Form.java",
"license": "agpl-3.0",
"size": 4976
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 14,148 |
public void addExtension(
ASN1ObjectIdentifier oid,
boolean isCritical,
ASN1Encodable value)
throws DVCSException
{
try
{
extGenerator.addExtension(oid, isCritical, value);
}
catch (IOException e)
{
throw new DVCSException("cannot encode extension: " + e.getMessage(), e);
}
} | void function( ASN1ObjectIdentifier oid, boolean isCritical, ASN1Encodable value) throws DVCSException { try { extGenerator.addExtension(oid, isCritical, value); } catch (IOException e) { throw new DVCSException(STR + e.getMessage(), e); } } | /**
* Add a given extension field.
*
* @param oid the OID defining the extension type.
* @param isCritical true if the extension is critical, false otherwise.
* @param value the ASN.1 structure that forms the extension's value.
* @throws DVCSException if there is an issue encoding the extension for adding.
*/ | Add a given extension field | addExtension | {
"repo_name": "Skywalker-11/spongycastle",
"path": "pkix/src/main/java/org/spongycastle/dvcs/DVCSRequestBuilder.java",
"license": "mit",
"size": 3766
} | [
"java.io.IOException",
"org.spongycastle.asn1.ASN1Encodable",
"org.spongycastle.asn1.ASN1ObjectIdentifier"
] | import java.io.IOException; import org.spongycastle.asn1.ASN1Encodable; import org.spongycastle.asn1.ASN1ObjectIdentifier; | import java.io.*; import org.spongycastle.asn1.*; | [
"java.io",
"org.spongycastle.asn1"
] | java.io; org.spongycastle.asn1; | 1,251,191 |
default Set<Key<?>> getKeys(Vector3i coordinates) {
return getKeys(coordinates.getX(), coordinates.getY(), coordinates.getZ());
} | default Set<Key<?>> getKeys(Vector3i coordinates) { return getKeys(coordinates.getX(), coordinates.getY(), coordinates.getZ()); } | /**
* Gets an {@link ImmutableSet} of {@link Key}s for the block at the given
* location.
*
* @param coordinates The position of the block
* @return The immutable set of values for the block
*/ | Gets an <code>ImmutableSet</code> of <code>Key</code>s for the block at the given location | getKeys | {
"repo_name": "kashike/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/world/extent/LocationCompositeValueStore.java",
"license": "mit",
"size": 38496
} | [
"com.flowpowered.math.vector.Vector3i",
"java.util.Set",
"org.spongepowered.api.data.key.Key"
] | import com.flowpowered.math.vector.Vector3i; import java.util.Set; import org.spongepowered.api.data.key.Key; | import com.flowpowered.math.vector.*; import java.util.*; import org.spongepowered.api.data.key.*; | [
"com.flowpowered.math",
"java.util",
"org.spongepowered.api"
] | com.flowpowered.math; java.util; org.spongepowered.api; | 1,559,094 |
public ServiceResponse<Map<String, Long>> getLongInvalidString() throws ErrorException, IOException {
Call<ResponseBody> call = service.getLongInvalidString();
return getLongInvalidStringDelegate(call.execute());
} | ServiceResponse<Map<String, Long>> function() throws ErrorException, IOException { Call<ResponseBody> call = service.getLongInvalidString(); return getLongInvalidStringDelegate(call.execute()); } | /**
* Get long dictionary value {"0": 1, "1": "integer", "2": 0}.
*
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @return the Map<String, Long> object wrapped in {@link ServiceResponse} if successful.
*/ | Get long dictionary value {"0": 1, "1": "integer", "2": 0} | getLongInvalidString | {
"repo_name": "stankovski/AutoRest",
"path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/DictionaryOperationsImpl.java",
"license": "mit",
"size": 167988
} | [
"com.microsoft.rest.ServiceResponse",
"java.io.IOException",
"java.util.Map"
] | import com.microsoft.rest.ServiceResponse; import java.io.IOException; import java.util.Map; | import com.microsoft.rest.*; import java.io.*; import java.util.*; | [
"com.microsoft.rest",
"java.io",
"java.util"
] | com.microsoft.rest; java.io; java.util; | 2,032,320 |
private static void assertNullReference_isFalse(Object x) {
Assert.assertFalse("Passing null to equals should return false", x.equals(null));
} | static void function(Object x) { Assert.assertFalse(STR, x.equals(null)); } | /**
* x.equals(null) must return false;
*/ | x.equals(null) must return false | assertNullReference_isFalse | {
"repo_name": "madhav123/gkmaster",
"path": "application/src/test/java/org/mifos/framework/TestUtils.java",
"license": "apache-2.0",
"size": 14906
} | [
"junit.framework.Assert"
] | import junit.framework.Assert; | import junit.framework.*; | [
"junit.framework"
] | junit.framework; | 2,678,937 |
protected void cleanUp() throws Exception {
APIStoreRestClient apiStore = new APIStoreRestClient(getStoreURLHttp());
apiStore.login(user.getUserName(), user.getPassword());
APIPublisherRestClient publisherRestClient = new APIPublisherRestClient(getPublisherURLHttp());
publisherRestClient.login(user.getUserName(), user.getPassword());
HttpResponse subscriptionDataResponse = apiStore.getAllSubscriptions();
verifyResponse(subscriptionDataResponse);
JSONObject jsonSubscription = new JSONObject(subscriptionDataResponse.getData());
if (!jsonSubscription.getBoolean(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_ERROR)) {
JSONObject jsonSubscriptionsObject = jsonSubscription.getJSONObject(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_SUBSCRIPTION);
JSONArray jsonApplicationsArray = jsonSubscriptionsObject.getJSONArray(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_APPLICATIONS);
//Remove API Subscriptions
for (int i = 0; i < jsonApplicationsArray.length(); i++) {
JSONObject appObject = jsonApplicationsArray.getJSONObject(i);
int id = appObject.getInt(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_ID);
JSONArray subscribedAPIJSONArray = appObject.getJSONArray(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_SUBSCRIPTION);
for (int j = 0; j < subscribedAPIJSONArray.length(); j++) {
JSONObject subscribedAPI = subscribedAPIJSONArray.getJSONObject(j);
verifyResponse(apiStore.removeAPISubscription(subscribedAPI.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_NAME)
, subscribedAPI.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_VERSION),
subscribedAPI.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_PROVIDER), String.valueOf(id)));
}
}
}
//delete all application other than default application
String applicationData = apiStore.getAllApplications().getData();
JSONObject jsonApplicationData = new JSONObject(applicationData);
JSONArray applicationArray = jsonApplicationData.getJSONArray(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_APPLICATIONS);
for (int i = 0; i < applicationArray.length(); i++) {
JSONObject jsonApplication = applicationArray.getJSONObject(i);
if (!jsonApplication.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_NAME).equals(APIMIntegrationConstants.OAUTH_DEFAULT_APPLICATION_NAME)) {
verifyResponse(apiStore.removeApplication(jsonApplication.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_NAME)));
}
}
String apiData = apiStore.getAPI().getData();
JSONObject jsonAPIData = new JSONObject(apiData);
JSONArray jsonAPIArray = jsonAPIData.getJSONArray(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_APIS);
//delete all APIs
for (int i = 0; i < jsonAPIArray.length(); i++) {
JSONObject api = jsonAPIArray.getJSONObject(i);
// verifyResponse(publisherRestClient.deleteAPI(api.getString("name"), api.getString("version"), user.getUserName()));
publisherRestClient.deleteAPI(api.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_NAME)
, api.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_VERSION), user.getUserName());
}
} | void function() throws Exception { APIStoreRestClient apiStore = new APIStoreRestClient(getStoreURLHttp()); apiStore.login(user.getUserName(), user.getPassword()); APIPublisherRestClient publisherRestClient = new APIPublisherRestClient(getPublisherURLHttp()); publisherRestClient.login(user.getUserName(), user.getPassword()); HttpResponse subscriptionDataResponse = apiStore.getAllSubscriptions(); verifyResponse(subscriptionDataResponse); JSONObject jsonSubscription = new JSONObject(subscriptionDataResponse.getData()); if (!jsonSubscription.getBoolean(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_ERROR)) { JSONObject jsonSubscriptionsObject = jsonSubscription.getJSONObject(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_SUBSCRIPTION); JSONArray jsonApplicationsArray = jsonSubscriptionsObject.getJSONArray(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_APPLICATIONS); for (int i = 0; i < jsonApplicationsArray.length(); i++) { JSONObject appObject = jsonApplicationsArray.getJSONObject(i); int id = appObject.getInt(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_ID); JSONArray subscribedAPIJSONArray = appObject.getJSONArray(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_SUBSCRIPTION); for (int j = 0; j < subscribedAPIJSONArray.length(); j++) { JSONObject subscribedAPI = subscribedAPIJSONArray.getJSONObject(j); verifyResponse(apiStore.removeAPISubscription(subscribedAPI.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_NAME) , subscribedAPI.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_VERSION), subscribedAPI.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_PROVIDER), String.valueOf(id))); } } } String applicationData = apiStore.getAllApplications().getData(); JSONObject jsonApplicationData = new JSONObject(applicationData); JSONArray applicationArray = jsonApplicationData.getJSONArray(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_APPLICATIONS); for (int i = 0; i < applicationArray.length(); i++) { JSONObject jsonApplication = applicationArray.getJSONObject(i); if (!jsonApplication.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_NAME).equals(APIMIntegrationConstants.OAUTH_DEFAULT_APPLICATION_NAME)) { verifyResponse(apiStore.removeApplication(jsonApplication.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_NAME))); } } String apiData = apiStore.getAPI().getData(); JSONObject jsonAPIData = new JSONObject(apiData); JSONArray jsonAPIArray = jsonAPIData.getJSONArray(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_APIS); for (int i = 0; i < jsonAPIArray.length(); i++) { JSONObject api = jsonAPIArray.getJSONObject(i); publisherRestClient.deleteAPI(api.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_NAME) , api.getString(APIMIntegrationConstants.API_RESPONSE_ELEMENT_NAME_API_VERSION), user.getUserName()); } } | /**
* Cleaning up the API manager by removing all APIs and applications other than default application
*
* @throws APIManagerIntegrationTestException - occurred when calling the apis
* @throws org.json.JSONException - occurred when reading the json
*/ | Cleaning up the API manager by removing all APIs and applications other than default application | cleanUp | {
"repo_name": "amalkasubasinghe/product-apim",
"path": "modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/base/APIMIntegrationBaseTest.java",
"license": "apache-2.0",
"size": 24166
} | [
"org.json.JSONArray",
"org.json.JSONObject",
"org.wso2.am.integration.test.utils.clients.APIPublisherRestClient",
"org.wso2.am.integration.test.utils.clients.APIStoreRestClient",
"org.wso2.carbon.automation.test.utils.http.client.HttpResponse"
] | import org.json.JSONArray; import org.json.JSONObject; import org.wso2.am.integration.test.utils.clients.APIPublisherRestClient; import org.wso2.am.integration.test.utils.clients.APIStoreRestClient; import org.wso2.carbon.automation.test.utils.http.client.HttpResponse; | import org.json.*; import org.wso2.am.integration.test.utils.clients.*; import org.wso2.carbon.automation.test.utils.http.client.*; | [
"org.json",
"org.wso2.am",
"org.wso2.carbon"
] | org.json; org.wso2.am; org.wso2.carbon; | 214,368 |
public Optional<WAComponent> getWAComponent(String componentName) {
return Optional.ofNullable(componentsByName.get(componentName));
} | Optional<WAComponent> function(String componentName) { return Optional.ofNullable(componentsByName.get(componentName)); } | /**
* Gets the WAComponent instance registered under the specified name.
* @param componentName the name of the Silverpeas component.
* @return an optional WAComponent instance if such instance exists under the given name.
*/ | Gets the WAComponent instance registered under the specified name | getWAComponent | {
"repo_name": "auroreallibe/Silverpeas-Core",
"path": "core-library/src/main/java/org/silverpeas/core/admin/component/WAComponentRegistry.java",
"license": "agpl-3.0",
"size": 7896
} | [
"java.util.Optional",
"org.silverpeas.core.admin.component.model.WAComponent"
] | import java.util.Optional; import org.silverpeas.core.admin.component.model.WAComponent; | import java.util.*; import org.silverpeas.core.admin.component.model.*; | [
"java.util",
"org.silverpeas.core"
] | java.util; org.silverpeas.core; | 2,905,979 |
public Iterator<Statistics> getAllStatistics();
| Iterator<Statistics> function(); | /**
* Returns an iterator over all statistics objects available for this type of attribute.
* Additional statistics can be registered via {@link #registerStatistics(Statistics)}.
*/ | Returns an iterator over all statistics objects available for this type of attribute. Additional statistics can be registered via <code>#registerStatistics(Statistics)</code> | getAllStatistics | {
"repo_name": "brtonnies/rapidminer-studio",
"path": "src/main/java/com/rapidminer/example/Attribute.java",
"license": "agpl-3.0",
"size": 6915
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,272,730 |
protected void processExchange(Exchange exchange) throws Exception {
processor.process(exchange);
if (exchange.getException() != null) {
getExceptionHandler().handleException("Error processing aggregated exchange: " + exchange, exchange.getException());
}
} | void function(Exchange exchange) throws Exception { processor.process(exchange); if (exchange.getException() != null) { getExceptionHandler().handleException(STR + exchange, exchange.getException()); } } | /**
* Strategy Method to process an exchange in the batch. This method allows derived classes to perform
* custom processing before or after an individual exchange is processed
*/ | Strategy Method to process an exchange in the batch. This method allows derived classes to perform custom processing before or after an individual exchange is processed | processExchange | {
"repo_name": "chicagozer/rheosoft",
"path": "camel-core/src/main/java/org/apache/camel/processor/BatchProcessor.java",
"license": "apache-2.0",
"size": 15460
} | [
"org.apache.camel.Exchange"
] | import org.apache.camel.Exchange; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,407,096 |
Printable getProtocolPrintArtifacts(ProtocolBase protocol) ;
| Printable getProtocolPrintArtifacts(ProtocolBase protocol) ; | /**
*
* This method is to get the printable Artifacts for the selected protocol.
* @param protocol
* @return
*/ | This method is to get the printable Artifacts for the selected protocol | getProtocolPrintArtifacts | {
"repo_name": "mukadder/kc",
"path": "coeus-impl/src/main/java/org/kuali/kra/protocol/actions/print/ProtocolPrintingService.java",
"license": "agpl-3.0",
"size": 2383
} | [
"org.kuali.coeus.common.framework.print.Printable",
"org.kuali.kra.protocol.ProtocolBase"
] | import org.kuali.coeus.common.framework.print.Printable; import org.kuali.kra.protocol.ProtocolBase; | import org.kuali.coeus.common.framework.print.*; import org.kuali.kra.protocol.*; | [
"org.kuali.coeus",
"org.kuali.kra"
] | org.kuali.coeus; org.kuali.kra; | 1,909,626 |
public static byte[][] readArrayOfByteArrays(DataInput in)
throws IOException, ClassNotFoundException {
InternalDataSerializer.checkIn(in);
int length = InternalDataSerializer.readArrayLength(in);
if (length == -1) {
return null;
} else {
byte[][] array = new byte[length][];
for (int i = 0; i < length; i++) {
array[i] = readByteArray(in);
}
if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) {
logger.trace(LogMarker.SERIALIZER_VERBOSE, "Read byte[][] of length {}", length);
}
return array;
}
} | static byte[][] function(DataInput in) throws IOException, ClassNotFoundException { InternalDataSerializer.checkIn(in); int length = InternalDataSerializer.readArrayLength(in); if (length == -1) { return null; } else { byte[][] array = new byte[length][]; for (int i = 0; i < length; i++) { array[i] = readByteArray(in); } if (logger.isTraceEnabled(LogMarker.SERIALIZER_VERBOSE)) { logger.trace(LogMarker.SERIALIZER_VERBOSE, STR, length); } return array; } } | /**
* Reads an array of <code>byte[]</code>s from a <code>DataInput</code>.
*
* @throws IOException A problem occurs while reading from <code>in</code>
*/ | Reads an array of <code>byte[]</code>s from a <code>DataInput</code> | readArrayOfByteArrays | {
"repo_name": "jdeppe-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/DataSerializer.java",
"license": "apache-2.0",
"size": 104615
} | [
"java.io.DataInput",
"java.io.IOException",
"org.apache.geode.internal.InternalDataSerializer",
"org.apache.geode.internal.logging.log4j.LogMarker"
] | import java.io.DataInput; import java.io.IOException; import org.apache.geode.internal.InternalDataSerializer; import org.apache.geode.internal.logging.log4j.LogMarker; | import java.io.*; import org.apache.geode.internal.*; import org.apache.geode.internal.logging.log4j.*; | [
"java.io",
"org.apache.geode"
] | java.io; org.apache.geode; | 2,016,239 |
private RegExpTree parseEscape() {
Preconditions.checkState(pattern.charAt(pos) == '\\');
++pos;
char ch = pattern.charAt(pos);
if (ch == 'b' || ch == 'B') {
++pos;
return new WordBoundary(ch);
} else if ('1' <= ch && ch <= '9') {
++pos;
int possibleGroupIndex = ch - '0';
if (numCapturingGroups >= possibleGroupIndex) {
if (pos < limit) {
char next = pattern.charAt(pos);
if ('0' <= next && next <= '9') {
int twoDigitGroupIndex = possibleGroupIndex * 10 + (next - '0');
if (numCapturingGroups >= twoDigitGroupIndex) {
++pos;
possibleGroupIndex = twoDigitGroupIndex;
}
}
}
return new BackReference(possibleGroupIndex);
} else {
// \1 - \7 are octal escapes if there is no such group.
// \8 and \9 are the literal characters '8' and '9' if there
// is no such group.
return new Text(Character.toString(
possibleGroupIndex <= 7 ? (char) possibleGroupIndex : ch));
}
} else {
CharRanges charGroup = NAMED_CHAR_GROUPS.get(ch);
if (charGroup != null) { // Handle \d, etc.
++pos;
return new Charset(charGroup, CharRanges.EMPTY);
}
return new Text("" + parseEscapeChar());
}
} | RegExpTree function() { Preconditions.checkState(pattern.charAt(pos) == '\\'); ++pos; char ch = pattern.charAt(pos); if (ch == 'b' ch == 'B') { ++pos; return new WordBoundary(ch); } else if ('1' <= ch && ch <= '9') { ++pos; int possibleGroupIndex = ch - '0'; if (numCapturingGroups >= possibleGroupIndex) { if (pos < limit) { char next = pattern.charAt(pos); if ('0' <= next && next <= '9') { int twoDigitGroupIndex = possibleGroupIndex * 10 + (next - '0'); if (numCapturingGroups >= twoDigitGroupIndex) { ++pos; possibleGroupIndex = twoDigitGroupIndex; } } } return new BackReference(possibleGroupIndex); } else { return new Text(Character.toString( possibleGroupIndex <= 7 ? (char) possibleGroupIndex : ch)); } } else { CharRanges charGroup = NAMED_CHAR_GROUPS.get(ch); if (charGroup != null) { ++pos; return new Charset(charGroup, CharRanges.EMPTY); } return new Text("" + parseEscapeChar()); } } | /**
* Parses an escape that appears outside a charset.
*/ | Parses an escape that appears outside a charset | parseEscape | {
"repo_name": "wenzowski/closure-compiler",
"path": "src/com/google/javascript/jscomp/regex/RegExpTree.java",
"license": "apache-2.0",
"size": 56114
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 227,189 |
@ApiModelProperty(value = "Time the executor started, in RFC 3339 format.")
public String getStartTime() {
return startTime;
} | @ApiModelProperty(value = STR) String function() { return startTime; } | /**
* Time the executor started, in RFC 3339 format.
* @return startTime
**/ | Time the executor started, in RFC 3339 format | getStartTime | {
"repo_name": "robsyme/nextflow",
"path": "modules/nf-ga4gh/src/main/nextflow/ga4gh/tes/client/model/TesExecutorLog.java",
"license": "apache-2.0",
"size": 6521
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 2,335,242 |
public GetRequest versionType(VersionType versionType) {
this.versionType = versionType;
return this;
} | GetRequest function(VersionType versionType) { this.versionType = versionType; return this; } | /**
* Sets the versioning type. Defaults to {@link org.elasticsearch.index.VersionType#INTERNAL}.
*/ | Sets the versioning type. Defaults to <code>org.elasticsearch.index.VersionType#INTERNAL</code> | versionType | {
"repo_name": "alexksikes/elasticsearch",
"path": "src/main/java/org/elasticsearch/action/get/GetRequest.java",
"license": "apache-2.0",
"size": 9090
} | [
"org.elasticsearch.index.VersionType"
] | import org.elasticsearch.index.VersionType; | import org.elasticsearch.index.*; | [
"org.elasticsearch.index"
] | org.elasticsearch.index; | 2,284,171 |
protected HashSet<Node> getNeighborsInDirectedUnweighted(Node node) {
final HashSet<Node> neighbors = new HashSet<Node>();
DirectedEdge edge;
for (IElement iEdge : ((DirectedNode) node).getIncomingEdges()) {
edge = (DirectedEdge) iEdge;
neighbors.add(edge.getSrc());
}
return neighbors;
} | HashSet<Node> function(Node node) { final HashSet<Node> neighbors = new HashSet<Node>(); DirectedEdge edge; for (IElement iEdge : ((DirectedNode) node).getIncomingEdges()) { edge = (DirectedEdge) iEdge; neighbors.add(edge.getSrc()); } return neighbors; } | /**
* Get all incoming neighbors for a given node.
*
* @param node
* The {@link Node} which neighbors are wanted.
* @return A {@link Set} containing all incoming neighbors of given node.
*/ | Get all incoming neighbors for a given node | getNeighborsInDirectedUnweighted | {
"repo_name": "Rwilmes/DNA",
"path": "src/dna/metrics/similarityMeasures/Measures.java",
"license": "gpl-3.0",
"size": 25485
} | [
"dna.graph.IElement",
"dna.graph.edges.DirectedEdge",
"dna.graph.nodes.DirectedNode",
"dna.graph.nodes.Node",
"java.util.HashSet"
] | import dna.graph.IElement; import dna.graph.edges.DirectedEdge; import dna.graph.nodes.DirectedNode; import dna.graph.nodes.Node; import java.util.HashSet; | import dna.graph.*; import dna.graph.edges.*; import dna.graph.nodes.*; import java.util.*; | [
"dna.graph",
"dna.graph.edges",
"dna.graph.nodes",
"java.util"
] | dna.graph; dna.graph.edges; dna.graph.nodes; java.util; | 794,696 |
public static MozuClient<com.mozu.api.contracts.productruntime.Category> getCategoryClient(Integer categoryId) throws Exception
{
return getCategoryClient( categoryId, null, null);
} | static MozuClient<com.mozu.api.contracts.productruntime.Category> function(Integer categoryId) throws Exception { return getCategoryClient( categoryId, null, null); } | /**
* Retrieves the details of a single category.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.productruntime.Category> mozuClient=GetCategoryClient( categoryId);
* client.setBaseAddress(url);
* client.executeRequest();
* Category category = client.Result();
* </code></pre></p>
* @param categoryId Unique identifier for the storefront container used to organize products.
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.productruntime.Category>
* @see com.mozu.api.contracts.productruntime.Category
*/ | Retrieves the details of a single category. <code><code> MozuClient mozuClient=GetCategoryClient( categoryId); client.setBaseAddress(url); client.executeRequest(); Category category = client.Result(); </code></code> | getCategoryClient | {
"repo_name": "sanjaymandadi/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/catalog/storefront/CategoryClient.java",
"license": "mit",
"size": 8332
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 929,802 |
default @Nullable ModifierStatement getModifierStatement() {
final Optional<ModifierStatement> opt = findFirstDeclaredSubstatement(ModifierStatement.class);
return opt.isPresent() ? opt.get() : null;
} | default @Nullable ModifierStatement getModifierStatement() { final Optional<ModifierStatement> opt = findFirstDeclaredSubstatement(ModifierStatement.class); return opt.isPresent() ? opt.get() : null; } | /**
* Return a modifier statement, if present. In RFC6020 semantics, there are no modifiers and this methods always
* returns null.
*
* @return modifier statement, null if not present.
*/ | Return a modifier statement, if present. In RFC6020 semantics, there are no modifiers and this methods always returns null | getModifierStatement | {
"repo_name": "opendaylight/yangtools",
"path": "model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/PatternStatement.java",
"license": "epl-1.0",
"size": 1242
} | [
"java.util.Optional",
"org.eclipse.jdt.annotation.Nullable"
] | import java.util.Optional; import org.eclipse.jdt.annotation.Nullable; | import java.util.*; import org.eclipse.jdt.annotation.*; | [
"java.util",
"org.eclipse.jdt"
] | java.util; org.eclipse.jdt; | 1,566,776 |
@Override
protected synchronized void handleTransliterate(Replaceable text,
Position offsets, boolean isIncremental) {
if(csp==null) {
return;
}
if(offsets.start >= offsets.limit) {
return;
}
iter.setText(text);
result.setLength(0);
int c, delta;
// Walk through original string
// If there is a case change, modify corresponding position in replaceable
iter.setIndex(offsets.start);
iter.setLimit(offsets.limit);
iter.setContextLimits(offsets.contextStart, offsets.contextLimit);
while((c=iter.nextCaseMapCP())>=0) {
c=csp.toFullFolding(c, result, 0); // toFullFolding(int c, StringBuffer out, int options)
if(iter.didReachLimit() && isIncremental) {
// the case mapping function tried to look beyond the context limit
// wait for more input
offsets.start=iter.getCaseMapCPStart();
return;
}
if(c<0) {
continue;
} else if(c<=UCaseProps.MAX_STRING_LENGTH) {
delta=iter.replace(result.toString());
result.setLength(0);
} else {
delta=iter.replace(UTF16.valueOf(c));
}
if(delta!=0) {
offsets.limit += delta;
offsets.contextLimit += delta;
}
}
offsets.start = offsets.limit;
}
static SourceTargetUtility sourceTargetUtility = null; | synchronized void function(Replaceable text, Position offsets, boolean isIncremental) { if(csp==null) { return; } if(offsets.start >= offsets.limit) { return; } iter.setText(text); result.setLength(0); int c, delta; iter.setIndex(offsets.start); iter.setLimit(offsets.limit); iter.setContextLimits(offsets.contextStart, offsets.contextLimit); while((c=iter.nextCaseMapCP())>=0) { c=csp.toFullFolding(c, result, 0); if(iter.didReachLimit() && isIncremental) { offsets.start=iter.getCaseMapCPStart(); return; } if(c<0) { continue; } else if(c<=UCaseProps.MAX_STRING_LENGTH) { delta=iter.replace(result.toString()); result.setLength(0); } else { delta=iter.replace(UTF16.valueOf(c)); } if(delta!=0) { offsets.limit += delta; offsets.contextLimit += delta; } } offsets.start = offsets.limit; } static SourceTargetUtility sourceTargetUtility = null; | /**
* Implements {@link Transliterator#handleTransliterate}.
*/ | Implements <code>Transliterator#handleTransliterate</code> | handleTransliterate | {
"repo_name": "mirego/j2objc",
"path": "jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CaseFoldTransliterator.java",
"license": "apache-2.0",
"size": 4295
} | [
"android.icu.impl.UCaseProps"
] | import android.icu.impl.UCaseProps; | import android.icu.impl.*; | [
"android.icu"
] | android.icu; | 2,184,093 |
public ObjectNode toJsonNode() {
return getMapper().valueToTree(this);
} | ObjectNode function() { return getMapper().valueToTree(this); } | /**
* Return the JsonNode representing the device
*
* @return the JsonNode representing the device
*/ | Return the JsonNode representing the device | toJsonNode | {
"repo_name": "raptorbox/raptor",
"path": "raptor-models/src/main/java/org/createnet/raptor/models/objects/Device.java",
"license": "apache-2.0",
"size": 16124
} | [
"com.fasterxml.jackson.databind.node.ObjectNode"
] | import com.fasterxml.jackson.databind.node.ObjectNode; | import com.fasterxml.jackson.databind.node.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 2,422,160 |
private EventHandler createEventHandler(OutErr outErr,
BlazeCommandEventHandler.Options eventOptions) {
EventHandler eventHandler;
if (eventOptions.experimentalUi) {
// The experimental event handler is not to be rate limited.
return new ExperimentalEventHandler(outErr, eventOptions, runtime.getClock());
} else if ((eventOptions.useColor() || eventOptions.useCursorControl())) {
eventHandler = new FancyTerminalEventHandler(outErr, eventOptions);
} else {
eventHandler = new BlazeCommandEventHandler(outErr, eventOptions);
}
return RateLimitingEventHandler.create(eventHandler, eventOptions.showProgressRateLimit);
} | EventHandler function(OutErr outErr, BlazeCommandEventHandler.Options eventOptions) { EventHandler eventHandler; if (eventOptions.experimentalUi) { return new ExperimentalEventHandler(outErr, eventOptions, runtime.getClock()); } else if ((eventOptions.useColor() eventOptions.useCursorControl())) { eventHandler = new FancyTerminalEventHandler(outErr, eventOptions); } else { eventHandler = new BlazeCommandEventHandler(outErr, eventOptions); } return RateLimitingEventHandler.create(eventHandler, eventOptions.showProgressRateLimit); } | /**
* Returns the event handler to use for this Blaze command.
*/ | Returns the event handler to use for this Blaze command | createEventHandler | {
"repo_name": "whuwxl/bazel",
"path": "src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java",
"license": "apache-2.0",
"size": 29358
} | [
"com.google.devtools.build.lib.events.EventHandler",
"com.google.devtools.build.lib.util.io.OutErr"
] | import com.google.devtools.build.lib.events.EventHandler; import com.google.devtools.build.lib.util.io.OutErr; | import com.google.devtools.build.lib.events.*; import com.google.devtools.build.lib.util.io.*; | [
"com.google.devtools"
] | com.google.devtools; | 2,808,351 |
public boolean haCheckMount(String ha, String mountPoint) throws Exception {
boolean mount = true;
if (ha != null && ha.equals("ha") && !VolumeManager.isSystemMounted("/rdata")) {
Map<String, String> vol = VolumeManager.getLogicalVolumeFromPath(mountPoint);
String volGroup = vol.get("vg");
if (VolumeManager.isLocalDeviceGroup(volGroup)) {
logger.info("Cluster sin /rdata montado. '{}' SI es local => SI montamos", mountPoint);
mount=true;
} else {
logger.info("Cluster sin /rdata montado. '{}' NO es local => NO montamos", mountPoint);
mount=false;
}
} else
logger.info("No cluster, o no se ha llamado al script ha => SI montamos '{}'", mountPoint);
return mount;
}
| boolean function(String ha, String mountPoint) throws Exception { boolean mount = true; if (ha != null && ha.equals("ha") && !VolumeManager.isSystemMounted(STR)) { Map<String, String> vol = VolumeManager.getLogicalVolumeFromPath(mountPoint); String volGroup = vol.get("vg"); if (VolumeManager.isLocalDeviceGroup(volGroup)) { logger.info(STR, mountPoint); mount=true; } else { logger.info(STR, mountPoint); mount=false; } } else logger.info(STR, mountPoint); return mount; } | /**
* Si !ha ==> Se monta
* Si ha ==> si start y local ==> se monta, sino no se monta
* Si ha ==> si stop y local ==> no se desmonta, sino se desmonta
* @param ha
* @param mountPoint
* @return
* @throws Exception
*/ | Si !ha ==> Se monta Si ha ==> si start y local ==> se monta, sino no se monta Si ha ==> si stop y local ==> no se desmonta, sino se desmonta | haCheckMount | {
"repo_name": "WhiteBearSolutions/WBSAirback",
"path": "src/com/whitebearsolutions/imagine/wbsairback/util/VolumeDaemon.java",
"license": "apache-2.0",
"size": 17165
} | [
"com.whitebearsolutions.imagine.wbsairback.disk.VolumeManager",
"java.util.Map"
] | import com.whitebearsolutions.imagine.wbsairback.disk.VolumeManager; import java.util.Map; | import com.whitebearsolutions.imagine.wbsairback.disk.*; import java.util.*; | [
"com.whitebearsolutions.imagine",
"java.util"
] | com.whitebearsolutions.imagine; java.util; | 2,627,845 |
public DefectBean getDefect(String key) {
synchronized (defects) {
List<DefectBean> list = this.defects.get(key);
DefectBean defect = getLastDefect(list);
if (defect == null || defect.isDeleted()) {
return null;
}
return defect;
}
} | DefectBean function(String key) { synchronized (defects) { List<DefectBean> list = this.defects.get(key); DefectBean defect = getLastDefect(list); if (defect == null defect.isDeleted()) { return null; } return defect; } } | /**
* Returns defect of requested defect id. The undeleted defect with the last
* revision will be returned.
*
* @param key requested defect key (defect id).
* @return requested defect, or <tt>null</tt> if Defect with such key does
* not exist.
*/ | Returns defect of requested defect id. The undeleted defect with the last revision will be returned | getDefect | {
"repo_name": "apache/wink",
"path": "wink-examples/ext/History/src/main/java/org/apache/wink/example/history/legacy/DataStore.java",
"license": "apache-2.0",
"size": 13199
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,791,261 |
StringBuilder increment = new StringBuilder();
for (int i = 0; i < inc; i++)
increment.append(' ');
String incr = increment.toString();
for (File f : root.listFiles()) {
sb.append(incr).append(f.getName());
if (f.isDirectory()) {
sb.append(" [Directory]\n"); //$NON-NLS-1$
listing(sb, f, inc + 2);
} else {
sb.append(" [").append(f.length() + " bytes]\n"); //$NON-NLS-1$//$NON-NLS-2$
}
}
} | StringBuilder increment = new StringBuilder(); for (int i = 0; i < inc; i++) increment.append(' '); String incr = increment.toString(); for (File f : root.listFiles()) { sb.append(incr).append(f.getName()); if (f.isDirectory()) { sb.append(STR); listing(sb, f, inc + 2); } else { sb.append(STR).append(f.length() + STR); } } } | /**
*
* a recursive method to get the directory hierarchy under root.
*
* @param sb StringBuilder object which will return the final hierarchy
* @param root root of the hierarchy
* @param inc initial number of spaces.
*/ | a recursive method to get the directory hierarchy under root | listing | {
"repo_name": "rbouqueau/gpac",
"path": "applications/osmo4_android_studio/app/src/main/java/com/gpac/Osmo4/GPACInstance.java",
"license": "lgpl-2.1",
"size": 14202
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 167,258 |
public static <T> T extractFutureBody(CamelContext context, Future<?> future, long timeout, TimeUnit unit, Class<T> type) throws TimeoutException {
try {
if (timeout > 0) {
return doExtractFutureBody(context, future.get(timeout, unit), type);
} else {
return doExtractFutureBody(context, future.get(), type);
}
} catch (InterruptedException e) {
// execution failed due interruption so rethrow the cause
throw CamelExecutionException.wrapCamelExecutionException(null, e);
} catch (ExecutionException e) {
// execution failed due to an exception so rethrow the cause
throw CamelExecutionException.wrapCamelExecutionException(null, e.getCause());
} finally {
// its harmless to cancel if task is already completed
// and in any case we do not want to get hold of the task a 2nd time
// and its recommended to cancel according to Brian Goetz in his Java Concurrency in Practice book
future.cancel(true);
}
} | static <T> T function(CamelContext context, Future<?> future, long timeout, TimeUnit unit, Class<T> type) throws TimeoutException { try { if (timeout > 0) { return doExtractFutureBody(context, future.get(timeout, unit), type); } else { return doExtractFutureBody(context, future.get(), type); } } catch (InterruptedException e) { throw CamelExecutionException.wrapCamelExecutionException(null, e); } catch (ExecutionException e) { throw CamelExecutionException.wrapCamelExecutionException(null, e.getCause()); } finally { future.cancel(true); } } | /**
* Extracts the body from the given future, that represents a handle to an asynchronous exchange.
* <p/>
* Will wait for the future task to complete, but waiting at most the timeout value.
*
* @param context the camel context
* @param future the future handle
* @param timeout timeout value
* @param unit timeout unit
* @param type the expected body response type
* @return the result body, can be <tt>null</tt>.
* @throws CamelExecutionException is thrown if the processing of the exchange failed
* @throws java.util.concurrent.TimeoutException is thrown if a timeout triggered
*/ | Extracts the body from the given future, that represents a handle to an asynchronous exchange. Will wait for the future task to complete, but waiting at most the timeout value | extractFutureBody | {
"repo_name": "davidkarlsen/camel",
"path": "core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java",
"license": "apache-2.0",
"size": 41703
} | [
"java.util.concurrent.ExecutionException",
"java.util.concurrent.Future",
"java.util.concurrent.TimeUnit",
"java.util.concurrent.TimeoutException",
"org.apache.camel.CamelContext",
"org.apache.camel.CamelExecutionException"
] | import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.apache.camel.CamelContext; import org.apache.camel.CamelExecutionException; | import java.util.concurrent.*; import org.apache.camel.*; | [
"java.util",
"org.apache.camel"
] | java.util; org.apache.camel; | 485,679 |
void replayWALCompactionMarker(CompactionDescriptor compaction, boolean pickCompactionFiles,
boolean removeFiles, long replaySeqId)
throws IOException {
try {
checkTargetRegion(compaction.getEncodedRegionName().toByteArray(),
"Compaction marker from WAL ", compaction);
} catch (WrongRegionException wre) {
if (RegionReplicaUtil.isDefaultReplica(this.getRegionInfo())) {
// skip the compaction marker since it is not for this region
return;
}
throw wre;
}
synchronized (writestate) {
if (replaySeqId < lastReplayedOpenRegionSeqId) {
LOG.warn(getRegionInfo().getEncodedName() + " : "
+ "Skipping replaying compaction event :" + TextFormat.shortDebugString(compaction)
+ " because its sequence id " + replaySeqId + " is smaller than this regions "
+ "lastReplayedOpenRegionSeqId of " + lastReplayedOpenRegionSeqId);
return;
}
if (replaySeqId < lastReplayedCompactionSeqId) {
LOG.warn(getRegionInfo().getEncodedName() + " : "
+ "Skipping replaying compaction event :" + TextFormat.shortDebugString(compaction)
+ " because its sequence id " + replaySeqId + " is smaller than this regions "
+ "lastReplayedCompactionSeqId of " + lastReplayedCompactionSeqId);
return;
} else {
lastReplayedCompactionSeqId = replaySeqId;
}
if (LOG.isDebugEnabled()) {
LOG.debug(getRegionInfo().getEncodedName() + " : "
+ "Replaying compaction marker " + TextFormat.shortDebugString(compaction)
+ " with seqId=" + replaySeqId + " and lastReplayedOpenRegionSeqId="
+ lastReplayedOpenRegionSeqId);
}
startRegionOperation(Operation.REPLAY_EVENT);
try {
HStore store = this.getHStore(compaction.getFamilyName().toByteArray());
if (store == null) {
LOG.warn(getRegionInfo().getEncodedName() + " : "
+ "Found Compaction WAL edit for deleted family:"
+ Bytes.toString(compaction.getFamilyName().toByteArray()));
return;
}
store.replayCompactionMarker(compaction, pickCompactionFiles, removeFiles);
logRegionFiles();
} catch (FileNotFoundException ex) {
LOG.warn(getRegionInfo().getEncodedName() + " : "
+ "At least one of the store files in compaction: "
+ TextFormat.shortDebugString(compaction)
+ " doesn't exist any more. Skip loading the file(s)", ex);
} finally {
closeRegionOperation(Operation.REPLAY_EVENT);
}
}
} | void replayWALCompactionMarker(CompactionDescriptor compaction, boolean pickCompactionFiles, boolean removeFiles, long replaySeqId) throws IOException { try { checkTargetRegion(compaction.getEncodedRegionName().toByteArray(), STR, compaction); } catch (WrongRegionException wre) { if (RegionReplicaUtil.isDefaultReplica(this.getRegionInfo())) { return; } throw wre; } synchronized (writestate) { if (replaySeqId < lastReplayedOpenRegionSeqId) { LOG.warn(getRegionInfo().getEncodedName() + STR + STR + TextFormat.shortDebugString(compaction) + STR + replaySeqId + STR + STR + lastReplayedOpenRegionSeqId); return; } if (replaySeqId < lastReplayedCompactionSeqId) { LOG.warn(getRegionInfo().getEncodedName() + STR + STR + TextFormat.shortDebugString(compaction) + STR + replaySeqId + STR + STR + lastReplayedCompactionSeqId); return; } else { lastReplayedCompactionSeqId = replaySeqId; } if (LOG.isDebugEnabled()) { LOG.debug(getRegionInfo().getEncodedName() + STR + STR + TextFormat.shortDebugString(compaction) + STR + replaySeqId + STR + lastReplayedOpenRegionSeqId); } startRegionOperation(Operation.REPLAY_EVENT); try { HStore store = this.getHStore(compaction.getFamilyName().toByteArray()); if (store == null) { LOG.warn(getRegionInfo().getEncodedName() + STR + STR + Bytes.toString(compaction.getFamilyName().toByteArray())); return; } store.replayCompactionMarker(compaction, pickCompactionFiles, removeFiles); logRegionFiles(); } catch (FileNotFoundException ex) { LOG.warn(getRegionInfo().getEncodedName() + STR + STR + TextFormat.shortDebugString(compaction) + STR, ex); } finally { closeRegionOperation(Operation.REPLAY_EVENT); } } } | /**
* Call to complete a compaction. Its for the case where we find in the WAL a compaction
* that was not finished. We could find one recovering a WAL after a regionserver crash.
* See HBASE-2331.
*/ | Call to complete a compaction. Its for the case where we find in the WAL a compaction that was not finished. We could find one recovering a WAL after a regionserver crash. See HBASE-2331 | replayWALCompactionMarker | {
"repo_name": "gustavoanatoly/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java",
"license": "apache-2.0",
"size": 328407
} | [
"java.io.FileNotFoundException",
"java.io.IOException",
"org.apache.hadoop.hbase.client.RegionReplicaUtil",
"org.apache.hadoop.hbase.shaded.com.google.protobuf.TextFormat",
"org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos",
"org.apache.hadoop.hbase.util.Bytes"
] | import java.io.FileNotFoundException; import java.io.IOException; import org.apache.hadoop.hbase.client.RegionReplicaUtil; import org.apache.hadoop.hbase.shaded.com.google.protobuf.TextFormat; import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos; import org.apache.hadoop.hbase.util.Bytes; | import java.io.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.shaded.com.google.protobuf.*; import org.apache.hadoop.hbase.shaded.protobuf.generated.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,503,261 |
@BeanTagAttribute(name = "literal")
public String getLiteral() {
return literal;
} | @BeanTagAttribute(name = STR) String function() { return literal; } | /**
* Gets the literalString attribute.
*
* @return Returns the literal String.
*/ | Gets the literalString attribute | getLiteral | {
"repo_name": "ricepanda/rice-git3",
"path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/datadictionary/mask/MaskFormatterLiteral.java",
"license": "apache-2.0",
"size": 2043
} | [
"org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute"
] | import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute; | import org.kuali.rice.krad.datadictionary.parse.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 233,564 |
public MessageBytes getUniqueValue(String name) {
MessageBytes result = null;
for (int i = 0; i < count; i++) {
if (headers[i].getName().equalsIgnoreCase(name)) {
if (result == null) {
result = headers[i].getValue();
} else {
throw new IllegalArgumentException();
}
}
}
return result;
} | MessageBytes function(String name) { MessageBytes result = null; for (int i = 0; i < count; i++) { if (headers[i].getName().equalsIgnoreCase(name)) { if (result == null) { result = headers[i].getValue(); } else { throw new IllegalArgumentException(); } } } return result; } | /**
* Finds and returns a unique header field with the given name. If no such
* field exists, null is returned. If the specified header field is not
* unique then an {@link IllegalArgumentException} is thrown.
*/ | Finds and returns a unique header field with the given name. If no such field exists, null is returned. If the specified header field is not unique then an <code>IllegalArgumentException</code> is thrown | getUniqueValue | {
"repo_name": "plumer/codana",
"path": "tomcat_files/7.0.0/MimeHeaders.java",
"license": "mit",
"size": 14322
} | [
"org.apache.tomcat.util.buf.MessageBytes"
] | import org.apache.tomcat.util.buf.MessageBytes; | import org.apache.tomcat.util.buf.*; | [
"org.apache.tomcat"
] | org.apache.tomcat; | 2,295,243 |
public String toString(Locale locale, Messages messages);
String getKind();
static class LocalizedString implements Formattable {
String key;
public LocalizedString(String key) {
this.key = key;
} | String toString(Locale locale, Messages messages); String function(); static class LocalizedString implements Formattable { String key; public LocalizedString(String key) { this.key = key; } | /**
* Retrieve a pretty name of this object's kind
* @return a string representing the object's kind
*/ | Retrieve a pretty name of this object's kind | getKind | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java",
"license": "mit",
"size": 2727
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 2,240,123 |
public WireFeed build(org.w3c.dom.Document document) throws IllegalArgumentException,FeedException {
DOMBuilder domBuilder = new DOMBuilder();
try {
Document jdomDoc = domBuilder.build(document);
return build(jdomDoc);
}
catch (Exception ex) {
throw new ParsingFeedException("Invalid XML",ex);
}
} | WireFeed function(org.w3c.dom.Document document) throws IllegalArgumentException,FeedException { DOMBuilder domBuilder = new DOMBuilder(); try { Document jdomDoc = domBuilder.build(document); return build(jdomDoc); } catch (Exception ex) { throw new ParsingFeedException(STR,ex); } } | /**
* Builds an WireFeed (RSS or Atom) from an W3C DOM document.
* <p>
* NOTE: This method delages to the 'AsbtractFeed WireFeedInput#build(org.jdom.Document)'.
* <p>
* @param document W3C DOM document to read to create the WireFeed.
* @return the WireFeed read from the W3C DOM document.
* @throws IllegalArgumentException thrown if feed type could not be understood by any of the underlying parsers.
* @throws FeedException if the feed could not be parsed
*
*/ | Builds an WireFeed (RSS or Atom) from an W3C DOM document. | build | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "georss/rome-0.9/src/java/com/sun/syndication/io/WireFeedInput.java",
"license": "gpl-2.0",
"size": 11348
} | [
"com.sun.syndication.feed.WireFeed",
"org.jdom.Document",
"org.jdom.input.DOMBuilder"
] | import com.sun.syndication.feed.WireFeed; import org.jdom.Document; import org.jdom.input.DOMBuilder; | import com.sun.syndication.feed.*; import org.jdom.*; import org.jdom.input.*; | [
"com.sun.syndication",
"org.jdom",
"org.jdom.input"
] | com.sun.syndication; org.jdom; org.jdom.input; | 148,040 |
@SuppressWarnings("unchecked")
@Nullable
public <T> T fromYaml(InputStream input, Class<T> type)
{
return (T) this.loadFromReader(new StreamReader(new UnicodeReader(input)), type);
} | @SuppressWarnings(STR) <T> T function(InputStream input, Class<T> type) { return (T) this.loadFromReader(new StreamReader(new UnicodeReader(input)), type); } | /**
* Parse the only YAML document in a stream and produce the corresponding
* Java object.
*
* @param <T>
* Class is defined by the second argument
* @param input
* data to load from (BOM is respected and removed)
* @param type
* Class of the object to be created
*
* @return parsed object
*/ | Parse the only YAML document in a stream and produce the corresponding Java object | fromYaml | {
"repo_name": "GotoFinal/diorite-configs-java8",
"path": "src/main/java/org/diorite/config/serialization/snakeyaml/Yaml.java",
"license": "mit",
"size": 33096
} | [
"java.io.InputStream",
"org.yaml.snakeyaml.reader.StreamReader",
"org.yaml.snakeyaml.reader.UnicodeReader"
] | import java.io.InputStream; import org.yaml.snakeyaml.reader.StreamReader; import org.yaml.snakeyaml.reader.UnicodeReader; | import java.io.*; import org.yaml.snakeyaml.reader.*; | [
"java.io",
"org.yaml.snakeyaml"
] | java.io; org.yaml.snakeyaml; | 1,599,244 |
Set<Long> getAllLeaderUserIds(Long toolSessionId, Integer learnerId); | Set<Long> getAllLeaderUserIds(Long toolSessionId, Integer learnerId); | /**
* Returns all leaders available in the nearest leader selection tool (that is all leaders in all sessions).
*
* @param toolSessionId
* @param learnerId
* @return
*/ | Returns all leaders available in the nearest leader selection tool (that is all leaders in all sessions) | getAllLeaderUserIds | {
"repo_name": "lamsfoundation/lams",
"path": "lams_common/src/java/org/lamsfoundation/lams/tool/service/ILamsToolService.java",
"license": "gpl-2.0",
"size": 9187
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,506,931 |
public ServiceResponse<Boolean> getFalse() throws ErrorException, IOException {
Call<ResponseBody> call = service.getFalse();
return getFalseDelegate(call.execute());
} | ServiceResponse<Boolean> function() throws ErrorException, IOException { Call<ResponseBody> call = service.getFalse(); return getFalseDelegate(call.execute()); } | /**
* Get false Boolean value.
*
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @return the boolean object wrapped in {@link ServiceResponse} if successful.
*/ | Get false Boolean value | getFalse | {
"repo_name": "sharadagarwal/autorest",
"path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyboolean/BoolOperationsImpl.java",
"license": "mit",
"size": 14870
} | [
"com.microsoft.rest.ServiceResponse",
"java.io.IOException"
] | import com.microsoft.rest.ServiceResponse; import java.io.IOException; | import com.microsoft.rest.*; import java.io.*; | [
"com.microsoft.rest",
"java.io"
] | com.microsoft.rest; java.io; | 2,119,602 |
public void testConstructor4() {
try {
Integer[] ints = new Integer[SIZE];
COWNavigableSet q = new COWNavigableSet(Arrays.asList(ints));
shouldThrow();
} catch (NullPointerException success) {}
} | void function() { try { Integer[] ints = new Integer[SIZE]; COWNavigableSet q = new COWNavigableSet(Arrays.asList(ints)); shouldThrow(); } catch (NullPointerException success) {} } | /**
* Initializing from Collection of null elements throws NPE
*/ | Initializing from Collection of null elements throws NPE | testConstructor4 | {
"repo_name": "kumarrus/voltdb",
"path": "tests/frontend/org/voltcore/utils/TestCOWNavigableSet.java",
"license": "agpl-3.0",
"size": 31268
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 174,964 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
projectNameLabel = new javax.swing.JLabel();
projectNameTextField = new javax.swing.JTextField();
projectLocationLabel = new javax.swing.JLabel();
projectLocationTextField = new javax.swing.JTextField();
browseButton = new javax.swing.JButton();
createdFolderLabel = new javax.swing.JLabel();
createdFolderTextField = new javax.swing.JTextField();
jSeparator1 = new javax.swing.JSeparator();
addressLabel = new javax.swing.JLabel();
addressTextField = new javax.swing.JTextField();
portLabel = new javax.swing.JLabel();
portSpinner = new javax.swing.JSpinner();
loginLabel = new javax.swing.JLabel();
loginTextField = new javax.swing.JTextField();
passwordLabel = new javax.swing.JLabel();
passwordField = new javax.swing.JPasswordField();
org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel, org.openide.util.NbBundle.getMessage(CacheProjectVisualPanel1.class, "CacheProjectVisualPanel1.projectNameLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(projectLocationLabel, org.openide.util.NbBundle.getMessage(CacheProjectVisualPanel1.class, "CacheProjectVisualPanel1.projectLocationLabel.text")); // NOI18N | void function() { projectNameLabel = new javax.swing.JLabel(); projectNameTextField = new javax.swing.JTextField(); projectLocationLabel = new javax.swing.JLabel(); projectLocationTextField = new javax.swing.JTextField(); browseButton = new javax.swing.JButton(); createdFolderLabel = new javax.swing.JLabel(); createdFolderTextField = new javax.swing.JTextField(); jSeparator1 = new javax.swing.JSeparator(); addressLabel = new javax.swing.JLabel(); addressTextField = new javax.swing.JTextField(); portLabel = new javax.swing.JLabel(); portSpinner = new javax.swing.JSpinner(); loginLabel = new javax.swing.JLabel(); loginTextField = new javax.swing.JTextField(); passwordLabel = new javax.swing.JLabel(); passwordField = new javax.swing.JPasswordField(); org.openide.awt.Mnemonics.setLocalizedText(projectNameLabel, org.openide.util.NbBundle.getMessage(CacheProjectVisualPanel1.class, STR)); org.openide.awt.Mnemonics.setLocalizedText(projectLocationLabel, org.openide.util.NbBundle.getMessage(CacheProjectVisualPanel1.class, STR)); | /**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/ | This method is called from within the constructor to initialize the form. regenerated by the Form Editor | initComponents | {
"repo_name": "daimor/NBStudio",
"path": "NBStudioCore/src/org/nbstudio/project/CacheProjectVisualPanel1.java",
"license": "mit",
"size": 18665
} | [
"javax.swing.JSpinner"
] | import javax.swing.JSpinner; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,743,398 |
private Map<String, Method> validateMethods(Validator<?> validator) {
// check: only "public static" or synthetic methods
Map<String, Method> factoryMethods = new HashMap<String, Method>();
for (Method method : javaClass.getDeclaredMethods()) {
if (method.isSynthetic()) {
// skip synthetic methods
continue;
}
ClassExecutableValidator v = new ClassExecutableValidator(method);
if (factoryMethods.get(method.getName()) != null) {
v.addError("The method must have a unique name");
}
v.withModifiers(Modifier.PUBLIC | Modifier.STATIC);
v.withoutModifiers(Modifier.ABSTRACT | Modifier.FINAL | Modifier.NATIVE);
factoryMethods.put(method.getName(), method);
validator.addChildIfInvalid(v);
}
return factoryMethods;
} | Map<String, Method> function(Validator<?> validator) { Map<String, Method> factoryMethods = new HashMap<String, Method>(); for (Method method : javaClass.getDeclaredMethods()) { if (method.isSynthetic()) { continue; } ClassExecutableValidator v = new ClassExecutableValidator(method); if (factoryMethods.get(method.getName()) != null) { v.addError(STR); } v.withModifiers(Modifier.PUBLIC Modifier.STATIC); v.withoutModifiers(Modifier.ABSTRACT Modifier.FINAL Modifier.NATIVE); factoryMethods.put(method.getName(), method); validator.addChildIfInvalid(v); } return factoryMethods; } | /**
* Validates methods of the class.
*
* @param validationContext
* a validation context
* @return a map containing the input factory methods by their name
*/ | Validates methods of the class | validateMethods | {
"repo_name": "SETTE-Testing/sette-tool",
"path": "src/sette-core/src/hu/bme/mit/sette/core/model/snippet/SnippetInputFactoryContainer.java",
"license": "apache-2.0",
"size": 8142
} | [
"hu.bme.mit.sette.core.validator.ClassExecutableValidator",
"hu.bme.mit.sette.core.validator.Validator",
"java.lang.reflect.Method",
"java.lang.reflect.Modifier",
"java.util.HashMap",
"java.util.Map"
] | import hu.bme.mit.sette.core.validator.ClassExecutableValidator; import hu.bme.mit.sette.core.validator.Validator; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Map; | import hu.bme.mit.sette.core.validator.*; import java.lang.reflect.*; import java.util.*; | [
"hu.bme.mit",
"java.lang",
"java.util"
] | hu.bme.mit; java.lang; java.util; | 1,545,531 |
JdbcTemplate jdbcTemplate = new JdbcTemplate(new SingleConnectionDataSource(connection, true));
SQLExceptionTranslator origExceptionTranslator = jdbcTemplate.getExceptionTranslator();
for (SqlCommand command : commands) {
if (command.canHandleInJdbcTemplate()) {
command.handle(jdbcTemplate, connection);
}
else {
if(!ObjectUtils.isEmpty(command.getSuppressedErrorCodes())) {
jdbcTemplate.setExceptionTranslator(new SuppressSQLErrorCodesTranslator(command.getSuppressedErrorCodes()));
}
try {
logger.debug("Executing command {}", command.getCommand());
jdbcTemplate.execute(command.getCommand());
} catch (SuppressDataAccessException e) {
logger.debug("Suppressing error {}", e);
}
// restore original translator in case next command
// doesn't define suppressing codes.
jdbcTemplate.setExceptionTranslator(origExceptionTranslator);
}
}
} | JdbcTemplate jdbcTemplate = new JdbcTemplate(new SingleConnectionDataSource(connection, true)); SQLExceptionTranslator origExceptionTranslator = jdbcTemplate.getExceptionTranslator(); for (SqlCommand command : commands) { if (command.canHandleInJdbcTemplate()) { command.handle(jdbcTemplate, connection); } else { if(!ObjectUtils.isEmpty(command.getSuppressedErrorCodes())) { jdbcTemplate.setExceptionTranslator(new SuppressSQLErrorCodesTranslator(command.getSuppressedErrorCodes())); } try { logger.debug(STR, command.getCommand()); jdbcTemplate.execute(command.getCommand()); } catch (SuppressDataAccessException e) { logger.debug(STR, e); } jdbcTemplate.setExceptionTranslator(origExceptionTranslator); } } } | /**
* Execute list of {@code SqlCommand} by suppressing errors if those are given
* with a command.
*
* @param connection the connection
* @param commands the sql commands
*/ | Execute list of SqlCommand by suppressing errors if those are given with a command | execute | {
"repo_name": "dturanski/spring-cloud-data",
"path": "spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/db/migration/SqlCommandsRunner.java",
"license": "apache-2.0",
"size": 2461
} | [
"org.springframework.jdbc.core.JdbcTemplate",
"org.springframework.jdbc.datasource.SingleConnectionDataSource",
"org.springframework.jdbc.support.SQLExceptionTranslator",
"org.springframework.util.ObjectUtils"
] | import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.SingleConnectionDataSource; import org.springframework.jdbc.support.SQLExceptionTranslator; import org.springframework.util.ObjectUtils; | import org.springframework.jdbc.core.*; import org.springframework.jdbc.datasource.*; import org.springframework.jdbc.support.*; import org.springframework.util.*; | [
"org.springframework.jdbc",
"org.springframework.util"
] | org.springframework.jdbc; org.springframework.util; | 1,877,283 |
public List<AdditionalColumns> additionalColumns() {
return this.additionalColumns;
} | List<AdditionalColumns> function() { return this.additionalColumns; } | /**
* Get specifies the additional columns to be added to source data. Type: array of objects (or Expression with resultType array of objects).
*
* @return the additionalColumns value
*/ | Get specifies the additional columns to be added to source data. Type: array of objects (or Expression with resultType array of objects) | additionalColumns | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/datafactory/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/datafactory/v2018_06_01/TabularSource.java",
"license": "mit",
"size": 7300
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,740,038 |
private boolean tryTransition(int possibleStates, int nextState) {
if (isState(possibleStates)) {
Logger.global.finer(name(fState) + " > " + name(nextState) + " (" + name(possibleStates) + ")");
fState= nextState;
return true;
}
Logger.global.finest("noTransition" + name(fState) + " !> " + name(nextState) + " (" + name(possibleStates) + ")");
return false;
} | boolean function(int possibleStates, int nextState) { if (isState(possibleStates)) { Logger.global.finer(name(fState) + STR + name(nextState) + STR + name(possibleStates) + ")"); fState= nextState; return true; } Logger.global.finest(STR + name(fState) + STR + name(nextState) + STR + name(possibleStates) + ")"); return false; } | /**
* Transitions to <code>nextState</code> if the current state is one of
* <code>possibleStates</code>. Returns <code>true</code> if the
* transition happened, <code>false</code> otherwise.
*
* @param possibleStates the states which trigger a transition
* @param nextState the state to transition to
* @return <code>true</code> if the transition happened,
* <code>false</code> otherwise
*/ | Transitions to <code>nextState</code> if the current state is one of <code>possibleStates</code>. Returns <code>true</code> if the transition happened, <code>false</code> otherwise | tryTransition | {
"repo_name": "maxeler/eclipse",
"path": "eclipse.jdt.ui/org.eclipse.jdt.ui.tests/test plugin/org/eclipse/jdt/testplugin/util/DisplayHelper.java",
"license": "epl-1.0",
"size": 16992
} | [
"java.util.logging.Logger"
] | import java.util.logging.Logger; | import java.util.logging.*; | [
"java.util"
] | java.util; | 1,002,049 |
@Test
public void testPropSet() throws Exception {
this.subversionApi.checkout(DtoFactory.getInstance()
.createDto(CheckoutRequest.class)
.withProjectPath(tmpAbsolutePath)
.withUrl(repoUrl));
CLIOutputResponse response = this.subversionApi.propset(DtoFactory.getInstance().createDto(PropertySetRequest.class)
.withValue("'*.*'")
.withProjectPath(tmpAbsolutePath)
.withPath("trunk/A/B")
.withForce(true)
.withDepth(Depth.DIRS_ONLY)
.withName("svn:ignore"));
assertEquals(response.getOutput().size(), 1);
assertEquals(response.getOutput().get(0), "property 'svn:ignore' set on 'trunk" + File.separator + "A" + File.separator + "B'");
} | void function() throws Exception { this.subversionApi.checkout(DtoFactory.getInstance() .createDto(CheckoutRequest.class) .withProjectPath(tmpAbsolutePath) .withUrl(repoUrl)); CLIOutputResponse response = this.subversionApi.propset(DtoFactory.getInstance().createDto(PropertySetRequest.class) .withValue("'*.*'") .withProjectPath(tmpAbsolutePath) .withPath(STR) .withForce(true) .withDepth(Depth.DIRS_ONLY) .withName(STR)); assertEquals(response.getOutput().size(), 1); assertEquals(response.getOutput().get(0), STR + File.separator + "A" + File.separator + "B'"); } | /**
* Tests for {@link SubversionApi#propset(org.eclipse.che.plugin.svn.shared.PropertySetRequest)}.
*
* @throws Exception
* if anything goes wrong
*/ | Tests for <code>SubversionApi#propset(org.eclipse.che.plugin.svn.shared.PropertySetRequest)</code> | testPropSet | {
"repo_name": "gazarenkov/che-sketch",
"path": "plugins/plugin-svn/che-plugin-svn-ext-server/src/test/java/org/eclipse/che/plugin/svn/server/SubversionApiITest.java",
"license": "epl-1.0",
"size": 18182
} | [
"java.io.File",
"org.eclipse.che.dto.server.DtoFactory",
"org.eclipse.che.plugin.svn.shared.CLIOutputResponse",
"org.eclipse.che.plugin.svn.shared.CheckoutRequest",
"org.eclipse.che.plugin.svn.shared.Depth",
"org.eclipse.che.plugin.svn.shared.PropertySetRequest",
"org.junit.Assert"
] | import java.io.File; import org.eclipse.che.dto.server.DtoFactory; import org.eclipse.che.plugin.svn.shared.CLIOutputResponse; import org.eclipse.che.plugin.svn.shared.CheckoutRequest; import org.eclipse.che.plugin.svn.shared.Depth; import org.eclipse.che.plugin.svn.shared.PropertySetRequest; import org.junit.Assert; | import java.io.*; import org.eclipse.che.dto.server.*; import org.eclipse.che.plugin.svn.shared.*; import org.junit.*; | [
"java.io",
"org.eclipse.che",
"org.junit"
] | java.io; org.eclipse.che; org.junit; | 2,663,522 |
public List<assessment_whvalues_whcriterion> findBywhvalues_id(
long whvalues_id) throws SystemException {
return findBywhvalues_id(whvalues_id, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, null);
} | List<assessment_whvalues_whcriterion> function( long whvalues_id) throws SystemException { return findBywhvalues_id(whvalues_id, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } | /**
* Returns all the assessment_whvalues_whcriterions where whvalues_id = ?.
*
* @param whvalues_id the whvalues_id
* @return the matching assessment_whvalues_whcriterions
* @throws SystemException if a system exception occurred
*/ | Returns all the assessment_whvalues_whcriterions where whvalues_id = ? | findBywhvalues_id | {
"repo_name": "iucn-whp/world-heritage-outlook",
"path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/src/com/iucn/whp/dbservice/service/persistence/assessment_whvalues_whcriterionPersistenceImpl.java",
"license": "gpl-2.0",
"size": 56219
} | [
"com.liferay.portal.kernel.dao.orm.QueryUtil",
"com.liferay.portal.kernel.exception.SystemException",
"java.util.List"
] | import com.liferay.portal.kernel.dao.orm.QueryUtil; import com.liferay.portal.kernel.exception.SystemException; import java.util.List; | import com.liferay.portal.kernel.dao.orm.*; import com.liferay.portal.kernel.exception.*; import java.util.*; | [
"com.liferay.portal",
"java.util"
] | com.liferay.portal; java.util; | 1,053,444 |
public List<JSONEntity> entities() {
return this.entities;
} | List<JSONEntity> function() { return this.entities; } | /**
* Get the entities value.
*
* @return the entities value
*/ | Get the entities value | entities | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/cognitiveservices/ms-azure-cs-luis-authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/models/JSONUtterance.java",
"license": "mit",
"size": 2052
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,758,603 |
public static void assertFileExists(File file)
{
assertTrue("File or directory " + file + " expected but not found", file.exists());
} | static void function(File file) { assertTrue(STR + file + STR, file.exists()); } | /**
* Verifies that a file exists.
*
* @param file the file
*/ | Verifies that a file exists | assertFileExists | {
"repo_name": "Murdock01/izpack",
"path": "izpack-test-common/src/main/java/com/izforge/izpack/test/util/TestHelper.java",
"license": "apache-2.0",
"size": 4592
} | [
"java.io.File",
"org.junit.Assert"
] | import java.io.File; import org.junit.Assert; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 2,068,108 |
public Adapter createObjectAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for an object of class '{@link LRBAC2.Object <em>Object</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see LRBAC2.Object
* @generated
*/ | Creates a new adapter for an object of class '<code>LRBAC2.Object Object</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. | createObjectAdapter | {
"repo_name": "arnobl/kompren",
"path": "kompren-examples/LRBAC2.model/src/LRBAC2/util/LRBAC2AdapterFactory.java",
"license": "epl-1.0",
"size": 8165
} | [
"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; | 1,449,395 |
protected void sequence_SimpleGroup(ISerializationContext context, SimpleGroup semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, SequencertestPackage.Literals.SIMPLE_GROUP__VAL1) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SequencertestPackage.Literals.SIMPLE_GROUP__VAL1));
if (transientValues.isValueTransient(semanticObject, SequencertestPackage.Literals.SIMPLE_GROUP__VAL2) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SequencertestPackage.Literals.SIMPLE_GROUP__VAL2));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getSimpleGroupAccess().getVal1IDTerminalRuleCall_1_0(), semanticObject.getVal1());
feeder.accept(grammarAccess.getSimpleGroupAccess().getVal2IDTerminalRuleCall_2_0(), semanticObject.getVal2());
feeder.finish();
}
| void function(ISerializationContext context, SimpleGroup semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, SequencertestPackage.Literals.SIMPLE_GROUP__VAL1) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SequencertestPackage.Literals.SIMPLE_GROUP__VAL1)); if (transientValues.isValueTransient(semanticObject, SequencertestPackage.Literals.SIMPLE_GROUP__VAL2) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SequencertestPackage.Literals.SIMPLE_GROUP__VAL2)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getSimpleGroupAccess().getVal1IDTerminalRuleCall_1_0(), semanticObject.getVal1()); feeder.accept(grammarAccess.getSimpleGroupAccess().getVal2IDTerminalRuleCall_2_0(), semanticObject.getVal2()); feeder.finish(); } | /**
* Contexts:
* SimpleGroup returns SimpleGroup
*
* Constraint:
* (val1=ID val2=ID)
*/ | Contexts: SimpleGroup returns SimpleGroup Constraint: (val1=ID val2=ID) | sequence_SimpleGroup | {
"repo_name": "miklossy/xtext-core",
"path": "org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/serializer/serializer/SequencerTestLanguageSemanticSequencer.java",
"license": "epl-1.0",
"size": 39304
} | [
"org.eclipse.xtext.serializer.ISerializationContext",
"org.eclipse.xtext.serializer.acceptor.SequenceFeeder",
"org.eclipse.xtext.serializer.sequencer.ITransientValueService",
"org.eclipse.xtext.serializer.sequencertest.SequencertestPackage",
"org.eclipse.xtext.serializer.sequencertest.SimpleGroup"
] | import org.eclipse.xtext.serializer.ISerializationContext; import org.eclipse.xtext.serializer.acceptor.SequenceFeeder; import org.eclipse.xtext.serializer.sequencer.ITransientValueService; import org.eclipse.xtext.serializer.sequencertest.SequencertestPackage; import org.eclipse.xtext.serializer.sequencertest.SimpleGroup; | import org.eclipse.xtext.serializer.*; import org.eclipse.xtext.serializer.acceptor.*; import org.eclipse.xtext.serializer.sequencer.*; import org.eclipse.xtext.serializer.sequencertest.*; | [
"org.eclipse.xtext"
] | org.eclipse.xtext; | 1,688,695 |
public void setLineWidth(float width) {
if (width < 0.2f)
width = 0.2f;
if (width > 10.0f)
width = 10.0f;
mLineWidth = Utils.convertDpToPixel(width);
} | void function(float width) { if (width < 0.2f) width = 0.2f; if (width > 10.0f) width = 10.0f; mLineWidth = Utils.convertDpToPixel(width); } | /**
* set the line width of the chart (min = 0.2f, max = 10f); default 1f NOTE:
* thinner line == better performance, thicker line == worse performance
*
* @param width
*/ | thinner line == better performance, thicker line == worse performance | setLineWidth | {
"repo_name": "codezork/BlueNodes",
"path": "mobile/bluenodes/src/main/java/com/github/mikephil/charting/data/LineRadarDataSet.java",
"license": "apache-2.0",
"size": 2782
} | [
"com.github.mikephil.charting.utils.Utils"
] | import com.github.mikephil.charting.utils.Utils; | import com.github.mikephil.charting.utils.*; | [
"com.github.mikephil"
] | com.github.mikephil; | 387,419 |
//
// Use the stale flag method to identify if we should re-generate the java source code from the supplied
// Xml Schema. Basically, we should regenerate the JAXB code if:
//
// a) The staleFile does not exist
// b) The staleFile exists and is older than one of the sources (XSD or XJB files).
// "Older" is determined by comparing the modification timestamp of the staleFile and the source files.
//
final File staleFile = getStaleFile();
final String debugPrefix = "StaleFile [" + FileSystemUtilities.getCanonicalPath(staleFile) + "]";
boolean stale = !staleFile.exists();
if (stale) {
getLog().debug(debugPrefix + " not found. JAXB (re-)generation required.");
} else {
final List<URL> sourceXSDs = getSources();
final List<File> sourceXJBs = getSourceXJBs();
if (getLog().isDebugEnabled()) {
getLog().debug(debugPrefix + " found. Checking timestamps on source XSD and XJB "
+ "files to determine if JAXB (re-)generation is required.");
}
final long staleFileLastModified = staleFile.lastModified();
for (URL current : sourceXSDs) {
final URLConnection sourceXsdConnection;
try {
sourceXsdConnection = current.openConnection();
sourceXsdConnection.connect();
} catch (Exception e) {
// Can't determine if the staleFile is younger than this sourceXSD.
// Re-generate to be on the safe side.
stale = true;
break;
}
try {
if (sourceXsdConnection.getLastModified() > staleFileLastModified) {
if (getLog().isDebugEnabled()) {
getLog().debug(current.toString() + " is newer than the stale flag file.");
}
stale = true;
}
} finally {
if (sourceXsdConnection instanceof HttpURLConnection) {
((HttpURLConnection) sourceXsdConnection).disconnect();
}
}
}
for (File current : sourceXJBs) {
if (current.lastModified() > staleFileLastModified) {
if (getLog().isDebugEnabled()) {
getLog().debug(FileSystemUtilities.getCanonicalPath(current)
+ " is newer than the stale flag file.");
}
stale = true;
break;
}
}
}
// All done.
return stale;
}
/**
* {@inheritDoc} | final String debugPrefix = STR + FileSystemUtilities.getCanonicalPath(staleFile) + "]"; boolean stale = !staleFile.exists(); if (stale) { getLog().debug(debugPrefix + STR); } else { final List<URL> sourceXSDs = getSources(); final List<File> sourceXJBs = getSourceXJBs(); if (getLog().isDebugEnabled()) { getLog().debug(debugPrefix + STR + STR); } final long staleFileLastModified = staleFile.lastModified(); for (URL current : sourceXSDs) { final URLConnection sourceXsdConnection; try { sourceXsdConnection = current.openConnection(); sourceXsdConnection.connect(); } catch (Exception e) { stale = true; break; } try { if (sourceXsdConnection.getLastModified() > staleFileLastModified) { if (getLog().isDebugEnabled()) { getLog().debug(current.toString() + STR); } stale = true; } } finally { if (sourceXsdConnection instanceof HttpURLConnection) { ((HttpURLConnection) sourceXsdConnection).disconnect(); } } } for (File current : sourceXJBs) { if (current.lastModified() > staleFileLastModified) { if (getLog().isDebugEnabled()) { getLog().debug(FileSystemUtilities.getCanonicalPath(current) + STR); } stale = true; break; } } } return stale; } /** * {@inheritDoc} | /**
* <p>Java generation is required if any of the file products is outdated/stale.</p>
* {@inheritDoc}
*/ | Java generation is required if any of the file products is outdated/stale. | isReGenerationRequired | {
"repo_name": "jkupcho/jaxb2-maven-plugin",
"path": "src/main/java/org/codehaus/mojo/jaxb2/javageneration/AbstractJavaGeneratorMojo.java",
"license": "apache-2.0",
"size": 26836
} | [
"java.io.File",
"java.net.HttpURLConnection",
"java.net.URLConnection",
"java.util.List",
"org.codehaus.mojo.jaxb2.shared.FileSystemUtilities"
] | import java.io.File; import java.net.HttpURLConnection; import java.net.URLConnection; import java.util.List; import org.codehaus.mojo.jaxb2.shared.FileSystemUtilities; | import java.io.*; import java.net.*; import java.util.*; import org.codehaus.mojo.jaxb2.shared.*; | [
"java.io",
"java.net",
"java.util",
"org.codehaus.mojo"
] | java.io; java.net; java.util; org.codehaus.mojo; | 1,598,357 |
@Override
public void setData_oplaty(Date data_oplaty) {
_oplachennyeZakazy.setData_oplaty(data_oplaty);
} | void function(Date data_oplaty) { _oplachennyeZakazy.setData_oplaty(data_oplaty); } | /**
* Sets the data_oplaty of this oplachennye zakazy.
*
* @param data_oplaty the data_oplaty of this oplachennye zakazy
*/ | Sets the data_oplaty of this oplachennye zakazy | setData_oplaty | {
"repo_name": "falko0000/moduleEProc",
"path": "OplachennyeZakazy/OplachennyeZakazy-api/src/main/java/tj/oplachennye/zakazy/model/OplachennyeZakazyWrapper.java",
"license": "lgpl-2.1",
"size": 10026
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,627,094 |
public void updateAchievement(DBTransaction transaction, Integer id, Achievement achievement) throws SQLException {
String query = "UPDATE achievement SET " +
"identifier = '[identifier]', " +
"title = '[title]', " +
"category = '[category]', " +
"description = '[description]', " +
"base_score = [base_score], " +
"active = [active] " +
"WHERE id = [id];";
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("identifier", achievement.getIdentifier());
parameters.put("title", achievement.getTitle());
parameters.put("category", achievement.getCategory().toString());
parameters.put("description", achievement.getDescription());
parameters.put("base_score", achievement.getBaseScore());
parameters.put("active", achievement.isActive() ? 1 : 0);
parameters.put("id", id);
transaction.execute(query, parameters);
} | void function(DBTransaction transaction, Integer id, Achievement achievement) throws SQLException { String query = STR + STR + STR + STR + STR + STR + STR + STR; Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put(STR, achievement.getIdentifier()); parameters.put("title", achievement.getTitle()); parameters.put(STR, achievement.getCategory().toString()); parameters.put(STR, achievement.getDescription()); parameters.put(STR, achievement.getBaseScore()); parameters.put(STR, achievement.isActive() ? 1 : 0); parameters.put("id", id); transaction.execute(query, parameters); } | /**
* Updates the achievement with the given id
*
* @param transaction DBTransaction
* @param id id of achievement
* @param achievement Achievement
* @throws SQLException in case of an database error
*/ | Updates the achievement with the given id | updateAchievement | {
"repo_name": "AntumDeluge/arianne-stendhal",
"path": "src/games/stendhal/server/core/engine/db/AchievementDAO.java",
"license": "gpl-2.0",
"size": 8112
} | [
"games.stendhal.server.core.rp.achievement.Achievement",
"java.sql.SQLException",
"java.util.HashMap",
"java.util.Map"
] | import games.stendhal.server.core.rp.achievement.Achievement; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; | import games.stendhal.server.core.rp.achievement.*; import java.sql.*; import java.util.*; | [
"games.stendhal.server",
"java.sql",
"java.util"
] | games.stendhal.server; java.sql; java.util; | 1,775,435 |
public IndexShard getShard(int shardId) {
IndexShard indexShard = getShardOrNull(shardId);
if (indexShard == null) {
throw new ShardNotFoundException(new ShardId(index(), shardId));
}
return indexShard;
} | IndexShard function(int shardId) { IndexShard indexShard = getShardOrNull(shardId); if (indexShard == null) { throw new ShardNotFoundException(new ShardId(index(), shardId)); } return indexShard; } | /**
* Return the shard with the provided id, or throw an exception if it doesn't exist.
*/ | Return the shard with the provided id, or throw an exception if it doesn't exist | getShard | {
"repo_name": "mapr/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/index/IndexService.java",
"license": "apache-2.0",
"size": 35512
} | [
"org.elasticsearch.index.shard.IndexShard",
"org.elasticsearch.index.shard.ShardId",
"org.elasticsearch.index.shard.ShardNotFoundException"
] | import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardNotFoundException; | import org.elasticsearch.index.shard.*; | [
"org.elasticsearch.index"
] | org.elasticsearch.index; | 170,853 |
static int getAndCheckPreLongs(final Memory mem) {
final long cap = mem.getCapacity();
if (cap < 8) {
throwNotBigEnough(cap, 8);
}
final int preLongs = extractPreLongs(mem);
final int required = Math.max(preLongs << 3, 8);
if (cap < required) {
throwNotBigEnough(cap, required);
}
return preLongs;
} | static int getAndCheckPreLongs(final Memory mem) { final long cap = mem.getCapacity(); if (cap < 8) { throwNotBigEnough(cap, 8); } final int preLongs = extractPreLongs(mem); final int required = Math.max(preLongs << 3, 8); if (cap < required) { throwNotBigEnough(cap, required); } return preLongs; } | /**
* Checks Memory for capacity to hold the preamble and returns the extracted preLongs.
* @param mem the given Memory
* @return the extracted prelongs value.
*/ | Checks Memory for capacity to hold the preamble and returns the extracted preLongs | getAndCheckPreLongs | {
"repo_name": "DataSketches/sketches-core",
"path": "src/main/java/org/apache/datasketches/theta/PreambleUtil.java",
"license": "apache-2.0",
"size": 22007
} | [
"org.apache.datasketches.memory.Memory"
] | import org.apache.datasketches.memory.Memory; | import org.apache.datasketches.memory.*; | [
"org.apache.datasketches"
] | org.apache.datasketches; | 1,260,791 |
public void fillStatementWithBean(PreparedStatement stmt, Object bean,
PropertyDescriptor[] properties) throws SQLException {
Object[] params = new Object[properties.length];
for (int i = 0; i < properties.length; i++) {
PropertyDescriptor property = properties[i];
Object value = null;
Method method = property.getReadMethod();
if (method == null) {
throw new RuntimeException("No read method for bean property "
+ bean.getClass() + " " + property.getName());
}
try {
value = method.invoke(bean, new Object[0]);
} catch (InvocationTargetException e) {
throw new RuntimeException("Couldn't invoke method: " + method,
e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(
"Couldn't invoke method with 0 arguments: " + method, e);
} catch (IllegalAccessException e) {
throw new RuntimeException("Couldn't invoke method: " + method,
e);
}
params[i] = value;
}
fillStatement(stmt, params);
} | void function(PreparedStatement stmt, Object bean, PropertyDescriptor[] properties) throws SQLException { Object[] params = new Object[properties.length]; for (int i = 0; i < properties.length; i++) { PropertyDescriptor property = properties[i]; Object value = null; Method method = property.getReadMethod(); if (method == null) { throw new RuntimeException(STR + bean.getClass() + " " + property.getName()); } try { value = method.invoke(bean, new Object[0]); } catch (InvocationTargetException e) { throw new RuntimeException(STR + method, e); } catch (IllegalArgumentException e) { throw new RuntimeException( STR + method, e); } catch (IllegalAccessException e) { throw new RuntimeException(STR + method, e); } params[i] = value; } fillStatement(stmt, params); } | /**
* Fill the <code>PreparedStatement</code> replacement parameters with the
* given object's bean property values.
*
* @param stmt
* PreparedStatement to fill
* @param bean
* a JavaBean object
* @param properties
* an ordered array of properties; this gives the order to insert
* values in the statement
* @throws SQLException
* if a database access error occurs
*/ | Fill the <code>PreparedStatement</code> replacement parameters with the given object's bean property values | fillStatementWithBean | {
"repo_name": "reesun/dbutils",
"path": "src/main/java/org/apache/commons/dbutils/AbstractQueryRunner.java",
"license": "apache-2.0",
"size": 15931
} | [
"java.beans.PropertyDescriptor",
"java.lang.reflect.InvocationTargetException",
"java.lang.reflect.Method",
"java.sql.PreparedStatement",
"java.sql.SQLException"
] | import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.sql.PreparedStatement; import java.sql.SQLException; | import java.beans.*; import java.lang.reflect.*; import java.sql.*; | [
"java.beans",
"java.lang",
"java.sql"
] | java.beans; java.lang; java.sql; | 1,627,633 |
private int applyRuleN3()
throws SailException
{
int nofInferred = 0;
Iterator<Statement> it1 = this.newThisIteration.match(null, NRL_InverseProperty, null);
while (it1.hasNext()) {
Statement stmt1 = it1.next();
Resource ppp = stmt1.getSubject();
if(ppp instanceof URI) {
// infer: ppp is a property
boolean addedPPP = addInferredStatement(ppp, RDF.TYPE, RDF.PROPERTY);
if (addedPPP) {
nofInferred++;
}
}
Value qqq = stmt1.getObject();
if(qqq instanceof Resource) {
if(qqq instanceof URI) {
// infer: qqq is a property
boolean addedQQQ = addInferredStatement((URI)qqq, RDF.TYPE, RDF.PROPERTY);
if (addedQQQ) {
nofInferred++;
}
}
if(! qqq.equals(ppp)) {
// infer: qqq inverse ppp
boolean added = addInferredStatement((Resource)qqq, NRL_InverseProperty, ppp);
if (added) {
nofInferred++;
}
}
}
}
return nofInferred;
} | int function() throws SailException { int nofInferred = 0; Iterator<Statement> it1 = this.newThisIteration.match(null, NRL_InverseProperty, null); while (it1.hasNext()) { Statement stmt1 = it1.next(); Resource ppp = stmt1.getSubject(); if(ppp instanceof URI) { boolean addedPPP = addInferredStatement(ppp, RDF.TYPE, RDF.PROPERTY); if (addedPPP) { nofInferred++; } } Value qqq = stmt1.getObject(); if(qqq instanceof Resource) { if(qqq instanceof URI) { boolean addedQQQ = addInferredStatement((URI)qqq, RDF.TYPE, RDF.PROPERTY); if (addedQQQ) { nofInferred++; } } if(! qqq.equals(ppp)) { boolean added = addInferredStatement((Resource)qqq, NRL_InverseProperty, ppp); if (added) { nofInferred++; } } } } return nofInferred; } | /**
* ppp nrl:inverseProperty qqq
* -->
* qqq nrl:inverseProperty ppp
* ppp a rdf:Property
* qqq a rdf:Property
*
* @return
* @throws SailException
*/ | ppp nrl:inverseProperty qqq --> qqq nrl:inverseProperty ppp ppp a rdf:Property qqq a rdf:Property | applyRuleN3 | {
"repo_name": "semweb4j/semweb4j",
"path": "org.semweb4j.sesame.rdfs-inverse-inferencer/src/main/java/org/semweb4j/sesame/ForwardChainingRDFSInferencerConnection.java",
"license": "bsd-2-clause",
"size": 36185
} | [
"java.util.Iterator",
"org.openrdf.model.Resource",
"org.openrdf.model.Statement",
"org.openrdf.model.Value",
"org.openrdf.sail.SailException"
] | import java.util.Iterator; import org.openrdf.model.Resource; import org.openrdf.model.Statement; import org.openrdf.model.Value; import org.openrdf.sail.SailException; | import java.util.*; import org.openrdf.model.*; import org.openrdf.sail.*; | [
"java.util",
"org.openrdf.model",
"org.openrdf.sail"
] | java.util; org.openrdf.model; org.openrdf.sail; | 127,465 |
public void setTrustResolver(AuthenticationTrustResolver trustResolver) {
Assert.notNull(trustResolver, "trustResolver cannot be null");
this.trustResolver = trustResolver;
} | void function(AuthenticationTrustResolver trustResolver) { Assert.notNull(trustResolver, STR); this.trustResolver = trustResolver; } | /**
* Sets the {@link AuthenticationTrustResolver} to be used. The default is
* {@link AuthenticationTrustResolverImpl}.
*
* @param trustResolver the {@link AuthenticationTrustResolver} to use. Cannot be
* null.
*/ | Sets the <code>AuthenticationTrustResolver</code> to be used. The default is <code>AuthenticationTrustResolverImpl</code> | setTrustResolver | {
"repo_name": "thomasdarimont/spring-security",
"path": "web/src/main/java/org/springframework/security/web/access/expression/DefaultWebSecurityExpressionHandler.java",
"license": "apache-2.0",
"size": 3206
} | [
"org.springframework.security.authentication.AuthenticationTrustResolver",
"org.springframework.util.Assert"
] | import org.springframework.security.authentication.AuthenticationTrustResolver; import org.springframework.util.Assert; | import org.springframework.security.authentication.*; import org.springframework.util.*; | [
"org.springframework.security",
"org.springframework.util"
] | org.springframework.security; org.springframework.util; | 553,259 |
void set(BitSet bs); | void set(BitSet bs); | /**
* Copy bits state of source BitSet object to this object
*
* @param bs - BitSet source
*/ | Copy bits state of source BitSet object to this object | set | {
"repo_name": "redisson/redisson",
"path": "redisson/src/main/java/org/redisson/api/RBitSet.java",
"license": "apache-2.0",
"size": 9869
} | [
"java.util.BitSet"
] | import java.util.BitSet; | import java.util.*; | [
"java.util"
] | java.util; | 461,778 |
Map<String,INDArray> paramTable(); | Map<String,INDArray> paramTable(); | /**
* The param table
* @return
*/ | The param table | paramTable | {
"repo_name": "xuzhongxing/deeplearning4j",
"path": "deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/api/Model.java",
"license": "apache-2.0",
"size": 5557
} | [
"java.util.Map",
"org.nd4j.linalg.api.ndarray.INDArray"
] | import java.util.Map; import org.nd4j.linalg.api.ndarray.INDArray; | import java.util.*; import org.nd4j.linalg.api.ndarray.*; | [
"java.util",
"org.nd4j.linalg"
] | java.util; org.nd4j.linalg; | 382,182 |
@SuppressWarnings("unchecked")
protected void fillMap(HashMap<String, ByteIterator> resultMap, DBObject obj) {
Map<String, Object> objMap = obj.toMap();
for (Map.Entry<String, Object> entry : objMap.entrySet()) {
if (entry.getValue() instanceof byte[]) {
resultMap.put(entry.getKey(), new ByteArrayByteIterator(
(byte[]) entry.getValue()));
}
}
} | @SuppressWarnings(STR) void function(HashMap<String, ByteIterator> resultMap, DBObject obj) { Map<String, Object> objMap = obj.toMap(); for (Map.Entry<String, Object> entry : objMap.entrySet()) { if (entry.getValue() instanceof byte[]) { resultMap.put(entry.getKey(), new ByteArrayByteIterator( (byte[]) entry.getValue())); } } } | /**
* TODO - Finish
*
* @param resultMap
* @param obj
*/ | TODO - Finish | fillMap | {
"repo_name": "basicthinker/vm-persistence",
"path": "benchmarks/ycsb/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java",
"license": "gpl-2.0",
"size": 13119
} | [
"com.mongodb.DBObject",
"com.yahoo.ycsb.ByteArrayByteIterator",
"com.yahoo.ycsb.ByteIterator",
"java.util.HashMap",
"java.util.Map"
] | import com.mongodb.DBObject; import com.yahoo.ycsb.ByteArrayByteIterator; import com.yahoo.ycsb.ByteIterator; import java.util.HashMap; import java.util.Map; | import com.mongodb.*; import com.yahoo.ycsb.*; import java.util.*; | [
"com.mongodb",
"com.yahoo.ycsb",
"java.util"
] | com.mongodb; com.yahoo.ycsb; java.util; | 2,716,411 |
public static Thread setDaemonThreadRunning(final Thread t,
final String name, final UncaughtExceptionHandler handler) {
t.setName(name);
if (handler != null) {
t.setUncaughtExceptionHandler(handler);
}
t.setDaemon(true);
t.start();
return t;
} | static Thread function(final Thread t, final String name, final UncaughtExceptionHandler handler) { t.setName(name); if (handler != null) { t.setUncaughtExceptionHandler(handler); } t.setDaemon(true); t.start(); return t; } | /**
* Utility method that sets name, daemon status and starts passed thread.
* @param t
* @param name
* @param handler A handler to set on the thread. Pass null if want to
* use default handler.
* @return Returns the passed Thread <code>t</code>.
*/ | Utility method that sets name, daemon status and starts passed thread | setDaemonThreadRunning | {
"repo_name": "ALEXGUOQ/hbase",
"path": "src/java/org/apache/hadoop/hbase/util/Threads.java",
"license": "apache-2.0",
"size": 2006
} | [
"java.lang.Thread"
] | import java.lang.Thread; | import java.lang.*; | [
"java.lang"
] | java.lang; | 1,302,392 |
public void removePropertyChangeListener( String property,
PropertyChangeListener listener ) {
this.pcs.removePropertyChangeListener( property, listener );
}
| void function( String property, PropertyChangeListener listener ) { this.pcs.removePropertyChangeListener( property, listener ); } | /**
* Remove a listener from a specified events
*
* @param property
* a name of the property
* @param listener
* listener to remove
*/ | Remove a listener from a specified events | removePropertyChangeListener | {
"repo_name": "Rubbiroid/VVIDE",
"path": "src/vvide/MarkerManager.java",
"license": "gpl-3.0",
"size": 8195
} | [
"java.beans.PropertyChangeListener"
] | import java.beans.PropertyChangeListener; | import java.beans.*; | [
"java.beans"
] | java.beans; | 1,942,267 |
public void onPlayAdvertisement(Advertisement advertisement) {
throw new UnsupportedOperationException(
"Override BaseTvInputService.Session.onPlayAdvertisement(int, Uri) to enable "
+ "ads insertion.");
} | void function(Advertisement advertisement) { throw new UnsupportedOperationException( STR + STR); } | /**
* Called when ads player is about to be created. Developers should override this if they
* want to enable ads insertion. Time shifting within ads is currently not supported.
*
* @param advertisement The advertisement that should be played.
*/ | Called when ads player is about to be created. Developers should override this if they want to enable ads insertion. Time shifting within ads is currently not supported | onPlayAdvertisement | {
"repo_name": "zaclimon/xipl",
"path": "tiflibrary/src/main/java/com/google/android/media/tv/companionlibrary/BaseTvInputService.java",
"license": "apache-2.0",
"size": 46512
} | [
"com.google.android.media.tv.companionlibrary.model.Advertisement"
] | import com.google.android.media.tv.companionlibrary.model.Advertisement; | import com.google.android.media.tv.companionlibrary.model.*; | [
"com.google.android"
] | com.google.android; | 1,443,449 |
public static MinguoDate of(int prolepticYear, int month, int dayOfMonth) {
return MinguoChronology.INSTANCE.date(prolepticYear, month, dayOfMonth);
}
/**
* Obtains a {@code MinguoDate} from a temporal object.
* <p>
* This obtains a date in the Minguo calendar system based on the specified temporal.
* A {@code TemporalAccessor} represents an arbitrary set of date and time information,
* which this factory converts to an instance of {@code MinguoDate}.
* <p>
* The conversion typically uses the {@link ChronoField#EPOCH_DAY EPOCH_DAY}
* field, which is standardized across calendar systems.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
* allowing it to be used as a query via method reference, {@code MinguoDate::from}.
*
* @param temporal the temporal object to convert, not null
* @return the date in Minguo calendar system, not null
* @throws DateTimeException if unable to convert to a {@code MinguoDate} | static MinguoDate function(int prolepticYear, int month, int dayOfMonth) { return MinguoChronology.INSTANCE.date(prolepticYear, month, dayOfMonth); } /** * Obtains a {@code MinguoDate} from a temporal object. * <p> * This obtains a date in the Minguo calendar system based on the specified temporal. * A {@code TemporalAccessor} represents an arbitrary set of date and time information, * which this factory converts to an instance of {@code MinguoDate}. * <p> * The conversion typically uses the {@link ChronoField#EPOCH_DAY EPOCH_DAY} * field, which is standardized across calendar systems. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} * allowing it to be used as a query via method reference, {@code MinguoDate::from}. * * @param temporal the temporal object to convert, not null * @return the date in Minguo calendar system, not null * @throws DateTimeException if unable to convert to a {@code MinguoDate} | /**
* Obtains a {@code MinguoDate} representing a date in the Minguo calendar
* system from the proleptic-year, month-of-year and day-of-month fields.
* <p>
* This returns a {@code MinguoDate} with the specified fields.
* The day must be valid for the year and month, otherwise an exception will be thrown.
*
* @param prolepticYear the Minguo proleptic-year
* @param month the Minguo month-of-year, from 1 to 12
* @param dayOfMonth the Minguo day-of-month, from 1 to 31
* @return the date in Minguo calendar system, not null
* @throws DateTimeException if the value of any field is out of range,
* or if the day-of-month is invalid for the month-year
*/ | Obtains a MinguoDate representing a date in the Minguo calendar system from the proleptic-year, month-of-year and day-of-month fields. This returns a MinguoDate with the specified fields. The day must be valid for the year and month, otherwise an exception will be thrown | of | {
"repo_name": "seratch/java-time-backport",
"path": "src/main/java/java/time/chrono/MinguoDate.java",
"license": "bsd-3-clause",
"size": 14100
} | [
"java.time.DateTimeException",
"java.time.temporal.ChronoField",
"java.time.temporal.TemporalAccessor",
"java.time.temporal.TemporalQuery"
] | import java.time.DateTimeException; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalQuery; | import java.time.*; import java.time.temporal.*; | [
"java.time"
] | java.time; | 485,858 |
@Test
public void testMapProgress() throws Exception {
JobConf job = new JobConf();
fs = FileSystem.getLocal(job);
Path rootDir = new Path(TEST_ROOT_DIR);
createInputFile(rootDir);
job.setNumReduceTasks(0);
TaskAttemptID taskId = TaskAttemptID.forName(
"attempt_200907082313_0424_m_000000_0");
job.setClass("mapreduce.job.outputformat.class",
NullOutputFormat.class, OutputFormat.class);
job.set(org.apache.hadoop.mapreduce.lib.input.FileInputFormat.INPUT_DIR,
TEST_ROOT_DIR);
jobId = taskId.getJobID();
JobContext jContext = new JobContextImpl(job, jobId);
InputFormat<?, ?> input =
ReflectionUtils.newInstance(jContext.getInputFormatClass(), job);
List<InputSplit> splits = input.getSplits(jContext);
JobSplitWriter.createSplitFiles(new Path(TEST_ROOT_DIR), job,
new Path(TEST_ROOT_DIR).getFileSystem(job),
splits);
TaskSplitMetaInfo[] splitMetaInfo =
SplitMetaInfoReader.readSplitMetaInfo(jobId, fs, job, new Path(TEST_ROOT_DIR));
job.setUseNewMapper(true); // use new api
for (int i = 0; i < splitMetaInfo.length; i++) {// rawSplits.length is 1
map = new TestMapTask(
job.get(JTConfig.JT_SYSTEM_DIR, "/tmp/hadoop/mapred/system") +
jobId + "job.xml",
taskId, i,
splitMetaInfo[i].getSplitIndex(), 1);
JobConf localConf = new JobConf(job);
map.localizeConfiguration(localConf);
map.setConf(localConf);
map.run(localConf, fakeUmbilical);
}
// clean up
fs.delete(rootDir, true);
} | void function() throws Exception { JobConf job = new JobConf(); fs = FileSystem.getLocal(job); Path rootDir = new Path(TEST_ROOT_DIR); createInputFile(rootDir); job.setNumReduceTasks(0); TaskAttemptID taskId = TaskAttemptID.forName( STR); job.setClass(STR, NullOutputFormat.class, OutputFormat.class); job.set(org.apache.hadoop.mapreduce.lib.input.FileInputFormat.INPUT_DIR, TEST_ROOT_DIR); jobId = taskId.getJobID(); JobContext jContext = new JobContextImpl(job, jobId); InputFormat<?, ?> input = ReflectionUtils.newInstance(jContext.getInputFormatClass(), job); List<InputSplit> splits = input.getSplits(jContext); JobSplitWriter.createSplitFiles(new Path(TEST_ROOT_DIR), job, new Path(TEST_ROOT_DIR).getFileSystem(job), splits); TaskSplitMetaInfo[] splitMetaInfo = SplitMetaInfoReader.readSplitMetaInfo(jobId, fs, job, new Path(TEST_ROOT_DIR)); job.setUseNewMapper(true); for (int i = 0; i < splitMetaInfo.length; i++) { map = new TestMapTask( job.get(JTConfig.JT_SYSTEM_DIR, STR) + jobId + STR, taskId, i, splitMetaInfo[i].getSplitIndex(), 1); JobConf localConf = new JobConf(job); map.localizeConfiguration(localConf); map.setConf(localConf); map.run(localConf, fakeUmbilical); } fs.delete(rootDir, true); } | /**
* Validates map phase progress after each record is processed by map task
* using custom task reporter.
*/ | Validates map phase progress after each record is processed by map task using custom task reporter | testMapProgress | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/TestMapProgress.java",
"license": "apache-2.0",
"size": 10239
} | [
"java.util.List",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.mapreduce.InputFormat",
"org.apache.hadoop.mapreduce.InputSplit",
"org.apache.hadoop.mapreduce.OutputFormat",
"org.apache.hadoop.mapreduce.lib.output.NullOutputFormat",
"org.apache.hadoop.mapreduce.ser... | import java.util.List; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapreduce.InputFormat; import org.apache.hadoop.mapreduce.InputSplit; import org.apache.hadoop.mapreduce.OutputFormat; import org.apache.hadoop.mapreduce.lib.output.NullOutputFormat; import org.apache.hadoop.mapreduce.server.jobtracker.JTConfig; import org.apache.hadoop.mapreduce.split.JobSplit; import org.apache.hadoop.mapreduce.split.JobSplitWriter; import org.apache.hadoop.mapreduce.split.SplitMetaInfoReader; import org.apache.hadoop.util.ReflectionUtils; | import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.mapreduce.lib.output.*; import org.apache.hadoop.mapreduce.server.jobtracker.*; import org.apache.hadoop.mapreduce.split.*; import org.apache.hadoop.util.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,225,132 |
public void removeAll(@Nullable String spaceName, Collection<SwapKey> keys,
IgniteBiInClosure<SwapKey, byte[]> c, @Nullable ClassLoader ldr) throws IgniteCheckedException {
assert keys != null;
try {
getSpi().removeAll(spaceName, keys, c, context(ldr));
}
catch (IgniteSpiException e) {
throw new IgniteCheckedException("Failed to remove from swap space [space=" + spaceName + ", " +
"keysCnt=" + keys.size() + ']', e);
}
} | void function(@Nullable String spaceName, Collection<SwapKey> keys, IgniteBiInClosure<SwapKey, byte[]> c, @Nullable ClassLoader ldr) throws IgniteCheckedException { assert keys != null; try { getSpi().removeAll(spaceName, keys, c, context(ldr)); } catch (IgniteSpiException e) { throw new IgniteCheckedException(STR + spaceName + STR + STR + keys.size() + ']', e); } } | /**
* Removes value from swap.
*
* @param spaceName Space name.
* @param keys Collection of keys.
* @param c Optional closure that takes removed value and executes after actual
* removing. If there was no value in storage the closure is executed given
* {@code null} value as parameter.
* @param ldr Class loader (optional).
* @throws IgniteCheckedException If failed.
*/ | Removes value from swap | removeAll | {
"repo_name": "agura/incubator-ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/managers/swapspace/GridSwapSpaceManager.java",
"license": "apache-2.0",
"size": 15168
} | [
"java.util.Collection",
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.lang.IgniteBiInClosure",
"org.apache.ignite.spi.IgniteSpiException",
"org.apache.ignite.spi.swapspace.SwapKey",
"org.jetbrains.annotations.Nullable"
] | import java.util.Collection; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.lang.IgniteBiInClosure; import org.apache.ignite.spi.IgniteSpiException; import org.apache.ignite.spi.swapspace.SwapKey; import org.jetbrains.annotations.Nullable; | import java.util.*; import org.apache.ignite.*; import org.apache.ignite.lang.*; import org.apache.ignite.spi.*; import org.apache.ignite.spi.swapspace.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.util; org.apache.ignite; org.jetbrains.annotations; | 438,777 |
@Override
public void compute(I correction, I estimate) {
if (variation == null) {
Type<T> type = Util.getTypeFromInterval(correction);
variation = ops().create().img(correction, type.createVariable());
}
divUnitGradFastThread(estimate);
final Cursor<T> cursorCorrection = Views.iterable(correction).cursor();
final Cursor<T> cursorVariation = Views.iterable(variation).cursor();
final Cursor<T> cursorEstimate = Views.iterable(estimate).cursor();
while (cursorEstimate.hasNext()) {
cursorCorrection.fwd();
cursorVariation.fwd();
cursorEstimate.fwd();
cursorEstimate.get().mul(cursorCorrection.get());
cursorEstimate.get().mul(1f / (1f - regularizationFactor * cursorVariation
.get().getRealFloat()));
}
} | void function(I correction, I estimate) { if (variation == null) { Type<T> type = Util.getTypeFromInterval(correction); variation = ops().create().img(correction, type.createVariable()); } divUnitGradFastThread(estimate); final Cursor<T> cursorCorrection = Views.iterable(correction).cursor(); final Cursor<T> cursorVariation = Views.iterable(variation).cursor(); final Cursor<T> cursorEstimate = Views.iterable(estimate).cursor(); while (cursorEstimate.hasNext()) { cursorCorrection.fwd(); cursorVariation.fwd(); cursorEstimate.fwd(); cursorEstimate.get().mul(cursorCorrection.get()); cursorEstimate.get().mul(1f / (1f - regularizationFactor * cursorVariation .get().getRealFloat())); } } | /**
* performs update step of the Richardson Lucy with Total Variation Algorithm
*/ | performs update step of the Richardson Lucy with Total Variation Algorithm | compute | {
"repo_name": "imagej/imagej-ops",
"path": "src/main/java/net/imagej/ops/deconvolve/RichardsonLucyTVUpdate.java",
"license": "bsd-2-clause",
"size": 11905
} | [
"net.imglib2.Cursor",
"net.imglib2.type.Type",
"net.imglib2.util.Util",
"net.imglib2.view.Views"
] | import net.imglib2.Cursor; import net.imglib2.type.Type; import net.imglib2.util.Util; import net.imglib2.view.Views; | import net.imglib2.*; import net.imglib2.type.*; import net.imglib2.util.*; import net.imglib2.view.*; | [
"net.imglib2",
"net.imglib2.type",
"net.imglib2.util",
"net.imglib2.view"
] | net.imglib2; net.imglib2.type; net.imglib2.util; net.imglib2.view; | 2,102,011 |
public Map<Integer, Set<Vote>> readFromFile(File file) throws XmlPullParserException, IOException
{
Map<Integer,Set<Vote>> votes = new HashMap<Integer, Set<Vote>>();
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParser parser = factory.newPullParser();
FileReader reader = new FileReader(file);
parser.setInput(reader);
processXML(parser, votes);
reader.close();
return votes;
} | Map<Integer, Set<Vote>> function(File file) throws XmlPullParserException, IOException { Map<Integer,Set<Vote>> votes = new HashMap<Integer, Set<Vote>>(); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser parser = factory.newPullParser(); FileReader reader = new FileReader(file); parser.setInput(reader); processXML(parser, votes); reader.close(); return votes; } | /**
* Receives a File object and returns a Hashmap of lists, which contain votes.
* @param file The file object, where the votes are stored.
* @throws XmlPullParserException
* @throws IOException
*/ | Receives a File object and returns a Hashmap of lists, which contain votes | readFromFile | {
"repo_name": "brunsen/sturesy-android-client",
"path": "src/sturesy/services/deserialization/VoteImportservice.java",
"license": "agpl-3.0",
"size": 4465
} | [
"java.io.File",
"java.io.FileReader",
"java.io.IOException",
"java.util.HashMap",
"java.util.Map",
"java.util.Set",
"org.xmlpull.v1.XmlPullParser",
"org.xmlpull.v1.XmlPullParserException",
"org.xmlpull.v1.XmlPullParserFactory"
] | import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Set; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserFactory; | import java.io.*; import java.util.*; import org.xmlpull.v1.*; | [
"java.io",
"java.util",
"org.xmlpull.v1"
] | java.io; java.util; org.xmlpull.v1; | 1,460,546 |
return Collections.unmodifiableSet(actions);
}
public static class Builder {
private Set<Action> actions;
public Builder() {
actions = new HashSet<>(0);
} | return Collections.unmodifiableSet(actions); } public static class Builder { private Set<Action> actions; public Builder() { actions = new HashSet<>(0); } | /**
* Get the actions as a set.
* @return the actions
*/ | Get the actions as a set | asSet | {
"repo_name": "gerryai/planning-common",
"path": "model/src/main/java/org/gerryai/planning/model/domain/Actions.java",
"license": "gpl-3.0",
"size": 2067
} | [
"java.util.Collections",
"java.util.HashSet",
"java.util.Set"
] | import java.util.Collections; import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,308,744 |
public void processEmailTemplates(List<String> templatePaths);
| void function(List<String> templatePaths); | /**
* Takes the list of paths supplied and looks up the XML files using the services classloader. Each file is parsed
* into an EmailTemplate and saved.
* @param templatePaths A List of template path Strings
*/ | Takes the list of paths supplied and looks up the XML files using the services classloader. Each file is parsed into an EmailTemplate and saved | processEmailTemplates | {
"repo_name": "harfalm/Sakai-10.1",
"path": "emailtemplateservice/api/src/java/org/sakaiproject/emailtemplateservice/service/EmailTemplateService.java",
"license": "apache-2.0",
"size": 6310
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,576,587 |
@Nullable private GridCacheGateway<K, V> gate() {
GridCacheContext<K, V> cacheContext = delegate.context();
return cacheContext != null ? cacheContext.gate() : null;
} | @Nullable GridCacheGateway<K, V> function() { GridCacheContext<K, V> cacheContext = delegate.context(); return cacheContext != null ? cacheContext.gate() : null; } | /**
* Safely get CacheGateway.
*
* @return Cache Gateway.
*/ | Safely get CacheGateway | gate | {
"repo_name": "amirakhmedov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java",
"license": "apache-2.0",
"size": 44918
} | [
"org.jetbrains.annotations.Nullable"
] | import org.jetbrains.annotations.Nullable; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 2,349,825 |
private void downloadFile(AlluxioURI path, HttpServletRequest request,
HttpServletResponse response) throws FileDoesNotExistException, IOException,
InvalidPathException, AlluxioException {
FileSystem alluxioClient = FileSystem.Factory.get();
URIStatus status = alluxioClient.getStatus(path);
long len = status.getLength();
String fileName = path.getName();
response.setContentType("application/octet-stream");
if (len <= Integer.MAX_VALUE) {
response.setContentLength((int) len);
} else {
response.addHeader("Content-Length", Long.toString(len));
}
response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
FileInStream is = null;
ServletOutputStream out = null;
try {
OpenFileOptions options = OpenFileOptions.defaults().setReadType(ReadType.NO_CACHE);
is = alluxioClient.openFile(path, options);
out = response.getOutputStream();
ByteStreams.copy(is, out);
} finally {
if (out != null) {
out.flush();
out.close();
}
if (is != null) {
is.close();
}
}
} | void function(AlluxioURI path, HttpServletRequest request, HttpServletResponse response) throws FileDoesNotExistException, IOException, InvalidPathException, AlluxioException { FileSystem alluxioClient = FileSystem.Factory.get(); URIStatus status = alluxioClient.getStatus(path); long len = status.getLength(); String fileName = path.getName(); response.setContentType(STR); if (len <= Integer.MAX_VALUE) { response.setContentLength((int) len); } else { response.addHeader(STR, Long.toString(len)); } response.addHeader(STR, STR + fileName); FileInStream is = null; ServletOutputStream out = null; try { OpenFileOptions options = OpenFileOptions.defaults().setReadType(ReadType.NO_CACHE); is = alluxioClient.openFile(path, options); out = response.getOutputStream(); ByteStreams.copy(is, out); } finally { if (out != null) { out.flush(); out.close(); } if (is != null) { is.close(); } } } | /**
* This function prepares for downloading a file.
*
* @param path the path of the file to download
* @param request the {@link HttpServletRequest} object
* @param response the {@link HttpServletResponse} object
* @throws FileDoesNotExistException if the file does not exist
* @throws InvalidPathException if an invalid path is encountered
*/ | This function prepares for downloading a file | downloadFile | {
"repo_name": "riversand963/alluxio",
"path": "core/server/master/src/main/java/alluxio/web/WebInterfaceDownloadServlet.java",
"license": "apache-2.0",
"size": 5240
} | [
"com.google.common.io.ByteStreams",
"java.io.IOException",
"javax.servlet.ServletOutputStream",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import com.google.common.io.ByteStreams; import java.io.IOException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import com.google.common.io.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"com.google.common",
"java.io",
"javax.servlet"
] | com.google.common; java.io; javax.servlet; | 1,966,948 |
public synchronized <T extends Asset<U>, U extends AssetData> void registerCoreProducer(Class<T> assetType, AssetDataProducer<U> producer) {
coreProducers.put(assetType, producer);
} | synchronized <T extends Asset<U>, U extends AssetData> void function(Class<T> assetType, AssetDataProducer<U> producer) { coreProducers.put(assetType, producer); } | /**
* Registers an AssetDataProducer for use by a specified asset type. This change will take affect next time
* {@link #switchEnvironment(org.terasology.module.ModuleEnvironment)} is called.
*
* @param assetType The type of asset the producer should be registered with
* @param producer The AssetDataProducer.
* @param <T> The type of asset
* @param <U> The type of asset data
*/ | Registers an AssetDataProducer for use by a specified asset type. This change will take affect next time <code>#switchEnvironment(org.terasology.module.ModuleEnvironment)</code> is called | registerCoreProducer | {
"repo_name": "msteiger/gestalt",
"path": "gestalt-asset-core/src/main/java/org/terasology/assets/module/ModuleAwareAssetTypeManager.java",
"license": "apache-2.0",
"size": 30833
} | [
"org.terasology.assets.Asset",
"org.terasology.assets.AssetData",
"org.terasology.assets.AssetDataProducer"
] | import org.terasology.assets.Asset; import org.terasology.assets.AssetData; import org.terasology.assets.AssetDataProducer; | import org.terasology.assets.*; | [
"org.terasology.assets"
] | org.terasology.assets; | 2,062,096 |
public LocationTrace updateTrace(final Player player, final Location loc, final long time,
final IEntityAccessDimensions iead) {
final LocationTrace trace = getTrace(player);
if (iead == null) {
// TODO: 0.3 from bukkit based default heights (needs extra registered classes).
trace.addEntry(time, loc.getX(), loc.getY(), loc.getZ(), 0.3, player.getEyeHeight());
}
else {
trace.addEntry(time, loc.getX(), loc.getY(), loc.getZ(), iead.getWidth(player) / 2.0, Math.max(player.getEyeHeight(), iead.getHeight(player)));
}
return trace;
}
| LocationTrace function(final Player player, final Location loc, final long time, final IEntityAccessDimensions iead) { final LocationTrace trace = getTrace(player); if (iead == null) { trace.addEntry(time, loc.getX(), loc.getY(), loc.getZ(), 0.3, player.getEyeHeight()); } else { trace.addEntry(time, loc.getX(), loc.getY(), loc.getZ(), iead.getWidth(player) / 2.0, Math.max(player.getEyeHeight(), iead.getHeight(player))); } return trace; } | /**
* Convenience method to add a location to the trace, creates the trace if
* necessary.
*
* @param player
* @param loc
* @param time
* @param iead
* If null getEyeHeight and 0.3 are used (assume fake player).
* @return Updated LocationTrace instance, for convenient use, without
* sticking too much to MovingData.
*/ | Convenience method to add a location to the trace, creates the trace if necessary | updateTrace | {
"repo_name": "NoCheatPlus/NoCheatPlus",
"path": "NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingData.java",
"license": "gpl-3.0",
"size": 48888
} | [
"fr.neatmonster.nocheatplus.checks.moving.location.tracking.LocationTrace",
"fr.neatmonster.nocheatplus.components.entity.IEntityAccessDimensions",
"org.bukkit.Location",
"org.bukkit.entity.Player"
] | import fr.neatmonster.nocheatplus.checks.moving.location.tracking.LocationTrace; import fr.neatmonster.nocheatplus.components.entity.IEntityAccessDimensions; import org.bukkit.Location; import org.bukkit.entity.Player; | import fr.neatmonster.nocheatplus.checks.moving.location.tracking.*; import fr.neatmonster.nocheatplus.components.entity.*; import org.bukkit.*; import org.bukkit.entity.*; | [
"fr.neatmonster.nocheatplus",
"org.bukkit",
"org.bukkit.entity"
] | fr.neatmonster.nocheatplus; org.bukkit; org.bukkit.entity; | 2,670,677 |
private void setTOS(ValueNumberFrame vnaFrame, Location location, DefinitelyNullSet fact, NullnessValue nullnessValue)
throws DataflowAnalysisException {
ValueNumber valueNumber = vnaFrame.getTopValue();
changeNullnessOfValue(valueNumber, location, fact, nullnessValue);
} | void function(ValueNumberFrame vnaFrame, Location location, DefinitelyNullSet fact, NullnessValue nullnessValue) throws DataflowAnalysisException { ValueNumber valueNumber = vnaFrame.getTopValue(); changeNullnessOfValue(valueNumber, location, fact, nullnessValue); } | /**
* Set the value on top of the stack as either null or unknown.
*
* @param vnaFrame
* ValueNumberFrame at Location
* @param location
* the Location
* @param fact
* DefinitelyNullSet to modify
* @param nullnessValue
* the nullness of the value number
* @throws DataflowAnalysisException
*/ | Set the value on top of the stack as either null or unknown | setTOS | {
"repo_name": "jesusaplsoft/FindAllBugs",
"path": "findbugs/src/obsolete/edu/umd/cs/findbugs/ba/npe2/DefinitelyNullSetAnalysis.java",
"license": "gpl-2.0",
"size": 11756
} | [
"edu.umd.cs.findbugs.ba.DataflowAnalysisException",
"edu.umd.cs.findbugs.ba.Location",
"edu.umd.cs.findbugs.ba.vna.ValueNumber",
"edu.umd.cs.findbugs.ba.vna.ValueNumberFrame"
] | import edu.umd.cs.findbugs.ba.DataflowAnalysisException; import edu.umd.cs.findbugs.ba.Location; import edu.umd.cs.findbugs.ba.vna.ValueNumber; import edu.umd.cs.findbugs.ba.vna.ValueNumberFrame; | import edu.umd.cs.findbugs.ba.*; import edu.umd.cs.findbugs.ba.vna.*; | [
"edu.umd.cs"
] | edu.umd.cs; | 1,801,829 |
public URLConnection openConnection(URL url) throws IOException {
try {
return openConnection(url, false);
} catch (AuthenticationException e) {
// Unreachable
LOG.error("Open connection {} failed", url, e);
return null;
}
} | URLConnection function(URL url) throws IOException { try { return openConnection(url, false); } catch (AuthenticationException e) { LOG.error(STR, url, e); return null; } } | /**
* Opens a url with read and connect timeouts
*
* @param url
* to open
* @return URLConnection
* @throws IOException
*/ | Opens a url with read and connect timeouts | openConnection | {
"repo_name": "legend-hua/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/URLConnectionFactory.java",
"license": "apache-2.0",
"size": 8031
} | [
"java.io.IOException",
"java.net.URLConnection",
"org.apache.hadoop.security.authentication.client.AuthenticationException"
] | import java.io.IOException; import java.net.URLConnection; import org.apache.hadoop.security.authentication.client.AuthenticationException; | import java.io.*; import java.net.*; import org.apache.hadoop.security.authentication.client.*; | [
"java.io",
"java.net",
"org.apache.hadoop"
] | java.io; java.net; org.apache.hadoop; | 614,779 |
@SuppressWarnings({"GoodTime-ApiWithNumericTimeUnit", "JavaLocalDateTimeGetNano"})
public static long encodePacked64DatetimeMicros(LocalDateTime dateTime) {
checkValidDateTimeMicros(dateTime);
return (encodePacked64DatetimeSeconds(dateTime) << MICRO_LENGTH)
| (dateTime.getNano() / 1_000L);
} | @SuppressWarnings({STR, STR}) static long function(LocalDateTime dateTime) { checkValidDateTimeMicros(dateTime); return (encodePacked64DatetimeSeconds(dateTime) << MICRO_LENGTH) (dateTime.getNano() / 1_000L); } | /**
* Encodes {@code dateTime} as a 8-byte integer with microseconds precision.
*
* <p>Encoding is as the following:
*
* <pre>
* 6 5 4 3 2 1
* MSB 3210987654321098765432109876543210987654321098765432109876543210 LSB
* |--- year ---||m || D || H || M || S ||-------micros-----|
* </pre>
*
* @see #decodePacked64DatetimeMicros(long)
*/ | Encodes dateTime as a 8-byte integer with microseconds precision. Encoding is as the following: <code> 6 5 4 3 2 1 MSB 3210987654321098765432109876543210987654321098765432109876543210 LSB |--- year ---||m || D || H || M || S ||-------micros-----| </code> | encodePacked64DatetimeMicros | {
"repo_name": "googleapis/java-bigquerystorage",
"path": "google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/CivilTimeEncoder.java",
"license": "apache-2.0",
"size": 12664
} | [
"org.threeten.bp.LocalDateTime"
] | import org.threeten.bp.LocalDateTime; | import org.threeten.bp.*; | [
"org.threeten.bp"
] | org.threeten.bp; | 2,299,917 |
List<DataSegment> getUsedSegmentsForIntervals(String dataSource, List<Interval> intervals)
throws IOException; | List<DataSegment> getUsedSegmentsForIntervals(String dataSource, List<Interval> intervals) throws IOException; | /**
* Get all segments which may include any data in the interval and are flagged as used.
*
* @param dataSource The datasource to query
* @param intervals The intervals for which used segments are to be returned
*
* @return The DataSegments which include data in the requested intervals. These segments may contain data outside the requested interval.
*
* @throws IOException
*/ | Get all segments which may include any data in the interval and are flagged as used | getUsedSegmentsForIntervals | {
"repo_name": "andy256/druid",
"path": "indexing-hadoop/src/main/java/io/druid/indexer/path/UsedSegmentLister.java",
"license": "apache-2.0",
"size": 1537
} | [
"io.druid.timeline.DataSegment",
"java.io.IOException",
"java.util.List",
"org.joda.time.Interval"
] | import io.druid.timeline.DataSegment; import java.io.IOException; import java.util.List; import org.joda.time.Interval; | import io.druid.timeline.*; import java.io.*; import java.util.*; import org.joda.time.*; | [
"io.druid.timeline",
"java.io",
"java.util",
"org.joda.time"
] | io.druid.timeline; java.io; java.util; org.joda.time; | 1,535,344 |
void afterInsert(Document doc, SchemaRepository repo) throws BagriException;
| void afterInsert(Document doc, SchemaRepository repo) throws BagriException; | /**
* fires after document inserted into XDM Schema
*
* @param doc the XDM document
* @param repo the XDM Schema Repository
* @throws BagriException in case of processing error
*/ | fires after document inserted into XDM Schema | afterInsert | {
"repo_name": "dsukhoroslov/bagri",
"path": "bagri-core/src/main/java/com/bagri/core/server/api/DocumentTrigger.java",
"license": "apache-2.0",
"size": 2039
} | [
"com.bagri.core.api.BagriException",
"com.bagri.core.api.SchemaRepository",
"com.bagri.core.model.Document"
] | import com.bagri.core.api.BagriException; import com.bagri.core.api.SchemaRepository; import com.bagri.core.model.Document; | import com.bagri.core.api.*; import com.bagri.core.model.*; | [
"com.bagri.core"
] | com.bagri.core; | 2,598,695 |
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
// Handle item selection
switch (item.getItemId()) {
case R.id.menu_option_about:
showAboutBox();
return true;
case R.id.menu_option_settings:
startActivity(item.getIntent());
return( true );
default:
return super.onOptionsItemSelected(item);
}
} | boolean function(MenuItem item) { switch (item.getItemId()) { case R.id.menu_option_about: showAboutBox(); return true; case R.id.menu_option_settings: startActivity(item.getIntent()); return( true ); default: return super.onOptionsItemSelected(item); } } | /**
* Action to take on menu item selection
*/ | Action to take on menu item selection | onOptionsItemSelected | {
"repo_name": "ajnsit/DNCViolation",
"path": "src/kandalaya/dncviolation/DNCViolationActivity.java",
"license": "gpl-3.0",
"size": 20572
} | [
"android.view.MenuItem"
] | import android.view.MenuItem; | import android.view.*; | [
"android.view"
] | android.view; | 465,701 |
@Override
public void generateCode(BlockScope currentScope, CodeStream codeStream) {
if ((this.bits & ASTNode.IsReachable) == 0)
return;
int pc = codeStream.position;
this.exception.generateCode(currentScope, codeStream, true);
codeStream.athrow();
codeStream.recordPositionsFrom(pc, this.sourceStart);
} | void function(BlockScope currentScope, CodeStream codeStream) { if ((this.bits & ASTNode.IsReachable) == 0) return; int pc = codeStream.position; this.exception.generateCode(currentScope, codeStream, true); codeStream.athrow(); codeStream.recordPositionsFrom(pc, this.sourceStart); } | /**
* Throw code generation
*
* @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
* @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
*/ | Throw code generation | generateCode | {
"repo_name": "Niky4000/UsefulUtils",
"path": "projects/others/eclipse-platform-parent/eclipse.jdt.core-master/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java",
"license": "gpl-3.0",
"size": 4124
} | [
"org.eclipse.jdt.internal.compiler.codegen.CodeStream",
"org.eclipse.jdt.internal.compiler.lookup.BlockScope"
] | import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; | import org.eclipse.jdt.internal.compiler.codegen.*; import org.eclipse.jdt.internal.compiler.lookup.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 2,076,052 |
protected Properties getProps() {
Properties props = new Properties();
double qty = rng.nextInt(MAX_QTY) * 100.00;
double mktValue = rng.nextDouble() * MAX_PRICE;
props.setProperty("qty", String.valueOf(qty));
props.setProperty("mktValue", String.valueOf(mktValue));
return props;
} | Properties function() { Properties props = new Properties(); double qty = rng.nextInt(MAX_QTY) * 100.00; double mktValue = rng.nextDouble() * MAX_PRICE; props.setProperty("qty", String.valueOf(qty)); props.setProperty(STR, String.valueOf(mktValue)); return props; } | /**
* To provide random values to populate a position.
*
*/ | To provide random values to populate a position | getProps | {
"repo_name": "smgoller/geode",
"path": "geode-junit/src/main/java/parReg/query/unittest/NewPortfolio.java",
"license": "apache-2.0",
"size": 6618
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 160,744 |
public int useCount(JSONObject m) {
try {
return mCol.getDb().queryScalar("select count() from notes where mid = " + m.getLong("id"));
} catch (JSONException e) {
throw new RuntimeException(e);
}
} | int function(JSONObject m) { try { return mCol.getDb().queryScalar(STR + m.getLong("id")); } catch (JSONException e) { throw new RuntimeException(e); } } | /**
* Number of notes using m
* @param m The model to the count the notes of.
* @return The number of notes with that model.
*/ | Number of notes using m | useCount | {
"repo_name": "stockcode/kids-english",
"path": "src/main/java/com/nit/libanki/Models.java",
"license": "gpl-3.0",
"size": 51742
} | [
"org.json.JSONException",
"org.json.JSONObject"
] | import org.json.JSONException; import org.json.JSONObject; | import org.json.*; | [
"org.json"
] | org.json; | 2,720,135 |
public void attackTargetEntityWithCurrentItem(Entity targetEntity)
{
if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, targetEntity)) return;
if (targetEntity.canBeAttackedWithItem())
{
if (!targetEntity.hitByEntity(this))
{
float f = (float)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue();
float f1;
if (targetEntity instanceof EntityLivingBase)
{
f1 = EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(), ((EntityLivingBase)targetEntity).getCreatureAttribute());
}
else
{
f1 = EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(), EnumCreatureAttribute.UNDEFINED);
}
float f2 = this.getCooledAttackStrength(0.5F);
f = f * (0.2F + f2 * f2 * 0.8F);
f1 = f1 * f2;
this.resetCooldown();
if (f > 0.0F || f1 > 0.0F)
{
boolean flag = f2 > 0.9F;
boolean flag1 = false;
int i = 0;
i = i + EnchantmentHelper.getKnockbackModifier(this);
if (this.isSprinting() && flag)
{
this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.getSoundCategory(), 1.0F, 1.0F);
++i;
flag1 = true;
}
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater() && !this.isPotionActive(MobEffects.BLINDNESS) && !this.isRiding() && targetEntity instanceof EntityLivingBase;
flag2 = flag2 && !this.isSprinting();
if (flag2)
{
f *= 1.5F;
}
f = f + f1;
boolean flag3 = false;
double d0 = (double)(this.distanceWalkedModified - this.prevDistanceWalkedModified);
if (flag && !flag2 && !flag1 && this.onGround && d0 < (double)this.getAIMoveSpeed())
{
ItemStack itemstack = this.getHeldItem(EnumHand.MAIN_HAND);
if (itemstack != null && itemstack.getItem() instanceof ItemSword)
{
flag3 = true;
}
}
float f4 = 0.0F;
boolean flag4 = false;
int j = EnchantmentHelper.getFireAspectModifier(this);
if (targetEntity instanceof EntityLivingBase)
{
f4 = ((EntityLivingBase)targetEntity).getHealth();
if (j > 0 && !targetEntity.isBurning())
{
flag4 = true;
targetEntity.setFire(1);
}
}
double d1 = targetEntity.motionX;
double d2 = targetEntity.motionY;
double d3 = targetEntity.motionZ;
boolean flag5 = targetEntity.attackEntityFrom(DamageSource.causePlayerDamage(this), f);
if (flag5)
{
if (i > 0)
{
if (targetEntity instanceof EntityLivingBase)
{
((EntityLivingBase)targetEntity).knockBack(this, (float)i * 0.5F, (double)MathHelper.sin(this.rotationYaw * 0.017453292F), (double)(-MathHelper.cos(this.rotationYaw * 0.017453292F)));
}
else
{
targetEntity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * 0.017453292F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * 0.017453292F) * (float)i * 0.5F));
}
this.motionX *= 0.6D;
this.motionZ *= 0.6D;
this.setSprinting(false);
}
if (flag3)
{
for (EntityLivingBase entitylivingbase : this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, targetEntity.getEntityBoundingBox().expand(1.0D, 0.25D, 1.0D)))
{
if (entitylivingbase != this && entitylivingbase != targetEntity && !this.isOnSameTeam(entitylivingbase) && this.getDistanceSqToEntity(entitylivingbase) < 9.0D)
{
entitylivingbase.knockBack(this, 0.4F, (double)MathHelper.sin(this.rotationYaw * 0.017453292F), (double)(-MathHelper.cos(this.rotationYaw * 0.017453292F)));
entitylivingbase.attackEntityFrom(DamageSource.causePlayerDamage(this), 1.0F);
}
}
this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F);
this.spawnSweepParticles();
}
if (targetEntity instanceof EntityPlayerMP && targetEntity.velocityChanged)
{
((EntityPlayerMP)targetEntity).connection.sendPacket(new SPacketEntityVelocity(targetEntity));
targetEntity.velocityChanged = false;
targetEntity.motionX = d1;
targetEntity.motionY = d2;
targetEntity.motionZ = d3;
}
if (flag2)
{
this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_CRIT, this.getSoundCategory(), 1.0F, 1.0F);
this.onCriticalHit(targetEntity);
}
if (!flag2 && !flag3)
{
if (flag)
{
this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_STRONG, this.getSoundCategory(), 1.0F, 1.0F);
}
else
{
this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_WEAK, this.getSoundCategory(), 1.0F, 1.0F);
}
}
if (f1 > 0.0F)
{
this.onEnchantmentCritical(targetEntity);
}
if (!this.worldObj.isRemote && targetEntity instanceof EntityPlayer)
{
EntityPlayer entityplayer = (EntityPlayer)targetEntity;
ItemStack itemstack2 = this.getHeldItemMainhand();
ItemStack itemstack3 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : null;
if (itemstack2 != null && itemstack3 != null && itemstack2.getItem() instanceof ItemAxe && itemstack3.getItem() == Items.SHIELD)
{
float f3 = 0.25F + (float)EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;
if (flag1)
{
f3 += 0.75F;
}
if (this.rand.nextFloat() < f3)
{
entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
this.worldObj.setEntityState(entityplayer, (byte)30);
}
}
}
if (f >= 18.0F)
{
this.addStat(AchievementList.OVERKILL);
}
this.setLastAttacker(targetEntity);
if (targetEntity instanceof EntityLivingBase)
{
EnchantmentHelper.applyThornEnchantments((EntityLivingBase)targetEntity, this);
}
EnchantmentHelper.applyArthropodEnchantments(this, targetEntity);
ItemStack itemstack1 = this.getHeldItemMainhand();
Entity entity = targetEntity;
if (targetEntity instanceof EntityDragonPart)
{
IEntityMultiPart ientitymultipart = ((EntityDragonPart)targetEntity).entityDragonObj;
if (ientitymultipart instanceof EntityLivingBase)
{
entity = (EntityLivingBase)ientitymultipart;
}
}
if (itemstack1 != null && entity instanceof EntityLivingBase)
{
itemstack1.hitEntity((EntityLivingBase)entity, this);
if (itemstack1.stackSize <= 0)
{
this.setHeldItem(EnumHand.MAIN_HAND, (ItemStack)null);
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, EnumHand.MAIN_HAND);
}
}
if (targetEntity instanceof EntityLivingBase)
{
float f5 = f4 - ((EntityLivingBase)targetEntity).getHealth();
this.addStat(StatList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0)
{
targetEntity.setFire(j * 4);
}
if (this.worldObj instanceof WorldServer && f5 > 2.0F)
{
int k = (int)((double)f5 * 0.5D);
((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.DAMAGE_INDICATOR, targetEntity.posX, targetEntity.posY + (double)(targetEntity.height * 0.5F), targetEntity.posZ, k, 0.1D, 0.0D, 0.1D, 0.2D, new int[0]);
}
}
this.addExhaustion(0.3F);
}
else
{
this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, this.getSoundCategory(), 1.0F, 1.0F);
if (flag4)
{
targetEntity.extinguish();
}
}
}
}
}
} | void function(Entity targetEntity) { if (!net.minecraftforge.common.ForgeHooks.onPlayerAttackTarget(this, targetEntity)) return; if (targetEntity.canBeAttackedWithItem()) { if (!targetEntity.hitByEntity(this)) { float f = (float)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue(); float f1; if (targetEntity instanceof EntityLivingBase) { f1 = EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(), ((EntityLivingBase)targetEntity).getCreatureAttribute()); } else { f1 = EnchantmentHelper.getModifierForCreature(this.getHeldItemMainhand(), EnumCreatureAttribute.UNDEFINED); } float f2 = this.getCooledAttackStrength(0.5F); f = f * (0.2F + f2 * f2 * 0.8F); f1 = f1 * f2; this.resetCooldown(); if (f > 0.0F f1 > 0.0F) { boolean flag = f2 > 0.9F; boolean flag1 = false; int i = 0; i = i + EnchantmentHelper.getKnockbackModifier(this); if (this.isSprinting() && flag) { this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK, this.getSoundCategory(), 1.0F, 1.0F); ++i; flag1 = true; } boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater() && !this.isPotionActive(MobEffects.BLINDNESS) && !this.isRiding() && targetEntity instanceof EntityLivingBase; flag2 = flag2 && !this.isSprinting(); if (flag2) { f *= 1.5F; } f = f + f1; boolean flag3 = false; double d0 = (double)(this.distanceWalkedModified - this.prevDistanceWalkedModified); if (flag && !flag2 && !flag1 && this.onGround && d0 < (double)this.getAIMoveSpeed()) { ItemStack itemstack = this.getHeldItem(EnumHand.MAIN_HAND); if (itemstack != null && itemstack.getItem() instanceof ItemSword) { flag3 = true; } } float f4 = 0.0F; boolean flag4 = false; int j = EnchantmentHelper.getFireAspectModifier(this); if (targetEntity instanceof EntityLivingBase) { f4 = ((EntityLivingBase)targetEntity).getHealth(); if (j > 0 && !targetEntity.isBurning()) { flag4 = true; targetEntity.setFire(1); } } double d1 = targetEntity.motionX; double d2 = targetEntity.motionY; double d3 = targetEntity.motionZ; boolean flag5 = targetEntity.attackEntityFrom(DamageSource.causePlayerDamage(this), f); if (flag5) { if (i > 0) { if (targetEntity instanceof EntityLivingBase) { ((EntityLivingBase)targetEntity).knockBack(this, (float)i * 0.5F, (double)MathHelper.sin(this.rotationYaw * 0.017453292F), (double)(-MathHelper.cos(this.rotationYaw * 0.017453292F))); } else { targetEntity.addVelocity((double)(-MathHelper.sin(this.rotationYaw * 0.017453292F) * (float)i * 0.5F), 0.1D, (double)(MathHelper.cos(this.rotationYaw * 0.017453292F) * (float)i * 0.5F)); } this.motionX *= 0.6D; this.motionZ *= 0.6D; this.setSprinting(false); } if (flag3) { for (EntityLivingBase entitylivingbase : this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, targetEntity.getEntityBoundingBox().expand(1.0D, 0.25D, 1.0D))) { if (entitylivingbase != this && entitylivingbase != targetEntity && !this.isOnSameTeam(entitylivingbase) && this.getDistanceSqToEntity(entitylivingbase) < 9.0D) { entitylivingbase.knockBack(this, 0.4F, (double)MathHelper.sin(this.rotationYaw * 0.017453292F), (double)(-MathHelper.cos(this.rotationYaw * 0.017453292F))); entitylivingbase.attackEntityFrom(DamageSource.causePlayerDamage(this), 1.0F); } } this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F); this.spawnSweepParticles(); } if (targetEntity instanceof EntityPlayerMP && targetEntity.velocityChanged) { ((EntityPlayerMP)targetEntity).connection.sendPacket(new SPacketEntityVelocity(targetEntity)); targetEntity.velocityChanged = false; targetEntity.motionX = d1; targetEntity.motionY = d2; targetEntity.motionZ = d3; } if (flag2) { this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_CRIT, this.getSoundCategory(), 1.0F, 1.0F); this.onCriticalHit(targetEntity); } if (!flag2 && !flag3) { if (flag) { this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_STRONG, this.getSoundCategory(), 1.0F, 1.0F); } else { this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_WEAK, this.getSoundCategory(), 1.0F, 1.0F); } } if (f1 > 0.0F) { this.onEnchantmentCritical(targetEntity); } if (!this.worldObj.isRemote && targetEntity instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer)targetEntity; ItemStack itemstack2 = this.getHeldItemMainhand(); ItemStack itemstack3 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : null; if (itemstack2 != null && itemstack3 != null && itemstack2.getItem() instanceof ItemAxe && itemstack3.getItem() == Items.SHIELD) { float f3 = 0.25F + (float)EnchantmentHelper.getEfficiencyModifier(this) * 0.05F; if (flag1) { f3 += 0.75F; } if (this.rand.nextFloat() < f3) { entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100); this.worldObj.setEntityState(entityplayer, (byte)30); } } } if (f >= 18.0F) { this.addStat(AchievementList.OVERKILL); } this.setLastAttacker(targetEntity); if (targetEntity instanceof EntityLivingBase) { EnchantmentHelper.applyThornEnchantments((EntityLivingBase)targetEntity, this); } EnchantmentHelper.applyArthropodEnchantments(this, targetEntity); ItemStack itemstack1 = this.getHeldItemMainhand(); Entity entity = targetEntity; if (targetEntity instanceof EntityDragonPart) { IEntityMultiPart ientitymultipart = ((EntityDragonPart)targetEntity).entityDragonObj; if (ientitymultipart instanceof EntityLivingBase) { entity = (EntityLivingBase)ientitymultipart; } } if (itemstack1 != null && entity instanceof EntityLivingBase) { itemstack1.hitEntity((EntityLivingBase)entity, this); if (itemstack1.stackSize <= 0) { this.setHeldItem(EnumHand.MAIN_HAND, (ItemStack)null); net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this, itemstack1, EnumHand.MAIN_HAND); } } if (targetEntity instanceof EntityLivingBase) { float f5 = f4 - ((EntityLivingBase)targetEntity).getHealth(); this.addStat(StatList.DAMAGE_DEALT, Math.round(f5 * 10.0F)); if (j > 0) { targetEntity.setFire(j * 4); } if (this.worldObj instanceof WorldServer && f5 > 2.0F) { int k = (int)((double)f5 * 0.5D); ((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.DAMAGE_INDICATOR, targetEntity.posX, targetEntity.posY + (double)(targetEntity.height * 0.5F), targetEntity.posZ, k, 0.1D, 0.0D, 0.1D, 0.2D, new int[0]); } } this.addExhaustion(0.3F); } else { this.worldObj.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, this.getSoundCategory(), 1.0F, 1.0F); if (flag4) { targetEntity.extinguish(); } } } } } } | /**
* Attacks for the player the targeted entity with the currently equipped item. The equipped item has hitEntity
* called on it. Args: targetEntity
*/ | Attacks for the player the targeted entity with the currently equipped item. The equipped item has hitEntity called on it. Args: targetEntity | attackTargetEntityWithCurrentItem | {
"repo_name": "Im-Jrotica/forge_latest",
"path": "build/tmp/recompileMc/sources/net/minecraft/entity/player/EntityPlayer.java",
"license": "lgpl-2.1",
"size": 99086
} | [
"net.minecraft.enchantment.EnchantmentHelper",
"net.minecraft.entity.Entity",
"net.minecraft.entity.EntityLivingBase",
"net.minecraft.entity.EnumCreatureAttribute",
"net.minecraft.entity.IEntityMultiPart",
"net.minecraft.entity.SharedMonsterAttributes",
"net.minecraft.entity.boss.EntityDragonPart",
"n... | import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.IEntityMultiPart; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.boss.EntityDragonPart; import net.minecraft.init.Items; import net.minecraft.init.MobEffects; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.network.play.server.SPacketEntityVelocity; import net.minecraft.stats.AchievementList; import net.minecraft.stats.StatList; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.MathHelper; import net.minecraft.world.WorldServer; | import net.minecraft.enchantment.*; import net.minecraft.entity.*; import net.minecraft.entity.boss.*; import net.minecraft.init.*; import net.minecraft.item.*; import net.minecraft.network.play.server.*; import net.minecraft.stats.*; import net.minecraft.util.*; import net.minecraft.util.math.*; import net.minecraft.world.*; | [
"net.minecraft.enchantment",
"net.minecraft.entity",
"net.minecraft.init",
"net.minecraft.item",
"net.minecraft.network",
"net.minecraft.stats",
"net.minecraft.util",
"net.minecraft.world"
] | net.minecraft.enchantment; net.minecraft.entity; net.minecraft.init; net.minecraft.item; net.minecraft.network; net.minecraft.stats; net.minecraft.util; net.minecraft.world; | 1,503,640 |
public static BigDecimal multiply(BigDecimal a, BigRational b, Precision resultPrecision) {
Precision internalPrecision = resultPrecision.add(1);
BigDecimal result = a.multiply(b.toBigDecimal(internalPrecision));
return resultPrecision.applyTo(result);
} | static BigDecimal function(BigDecimal a, BigRational b, Precision resultPrecision) { Precision internalPrecision = resultPrecision.add(1); BigDecimal result = a.multiply(b.toBigDecimal(internalPrecision)); return resultPrecision.applyTo(result); } | /**
* Computes the product of a and b.<br>
*
* Precision is the natural accuracy measure for multiplications because
* for each argument, each piece of it (bit, digit, ...) makes its own
* independent contribution to the result precision.
*
* @param a
* @param b
* @param resultPrecision
* @return product
*/ | Computes the product of a and b. Precision is the natural accuracy measure for multiplications because for each argument, each piece of it (bit, digit, ...) makes its own independent contribution to the result precision | multiply | {
"repo_name": "axkr/symja_android_library",
"path": "symja_android_library/matheclipse-gpl/src/main/java/de/tilman_neumann/jml/base/BigDecimalMath.java",
"license": "gpl-3.0",
"size": 6578
} | [
"de.tilman_neumann.jml.precision.Precision",
"java.math.BigDecimal"
] | import de.tilman_neumann.jml.precision.Precision; import java.math.BigDecimal; | import de.tilman_neumann.jml.precision.*; import java.math.*; | [
"de.tilman_neumann.jml",
"java.math"
] | de.tilman_neumann.jml; java.math; | 2,817,878 |
EAttribute getSystemInstantiation_Name(); | EAttribute getSystemInstantiation_Name(); | /**
* Returns the meta object for the attribute '{@link uk.ac.kcl.inf.robotics.rigidBodies.SystemInstantiation#getName <em>Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Name</em>'.
* @see uk.ac.kcl.inf.robotics.rigidBodies.SystemInstantiation#getName()
* @see #getSystemInstantiation()
* @generated
*/ | Returns the meta object for the attribute '<code>uk.ac.kcl.inf.robotics.rigidBodies.SystemInstantiation#getName Name</code>'. | getSystemInstantiation_Name | {
"repo_name": "szschaler/RigidBodies",
"path": "uk.ac.kcl.inf.robotics.rigid_bodies/src-gen/uk/ac/kcl/inf/robotics/rigidBodies/RigidBodiesPackage.java",
"license": "mit",
"size": 163741
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 842,649 |
TrackSelectionArray getCurrentTrackSelections(); | TrackSelectionArray getCurrentTrackSelections(); | /**
* Returns the current track selections for each renderer.
*/ | Returns the current track selections for each renderer | getCurrentTrackSelections | {
"repo_name": "superbderrick/ExoPlayer",
"path": "library/core/src/main/java/com/google/android/exoplayer2/Player.java",
"license": "apache-2.0",
"size": 38907
} | [
"com.google.android.exoplayer2.trackselection.TrackSelectionArray"
] | import com.google.android.exoplayer2.trackselection.TrackSelectionArray; | import com.google.android.exoplayer2.trackselection.*; | [
"com.google.android"
] | com.google.android; | 2,134,361 |
public void testDelayAndRethrottle() throws IOException, InterruptedException {
List<Throwable> errors = new CopyOnWriteArrayList<>();
AtomicBoolean done = new AtomicBoolean();
int threads = between(1, 10);
CyclicBarrier waitForShutdown = new CyclicBarrier(threads); | void function() throws IOException, InterruptedException { List<Throwable> errors = new CopyOnWriteArrayList<>(); AtomicBoolean done = new AtomicBoolean(); int threads = between(1, 10); CyclicBarrier waitForShutdown = new CyclicBarrier(threads); | /**
* Furiously rethrottles a delayed request to make sure that we never run it twice.
*/ | Furiously rethrottles a delayed request to make sure that we never run it twice | testDelayAndRethrottle | {
"repo_name": "mmaracic/elasticsearch",
"path": "modules/reindex/src/test/java/org/elasticsearch/index/reindex/BulkByScrollTaskTests.java",
"license": "apache-2.0",
"size": 11126
} | [
"java.io.IOException",
"java.util.List",
"java.util.concurrent.CopyOnWriteArrayList",
"java.util.concurrent.CyclicBarrier",
"java.util.concurrent.atomic.AtomicBoolean"
] | import java.io.IOException; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.atomic.AtomicBoolean; | import java.io.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,583,492 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.