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 static Enumeration getManifestPropertyNames() {
Hashtable names = new Hashtable();
Suite suite = VM.getCurrentIsolate().getLeafSuite();
while (suite != null) {
Enumeration additions = suite.getManifestPropertyNames();
while (additions.hasMoreElements()) {
Object propertyName = additions.nextElement();
names.put(propertyName, propertyName);
}
suite = suite.getParent();
}
return names.keys();
} | static Enumeration function() { Hashtable names = new Hashtable(); Suite suite = VM.getCurrentIsolate().getLeafSuite(); while (suite != null) { Enumeration additions = suite.getManifestPropertyNames(); while (additions.hasMoreElements()) { Object propertyName = additions.nextElement(); names.put(propertyName, propertyName); } suite = suite.getParent(); } return names.keys(); } | /**
* Gets the names of all manifest properties embedded in the leaf suite
* and all of its parents.
* @return enumeration over the names
*/ | Gets the names of all manifest properties embedded in the leaf suite and all of its parents | getManifestPropertyNames | {
"repo_name": "nejads/MqttMoped",
"path": "squawk/cldc/src/com/sun/squawk/VM.java",
"license": "gpl-2.0",
"size": 178144
} | [
"java.util.Enumeration",
"java.util.Hashtable"
] | import java.util.Enumeration; import java.util.Hashtable; | import java.util.*; | [
"java.util"
] | java.util; | 2,517,935 |
public void testNullEnum() {
String example = null;
try {
ServiceUpdateReason temp = ServiceUpdateReason.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
} catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
}
} | void function() { String example = null; try { ServiceUpdateReason temp = ServiceUpdateReason.valueForString(example); assertNull(STR, temp); } catch (NullPointerException exception) { fail(STR); } } | /**
* Verifies that a null assignment is invalid.
*/ | Verifies that a null assignment is invalid | testNullEnum | {
"repo_name": "smartdevicelink/sdl_android",
"path": "android/sdl_android/src/androidTest/java/com/smartdevicelink/test/rpc/enums/ServiceUpdateReasonTests.java",
"license": "bsd-3-clause",
"size": 3155
} | [
"com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason"
] | import com.smartdevicelink.proxy.rpc.enums.ServiceUpdateReason; | import com.smartdevicelink.proxy.rpc.enums.*; | [
"com.smartdevicelink.proxy"
] | com.smartdevicelink.proxy; | 1,990,906 |
public static void connect(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException { Libcore.os.connect(fd, address, port); } | public static void connect(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException { Libcore.os.connect(fd, address, port); } | /**
* See <a href="http://man7.org/linux/man-pages/man2/close.2.html">close(2)</a>.
*/ | See close(2) | close | {
"repo_name": "AdmireTheDistance/android_libcore",
"path": "luni/src/main/java/android/system/Os.java",
"license": "gpl-2.0",
"size": 28673
} | [
"java.io.FileDescriptor",
"java.net.InetAddress",
"java.net.SocketException"
] | import java.io.FileDescriptor; import java.net.InetAddress; import java.net.SocketException; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 815,352 |
EClass getMDeploymentAlternative(); | EClass getMDeploymentAlternative(); | /**
* Returns the meta object for class '{@link es.uah.aut.srg.micobs.mclev.mclevmcad.MDeploymentAlternative <em>MDeploymentAlternative</em>}'.
* @return the meta object for class '<em>MDeploymentAlternative</em>'.
* @see es.uah.aut.srg.micobs.mclev.mclevmcad.MDeploymentAlternative
* @generated
*/ | Returns the meta object for class '<code>es.uah.aut.srg.micobs.mclev.mclevmcad.MDeploymentAlternative MDeploymentAlternative</code>' | getMDeploymentAlternative | {
"repo_name": "parraman/micobs",
"path": "mclev/es.uah.aut.srg.micobs.mclev/src/es/uah/aut/srg/micobs/mclev/mclevmcad/mclevmcadPackage.java",
"license": "epl-1.0",
"size": 59510
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 116,637 |
public static void apiManagementSubscriptionListSecrets(
com.azure.resourcemanager.apimanagement.ApiManagementManager manager) {
manager
.subscriptions()
.listSecretsWithResponse("rg1", "apimService1", "5931a769d8d14f0ad8ce13b8", Context.NONE);
} | static void function( com.azure.resourcemanager.apimanagement.ApiManagementManager manager) { manager .subscriptions() .listSecretsWithResponse("rg1", STR, STR, Context.NONE); } | /**
* Sample code: ApiManagementSubscriptionListSecrets.
*
* @param manager Entry point to ApiManagementManager.
*/ | Sample code: ApiManagementSubscriptionListSecrets | apiManagementSubscriptionListSecrets | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/samples/java/com/azure/resourcemanager/apimanagement/SubscriptionListSecretsSamples.java",
"license": "mit",
"size": 928
} | [
"com.azure.core.util.Context"
] | import com.azure.core.util.Context; | import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 1,731,168 |
public static String getReaderURLIfCached(final Context context, @NonNull final String pageURL) {
SavedReaderViewHelper rvh = getSavedReaderViewHelper(context);
if (rvh.isURLCached(pageURL)) {
return ReaderModeUtils.getAboutReaderForUrl(pageURL);
} else {
return pageURL;
}
} | static String function(final Context context, @NonNull final String pageURL) { SavedReaderViewHelper rvh = getSavedReaderViewHelper(context); if (rvh.isURLCached(pageURL)) { return ReaderModeUtils.getAboutReaderForUrl(pageURL); } else { return pageURL; } } | /**
* Return the Reader View URL for a given URL if it is contained in the cache. Returns the
* plain URL if the page is not cached.
*/ | Return the Reader View URL for a given URL if it is contained in the cache. Returns the plain URL if the page is not cached | getReaderURLIfCached | {
"repo_name": "Yukarumya/Yukarum-Redfoxes",
"path": "mobile/android/base/java/org/mozilla/gecko/reader/SavedReaderViewHelper.java",
"license": "mpl-2.0",
"size": 10128
} | [
"android.content.Context",
"android.support.annotation.NonNull"
] | import android.content.Context; import android.support.annotation.NonNull; | import android.content.*; import android.support.annotation.*; | [
"android.content",
"android.support"
] | android.content; android.support; | 1,092,553 |
private void collideWithEntities(List<Entity> p_70970_1_)
{
double d0 = (this.dragonPartBody.getEntityBoundingBox().minX + this.dragonPartBody.getEntityBoundingBox().maxX) / 2.0D;
double d1 = (this.dragonPartBody.getEntityBoundingBox().minZ + this.dragonPartBody.getEntityBoundingBox().maxZ) / 2.0D;
for (Entity entity : p_70970_1_)
{
if (entity instanceof EntityLivingBase)
{
double d2 = entity.posX - d0;
double d3 = entity.posZ - d1;
double d4 = d2 * d2 + d3 * d3;
entity.addVelocity(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D);
if (!this.phaseManager.getCurrentPhase().getIsStationary() && ((EntityLivingBase)entity).getRevengeTimer() < entity.ticksExisted - 2)
{
entity.attackEntityFrom(DamageSource.causeMobDamage(this), 5.0F);
this.applyEnchantments(this, entity);
}
}
}
}
| void function(List<Entity> p_70970_1_) { double d0 = (this.dragonPartBody.getEntityBoundingBox().minX + this.dragonPartBody.getEntityBoundingBox().maxX) / 2.0D; double d1 = (this.dragonPartBody.getEntityBoundingBox().minZ + this.dragonPartBody.getEntityBoundingBox().maxZ) / 2.0D; for (Entity entity : p_70970_1_) { if (entity instanceof EntityLivingBase) { double d2 = entity.posX - d0; double d3 = entity.posZ - d1; double d4 = d2 * d2 + d3 * d3; entity.addVelocity(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D); if (!this.phaseManager.getCurrentPhase().getIsStationary() && ((EntityLivingBase)entity).getRevengeTimer() < entity.ticksExisted - 2) { entity.attackEntityFrom(DamageSource.causeMobDamage(this), 5.0F); this.applyEnchantments(this, entity); } } } } | /**
* Pushes all entities inside the list away from the enderdragon.
*/ | Pushes all entities inside the list away from the enderdragon | collideWithEntities | {
"repo_name": "lucemans/ShapeClient-SRC",
"path": "net/minecraft/entity/boss/EntityDragon.java",
"license": "mpl-2.0",
"size": 46729
} | [
"java.util.List",
"net.minecraft.entity.Entity",
"net.minecraft.entity.EntityLivingBase",
"net.minecraft.util.DamageSource"
] | import java.util.List; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; | import java.util.*; import net.minecraft.entity.*; import net.minecraft.util.*; | [
"java.util",
"net.minecraft.entity",
"net.minecraft.util"
] | java.util; net.minecraft.entity; net.minecraft.util; | 11,957 |
private int getAddressType(String string) {
int type = ContactsContract.CommonDataKinds.StructuredPostal.TYPE_OTHER;
if (string != null) {
if ("work".equals(string.toLowerCase())) {
return ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK;
}
else if ("other".equals(string.toLowerCase())) {
return ContactsContract.CommonDataKinds.StructuredPostal.TYPE_OTHER;
}
else if ("home".equals(string.toLowerCase())) {
return ContactsContract.CommonDataKinds.StructuredPostal.TYPE_HOME;
}
}
return type;
} | int function(String string) { int type = ContactsContract.CommonDataKinds.StructuredPostal.TYPE_OTHER; if (string != null) { if ("work".equals(string.toLowerCase())) { return ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK; } else if ("other".equals(string.toLowerCase())) { return ContactsContract.CommonDataKinds.StructuredPostal.TYPE_OTHER; } else if ("home".equals(string.toLowerCase())) { return ContactsContract.CommonDataKinds.StructuredPostal.TYPE_HOME; } } return type; } | /**
* Converts a string from the W3C Contact API to it's Android int value.
* @param string
* @return Android int value
*/ | Converts a string from the W3C Contact API to it's Android int value | getAddressType | {
"repo_name": "hgl888/cordova-android-chromeview",
"path": "framework/src/org/apache/cordova/ContactAccessorSdk5.java",
"license": "apache-2.0",
"size": 105483
} | [
"android.provider.ContactsContract"
] | import android.provider.ContactsContract; | import android.provider.*; | [
"android.provider"
] | android.provider; | 2,669,773 |
@SuppressWarnings("unchecked")
public void testAdValue1ByHQLCriteria() throws ApplicationException
{
HQLCriteria criteria = new HQLCriteria("from gov.nih.nci.cacoresdk.domain.other.datatype.AdDataType a where a.value1.part_0.value is not null order by a.id asc");
Collection<AdDataType> result = search(criteria, "gov.nih.nci.cacoresdk.domain.other.datatype.AdDataType");
assertNotNull(result);
assertEquals(5, result.size());
List indexList = new ArrayList();
indexList.add("2");
indexList.add("3");
indexList.add("4");
indexList.add("5");
indexList.add("6");
assertValue1(result, indexList);
}
| @SuppressWarnings(STR) void function() throws ApplicationException { HQLCriteria criteria = new HQLCriteria(STR); Collection<AdDataType> result = search(criteria, STR); assertNotNull(result); assertEquals(5, result.size()); List indexList = new ArrayList(); indexList.add("2"); indexList.add("3"); indexList.add("4"); indexList.add("5"); indexList.add("6"); assertValue1(result, indexList); } | /**
* Search Value1 by HQL criteria Test
*
* @throws ApplicationException
*/ | Search Value1 by HQL criteria Test | testAdValue1ByHQLCriteria | {
"repo_name": "NCIP/cacore-sdk",
"path": "sdk-toolkit/iso-example-project/junit/src/test/gov/nih/nci/cacoresdk/domain/other/datatype/AdDataTypeTest.java",
"license": "bsd-3-clause",
"size": 74764
} | [
"gov.nih.nci.cacoresdk.domain.other.datatype.AdDataType",
"gov.nih.nci.system.applicationservice.ApplicationException",
"gov.nih.nci.system.query.hibernate.HQLCriteria",
"java.util.ArrayList",
"java.util.Collection",
"java.util.List"
] | import gov.nih.nci.cacoresdk.domain.other.datatype.AdDataType; import gov.nih.nci.system.applicationservice.ApplicationException; import gov.nih.nci.system.query.hibernate.HQLCriteria; import java.util.ArrayList; import java.util.Collection; import java.util.List; | import gov.nih.nci.cacoresdk.domain.other.datatype.*; import gov.nih.nci.system.applicationservice.*; import gov.nih.nci.system.query.hibernate.*; import java.util.*; | [
"gov.nih.nci",
"java.util"
] | gov.nih.nci; java.util; | 2,732,448 |
boolean doMergeResults(GroupByQuery query); | boolean doMergeResults(GroupByQuery query); | /**
* Indicates if this query should undergo "mergeResults" or not. Checked by
* {@link GroupByQueryQueryToolChest#mergeResults(QueryRunner)}.
*/ | Indicates if this query should undergo "mergeResults" or not. Checked by <code>GroupByQueryQueryToolChest#mergeResults(QueryRunner)</code> | doMergeResults | {
"repo_name": "himanshug/druid",
"path": "processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategy.java",
"license": "apache-2.0",
"size": 8588
} | [
"org.apache.druid.query.groupby.GroupByQuery"
] | import org.apache.druid.query.groupby.GroupByQuery; | import org.apache.druid.query.groupby.*; | [
"org.apache.druid"
] | org.apache.druid; | 1,385,276 |
@Override
boolean equals(@Nullable Object o); | boolean equals(@Nullable Object o); | /**
* Compares this StringEncodedValue to another StringEncodedValue for equality.
* <p/>
* This StringEncodedValue is equal to another StringEncodedValue if the values returned by getValue() are equal.
*
* @param o The object to be compared for equality with this StringEncodedValue
* @return true if the specified object is equal to this StringEncodedValue
*/ | Compares this StringEncodedValue to another StringEncodedValue for equality. This StringEncodedValue is equal to another StringEncodedValue if the values returned by getValue() are equal | equals | {
"repo_name": "Unixcision/show-java",
"path": "app/src/main/java/org/jf/dexlib2/iface/value/StringEncodedValue.java",
"license": "apache-2.0",
"size": 3183
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 902,173 |
@Override
public void setSchema(IDatabaseSchema schema) {
// TODO Auto-generated method stub
} | void function(IDatabaseSchema schema) { } | /**
* Not implemented yet.
*/ | Not implemented yet | setSchema | {
"repo_name": "hyarthi/project-red",
"path": "src/java/org.openntf.red.main/src/org/openntf/red/impl/Database.java",
"license": "apache-2.0",
"size": 36930
} | [
"org.openntf.red.schema.IDatabaseSchema"
] | import org.openntf.red.schema.IDatabaseSchema; | import org.openntf.red.schema.*; | [
"org.openntf.red"
] | org.openntf.red; | 2,730,003 |
private List<ByteArray> readKey(String requestURI) {
List<ByteArray> keyList = null;
String[] parts = requestURI.split("/");
if(parts.length > 2) {
String base64KeyList = parts[2];
keyList = new ArrayList<ByteArray>();
if(!base64KeyList.contains(",")) {
String rawKey = base64KeyList.trim();
keyList.add(new ByteArray(Base64.decodeBase64(rawKey.getBytes())));
} else {
String[] base64KeyArray = base64KeyList.split(",");
for(String base64Key: base64KeyArray) {
String rawKey = base64Key.trim();
keyList.add(new ByteArray(Base64.decodeBase64(rawKey.getBytes())));
}
}
}
return keyList;
} | List<ByteArray> function(String requestURI) { List<ByteArray> keyList = null; String[] parts = requestURI.split("/"); if(parts.length > 2) { String base64KeyList = parts[2]; keyList = new ArrayList<ByteArray>(); if(!base64KeyList.contains(",")) { String rawKey = base64KeyList.trim(); keyList.add(new ByteArray(Base64.decodeBase64(rawKey.getBytes()))); } else { String[] base64KeyArray = base64KeyList.split(","); for(String base64Key: base64KeyArray) { String rawKey = base64Key.trim(); keyList.add(new ByteArray(Base64.decodeBase64(rawKey.getBytes()))); } } } return keyList; } | /**
* Method to read a key (or keys) present in the HTTP request URI. The URI
* must be of the format /<store_name>/<key>[,<key>,...]
*
* @param requestURI The URI of the HTTP request
* @return the List<ByteArray> representing the key (or keys)
*/ | Method to read a key (or keys) present in the HTTP request URI. The URI must be of the format //[,,...] | readKey | {
"repo_name": "medallia/voldemort",
"path": "src/java/voldemort/coordinator/VoldemortHttpRequestHandler.java",
"license": "apache-2.0",
"size": 17709
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.commons.codec.binary.Base64"
] | import java.util.ArrayList; import java.util.List; import org.apache.commons.codec.binary.Base64; | import java.util.*; import org.apache.commons.codec.binary.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 353,877 |
private Set<String> getUrlNames(CmsUUID id) {
try {
return new HashSet<String>(m_cms.readUrlNamesForAllLocales(id));
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
return Collections.emptySet();
}
} | Set<String> function(CmsUUID id) { try { return new HashSet<String>(m_cms.readUrlNamesForAllLocales(id)); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return Collections.emptySet(); } } | /**
* Reads the URL names for the id.<p>
*
* @param id the structure id of a resource
* @return the URL names for the resource
*/ | Reads the URL names for the id | getUrlNames | {
"repo_name": "mediaworx/opencms-core",
"path": "src/org/opencms/ade/configuration/CmsDetailNameCache.java",
"license": "lgpl-2.1",
"size": 8159
} | [
"java.util.Collections",
"java.util.HashSet",
"java.util.Set",
"org.opencms.util.CmsUUID"
] | import java.util.Collections; import java.util.HashSet; import java.util.Set; import org.opencms.util.CmsUUID; | import java.util.*; import org.opencms.util.*; | [
"java.util",
"org.opencms.util"
] | java.util; org.opencms.util; | 2,211,298 |
public InputStream doPost(byte[] postData, String contentType) {
this.urlConnection.setDoOutput(true);
if (contentType != null) this.urlConnection.setRequestProperty( "Content-type", contentType );
OutputStream out = null;
try {
out = this.getOutputStream();
if(out!=null)
{
out.write(postData);
out.flush();
}
} catch (IOException e) {
e.printStackTrace();
}finally {
if(out!=null)
try {
out.close();
} catch (IOException e) {
//
}
}
return (this.getInputStream());
} | InputStream function(byte[] postData, String contentType) { this.urlConnection.setDoOutput(true); if (contentType != null) this.urlConnection.setRequestProperty( STR, contentType ); OutputStream out = null; try { out = this.getOutputStream(); if(out!=null) { out.write(postData); out.flush(); } } catch (IOException e) { e.printStackTrace(); }finally { if(out!=null) try { out.close(); } catch (IOException e) { } return (this.getInputStream()); } | /**
* posts data to the inputstream and returns the InputStream.
*
* @param postData data to be posted. must be url-encoded already.
* @param contentType allows you to set the contentType of the request.
* @return InputStream input stream from URLConnection
*/ | posts data to the inputstream and returns the InputStream | doPost | {
"repo_name": "jfuerth/hal.next",
"path": "app/src/main/java/org/jboss/hal/server/proxy/HttpClient.java",
"license": "lgpl-2.1",
"size": 12396
} | [
"java.io.IOException",
"java.io.InputStream",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,519,098 |
public @Nullable String getUsername() {
return username;
} | @Nullable String function() { return username; } | /**
* Returns the username currently authenticated with or null if there isn't one.
*
* @return username or null
*/ | Returns the username currently authenticated with or null if there isn't one | getUsername | {
"repo_name": "theoweiss/openhab2",
"path": "bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/HueBridge.java",
"license": "epl-1.0",
"size": 37886
} | [
"org.eclipse.jdt.annotation.Nullable"
] | import org.eclipse.jdt.annotation.Nullable; | import org.eclipse.jdt.annotation.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 912,233 |
private HttpRequestBase preparePlainMethod(final String method, HTTPRequestConfiguration configuration)
throws UnsupportedEncodingException {
if (logger.isDebugEnabled()) {
logger.debug("Creating " + method + " request to " + configuration.getTarget());
}
HttpRequestBase httpMethod = new HttpPlainRequest(method, configuration.getTarget());
addQuery(configuration, httpMethod);
return httpMethod;
}
| HttpRequestBase function(final String method, HTTPRequestConfiguration configuration) throws UnsupportedEncodingException { if (logger.isDebugEnabled()) { logger.debug(STR + method + STR + configuration.getTarget()); } HttpRequestBase httpMethod = new HttpPlainRequest(method, configuration.getTarget()); addQuery(configuration, httpMethod); return httpMethod; } | /**
* Prepares a GET-like method for given configuration.
*
* @param configuration
* @return a GET-like method for given configuration.
*
* @throws UnsupportedEncodingException
*/ | Prepares a GET-like method for given configuration | preparePlainMethod | {
"repo_name": "CloverETL/CloverETL-Engine",
"path": "cloveretl.component/src/org/jetel/component/HttpConnector.java",
"license": "lgpl-2.1",
"size": 154063
} | [
"java.io.UnsupportedEncodingException",
"org.apache.http.client.methods.HttpRequestBase"
] | import java.io.UnsupportedEncodingException; import org.apache.http.client.methods.HttpRequestBase; | import java.io.*; import org.apache.http.client.methods.*; | [
"java.io",
"org.apache.http"
] | java.io; org.apache.http; | 319,861 |
public Set<Identifier> getVariables(); | Set<Identifier> function(); | /**
* Gets the of variables used in this expression that are not defined
* locally. The set need not be complete, because variable indices are
* ignored.
*
* @return set of undefined variables.
*/ | Gets the of variables used in this expression that are not defined locally. The set need not be complete, because variable indices are ignored | getVariables | {
"repo_name": "kasperdokter/Reo-compiler",
"path": "reo-interpreter/src/main/java/nl/cwi/reo/interpret/components/ComponentExpression.java",
"license": "mit",
"size": 565
} | [
"java.util.Set",
"nl.cwi.reo.interpret.variables.Identifier"
] | import java.util.Set; import nl.cwi.reo.interpret.variables.Identifier; | import java.util.*; import nl.cwi.reo.interpret.variables.*; | [
"java.util",
"nl.cwi.reo"
] | java.util; nl.cwi.reo; | 2,843,523 |
userLabel = new javax.swing.JLabel();
infoLabel = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
userLabel.setFont(new java.awt.Font("sansserif", 1, 24)); // NOI18N
userLabel.setForeground(new java.awt.Color(102, 102, 102));
userLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/myhotel/images/User_min.png"))); // NOI18N
getContentPane().add(userLabel);
userLabel.setBounds(113, 260, 304, 70);
infoLabel.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
infoLabel.setForeground(new java.awt.Color(255, 255, 255));
getContentPane().add(infoLabel);
infoLabel.setBounds(174, 188, 284, 37);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/myhotel/images/loading.gif"))); // NOI18N
getContentPane().add(jLabel1);
jLabel1.setBounds(126, 188, 30, 37);
jLabel2.setFont(new java.awt.Font("Trebuchet MS", 1, 72)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Welcome");
getContentPane().add(jLabel2);
jLabel2.setBounds(180, 80, 330, 90);
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/myhotel/images/2016-04-06-15-04-32.jpg"))); // NOI18N
getContentPane().add(jLabel3);
jLabel3.setBounds(0, 0, 650, 430);
setSize(new java.awt.Dimension(666, 468));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents | userLabel = new javax.swing.JLabel(); infoLabel = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(null); userLabel.setFont(new java.awt.Font(STR, 1, 24)); userLabel.setForeground(new java.awt.Color(102, 102, 102)); userLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource(STR))); getContentPane().add(userLabel); userLabel.setBounds(113, 260, 304, 70); infoLabel.setFont(new java.awt.Font(STR, 1, 18)); infoLabel.setForeground(new java.awt.Color(255, 255, 255)); getContentPane().add(infoLabel); infoLabel.setBounds(174, 188, 284, 37); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource(STR))); getContentPane().add(jLabel1); jLabel1.setBounds(126, 188, 30, 37); jLabel2.setFont(new java.awt.Font(STR, 1, 72)); jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText(STR); getContentPane().add(jLabel2); jLabel2.setBounds(180, 80, 330, 90); jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource(STR))); getContentPane().add(jLabel3); jLabel3.setBounds(0, 0, 650, 430); setSize(new java.awt.Dimension(666, 468)); setLocationRelativeTo(null); } | /**
* 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": "bhagi8/Nostimo",
"path": "src/myhotel/login/Loading.java",
"license": "mit",
"size": 6248
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,235,273 |
void dump() {
Log.d(TAG, "MediaBrowser...");
Log.d(TAG, " mServiceComponent=" + mServiceComponent);
Log.d(TAG, " mCallback=" + mCallback);
Log.d(TAG, " mRootHints=" + mRootHints);
Log.d(TAG, " mState=" + getStateLabel(mState));
Log.d(TAG, " mServiceConnection=" + mServiceConnection);
Log.d(TAG, " mServiceBinder=" + mServiceBinder);
Log.d(TAG, " mServiceCallbacks=" + mServiceCallbacks);
Log.d(TAG, " mRootId=" + mRootId);
Log.d(TAG, " mMediaSessionToken=" + mMediaSessionToken);
}
public static class MediaItem implements Parcelable {
private final int mFlags;
private final MediaDescription mDescription;
@Retention(RetentionPolicy.SOURCE)
@IntDef(flag=true, value = { FLAG_BROWSABLE, FLAG_PLAYABLE })
public @interface Flags { }
public static final int FLAG_BROWSABLE = 1 << 0;
public static final int FLAG_PLAYABLE = 1 << 1;
public MediaItem(@NonNull MediaDescription description, @Flags int flags) {
if (description == null) {
throw new IllegalArgumentException("description cannot be null");
}
if (TextUtils.isEmpty(description.getMediaId())) {
throw new IllegalArgumentException("description must have a non-empty media id");
}
mFlags = flags;
mDescription = description;
}
private MediaItem(Parcel in) {
mFlags = in.readInt();
mDescription = MediaDescription.CREATOR.createFromParcel(in);
} | void dump() { Log.d(TAG, STR); Log.d(TAG, STR + mServiceComponent); Log.d(TAG, STR + mCallback); Log.d(TAG, STR + mRootHints); Log.d(TAG, STR + getStateLabel(mState)); Log.d(TAG, STR + mServiceConnection); Log.d(TAG, STR + mServiceBinder); Log.d(TAG, STR + mServiceCallbacks); Log.d(TAG, STR + mRootId); Log.d(TAG, STR + mMediaSessionToken); } public static class MediaItem implements Parcelable { private final int mFlags; private final MediaDescription mDescription; @Retention(RetentionPolicy.SOURCE) @IntDef(flag=true, value = { FLAG_BROWSABLE, FLAG_PLAYABLE }) public @interface Flags { } public static final int FLAG_BROWSABLE = 1 << 0; public static final int FLAG_PLAYABLE = 1 << 1; public MediaItem(@NonNull MediaDescription description, @Flags int flags) { if (description == null) { throw new IllegalArgumentException(STR); } if (TextUtils.isEmpty(description.getMediaId())) { throw new IllegalArgumentException(STR); } mFlags = flags; mDescription = description; } private MediaItem(Parcel in) { mFlags = in.readInt(); mDescription = MediaDescription.CREATOR.createFromParcel(in); } | /**
* Log internal state.
* @hide
*/ | Log internal state | dump | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/base/media/java/android/media/browse/MediaBrowser.java",
"license": "gpl-3.0",
"size": 29720
} | [
"android.annotation.IntDef",
"android.annotation.NonNull",
"android.media.MediaDescription",
"android.os.Parcel",
"android.os.Parcelable",
"android.text.TextUtils",
"android.util.Log",
"java.lang.annotation.Retention",
"java.lang.annotation.RetentionPolicy"
] | import android.annotation.IntDef; import android.annotation.NonNull; import android.media.MediaDescription; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.Log; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; | import android.annotation.*; import android.media.*; import android.os.*; import android.text.*; import android.util.*; import java.lang.annotation.*; | [
"android.annotation",
"android.media",
"android.os",
"android.text",
"android.util",
"java.lang"
] | android.annotation; android.media; android.os; android.text; android.util; java.lang; | 2,650,657 |
public void draw(Graphics surface) {
surface.drawLine(50, 50, 250, 250);
surface.drawString("String!", 50, 50);
int [ ] x = {20, 35, 50, 65, 80, 95};
int [ ] y = {60, 105, 105, 110, 95, 95};
surface.drawPolygon(x, y, 6);
box.draw(surface);
surface.drawRoundRect(35,45,25,35,10,10);
} | void function(Graphics surface) { surface.drawLine(50, 50, 250, 250); surface.drawString(STR, 50, 50); int [ ] x = {20, 35, 50, 65, 80, 95}; int [ ] y = {60, 105, 105, 110, 95, 95}; surface.drawPolygon(x, y, 6); box.draw(surface); surface.drawRoundRect(35,45,25,35,10,10); } | /** Draw the contents of the window on surface. Called 20 times per second.
* @param surface */ | Draw the contents of the window on surface. Called 20 times per second | draw | {
"repo_name": "RibeiroThiago/MIT_6.092",
"path": "assign5_part1/DrawGraphics.java",
"license": "mit",
"size": 900
} | [
"java.awt.Graphics"
] | import java.awt.Graphics; | import java.awt.*; | [
"java.awt"
] | java.awt; | 872,045 |
public boolean parseBoolean() throws IOException, ParseException
{
Object ret = parseNext(false);
if(ret == null)
throw new IllegalStateException("No more elements in array");
else if(!(ret instanceof Boolean))
throw new IllegalStateException("Next element is a " + getType(ret) + ", not a boolean ");
else
return ((Boolean) ret).booleanValue();
} | boolean function() throws IOException, ParseException { Object ret = parseNext(false); if(ret == null) throw new IllegalStateException(STR); else if(!(ret instanceof Boolean)) throw new IllegalStateException(STR + getType(ret) + STR); else return ((Boolean) ret).booleanValue(); } | /**
* Same as {@link #parseNext(boolean)}, but asserting that there is a next element and that it is a boolean
*
* @return The value of the current property or the next element in the array as a boolean
* @throws IllegalStateException If the top of this parser's state is not either an array or an object property, if there is no next
* element in the array, or the next element is not a boolean
* @throws IOException If an error occurs reading the data from the stream
* @throws ParseException If the next element cannot be parsed
*/ | Same as <code>#parseNext(boolean)</code>, but asserting that there is a next element and that it is a boolean | parseBoolean | {
"repo_name": "Updownquark/Qommons",
"path": "src/main/java/org/qommons/json/JsonSerialReader.java",
"license": "mit",
"size": 43479
} | [
"java.io.IOException",
"org.qommons.json.SAJParser"
] | import java.io.IOException; import org.qommons.json.SAJParser; | import java.io.*; import org.qommons.json.*; | [
"java.io",
"org.qommons.json"
] | java.io; org.qommons.json; | 1,662,782 |
public String toString() {
// cross-platform newline :-)
String newLine = System.getProperty("line.separator");
StringBuilder details = new StringBuilder(1024);
Iterator<?> iterator = getValues().iterator();
List<Fetcher> fetchers = resultList.getFetchers();
for (int i = 0; iterator.hasNext(); i++) {
String fetcherName = fetchers.get(i).getName();
details.append(fetcherName).append(":\t");
Object value = iterator.next();
details.append(value != null ? value : "");
details.append(newLine);
}
return details.toString();
}
| String function() { String newLine = System.getProperty(STR); StringBuilder details = new StringBuilder(1024); Iterator<?> iterator = getValues().iterator(); List<Fetcher> fetchers = resultList.getFetchers(); for (int i = 0; iterator.hasNext(); i++) { String fetcherName = fetchers.get(i).getName(); details.append(fetcherName).append(":\t"); Object value = iterator.next(); details.append(value != null ? value : ""); details.append(newLine); } return details.toString(); } | /**
* Returns all results for this IP address as a String.
* This is used in showing the IP Details dialog box.
* @return human-friendly text representation of results
*/ | Returns all results for this IP address as a String. This is used in showing the IP Details dialog box | toString | {
"repo_name": "angryziber/ipscan",
"path": "src/net/azib/ipscan/core/ScanningResult.java",
"license": "gpl-2.0",
"size": 3202
} | [
"java.util.Iterator",
"java.util.List",
"net.azib.ipscan.fetchers.Fetcher"
] | import java.util.Iterator; import java.util.List; import net.azib.ipscan.fetchers.Fetcher; | import java.util.*; import net.azib.ipscan.fetchers.*; | [
"java.util",
"net.azib.ipscan"
] | java.util; net.azib.ipscan; | 892,385 |
@JsonProperty("URN")
void setURN(String URN); | @JsonProperty("URN") void setURN(String URN); | /**
* Sets the URN of this device. The URN will be persisted.
*
* @param URN
*/ | Sets the URN of this device. The URN will be persisted | setURN | {
"repo_name": "Ericsson-LMF/IoT-Gateway",
"path": "osgi/generic.device.access/src/main/java/com/ericsson/deviceaccess/api/GenericDevice.java",
"license": "gpl-2.0",
"size": 7576
} | [
"com.fasterxml.jackson.annotation.JsonProperty"
] | import com.fasterxml.jackson.annotation.JsonProperty; | import com.fasterxml.jackson.annotation.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 2,007,825 |
// Create a resource and initialize it
GalleryResource resource = (GalleryResource) createNewInstance();
// Create the resource properties bean so that the resource can use it to hold the resource property values
GalleryResourceProperties props = new GalleryResourceProperties();
// Get a unique id for the resource
Object id = UUIDGEN.nextUUID();
// Create the resource key set it on the resource
// this key is used for index service registration
ResourceKey key = new SimpleResourceKey(getKeyTypeName(), id);
resource.setResourceKey(key);
resource.initialize(props, GalleryConstants.RESOURCE_PROPERTY_SET, id);
// Add the resource to the list of resources in this home
add(key, resource);
return key;
}
| GalleryResource resource = (GalleryResource) createNewInstance(); GalleryResourceProperties props = new GalleryResourceProperties(); Object id = UUIDGEN.nextUUID(); ResourceKey key = new SimpleResourceKey(getKeyTypeName(), id); resource.setResourceKey(key); resource.initialize(props, GalleryConstants.RESOURCE_PROPERTY_SET, id); add(key, resource); return key; } | /**
* Creates a new Resource, adds it to the list of resources managed by this resource home,
* and returns the key to the resource.
*/ | Creates a new Resource, adds it to the list of resources managed by this resource home, and returns the key to the resource | createResource | {
"repo_name": "NCIP/cagrid",
"path": "cagrid/Software/general/demos/ImageGallery/PhotoSharing/src/org/cagrid/demo/photosharing/gallery/service/globus/resource/GalleryResourceHome.java",
"license": "bsd-3-clause",
"size": 3415
} | [
"org.cagrid.demo.photosharing.gallery.common.GalleryConstants",
"org.cagrid.demo.photosharing.gallery.stubs.GalleryResourceProperties",
"org.globus.wsrf.ResourceKey",
"org.globus.wsrf.impl.SimpleResourceKey"
] | import org.cagrid.demo.photosharing.gallery.common.GalleryConstants; import org.cagrid.demo.photosharing.gallery.stubs.GalleryResourceProperties; import org.globus.wsrf.ResourceKey; import org.globus.wsrf.impl.SimpleResourceKey; | import org.cagrid.demo.photosharing.gallery.common.*; import org.cagrid.demo.photosharing.gallery.stubs.*; import org.globus.wsrf.*; import org.globus.wsrf.impl.*; | [
"org.cagrid.demo",
"org.globus.wsrf"
] | org.cagrid.demo; org.globus.wsrf; | 1,377,734 |
public List<String> populateConstraints(Table tb, Set<String> allTableNames) {
List<String> constraints = new ArrayList<>();
getAlterTableStmtForeignKeyConstraint(tb.getForeignKeyInfo(), constraints, allTableNames);
getAlterTableStmtUniqueConstraint(tb.getUniqueKeyInfo(), constraints);
getAlterTableStmtDefaultConstraint(tb.getDefaultConstraint(), tb, constraints);
getAlterTableStmtCheckConstraint(tb.getCheckConstraint(), constraints);
getAlterTableStmtNotNullConstraint(tb.getNotNullConstraint(), tb, constraints);
return constraints;
} | List<String> function(Table tb, Set<String> allTableNames) { List<String> constraints = new ArrayList<>(); getAlterTableStmtForeignKeyConstraint(tb.getForeignKeyInfo(), constraints, allTableNames); getAlterTableStmtUniqueConstraint(tb.getUniqueKeyInfo(), constraints); getAlterTableStmtDefaultConstraint(tb.getDefaultConstraint(), tb, constraints); getAlterTableStmtCheckConstraint(tb.getCheckConstraint(), constraints); getAlterTableStmtNotNullConstraint(tb.getNotNullConstraint(), tb, constraints); return constraints; } | /**
* Add all the constraints for the given table. Will populate the constraints list.
*
* @param tb
*/ | Add all the constraints for the given table. Will populate the constraints list | populateConstraints | {
"repo_name": "sankarh/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/exec/DDLPlanUtils.java",
"license": "apache-2.0",
"size": 44245
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Set",
"org.apache.hadoop.hive.ql.metadata.Table"
] | import java.util.ArrayList; import java.util.List; import java.util.Set; import org.apache.hadoop.hive.ql.metadata.Table; | import java.util.*; import org.apache.hadoop.hive.ql.metadata.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,705,042 |
protected void load(Map data) {
Object o = data.get(tag);
if (o instanceof File)
setValue((File)o);
else if (o instanceof String)
setValue(new File((String)o));
} | void function(Map data) { Object o = data.get(tag); if (o instanceof File) setValue((File)o); else if (o instanceof String) setValue(new File((String)o)); } | /**
* Load the value for this question from a dictionary, using
* the tag as the key.
* @param data The map from which to load the value for this question.
*/ | Load the value for this question from a dictionary, using the tag as the key | load | {
"repo_name": "Distrotech/icedtea7",
"path": "test/jtreg/com/sun/interview/FileQuestion.java",
"license": "gpl-2.0",
"size": 8581
} | [
"java.io.File",
"java.util.Map"
] | import java.io.File; import java.util.Map; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,549,428 |
if (args.length > 1) {
curLocale = new Locale(args[0], args[1]);
} | if (args.length > 1) { curLocale = new Locale(args[0], args[1]); } | /**
* Launches app.
* @param args
*/ | Launches app | main | {
"repo_name": "akademi4eg/lists-and-cards",
"path": "src/net/dtkanov/lac/core/AppCore.java",
"license": "mit",
"size": 3666
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,926,473 |
void postCoercionProcessing(Dataset ds, int command) throws Exception {
doPostCoercionProcessing(ds,command);
} | void postCoercionProcessing(Dataset ds, int command) throws Exception { doPostCoercionProcessing(ds,command); } | /**
* Callback for post-processing the dataset after the dataset has been
* coerced.
*
* @param ds
* the coerced dataset
* @param command
* DICOM command type
* @throws Exception
*/ | Callback for post-processing the dataset after the dataset has been coerced | postCoercionProcessing | {
"repo_name": "medicayun/medicayundicom",
"path": "dcm4jboss-all/tags/DCM4CHEE_2_14_2_TAGA/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/qrscp/QueryRetrieveScpService.java",
"license": "apache-2.0",
"size": 56955
} | [
"org.dcm4che.data.Dataset"
] | import org.dcm4che.data.Dataset; | import org.dcm4che.data.*; | [
"org.dcm4che.data"
] | org.dcm4che.data; | 1,543,016 |
protected Document queryFederation(String nifId, String query, int offset) {
return queryFederation(nifId, AbstractNifResourceAccessTool.query, offset, AbstractNifResourceAccessTool.rowCount, 0);
} | Document function(String nifId, String query, int offset) { return queryFederation(nifId, AbstractNifResourceAccessTool.query, offset, AbstractNifResourceAccessTool.rowCount, 0); } | /***
* Query the data federation
*
* @param db The database name
* @param indexable The indexable name
* @param count The number of results to return
* @param query The query string
* @param offset The offset to start into the results
* @return Document
*/ | Query the data federation | queryFederation | {
"repo_name": "ncbo/resource_access_tools",
"path": "src/main/java/org/ncbo/resource_access_tools/resource/nif/AbstractNifResourceAccessTool.java",
"license": "bsd-3-clause",
"size": 5246
} | [
"org.w3c.dom.Document"
] | import org.w3c.dom.Document; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 764,708 |
public Set<Class<? extends Annotation>> getStereotypes()
{
return stereotypes;
} | Set<Class<? extends Annotation>> function() { return stereotypes; } | /**
* Stereotypes currently defined for bean creation.
*
* @return the stereotypes currently defined
*/ | Stereotypes currently defined for bean creation | getStereotypes | {
"repo_name": "rdicroce/deltaspike",
"path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/bean/BeanBuilder.java",
"license": "apache-2.0",
"size": 16662
} | [
"java.lang.annotation.Annotation",
"java.util.Set"
] | import java.lang.annotation.Annotation; import java.util.Set; | import java.lang.annotation.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 620,857 |
public static String formatMessage(String key, Object[] args)
throws MissingResourceException {
return localizableSupport.formatMessage(key, args);
} | static String function(String key, Object[] args) throws MissingResourceException { return localizableSupport.formatMessage(key, args); } | /**
* Implements {@link
* org.apache.batik.i18n.Localizable#formatMessage(String,Object[])}.
*/ | Implements <code>org.apache.batik.i18n.Localizable#formatMessage(String,Object[])</code> | formatMessage | {
"repo_name": "Squeegee/batik",
"path": "sources/org/apache/batik/util/resources/Messages.java",
"license": "apache-2.0",
"size": 2287
} | [
"java.util.MissingResourceException"
] | import java.util.MissingResourceException; | import java.util.*; | [
"java.util"
] | java.util; | 1,036,256 |
public void setBounds(int x, int y, int width, int height)
{
super.setBounds(x, y, width, height);
Rectangle r = getViewport().getViewRect();
Dimension d = layeredPane.getPreferredSize();
if (model.isBigImage()) {
//setSelectionRegion();
setBirdEyeViewLocation();
if (!(d.width < r.width && d.height < r.height))
return;
}
if (!scrollbarsVisible() && adjusting) adjusting = false;
JScrollBar hBar = getHorizontalScrollBar();
JScrollBar vBar = getVerticalScrollBar();
if (!(hBar.isVisible() && vBar.isVisible())) center();
}
| void function(int x, int y, int width, int height) { super.setBounds(x, y, width, height); Rectangle r = getViewport().getViewRect(); Dimension d = layeredPane.getPreferredSize(); if (model.isBigImage()) { setBirdEyeViewLocation(); if (!(d.width < r.width && d.height < r.height)) return; } if (!scrollbarsVisible() && adjusting) adjusting = false; JScrollBar hBar = getHorizontalScrollBar(); JScrollBar vBar = getVerticalScrollBar(); if (!(hBar.isVisible() && vBar.isVisible())) center(); } | /**
* Overridden to center the image.
* @see JComponent#setBounds(int, int, int, int)
*/ | Overridden to center the image | setBounds | {
"repo_name": "joshmoore/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/browser/BrowserUI.java",
"license": "gpl-2.0",
"size": 21065
} | [
"java.awt.Dimension",
"java.awt.Rectangle",
"javax.swing.JScrollBar"
] | import java.awt.Dimension; import java.awt.Rectangle; import javax.swing.JScrollBar; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,175,681 |
protected void createDefaultDecisionStates(final Flow flow) {
createServiceUnauthorizedCheckDecisionState(flow);
createServiceCheckDecisionState(flow);
createWarnDecisionState(flow);
createGatewayRequestCheckDecisionState(flow);
createHasServiceCheckDecisionState(flow);
createRenewCheckDecisionState(flow);
} | void function(final Flow flow) { createServiceUnauthorizedCheckDecisionState(flow); createServiceCheckDecisionState(flow); createWarnDecisionState(flow); createGatewayRequestCheckDecisionState(flow); createHasServiceCheckDecisionState(flow); createRenewCheckDecisionState(flow); } | /**
* Create default decision states.
*
* @param flow the flow
*/ | Create default decision states | createDefaultDecisionStates | {
"repo_name": "GIP-RECIA/cas",
"path": "core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/DefaultLoginWebflowConfigurer.java",
"license": "apache-2.0",
"size": 25431
} | [
"org.springframework.webflow.engine.Flow"
] | import org.springframework.webflow.engine.Flow; | import org.springframework.webflow.engine.*; | [
"org.springframework.webflow"
] | org.springframework.webflow; | 1,616,535 |
@SuppressWarnings("unused")
public void setCancelColor(@ColorInt int color) {
mCancelColor = Color.argb(255, Color.red(color), Color.green(color), Color.blue(color));
} | @SuppressWarnings(STR) void function(@ColorInt int color) { mCancelColor = Color.argb(255, Color.red(color), Color.green(color), Color.blue(color)); } | /**
* Set the text color of the Cancel button
*
* @param color the color you want
*/ | Set the text color of the Cancel button | setCancelColor | {
"repo_name": "wdullaer/MaterialDateTimePicker",
"path": "library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java",
"license": "apache-2.0",
"size": 43909
} | [
"android.graphics.Color",
"androidx.annotation.ColorInt"
] | import android.graphics.Color; import androidx.annotation.ColorInt; | import android.graphics.*; import androidx.annotation.*; | [
"android.graphics",
"androidx.annotation"
] | android.graphics; androidx.annotation; | 2,822,429 |
@Override
public int getAD_Org_ID()
{
if (super.getAD_Org_ID() != 0) // set earlier
return super.getAD_Org_ID();
// Prio 1 - get from locator - if exist
if (getM_Locator_ID() != 0)
{
String sql = "SELECT AD_Org_ID FROM M_Locator WHERE M_Locator_ID=? AND AD_Client_ID=?";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, get_TrxName());
pstmt.setInt(1, getM_Locator_ID());
pstmt.setInt(2, getAD_Client_ID());
rs = pstmt.executeQuery();
if (rs.next())
{
setAD_Org_ID(rs.getInt(1));
log.trace("AD_Org_ID=" + super.getAD_Org_ID() + " (1 from M_Locator_ID=" + getM_Locator_ID() + ")");
}
else
log.error("AD_Org_ID - Did not find M_Locator_ID=" + getM_Locator_ID());
}
catch (SQLException e)
{
log.error(sql, e);
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
} // M_Locator_ID != 0
// Prio 2 - get from doc line - if exists (document context overwrites)
if (m_docLine != null && super.getAD_Org_ID() == 0)
{
setAD_Org_ID(m_docLine.getAD_Org_ID());
log.trace("AD_Org_ID=" + super.getAD_Org_ID() + " (2 from DocumentLine)");
}
// Prio 3 - get from doc - if not GL
if (m_doc != null && super.getAD_Org_ID() == 0)
{
if (Doc.DOCTYPE_GLJournal.equals(m_doc.getDocumentType()))
{
setAD_Org_ID(m_acct.getAD_Org_ID()); // inter-company GL
log.trace("AD_Org_ID=" + super.getAD_Org_ID() + " (3 from Acct)");
}
else
{
setAD_Org_ID(m_doc.getAD_Org_ID());
log.trace("AD_Org_ID=" + super.getAD_Org_ID() + " (3 from Document)");
}
}
// Prio 4 - get from account - if not GL
if (m_doc != null && super.getAD_Org_ID() == 0)
{
if (Doc.DOCTYPE_GLJournal.equals(m_doc.getDocumentType()))
{
setAD_Org_ID(m_doc.getAD_Org_ID());
log.trace("AD_Org_ID=" + super.getAD_Org_ID() + " (4 from Document)");
}
else
{
setAD_Org_ID(m_acct.getAD_Org_ID());
log.trace("AD_Org_ID=" + super.getAD_Org_ID() + " (4 from Acct)");
}
}
return super.getAD_Org_ID();
} // setAD_Org_ID | int function() { if (super.getAD_Org_ID() != 0) return super.getAD_Org_ID(); if (getM_Locator_ID() != 0) { String sql = STR; PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = DB.prepareStatement(sql, get_TrxName()); pstmt.setInt(1, getM_Locator_ID()); pstmt.setInt(2, getAD_Client_ID()); rs = pstmt.executeQuery(); if (rs.next()) { setAD_Org_ID(rs.getInt(1)); log.trace(STR + super.getAD_Org_ID() + STR + getM_Locator_ID() + ")"); } else log.error(STR + getM_Locator_ID()); } catch (SQLException e) { log.error(sql, e); } finally { DB.close(rs, pstmt); rs = null; pstmt = null; } } if (m_docLine != null && super.getAD_Org_ID() == 0) { setAD_Org_ID(m_docLine.getAD_Org_ID()); log.trace(STR + super.getAD_Org_ID() + STR); } if (m_doc != null && super.getAD_Org_ID() == 0) { if (Doc.DOCTYPE_GLJournal.equals(m_doc.getDocumentType())) { setAD_Org_ID(m_acct.getAD_Org_ID()); log.trace(STR + super.getAD_Org_ID() + STR); } else { setAD_Org_ID(m_doc.getAD_Org_ID()); log.trace(STR + super.getAD_Org_ID() + STR); } } if (m_doc != null && super.getAD_Org_ID() == 0) { if (Doc.DOCTYPE_GLJournal.equals(m_doc.getDocumentType())) { setAD_Org_ID(m_doc.getAD_Org_ID()); log.trace(STR + super.getAD_Org_ID() + STR); } else { setAD_Org_ID(m_acct.getAD_Org_ID()); log.trace(STR + super.getAD_Org_ID() + STR); } } return super.getAD_Org_ID(); } | /**
* Get AD_Org_ID (balancing segment).
* (if not set directly - from document line, document, account, locator)
* <p>
* Note that Locator needs to be set before - otherwise segment balancing might produce the wrong results
*
* @return AD_Org_ID
*/ | Get AD_Org_ID (balancing segment). (if not set directly - from document line, document, account, locator) Note that Locator needs to be set before - otherwise segment balancing might produce the wrong results | getAD_Org_ID | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.acct.base/src/main/java-legacy/org/compiere/acct/FactLine.java",
"license": "gpl-2.0",
"size": 42895
} | [
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException",
"org.compiere.util.DB"
] | import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.compiere.util.DB; | import java.sql.*; import org.compiere.util.*; | [
"java.sql",
"org.compiere.util"
] | java.sql; org.compiere.util; | 1,055,712 |
Optional<EventFormat> getFormat(final Class<? extends DisplayableEvent> eventType); | Optional<EventFormat> getFormat(final Class<? extends DisplayableEvent> eventType); | /**
* Gets the format to be used, if any, for the given event type.
*
* @param eventType The type of event to retrieve a format for.
* @return The format to use, or an absent optional if no format is defined.
*/ | Gets the format to be used, if any, for the given event type | getFormat | {
"repo_name": "DMDirc/DMDirc",
"path": "src/main/java/com/dmdirc/ui/messages/EventFormatProvider.java",
"license": "mit",
"size": 1733
} | [
"com.dmdirc.events.DisplayableEvent",
"java.util.Optional"
] | import com.dmdirc.events.DisplayableEvent; import java.util.Optional; | import com.dmdirc.events.*; import java.util.*; | [
"com.dmdirc.events",
"java.util"
] | com.dmdirc.events; java.util; | 1,140,468 |
public static NetworkNode nodeBuilder(KeyId id, TeNode teNode) {
List<NetworkNodeKey> supportingNodeIds = null;
if (teNode.supportingTeNodeId() != null) {
supportingNodeIds = Lists.newArrayList(networkNodeKey(teNode.supportingTeNodeId()));
}
Map<KeyId, TerminationPoint> tps = Maps.newConcurrentMap();
for (Long teTpid : teNode.teTerminationPointIds()) {
tps.put(KeyId.keyId(Long.toString(teTpid)), tpBuilder(teTpid));
}
return new DefaultNetworkNode(id, supportingNodeIds, teNode, tps);
} | static NetworkNode function(KeyId id, TeNode teNode) { List<NetworkNodeKey> supportingNodeIds = null; if (teNode.supportingTeNodeId() != null) { supportingNodeIds = Lists.newArrayList(networkNodeKey(teNode.supportingTeNodeId())); } Map<KeyId, TerminationPoint> tps = Maps.newConcurrentMap(); for (Long teTpid : teNode.teTerminationPointIds()) { tps.put(KeyId.keyId(Long.toString(teTpid)), tpBuilder(teTpid)); } return new DefaultNetworkNode(id, supportingNodeIds, teNode, tps); } | /**
* Returns an instance of network node for a TE node.
*
* @param id value of the network node id
* @param teNode value of TE node
* @return an instance of network node
*/ | Returns an instance of network node for a TE node | nodeBuilder | {
"repo_name": "LorenzReinhart/ONOSnew",
"path": "apps/tetopology/app/src/main/java/org/onosproject/tetopology/management/impl/TeMgrUtil.java",
"license": "apache-2.0",
"size": 9392
} | [
"com.google.common.collect.Lists",
"com.google.common.collect.Maps",
"java.util.List",
"java.util.Map",
"org.onosproject.tetopology.management.api.KeyId",
"org.onosproject.tetopology.management.api.node.DefaultNetworkNode",
"org.onosproject.tetopology.management.api.node.NetworkNode",
"org.onosproject.tetopology.management.api.node.NetworkNodeKey",
"org.onosproject.tetopology.management.api.node.TeNode",
"org.onosproject.tetopology.management.api.node.TerminationPoint"
] | import com.google.common.collect.Lists; import com.google.common.collect.Maps; import java.util.List; import java.util.Map; import org.onosproject.tetopology.management.api.KeyId; import org.onosproject.tetopology.management.api.node.DefaultNetworkNode; import org.onosproject.tetopology.management.api.node.NetworkNode; import org.onosproject.tetopology.management.api.node.NetworkNodeKey; import org.onosproject.tetopology.management.api.node.TeNode; import org.onosproject.tetopology.management.api.node.TerminationPoint; | import com.google.common.collect.*; import java.util.*; import org.onosproject.tetopology.management.api.*; import org.onosproject.tetopology.management.api.node.*; | [
"com.google.common",
"java.util",
"org.onosproject.tetopology"
] | com.google.common; java.util; org.onosproject.tetopology; | 2,066,969 |
void onShortcutIntentCreated(Uri uri, Intent shortcutIntent);
}
public ShortcutIntentBuilder(Context context, OnShortcutIntentCreatedListener listener) {
mContext = context;
mListener = listener;
final Resources r = context.getResources();
final ActivityManager am = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
mIconSize = r.getDimensionPixelSize(R.dimen.shortcut_icon_size);
if (mIconSize == 0) {
mIconSize = am.getLauncherLargeIconSize();
}
mIconDensity = am.getLauncherLargeIconDensity();
mBorderWidth = r.getDimensionPixelOffset(
R.dimen.shortcut_icon_border_width);
mBorderColor = r.getColor(R.color.shortcut_overlay_text_background);
}
| void onShortcutIntentCreated(Uri uri, Intent shortcutIntent); } public ShortcutIntentBuilder(Context context, OnShortcutIntentCreatedListener listener) { mContext = context; mListener = listener; final Resources r = context.getResources(); final ActivityManager am = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); mIconSize = r.getDimensionPixelSize(R.dimen.shortcut_icon_size); if (mIconSize == 0) { mIconSize = am.getLauncherLargeIconSize(); } mIconDensity = am.getLauncherLargeIconDensity(); mBorderWidth = r.getDimensionPixelOffset( R.dimen.shortcut_icon_border_width); mBorderColor = r.getColor(R.color.shortcut_overlay_text_background); } | /**
* Callback for shortcut intent creation.
*
* @param uri the original URI for which the shortcut intent has been
* created.
* @param shortcutIntent resulting shortcut intent.
*/ | Callback for shortcut intent creation | onShortcutIntentCreated | {
"repo_name": "risingsunm/Contacts_4.0",
"path": "src/com/android/contacts/list/ShortcutIntentBuilder.java",
"license": "gpl-2.0",
"size": 15998
} | [
"android.app.ActivityManager",
"android.content.Context",
"android.content.Intent",
"android.content.res.Resources",
"android.net.Uri"
] | import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.net.Uri; | import android.app.*; import android.content.*; import android.content.res.*; import android.net.*; | [
"android.app",
"android.content",
"android.net"
] | android.app; android.content; android.net; | 2,373,567 |
public Request.Builder put(String path) {
return new Request.Builder(HttpMethods.HttpMethod.PUT, path);
} | Request.Builder function(String path) { return new Request.Builder(HttpMethods.HttpMethod.PUT, path); } | /**
* Factory method for PUT HTTP method.
* @param path to call
* @return builder
*/ | Factory method for PUT HTTP method | put | {
"repo_name": "spring-cloud/spring-cloud-contract",
"path": "spring-cloud-contract-verifier/src/main/java/org/springframework/cloud/contract/verifier/http/Request.java",
"license": "apache-2.0",
"size": 9568
} | [
"org.springframework.cloud.contract.spec.internal.HttpMethods"
] | import org.springframework.cloud.contract.spec.internal.HttpMethods; | import org.springframework.cloud.contract.spec.internal.*; | [
"org.springframework.cloud"
] | org.springframework.cloud; | 928,562 |
public String findErrorPage(int errorCode) throws MBeanException {
Context context = doGetManagedResource();
return context.findErrorPage(errorCode).toString();
} | String function(int errorCode) throws MBeanException { Context context = doGetManagedResource(); return context.findErrorPage(errorCode).toString(); } | /**
* Return the error page entry for the specified HTTP error code,
* if any; otherwise return <code>null</code>.
*
* @param errorCode Error code to look up
* @return a string representation of the error page
* @throws MBeanException propagated from the managed resource access
*/ | Return the error page entry for the specified HTTP error code, if any; otherwise return <code>null</code> | findErrorPage | {
"repo_name": "apache/tomcat",
"path": "java/org/apache/catalina/mbeans/ContextMBean.java",
"license": "apache-2.0",
"size": 6249
} | [
"javax.management.MBeanException",
"org.apache.catalina.Context"
] | import javax.management.MBeanException; import org.apache.catalina.Context; | import javax.management.*; import org.apache.catalina.*; | [
"javax.management",
"org.apache.catalina"
] | javax.management; org.apache.catalina; | 1,581,942 |
public void addMembrane(){
adjacentsPixel = new ArrayList<ArrayList<Integer>>();
adjacentsList = new ArrayList<ArrayList<String>>();
int lower, higher;
//adds the membrane may need changes in the future
for (int d = 0; d < depth; d++) {
for (int i = 0; i < height - 1; i++) {
for (int j = 0; j < width - 1; j++) {
// right
if (checkAdjacent(d * height * width + i * width + j, d * height * width + i * width + j + 1)) {
ArrayList<Integer> temp = new ArrayList<Integer>(2);
lower = getLowerLabel(matrix[d * height * width + i * width + j + 1], matrix[d * height * width + i * width + j]);
higher = getHigherLabel(matrix[d * height * width + i * width + j + 1], matrix[d * height * width + i * width + j]);
temp.add(higher); temp.add(lower);
adjacentsPixel.add(temp);
addmem(higher,lower);
}
// down
if (checkAdjacent(d * height * width + i * width + j, d * height * width + (i + 1) * width + j)) {
ArrayList<Integer> temp = new ArrayList<Integer>(2);
lower = getLowerLabel(matrix[d * height * width + (i + 1) * width + j], matrix[d * height * width + i * width + j]);
higher = getHigherLabel(matrix[d * height * width + (i + 1) * width + j], matrix[d * height * width + i * width + j]);
temp.add(higher); temp.add(lower);
adjacentsPixel.add(temp);
addmem(higher,lower);
}
//above
if ( d != depth -1 && checkAdjacent(d * height * width + i * width + j, (d + 1) * height * width + i * width + j)) {
ArrayList<Integer> temp = new ArrayList<Integer>(2);
lower = getLowerLabel(matrix[(d + 1) * height * width + i * width + j], matrix[d * height * width + i * width + j]);
higher = getHigherLabel(matrix[(d + 1) * height * width + i * width + j], matrix[d * height * width + i * width + j]);
temp.add(higher); temp.add(lower);
adjacentsPixel.add(temp);
addmem(higher,lower);
}
}
}
}
} | void function(){ adjacentsPixel = new ArrayList<ArrayList<Integer>>(); adjacentsList = new ArrayList<ArrayList<String>>(); int lower, higher; for (int d = 0; d < depth; d++) { for (int i = 0; i < height - 1; i++) { for (int j = 0; j < width - 1; j++) { if (checkAdjacent(d * height * width + i * width + j, d * height * width + i * width + j + 1)) { ArrayList<Integer> temp = new ArrayList<Integer>(2); lower = getLowerLabel(matrix[d * height * width + i * width + j + 1], matrix[d * height * width + i * width + j]); higher = getHigherLabel(matrix[d * height * width + i * width + j + 1], matrix[d * height * width + i * width + j]); temp.add(higher); temp.add(lower); adjacentsPixel.add(temp); addmem(higher,lower); } if (checkAdjacent(d * height * width + i * width + j, d * height * width + (i + 1) * width + j)) { ArrayList<Integer> temp = new ArrayList<Integer>(2); lower = getLowerLabel(matrix[d * height * width + (i + 1) * width + j], matrix[d * height * width + i * width + j]); higher = getHigherLabel(matrix[d * height * width + (i + 1) * width + j], matrix[d * height * width + i * width + j]); temp.add(higher); temp.add(lower); adjacentsPixel.add(temp); addmem(higher,lower); } if ( d != depth -1 && checkAdjacent(d * height * width + i * width + j, (d + 1) * height * width + i * width + j)) { ArrayList<Integer> temp = new ArrayList<Integer>(2); lower = getLowerLabel(matrix[(d + 1) * height * width + i * width + j], matrix[d * height * width + i * width + j]); higher = getHigherLabel(matrix[(d + 1) * height * width + i * width + j], matrix[d * height * width + i * width + j]); temp.add(higher); temp.add(lower); adjacentsPixel.add(temp); addmem(higher,lower); } } } } } | /**
* Adds a membrane between two different domains.
*/ | Adds a membrane between two different domains | addMembrane | {
"repo_name": "spatialsimulator/XitoSBML",
"path": "src/main/java/jp/ac/keio/bio/fun/xitosbml/image/ImageEdit.java",
"license": "apache-2.0",
"size": 15770
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,304,304 |
public int execute( String projectFile, String deploymentFile, String ejbJarXMLDir, Vector ignoreErrorCodes, Boolean failOnError, String url, String driverclass, String user, String password) {
Object[] args = { projectFile, deploymentFile, ejbJarXMLDir, ignoreErrorCodes, failOnError, url, driverclass, user, password};
return this.execute( args);
} | int function( String projectFile, String deploymentFile, String ejbJarXMLDir, Vector ignoreErrorCodes, Boolean failOnError, String url, String driverclass, String user, String password) { Object[] args = { projectFile, deploymentFile, ejbJarXMLDir, ignoreErrorCodes, failOnError, url, driverclass, user, password}; return this.execute( args); } | /**
* Generates TopLink deployment descriptor XML or the ejb-jar.xml
* depending on the specified Workbench project.
* Returns 0 if the generation is successful.
*/ | Generates TopLink deployment descriptor XML or the ejb-jar.xml depending on the specified Workbench project. Returns 0 if the generation is successful | execute | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "utils/eclipselink.utils.workbench/mappingsplugin/source/org/eclipse/persistence/tools/workbench/ant/taskdefs/ExportDeploymentXMLTask.java",
"license": "epl-1.0",
"size": 4760
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 2,060,921 |
protected class ToolBarContListener implements ContainerListener
{
public void componentAdded(ContainerEvent e)
{
if (e.getChild() instanceof JButton)
{
JButton b = (JButton) e.getChild();
if (b.getBorder() != null)
borders.put(b, b.getBorder());
}
if (isRolloverBorders())
setBorderToRollover(e.getChild());
else
setBorderToNonRollover(e.getChild());
cachedBounds = toolBar.getPreferredSize();
cachedOrientation = toolBar.getOrientation();
} | class ToolBarContListener implements ContainerListener { public void function(ContainerEvent e) { if (e.getChild() instanceof JButton) { JButton b = (JButton) e.getChild(); if (b.getBorder() != null) borders.put(b, b.getBorder()); } if (isRolloverBorders()) setBorderToRollover(e.getChild()); else setBorderToNonRollover(e.getChild()); cachedBounds = toolBar.getPreferredSize(); cachedOrientation = toolBar.getOrientation(); } | /**
* This method is responsible for setting rollover or non rollover for new
* buttons added to the JToolBar.
*
* @param e The ContainerEvent.
*/ | This method is responsible for setting rollover or non rollover for new buttons added to the JToolBar | componentAdded | {
"repo_name": "unofficial-opensource-apple/gcc_40",
"path": "libjava/javax/swing/plaf/basic/BasicToolBarUI.java",
"license": "gpl-2.0",
"size": 37188
} | [
"java.awt.event.ContainerEvent",
"java.awt.event.ContainerListener",
"javax.swing.JButton"
] | import java.awt.event.ContainerEvent; import java.awt.event.ContainerListener; import javax.swing.JButton; | import java.awt.event.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,524,334 |
protected void populateElementWithList(String mimeType, Element element,
List dataValues, TypeDescriptor elementType)
throws ParserConfigurationException, SAXException, IOException {
for (Iterator dataIterator = dataValues.iterator(); dataIterator
.hasNext();) {
Object dataItem = dataIterator.next();
String tag;
if (elementType instanceof BaseTypeDescriptor) {
tag = elementType.getType();
} else {
tag = elementType.getName();
}
Element item = element.getOwnerDocument().createElement(tag);
populateElementWithObjectData(mimeType, item, dataItem);
element.appendChild(item);
}
} | void function(String mimeType, Element element, List dataValues, TypeDescriptor elementType) throws ParserConfigurationException, SAXException, IOException { for (Iterator dataIterator = dataValues.iterator(); dataIterator .hasNext();) { Object dataItem = dataIterator.next(); String tag; if (elementType instanceof BaseTypeDescriptor) { tag = elementType.getType(); } else { tag = elementType.getName(); } Element item = element.getOwnerDocument().createElement(tag); populateElementWithObjectData(mimeType, item, dataItem); element.appendChild(item); } } | /**
* Populates a DOM XML Element with the contents of a List of dataValues
*
* @param mimeType -
* the mime type of the data
* @param element -
* the Element to be populated
* @param dataValues -
* the List of Objects containing the data
* @param elementType -
* the TypeDescriptor for the element being populated
* @throws ParserConfigurationException
* @throws SAXException
* @throws IOException
*/ | Populates a DOM XML Element with the contents of a List of dataValues | populateElementWithList | {
"repo_name": "NCIP/cagrid",
"path": "cagrid/Software/workflow/wsdl-generic/src/main/java/net/sf/taverna/wsdl/soap/AbstractBodyBuilder.java",
"license": "bsd-3-clause",
"size": 10058
} | [
"java.io.IOException",
"java.util.Iterator",
"java.util.List",
"javax.xml.parsers.ParserConfigurationException",
"net.sf.taverna.wsdl.parser.BaseTypeDescriptor",
"net.sf.taverna.wsdl.parser.TypeDescriptor",
"org.w3c.dom.Element",
"org.xml.sax.SAXException"
] | import java.io.IOException; import java.util.Iterator; import java.util.List; import javax.xml.parsers.ParserConfigurationException; import net.sf.taverna.wsdl.parser.BaseTypeDescriptor; import net.sf.taverna.wsdl.parser.TypeDescriptor; import org.w3c.dom.Element; import org.xml.sax.SAXException; | import java.io.*; import java.util.*; import javax.xml.parsers.*; import net.sf.taverna.wsdl.parser.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"java.io",
"java.util",
"javax.xml",
"net.sf.taverna",
"org.w3c.dom",
"org.xml.sax"
] | java.io; java.util; javax.xml; net.sf.taverna; org.w3c.dom; org.xml.sax; | 2,239,303 |
@Test
public void testOnActionPotion() {
final WrapAction wrap = new WrapAction();
final Player player = PlayerTestHelper.createPlayer("bob");
PlayerTestHelper.equipWithItem(player, "potion");
final RPAction action = new RPAction();
action.put("type", "wrap");
action.put("target", "potion");
wrap.onAction(player, action);
assertTrue(player.isEquipped("present"));
final Present present = (Present) player.getFirstEquipped("present");
assertNotNull(present);
assertThat(present.getInfoString(), is("potion"));
present.onUsed(player);
assertTrue(player.isEquipped("potion"));
} | void function() { final WrapAction wrap = new WrapAction(); final Player player = PlayerTestHelper.createPlayer("bob"); PlayerTestHelper.equipWithItem(player, STR); final RPAction action = new RPAction(); action.put("type", "wrap"); action.put(STR, STR); wrap.onAction(player, action); assertTrue(player.isEquipped(STR)); final Present present = (Present) player.getFirstEquipped(STR); assertNotNull(present); assertThat(present.getInfoString(), is(STR)); present.onUsed(player); assertTrue(player.isEquipped(STR)); } | /**
* Tests for onActionPotion.
*/ | Tests for onActionPotion | testOnActionPotion | {
"repo_name": "markuskeunecke/stendhal",
"path": "tests/games/stendhal/server/actions/admin/WrapActionTest.java",
"license": "gpl-2.0",
"size": 4472
} | [
"games.stendhal.server.entity.item.Present",
"games.stendhal.server.entity.player.Player",
"org.hamcrest.Matchers",
"org.junit.Assert"
] | import games.stendhal.server.entity.item.Present; import games.stendhal.server.entity.player.Player; import org.hamcrest.Matchers; import org.junit.Assert; | import games.stendhal.server.entity.item.*; import games.stendhal.server.entity.player.*; import org.hamcrest.*; import org.junit.*; | [
"games.stendhal.server",
"org.hamcrest",
"org.junit"
] | games.stendhal.server; org.hamcrest; org.junit; | 1,660,611 |
protected Vector<List<TextPosition>> getCharactersByArticle()
{
return charactersByArticle;
} | Vector<List<TextPosition>> function() { return charactersByArticle; } | /**
* Character strings are grouped by articles. It is quite common that there
* will only be a single article. This returns a List that contains List objects,
* the inner lists will contain TextPosition objects.
*
* @return A double List of TextPositions for all text strings on the page.
*/ | Character strings are grouped by articles. It is quite common that there will only be a single article. This returns a List that contains List objects, the inner lists will contain TextPosition objects | getCharactersByArticle | {
"repo_name": "phatn/lapdftext",
"path": "src/main/java/edu/isi/bmkeg/lapdf/extraction/LAPDFTextStripper.java",
"license": "gpl-3.0",
"size": 74251
} | [
"java.util.List",
"java.util.Vector",
"org.apache.pdfbox.util.TextPosition"
] | import java.util.List; import java.util.Vector; import org.apache.pdfbox.util.TextPosition; | import java.util.*; import org.apache.pdfbox.util.*; | [
"java.util",
"org.apache.pdfbox"
] | java.util; org.apache.pdfbox; | 1,492,841 |
public ListViewPanel addMoreEntriesAvailable()
{
add((ListViewItemPanel)new ListViewItemPanel(newChildId(), getString("moreEntriesAvailable")).add(AttributeModifier.replace("class",
"moreEntriesAvailable")));
return this;
} | ListViewPanel function() { add((ListViewItemPanel)new ListViewItemPanel(newChildId(), getString(STR)).add(AttributeModifier.replace("class", STR))); return this; } | /**
* Adds a new entry with the text "more entries available" as information for the user, that not all entries are shown.
* @return this for chaining.
*/ | Adds a new entry with the text "more entries available" as information for the user, that not all entries are shown | addMoreEntriesAvailable | {
"repo_name": "micromata/projectforge-webapp",
"path": "src/main/java/org/projectforge/web/mobile/ListViewPanel.java",
"license": "gpl-3.0",
"size": 2151
} | [
"org.apache.wicket.AttributeModifier"
] | import org.apache.wicket.AttributeModifier; | import org.apache.wicket.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 2,002,712 |
@PUT
@NoCache
@Path("models/{id}")
@Consumes(MediaType.APPLICATION_JSON)
public void update(@PathParam("id") String id, ProtocolMapperRepresentation rep) {
auth.requireManage();
ProtocolMapperModel model = client.getProtocolMapperById(id);
if (model == null) throw new NotFoundException("Model not found");
model = RepresentationToModel.toModel(rep);
client.updateProtocolMapper(model);
adminEvent.operation(OperationType.UPDATE).resourcePath(uriInfo).representation(rep).success();
} | @Path(STR) @Consumes(MediaType.APPLICATION_JSON) void function(@PathParam("id") String id, ProtocolMapperRepresentation rep) { auth.requireManage(); ProtocolMapperModel model = client.getProtocolMapperById(id); if (model == null) throw new NotFoundException(STR); model = RepresentationToModel.toModel(rep); client.updateProtocolMapper(model); adminEvent.operation(OperationType.UPDATE).resourcePath(uriInfo).representation(rep).success(); } | /**
* Update the mapper
*
* @param id Mapper id
* @param rep
*/ | Update the mapper | update | {
"repo_name": "gregjones60/keycloak",
"path": "services/src/main/java/org/keycloak/services/resources/admin/ProtocolMappersResource.java",
"license": "apache-2.0",
"size": 5983
} | [
"javax.ws.rs.Consumes",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.core.MediaType",
"org.jboss.resteasy.spi.NotFoundException",
"org.keycloak.events.admin.OperationType",
"org.keycloak.models.ProtocolMapperModel",
"org.keycloak.models.utils.RepresentationToModel",
"org.keycloak.representations.idm.ProtocolMapperRepresentation"
] | import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.MediaType; import org.jboss.resteasy.spi.NotFoundException; import org.keycloak.events.admin.OperationType; import org.keycloak.models.ProtocolMapperModel; import org.keycloak.models.utils.RepresentationToModel; import org.keycloak.representations.idm.ProtocolMapperRepresentation; | import javax.ws.rs.*; import javax.ws.rs.core.*; import org.jboss.resteasy.spi.*; import org.keycloak.events.admin.*; import org.keycloak.models.*; import org.keycloak.models.utils.*; import org.keycloak.representations.idm.*; | [
"javax.ws",
"org.jboss.resteasy",
"org.keycloak.events",
"org.keycloak.models",
"org.keycloak.representations"
] | javax.ws; org.jboss.resteasy; org.keycloak.events; org.keycloak.models; org.keycloak.representations; | 2,330,349 |
public static InputStream
parseInputStream(String path, InputStream defaultValue)
throws IOException
{
if (path == null)
return defaultValue;
if (path.equals("-"))
return System.in;
return new FileInputStream(path);
} | static InputStream function(String path, InputStream defaultValue) throws IOException { if (path == null) return defaultValue; if (path.equals("-")) return System.in; return new FileInputStream(path); } | /**
* Return a <code>InputStream</code> that is the result of creating
* a new <code>FileInputStream</code> object for the file named by
* the given <code>path</code>. If the argument is `<code>-</code>'
* then <code>System.in</code> is returned. If <code>path</code>
* is <code>null</code>, return <code>defaultValue</code>.
*/ | Return a <code>InputStream</code> that is the result of creating a new <code>FileInputStream</code> object for the file named by the given <code>path</code>. If the argument is `<code>-</code>' then <code>System.in</code> is returned. If <code>path</code> is <code>null</code>, return <code>defaultValue</code> | parseInputStream | {
"repo_name": "trasukg/river-qa-2.2",
"path": "src/com/sun/jini/system/CommandLine.java",
"license": "apache-2.0",
"size": 12319
} | [
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,906,852 |
public Paint getOutlineFillPaint() {
return mOutlineFillPaint;
}
| Paint function() { return mOutlineFillPaint; } | /**
* Gets the outline fill paint.
*
* @return the outline fill paint
*/ | Gets the outline fill paint | getOutlineFillPaint | {
"repo_name": "photo/mobile-android",
"path": "submodules/Android-Feather/src/com/aviary/android/feather/widget/DrawableHighlightView.java",
"license": "apache-2.0",
"size": 27091
} | [
"android.graphics.Paint"
] | import android.graphics.Paint; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 2,425,809 |
// UGLY HACK to support JAX-WS
// if other clients want to access those functionalities,
// we should design a better model
Accessor getElementPropertyAccessor(String nsUri,String localName); | Accessor getElementPropertyAccessor(String nsUri,String localName); | /**
* If this property is mapped to the specified element,
* return an accessor to it.
*
* @return
* null if the property is not mapped to the specified element.
*/ | If this property is mapped to the specified element, return an accessor to it | getElementPropertyAccessor | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jaxws/drop_included/jaxws_src/src/com/sun/xml/internal/bind/v2/runtime/property/Property.java",
"license": "gpl-2.0",
"size": 5086
} | [
"com.sun.xml.internal.bind.v2.runtime.reflect.Accessor"
] | import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; | import com.sun.xml.internal.bind.v2.runtime.reflect.*; | [
"com.sun.xml"
] | com.sun.xml; | 1,674,788 |
public void onServiceConnected(Messenger m) {
mRemoteService = DownloaderServiceMarshaller.CreateProxy(m);
mRemoteService.onClientUpdated(mDownloaderClientStub.getMessenger());
} | void function(Messenger m) { mRemoteService = DownloaderServiceMarshaller.CreateProxy(m); mRemoteService.onClientUpdated(mDownloaderClientStub.getMessenger()); } | /**
* Critical implementation detail. In onServiceConnected we create the
* remote service and marshaler. This is how we pass the client information
* back to the service so the client can be properly notified of changes. We
* must do this every time we reconnect to the service.
*/ | Critical implementation detail. In onServiceConnected we create the remote service and marshaler. This is how we pass the client information back to the service so the client can be properly notified of changes. We must do this every time we reconnect to the service | onServiceConnected | {
"repo_name": "Unaianu/Xbox360CollectorsPlace",
"path": "src/com/xboxcollectorsplace/bl/extension/XboxInitialDownload.java",
"license": "mit",
"size": 23523
} | [
"android.os.Messenger",
"com.google.android.vending.expansion.downloader.DownloaderServiceMarshaller"
] | import android.os.Messenger; import com.google.android.vending.expansion.downloader.DownloaderServiceMarshaller; | import android.os.*; import com.google.android.vending.expansion.downloader.*; | [
"android.os",
"com.google.android"
] | android.os; com.google.android; | 768,195 |
void setFont(PDFont font)
{
this.font = font;
} | void setFont(PDFont font) { this.font = font; } | /**
* Set the font.
*
* @param font the font to use.
*/ | Set the font | setFont | {
"repo_name": "TomRoush/PdfBox-Android",
"path": "library/src/main/java/com/tom_roush/pdfbox/pdmodel/interactive/form/PDDefaultAppearanceString.java",
"license": "apache-2.0",
"size": 9969
} | [
"com.tom_roush.pdfbox.pdmodel.font.PDFont"
] | import com.tom_roush.pdfbox.pdmodel.font.PDFont; | import com.tom_roush.pdfbox.pdmodel.font.*; | [
"com.tom_roush.pdfbox"
] | com.tom_roush.pdfbox; | 2,371,832 |
public void createOrUpdate(AlertDefinitionEntity alertDefinition)
throws AmbariException {
if (null == alertDefinition.getDefinitionId()) {
create(alertDefinition);
} else {
merge(alertDefinition);
}
}
/**
* Removes the specified alert definition and all related history and
* associations from the database. Fires an {@link AlertDefinitionDeleteEvent} | void function(AlertDefinitionEntity alertDefinition) throws AmbariException { if (null == alertDefinition.getDefinitionId()) { create(alertDefinition); } else { merge(alertDefinition); } } /** * Removes the specified alert definition and all related history and * associations from the database. Fires an {@link AlertDefinitionDeleteEvent} | /**
* Creates or updates the specified entity. This method will check
* {@link AlertDefinitionEntity#getDefinitionId()} in order to determine
* whether the entity should be created or merged.
*
* @param alertDefinition
* the definition to create or update (not {@code null}).
*/ | Creates or updates the specified entity. This method will check <code>AlertDefinitionEntity#getDefinitionId()</code> in order to determine whether the entity should be created or merged | createOrUpdate | {
"repo_name": "sekikn/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAO.java",
"license": "apache-2.0",
"size": 16444
} | [
"org.apache.ambari.server.AmbariException",
"org.apache.ambari.server.events.AlertDefinitionDeleteEvent",
"org.apache.ambari.server.orm.entities.AlertDefinitionEntity"
] | import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.events.AlertDefinitionDeleteEvent; import org.apache.ambari.server.orm.entities.AlertDefinitionEntity; | import org.apache.ambari.server.*; import org.apache.ambari.server.events.*; import org.apache.ambari.server.orm.entities.*; | [
"org.apache.ambari"
] | org.apache.ambari; | 1,217,435 |
public void init() {
assert nextFreeOffset.get() == UNINITIALIZED;
try {
allocateDataBuffer();
} catch (OutOfMemoryError e) {
boolean failInit = nextFreeOffset.compareAndSet(UNINITIALIZED, OOM);
assert failInit; // should be true.
throw e;
}
// Mark that it's ready for use
// Move 4 bytes since the first 4 bytes are having the chunkid in it
boolean initted = nextFreeOffset.compareAndSet(UNINITIALIZED, Bytes.SIZEOF_INT);
// We should always succeed the above CAS since only one thread
// calls init()!
Preconditions.checkState(initted, "Multiple threads tried to init same chunk");
} | void function() { assert nextFreeOffset.get() == UNINITIALIZED; try { allocateDataBuffer(); } catch (OutOfMemoryError e) { boolean failInit = nextFreeOffset.compareAndSet(UNINITIALIZED, OOM); assert failInit; throw e; } boolean initted = nextFreeOffset.compareAndSet(UNINITIALIZED, Bytes.SIZEOF_INT); Preconditions.checkState(initted, STR); } | /**
* Actually claim the memory for this chunk. This should only be called from the thread that
* constructed the chunk. It is thread-safe against other threads calling alloc(), who will block
* until the allocation is complete.
*/ | Actually claim the memory for this chunk. This should only be called from the thread that constructed the chunk. It is thread-safe against other threads calling alloc(), who will block until the allocation is complete | init | {
"repo_name": "JingchengDu/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Chunk.java",
"license": "apache-2.0",
"size": 5584
} | [
"org.apache.hadoop.hbase.shaded.com.google.common.base.Preconditions",
"org.apache.hadoop.hbase.util.Bytes"
] | import org.apache.hadoop.hbase.shaded.com.google.common.base.Preconditions; import org.apache.hadoop.hbase.util.Bytes; | import org.apache.hadoop.hbase.shaded.com.google.common.base.*; import org.apache.hadoop.hbase.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,115,676 |
boolean hasPermission(AccessControlled controlled, Permission permission); | boolean hasPermission(AccessControlled controlled, Permission permission); | /**
* Check if a an {@link AccessControlled} instance will allow the current
* security context the specified {@link Permission}.
* <p>
* Recommended to use this instead of checking has permission on the object
* directly. Consider this method a funnel for access security.
*
* @param controlled the instance under control
* @param permission the permission to check on the access controlled object
* @return true if current security context has the specified permission
*/ | Check if a an <code>AccessControlled</code> instance will allow the current security context the specified <code>Permission</code>. Recommended to use this instead of checking has permission on the object directly. Consider this method a funnel for access security | hasPermission | {
"repo_name": "cnopens/hudson",
"path": "hudson-service/src/main/java/org/hudsonci/service/SecurityService.java",
"license": "mit",
"size": 3400
} | [
"hudson.security.AccessControlled",
"hudson.security.Permission"
] | import hudson.security.AccessControlled; import hudson.security.Permission; | import hudson.security.*; | [
"hudson.security"
] | hudson.security; | 513,098 |
private static void newCoverOld(Map<String, Object> oldMap, Map<String, Object> newMap){
for(String key : newMap.keySet()){
Object value = newMap.get(key);
if( oldMap.containsKey(key) ){
log.info("cover key[{}] from {} to {}.", key, oldMap.get(key), value);
}else{
log.info("added key[{}] with {}.", key, value);
}
oldMap.put(key, value);
}
} | static void function(Map<String, Object> oldMap, Map<String, Object> newMap){ for(String key : newMap.keySet()){ Object value = newMap.get(key); if( oldMap.containsKey(key) ){ log.info(STR, key, oldMap.get(key), value); }else{ log.info(STR, key, value); } oldMap.put(key, value); } } | /**
* New cover old
* After cover before
*
* @param oldMap
* @param newMap
*/ | New cover old After cover before | newCoverOld | {
"repo_name": "zhaochunlin/Ak47",
"path": "core/src/main/java/com/wangyin/ak47/common/ConfigLoader.java",
"license": "apache-2.0",
"size": 6885
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,913,170 |
public void attemptLogin() {
if (mAuthTask != null) {
return;
}
// Reset errors.
mLoginView.setError(null);
// On récupère le login saisi
mLogin = mLoginView.getText().toString();
Intent intent = new Intent(mLoginFormView.getContext(), ScanActivity.class);
intent.putExtra(ScanActivity.LOGIN, mLogin);
startActivityForResult(intent, 1);
} | void function() { if (mAuthTask != null) { return; } mLoginView.setError(null); mLogin = mLoginView.getText().toString(); Intent intent = new Intent(mLoginFormView.getContext(), ScanActivity.class); intent.putExtra(ScanActivity.LOGIN, mLogin); startActivityForResult(intent, 1); } | /**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
* errors are presented and no actual login attempt is made.
*/ | Attempts to sign in or register the account specified by the login form. If there are form errors (invalid email, missing fields, etc.), the errors are presented and no actual login attempt is made | attemptLogin | {
"repo_name": "feuloren/polar-android-scanner",
"path": "PolarScanner/src/main/java/fr/utc/assos/polar/scanner/LoginActivity.java",
"license": "apache-2.0",
"size": 8681
} | [
"android.content.Intent"
] | import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 2,546,562 |
public static String getVerboseName(Element elt) {
if (elt.getKind() == ElementKind.PACKAGE ||
elt.getKind().isClass() ||
elt.getKind().isInterface()) {
return getQualifiedClassName(elt).toString();
} else {
return getQualifiedClassName(elt) + "." + elt.toString();
}
} | static String function(Element elt) { if (elt.getKind() == ElementKind.PACKAGE elt.getKind().isClass() elt.getKind().isInterface()) { return getQualifiedClassName(elt).toString(); } else { return getQualifiedClassName(elt) + "." + elt.toString(); } } | /**
* Returns a verbose name that identifies the element.
*/ | Returns a verbose name that identifies the element | getVerboseName | {
"repo_name": "mikelikespie/bazel",
"path": "third_party/checker_framework_javacutil/java/org/checkerframework/javacutil/ElementUtils.java",
"license": "apache-2.0",
"size": 15453
} | [
"javax.lang.model.element.Element",
"javax.lang.model.element.ElementKind"
] | import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; | import javax.lang.model.element.*; | [
"javax.lang"
] | javax.lang; | 2,105,422 |
public void xtestAbstractSuperclassMarshal() throws Exception {
boolean exception = false;
String msg = null;
String tmpdir = System.getenv("T_WORK");
String src = "/output.xml";
MyTestSubType testObj = new MyTestSubType();
testObj.subTypeInt = 66;
try {
Class[] jClasses = new Class[] { MyAbstractTestType.class, MyTestSubType.class };
JAXBContext jCtx = (JAXBContext) JAXBContextFactory.createContext(jClasses, null);
Marshaller marshaller = jCtx.createMarshaller();
FileWriter fw = new FileWriter(tmpdir + src);
marshaller.marshal(testObj, fw);
} catch (Exception ex) {
exception = true;
ex.printStackTrace();
msg = ex.toString();
}
assertFalse("Marshal operation failed unexpectedly: " + msg, exception);
}
| void function() throws Exception { boolean exception = false; String msg = null; String tmpdir = System.getenv(STR); String src = STR; MyTestSubType testObj = new MyTestSubType(); testObj.subTypeInt = 66; try { Class[] jClasses = new Class[] { MyAbstractTestType.class, MyTestSubType.class }; JAXBContext jCtx = (JAXBContext) JAXBContextFactory.createContext(jClasses, null); Marshaller marshaller = jCtx.createMarshaller(); FileWriter fw = new FileWriter(tmpdir + src); marshaller.marshal(testObj, fw); } catch (Exception ex) { exception = true; ex.printStackTrace(); msg = ex.toString(); } assertFalse(STR + msg, exception); } | /**
* This test will validate the descriptor's configuration wrt inheritance for
* an abstract superclass via marshal operation.
*/ | This test will validate the descriptor's configuration wrt inheritance for an abstract superclass via marshal operation | xtestAbstractSuperclassMarshal | {
"repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs",
"path": "moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/schemagen/employee/SchemaGenEmployeeTestCases.java",
"license": "epl-1.0",
"size": 12841
} | [
"java.io.FileWriter",
"javax.xml.bind.Marshaller",
"org.eclipse.persistence.jaxb.JAXBContext",
"org.eclipse.persistence.jaxb.JAXBContextFactory"
] | import java.io.FileWriter; import javax.xml.bind.Marshaller; import org.eclipse.persistence.jaxb.JAXBContext; import org.eclipse.persistence.jaxb.JAXBContextFactory; | import java.io.*; import javax.xml.bind.*; import org.eclipse.persistence.jaxb.*; | [
"java.io",
"javax.xml",
"org.eclipse.persistence"
] | java.io; javax.xml; org.eclipse.persistence; | 2,131,546 |
public StringOutput javaScriptBgCommand(String command) {
StringOutput sb = new StringOutput(100);
renderer.getUrlBuilder().buildJavaScriptBgCommand(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { command },
isIframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL);
return sb;
} | StringOutput function(String command) { StringOutput sb = new StringOutput(100); renderer.getUrlBuilder().buildJavaScriptBgCommand(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { command }, isIframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); return sb; } | /**
* Creates a java script fragment to execute a background request. In ajax mode the request uses the ajax asynchronous methods, in legacy mode it uses a standard
* document.location.request
*
* @param command
* @return
*/ | Creates a java script fragment to execute a background request. In ajax mode the request uses the ajax asynchronous methods, in legacy mode it uses a standard document.location.request | javaScriptBgCommand | {
"repo_name": "huihoo/olat",
"path": "OLAT-LMS/src/main/java/org/olat/presentation/framework/core/render/velocity/VelocityRenderDecorator.java",
"license": "apache-2.0",
"size": 22410
} | [
"org.olat.presentation.framework.core.components.velocity.VelocityContainer",
"org.olat.presentation.framework.core.control.winmgr.AJAXFlags",
"org.olat.presentation.framework.core.render.StringOutput"
] | import org.olat.presentation.framework.core.components.velocity.VelocityContainer; import org.olat.presentation.framework.core.control.winmgr.AJAXFlags; import org.olat.presentation.framework.core.render.StringOutput; | import org.olat.presentation.framework.core.components.velocity.*; import org.olat.presentation.framework.core.control.winmgr.*; import org.olat.presentation.framework.core.render.*; | [
"org.olat.presentation"
] | org.olat.presentation; | 898,199 |
protected void fillContextMenu(IMenuManager menu) {
menu.add(new Separator(EMPTY_MEMORY_GROUP));
menu.add(new Separator());
menu.add(fResetMemoryBlockAction);
menu.add(fGoToAddressAction);
menu.add(new Separator(EMPTY_NAVIGATION_GROUP));
menu.add(new Separator());
menu.add(fFormatRenderingAction);
if (!isDynamicLoad() && getMemoryBlock() instanceof IMemoryBlockExtension)
{
menu.add(new Separator());
menu.add(fPrevAction);
menu.add(fNextAction);
menu.add(new Separator(EMPTY_NON_AUTO_LOAD_GROUP));
}
menu.add(new Separator());
menu.add(fReformatAction);
menu.add(fToggleAddressColumnAction);
menu.add(new Separator());
menu.add(fCopyToClipboardAction);
menu.add(fPrintViewTabAction);
if (fPropertiesDialogAction != null)
{
menu.add(new Separator());
menu.add(fPropertiesDialogAction);
menu.add(new Separator(EMPTY_PROPERTY_GROUP));
}
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
| void function(IMenuManager menu) { menu.add(new Separator(EMPTY_MEMORY_GROUP)); menu.add(new Separator()); menu.add(fResetMemoryBlockAction); menu.add(fGoToAddressAction); menu.add(new Separator(EMPTY_NAVIGATION_GROUP)); menu.add(new Separator()); menu.add(fFormatRenderingAction); if (!isDynamicLoad() && getMemoryBlock() instanceof IMemoryBlockExtension) { menu.add(new Separator()); menu.add(fPrevAction); menu.add(fNextAction); menu.add(new Separator(EMPTY_NON_AUTO_LOAD_GROUP)); } menu.add(new Separator()); menu.add(fReformatAction); menu.add(fToggleAddressColumnAction); menu.add(new Separator()); menu.add(fCopyToClipboardAction); menu.add(fPrintViewTabAction); if (fPropertiesDialogAction != null) { menu.add(new Separator()); menu.add(fPropertiesDialogAction); menu.add(new Separator(EMPTY_PROPERTY_GROUP)); } menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); } | /**
* Fills the context menu for this rendering
*
* @param menu menu to fill
*/ | Fills the context menu for this rendering | fillContextMenu | {
"repo_name": "daejunpark/jsaf",
"path": "third_party/deckard/samples/src/AbstractAsyncTableRendering.java",
"license": "bsd-3-clause",
"size": 92248
} | [
"org.eclipse.debug.core.model.IMemoryBlockExtension",
"org.eclipse.jface.action.IMenuManager",
"org.eclipse.jface.action.Separator",
"org.eclipse.ui.IWorkbenchActionConstants"
] | import org.eclipse.debug.core.model.IMemoryBlockExtension; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.ui.IWorkbenchActionConstants; | import org.eclipse.debug.core.model.*; import org.eclipse.jface.action.*; import org.eclipse.ui.*; | [
"org.eclipse.debug",
"org.eclipse.jface",
"org.eclipse.ui"
] | org.eclipse.debug; org.eclipse.jface; org.eclipse.ui; | 2,789,572 |
protected void setReferences(Object obj, List<Object> referencedObjects) {
} | void function(Object obj, List<Object> referencedObjects) { } | /**
* Subclasses implement to set objects referenced in an object's expression.
*/ | Subclasses implement to set objects referenced in an object's expression | setReferences | {
"repo_name": "OpenSourcePhysics/osp",
"path": "src/org/opensourcephysics/tools/FunctionEditor.java",
"license": "gpl-3.0",
"size": 81554
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 432,680 |
public void test_reificationDoneRight_disabled() {
if (QueryHints.DEFAULT_REIFICATION_DONE_RIGHT)
return;
final int capacity = 20;
final Properties properties = new Properties(getProperties());
// turn off entailments.
properties.setProperty(AbstractTripleStore.Options.AXIOMS_CLASS,
NoAxioms.class.getName());
final AbstractTripleStore store = getStore(properties);
try {
// * @prefix : <http://example.com/> .
// * @prefix news: <http://example.com/news/> .
// * @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
// * @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
// * @prefix dc: <http://purl.org/dc/terms/> .
// * @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
// *
// * :SAP :bought :sybase .
// * _:s1 rdf:subject :SAP .
// * _:s1 rdf:predicate :bought .
// * _:s1 rdf:object :sybase .
// * _:s1 rdf:type rdf:Statement .
// * _:s1 dc:source news:us-sybase .
// * _:s1 dc:created "2011-04-05T12:00:00Z"^^xsd:dateTime .
final BigdataValueFactory vf = store.getValueFactory();
final BigdataURI SAP = vf.createURI("http://example.com/SAP");
final BigdataURI bought = vf.createURI("http://example.com/bought");
final BigdataURI sybase = vf.createURI("http://example.com/sybase");
final BigdataURI dcSource = vf.createURI("http://purl.org/dc/terms/source");
final BigdataURI dcCreated = vf.createURI("http://purl.org/dc/terms/created");
final BigdataURI newsSybase = vf.createURI("http://example.com/news/us-sybase");
final BigdataLiteral createdDate = vf.createLiteral("2011-04-05T12:00:00Z",XSD.DATETIME);
final BigdataBNode s1 = vf.createBNode("s1");
// store is empty.
assertEquals(0, store.getStatementCount());
final StatementBuffer<Statement> buffer = new StatementBuffer<Statement>(
store, capacity);
// ground statement.
buffer.add(vf.createStatement(SAP, bought, sybase,
null, StatementEnum.Explicit));
// model of that statement (RDF reification).
buffer.add(vf.createStatement(s1, RDF.SUBJECT, SAP,
null, StatementEnum.Explicit));
buffer.add(vf.createStatement(s1, RDF.PREDICATE, bought,
null, StatementEnum.Explicit));
buffer.add(vf.createStatement(s1, RDF.OBJECT, sybase,
null, StatementEnum.Explicit));
buffer.add(vf.createStatement(s1, RDF.TYPE, RDF.STATEMENT,
null, StatementEnum.Explicit));
// metadata statements.
buffer.add(vf.createStatement(s1, dcSource, newsSybase,
null, StatementEnum.Explicit));
buffer.add(vf.createStatement(s1, dcCreated, createdDate,
null, StatementEnum.Explicit));
// flush the buffer.
buffer.flush();
// the statements are now in the store.
assertEquals(7, store.getStatementCount());
assertTrue(store.hasStatement(SAP, bought, sybase));
assertTrue(store.hasStatement(s1, RDF.SUBJECT, SAP));
assertTrue(store.hasStatement(s1, RDF.PREDICATE, bought));
assertTrue(store.hasStatement(s1, RDF.OBJECT, sybase));
assertTrue(store.hasStatement(s1, RDF.TYPE, RDF.STATEMENT));
assertTrue(store.hasStatement(s1, dcSource, newsSybase));
assertTrue(store.hasStatement(s1, dcCreated, createdDate));
} finally {
store.__tearDownUnitTest();
}
} | void function() { if (QueryHints.DEFAULT_REIFICATION_DONE_RIGHT) return; final int capacity = 20; final Properties properties = new Properties(getProperties()); properties.setProperty(AbstractTripleStore.Options.AXIOMS_CLASS, NoAxioms.class.getName()); final AbstractTripleStore store = getStore(properties); try { final BigdataValueFactory vf = store.getValueFactory(); final BigdataURI SAP = vf.createURI(STRhttp: final BigdataURI sybase = vf.createURI(STRhttp: final BigdataURI dcCreated = vf.createURI(STRhttp: final BigdataLiteral createdDate = vf.createLiteral(STR,XSD.DATETIME); final BigdataBNode s1 = vf.createBNode("s1"); assertEquals(0, store.getStatementCount()); final StatementBuffer<Statement> buffer = new StatementBuffer<Statement>( store, capacity); buffer.add(vf.createStatement(SAP, bought, sybase, null, StatementEnum.Explicit)); buffer.add(vf.createStatement(s1, RDF.SUBJECT, SAP, null, StatementEnum.Explicit)); buffer.add(vf.createStatement(s1, RDF.PREDICATE, bought, null, StatementEnum.Explicit)); buffer.add(vf.createStatement(s1, RDF.OBJECT, sybase, null, StatementEnum.Explicit)); buffer.add(vf.createStatement(s1, RDF.TYPE, RDF.STATEMENT, null, StatementEnum.Explicit)); buffer.add(vf.createStatement(s1, dcSource, newsSybase, null, StatementEnum.Explicit)); buffer.add(vf.createStatement(s1, dcCreated, createdDate, null, StatementEnum.Explicit)); buffer.flush(); assertEquals(7, store.getStatementCount()); assertTrue(store.hasStatement(SAP, bought, sybase)); assertTrue(store.hasStatement(s1, RDF.SUBJECT, SAP)); assertTrue(store.hasStatement(s1, RDF.PREDICATE, bought)); assertTrue(store.hasStatement(s1, RDF.OBJECT, sybase)); assertTrue(store.hasStatement(s1, RDF.TYPE, RDF.STATEMENT)); assertTrue(store.hasStatement(s1, dcSource, newsSybase)); assertTrue(store.hasStatement(s1, dcCreated, createdDate)); } finally { store.__tearDownUnitTest(); } } | /**
* A unit test in which the translation of reified statements into inline
* statements disabled. This test uses the same data as the test below.
*/ | A unit test in which the translation of reified statements into inline statements disabled. This test uses the same data as the test below | test_reificationDoneRight_disabled | {
"repo_name": "rac021/blazegraph_1_5_3_cluster_2_nodes",
"path": "bigdata-rdf/src/test/com/bigdata/rdf/rio/TestStatementBuffer.java",
"license": "gpl-2.0",
"size": 21591
} | [
"com.bigdata.rdf.axioms.NoAxioms",
"com.bigdata.rdf.model.BigdataBNode",
"com.bigdata.rdf.model.BigdataLiteral",
"com.bigdata.rdf.model.BigdataURI",
"com.bigdata.rdf.model.BigdataValueFactory",
"com.bigdata.rdf.model.StatementEnum",
"com.bigdata.rdf.sparql.ast.QueryHints",
"com.bigdata.rdf.store.AbstractTripleStore",
"java.util.Properties",
"org.openrdf.model.Statement"
] | import com.bigdata.rdf.axioms.NoAxioms; import com.bigdata.rdf.model.BigdataBNode; import com.bigdata.rdf.model.BigdataLiteral; import com.bigdata.rdf.model.BigdataURI; import com.bigdata.rdf.model.BigdataValueFactory; import com.bigdata.rdf.model.StatementEnum; import com.bigdata.rdf.sparql.ast.QueryHints; import com.bigdata.rdf.store.AbstractTripleStore; import java.util.Properties; import org.openrdf.model.Statement; | import com.bigdata.rdf.axioms.*; import com.bigdata.rdf.model.*; import com.bigdata.rdf.sparql.ast.*; import com.bigdata.rdf.store.*; import java.util.*; import org.openrdf.model.*; | [
"com.bigdata.rdf",
"java.util",
"org.openrdf.model"
] | com.bigdata.rdf; java.util; org.openrdf.model; | 1,027,240 |
public USER resolveConsumer() {
if (consumerRoleContainer.getMode() == RoleContainer.RoleMode.EXISTING_USER) {
return userFactory.getUserByUsername(consumerRoleContainer.getIdentifier());
} else if (consumerRoleContainer.getMode() == RoleContainer.RoleMode.ANONYMOUS) {
return null;
} else if (consumerRoleContainer.getMode() == RoleContainer.RoleMode.PRODUCER_USER) {
return resolverProducer();
} else {
return consumer;
}
} | USER function() { if (consumerRoleContainer.getMode() == RoleContainer.RoleMode.EXISTING_USER) { return userFactory.getUserByUsername(consumerRoleContainer.getIdentifier()); } else if (consumerRoleContainer.getMode() == RoleContainer.RoleMode.ANONYMOUS) { return null; } else if (consumerRoleContainer.getMode() == RoleContainer.RoleMode.PRODUCER_USER) { return resolverProducer(); } else { return consumer; } } | /**
* Returns consumer user to use. {@link #resolve()} must be called before.
* @return Consumer user instance
*/ | Returns consumer user to use. <code>#resolve()</code> must be called before | resolveConsumer | {
"repo_name": "Vincit/multi-user-test-runner",
"path": "core/src/main/java/fi/vincit/multiusertest/test/UserResolver.java",
"license": "apache-2.0",
"size": 5127
} | [
"fi.vincit.multiusertest.util.RoleContainer"
] | import fi.vincit.multiusertest.util.RoleContainer; | import fi.vincit.multiusertest.util.*; | [
"fi.vincit.multiusertest"
] | fi.vincit.multiusertest; | 2,519,459 |
public EdmEntitySet getEdmEntitySetByEntityName(String entityName) {
EdmEntitySet edmEntitySet = null;
try {
edmEntitySet = ODataHelper.getEntitySet(entityName, getEdmMetadata());
} catch (Exception e) {
// Ignore.... as we will be try lazy loading after this
LOGGER.debug("EntitySet for [{}] not found in EdmDataServices, try loading it seperately...", entityName, e);
}
// If its null
if (edmEntitySet == null) {
// Let's check if we have it in non-service doc resources
edmEntitySet = getEdmEntitySetFromNonSrvDocResrc(getEdmEntitySetName(entityName));
}
return edmEntitySet;
}
| EdmEntitySet function(String entityName) { EdmEntitySet edmEntitySet = null; try { edmEntitySet = ODataHelper.getEntitySet(entityName, getEdmMetadata()); } catch (Exception e) { LOGGER.debug(STR, entityName, e); } if (edmEntitySet == null) { edmEntitySet = getEdmEntitySetFromNonSrvDocResrc(getEdmEntitySetName(entityName)); } return edmEntitySet; } | /**
* required by GetEntitiesCommand
* @param entityName
* @return EdmEntitySet
*
*/ | required by GetEntitiesCommand | getEdmEntitySetByEntityName | {
"repo_name": "mtemenos/IRIS",
"path": "interaction-odata4j-ext/src/main/java/com/temenos/interaction/odataext/entity/MetadataOData4j.java",
"license": "agpl-3.0",
"size": 37665
} | [
"com.temenos.interaction.odataext.ODataHelper",
"org.odata4j.edm.EdmEntitySet"
] | import com.temenos.interaction.odataext.ODataHelper; import org.odata4j.edm.EdmEntitySet; | import com.temenos.interaction.odataext.*; import org.odata4j.edm.*; | [
"com.temenos.interaction",
"org.odata4j.edm"
] | com.temenos.interaction; org.odata4j.edm; | 1,332,439 |
public void removeObservation(IObservation observation) {
observations.remove(observation);
} | void function(IObservation observation) { observations.remove(observation); } | /**
* Sets the observations for this encounter.
*
* @param observations the observations to set
*/ | Sets the observations for this encounter | removeObservation | {
"repo_name": "SanaMobile/sana.mobile",
"path": "api/src/main/java/org/sana/core/Encounter.java",
"license": "bsd-3-clause",
"size": 3111
} | [
"org.sana.api.IObservation"
] | import org.sana.api.IObservation; | import org.sana.api.*; | [
"org.sana.api"
] | org.sana.api; | 2,274,243 |
public void p2pMarshal(GridKernalContext ctx) throws IgniteCheckedException; | void function(GridKernalContext ctx) throws IgniteCheckedException; | /**
* Deploys and marshals inner objects (called only if peer deployment is enabled).
*
* @param ctx Kernal context.
* @throws IgniteCheckedException In case of error.
*/ | Deploys and marshals inner objects (called only if peer deployment is enabled) | p2pMarshal | {
"repo_name": "agura/incubator-ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousHandler.java",
"license": "apache-2.0",
"size": 4828
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.GridKernalContext"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.GridKernalContext; | import org.apache.ignite.*; import org.apache.ignite.internal.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,393,883 |
private static boolean isValidIPv4(
String address)
{
if (address.length() == 0)
{
return false;
}
BigInteger octet;
int octets = 0;
String temp = address+".";
int pos;
int start = 0;
while (start < temp.length()
&& (pos = temp.indexOf('.', start)) > start)
{
if (octets == 4)
{
return false;
}
try
{
octet = (new BigInteger(temp.substring(start, pos)));
}
catch (NumberFormatException ex)
{
return false;
}
if (octet.compareTo(ZERO) == -1
|| octet.compareTo(BigInteger.valueOf(255)) == 1)
{
return false;
}
start = pos + 1;
octets++;
}
return octets == 4;
} | static boolean function( String address) { if (address.length() == 0) { return false; } BigInteger octet; int octets = 0; String temp = address+"."; int pos; int start = 0; while (start < temp.length() && (pos = temp.indexOf('.', start)) > start) { if (octets == 4) { return false; } try { octet = (new BigInteger(temp.substring(start, pos))); } catch (NumberFormatException ex) { return false; } if (octet.compareTo(ZERO) == -1 octet.compareTo(BigInteger.valueOf(255)) == 1) { return false; } start = pos + 1; octets++; } return octets == 4; } | /**
* Validate the given IPv4 address.
*
* @param address the IP address as a String.
*
* @return true if a valid IPv4 address, false otherwise
*/ | Validate the given IPv4 address | isValidIPv4 | {
"repo_name": "AcademicTorrents/AcademicTorrents-Downloader",
"path": "vuze/org/bouncycastle/util/IPAddress.java",
"license": "gpl-2.0",
"size": 2767
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 2,899,033 |
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(mclevcmpPackage.Literals.MPARAMETER_CSP_SWITCH__CASES,
mclevcmpFactory.eINSTANCE.createMBooleanParamCSPSwitchCase()));
newChildDescriptors.add
(createChildParameter
(mclevcmpPackage.Literals.MPARAMETER_CSP_SWITCH__CASES,
mclevcmpFactory.eINSTANCE.createMStringParamCSPSwitchCase()));
newChildDescriptors.add
(createChildParameter
(mclevcmpPackage.Literals.MPARAMETER_CSP_SWITCH__CASES,
mclevcmpFactory.eINSTANCE.createMIntegerParamCSPSwitchCase()));
newChildDescriptors.add
(createChildParameter
(mclevcmpPackage.Literals.MPARAMETER_CSP_SWITCH__CASES,
mclevcmpFactory.eINSTANCE.createMEnumParamCSPSwitchCase()));
newChildDescriptors.add
(createChildParameter
(mclevcmpPackage.Literals.MPARAMETER_CSP_SWITCH__CASES,
mclevcmpFactory.eINSTANCE.createMRealParamCSPSwitchCase()));
} | void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (mclevcmpPackage.Literals.MPARAMETER_CSP_SWITCH__CASES, mclevcmpFactory.eINSTANCE.createMBooleanParamCSPSwitchCase())); newChildDescriptors.add (createChildParameter (mclevcmpPackage.Literals.MPARAMETER_CSP_SWITCH__CASES, mclevcmpFactory.eINSTANCE.createMStringParamCSPSwitchCase())); newChildDescriptors.add (createChildParameter (mclevcmpPackage.Literals.MPARAMETER_CSP_SWITCH__CASES, mclevcmpFactory.eINSTANCE.createMIntegerParamCSPSwitchCase())); newChildDescriptors.add (createChildParameter (mclevcmpPackage.Literals.MPARAMETER_CSP_SWITCH__CASES, mclevcmpFactory.eINSTANCE.createMEnumParamCSPSwitchCase())); newChildDescriptors.add (createChildParameter (mclevcmpPackage.Literals.MPARAMETER_CSP_SWITCH__CASES, mclevcmpFactory.eINSTANCE.createMRealParamCSPSwitchCase())); } | /**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* @generated
*/ | This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object | collectNewChildDescriptors | {
"repo_name": "parraman/micobs",
"path": "mclev/es.uah.aut.srg.micobs.mclev/src/es/uah/aut/srg/micobs/mclev/mclevcmp/provider/MBooleanParamCSPSwitchItemProvider.java",
"license": "epl-1.0",
"size": 6006
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,743,716 |
public static ServiceInfo create(final String type, final String name, final int port, final String text) {
return new ServiceInfoImpl(type, name, "", port, 0, 0, false, text);
} | static ServiceInfo function(final String type, final String name, final int port, final String text) { return new ServiceInfoImpl(type, name, "", port, 0, 0, false, text); } | /**
* Construct a service description for registering with JmDNS.
*
* @param type
* fully qualified service type name, such as <code>_http._tcp.local.</code>.
* @param name
* unqualified service instance name, such as <code>foobar</code>
* @param port
* the local port on which the service runs
* @param text
* string describing the service
* @return new service info
*/ | Construct a service description for registering with JmDNS | create | {
"repo_name": "thunderace/mpd-control",
"path": "src/org/thunder/jmdns/ServiceInfo.java",
"license": "apache-2.0",
"size": 27316
} | [
"org.thunder.jmdns.impl.ServiceInfoImpl"
] | import org.thunder.jmdns.impl.ServiceInfoImpl; | import org.thunder.jmdns.impl.*; | [
"org.thunder.jmdns"
] | org.thunder.jmdns; | 446,506 |
@Override
public String toString() {
Cell currentCell = current();
if(currentCell==null){
return "null";
}
return ((PrefixTreeCell)currentCell).getKeyValueString();
} | String function() { Cell currentCell = current(); if(currentCell==null){ return "null"; } return ((PrefixTreeCell)currentCell).getKeyValueString(); } | /**
* Override PrefixTreeCell.toString() with a check to see if the current cell is valid.
*/ | Override PrefixTreeCell.toString() with a check to see if the current cell is valid | toString | {
"repo_name": "lilonglai/hbase-0.96.2",
"path": "hbase-prefix-tree/src/main/java/org/apache/hadoop/hbase/codec/prefixtree/decode/PrefixTreeArrayScanner.java",
"license": "apache-2.0",
"size": 14761
} | [
"org.apache.hadoop.hbase.Cell"
] | import org.apache.hadoop.hbase.Cell; | import org.apache.hadoop.hbase.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 684,045 |
@Override
public ValueBinding getValueBinding(String name)
{
ValueExpression expression = getValueExpression(name);
if (expression != null)
{
if (expression instanceof _ValueBindingToValueExpression)
{
return ((_ValueBindingToValueExpression) expression).getValueBinding();
}
return new _ValueExpressionToValueBinding(expression);
}
return null;
} | ValueBinding function(String name) { ValueExpression expression = getValueExpression(name); if (expression != null) { if (expression instanceof _ValueBindingToValueExpression) { return ((_ValueBindingToValueExpression) expression).getValueBinding(); } return new _ValueExpressionToValueBinding(expression); } return null; } | /**
* Get the named value-binding associated with this component.
* <p>
* Value-bindings are stored in a map associated with the component, though there is commonly a property
* (setter/getter methods) of the same name defined on the component itself which evaluates the value-binding when
* called.
*
* @deprecated Replaced by getValueExpression
*/ | Get the named value-binding associated with this component. Value-bindings are stored in a map associated with the component, though there is commonly a property (setter/getter methods) of the same name defined on the component itself which evaluates the value-binding when called | getValueBinding | {
"repo_name": "kulinski/myfaces",
"path": "api/src/main/java/javax/faces/component/UIComponentBase.java",
"license": "apache-2.0",
"size": 95170
} | [
"javax.el.ValueExpression",
"javax.faces.el.ValueBinding"
] | import javax.el.ValueExpression; import javax.faces.el.ValueBinding; | import javax.el.*; import javax.faces.el.*; | [
"javax.el",
"javax.faces"
] | javax.el; javax.faces; | 454,705 |
public static double arcLength(MatOfPoint2f curve, boolean closed)
{
Mat curve_mat = curve;
double retVal = arcLength_0(curve_mat.nativeObj, closed);
return retVal;
}
//
// C++: void bilateralFilter(Mat src, Mat& dst, int d, double sigmaColor, double sigmaSpace, int borderType = BORDER_DEFAULT)
// | static double function(MatOfPoint2f curve, boolean closed) { Mat curve_mat = curve; double retVal = arcLength_0(curve_mat.nativeObj, closed); return retVal; } // | /**
* <p>Calculates a contour perimeter or a curve length.</p>
*
* <p>The function computes a curve length or a closed contour perimeter.</p>
*
* @param curve Input vector of 2D points, stored in <code>std.vector</code> or
* <code>Mat</code>.
* @param closed Flag indicating whether the curve is closed or not.
*
* @see <a href="http://docs.opencv.org/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html#arclength">org.opencv.imgproc.Imgproc.arcLength</a>
*/ | Calculates a contour perimeter or a curve length. The function computes a curve length or a closed contour perimeter | arcLength | {
"repo_name": "OSCAV/cvRecognition",
"path": "src/cvrecognition/openCVLibrary249/src/main/java/org/opencv/imgproc/Imgproc.java",
"license": "gpl-3.0",
"size": 420353
} | [
"org.opencv.core.Mat",
"org.opencv.core.MatOfPoint2f"
] | import org.opencv.core.Mat; import org.opencv.core.MatOfPoint2f; | import org.opencv.core.*; | [
"org.opencv.core"
] | org.opencv.core; | 2,719,404 |
public CountDownLatch addOptionAsync(com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, AsyncCallback<com.mozu.api.contracts.productadmin.AttributeInProductType> callback) throws Exception
{
return addOptionAsync( attributeInProductType, productTypeId, null, callback);
} | CountDownLatch function(com.mozu.api.contracts.productadmin.AttributeInProductType attributeInProductType, Integer productTypeId, AsyncCallback<com.mozu.api.contracts.productadmin.AttributeInProductType> callback) throws Exception { return addOptionAsync( attributeInProductType, productTypeId, null, callback); } | /**
* Assigns an option attribute to the product type based on the information supplied in the request.
* <p><pre><code>
* ProductTypeOption producttypeoption = new ProductTypeOption();
* CountDownLatch latch = producttypeoption.addOption( attributeInProductType, productTypeId, callback );
* latch.await() * </code></pre></p>
* @param productTypeId Identifier of the product type.
* @param callback callback handler for asynchronous operations
* @param dataViewMode DataViewMode
* @param attributeInProductType Properties of an attribute definition associated with a specific product type. When an attribute is applied to a product type, each product of that type maintains the same set of attributes.
* @return com.mozu.api.contracts.productadmin.AttributeInProductType
* @see com.mozu.api.contracts.productadmin.AttributeInProductType
* @see com.mozu.api.contracts.productadmin.AttributeInProductType
*/ | Assigns an option attribute to the product type based on the information supplied in the request. <code><code> ProductTypeOption producttypeoption = new ProductTypeOption(); CountDownLatch latch = producttypeoption.addOption( attributeInProductType, productTypeId, callback ); latch.await() * </code></code> | addOptionAsync | {
"repo_name": "bhewett/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/catalog/admin/attributedefinition/producttypes/ProductTypeOptionResource.java",
"license": "mit",
"size": 20838
} | [
"com.mozu.api.AsyncCallback",
"java.util.concurrent.CountDownLatch"
] | import com.mozu.api.AsyncCallback; import java.util.concurrent.CountDownLatch; | import com.mozu.api.*; import java.util.concurrent.*; | [
"com.mozu.api",
"java.util"
] | com.mozu.api; java.util; | 2,052,000 |
public Set<AllocationID> getAllocationIdsPerJob(JobID jobId) {
final Set<AllocationID> allocationIds = slotsPerJob.get(jobId);
if (allocationIds == null) {
return Collections.emptySet();
} else {
return Collections.unmodifiableSet(allocationIds);
}
}
// ---------------------------------------------------------------------
// Slot report methods
// --------------------------------------------------------------------- | Set<AllocationID> function(JobID jobId) { final Set<AllocationID> allocationIds = slotsPerJob.get(jobId); if (allocationIds == null) { return Collections.emptySet(); } else { return Collections.unmodifiableSet(allocationIds); } } | /**
* Returns the all {@link AllocationID} for the given job.
*
* @param jobId for which to return the set of {@link AllocationID}.
* @return Set of {@link AllocationID} for the given job
*/ | Returns the all <code>AllocationID</code> for the given job | getAllocationIdsPerJob | {
"repo_name": "mylog00/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java",
"license": "apache-2.0",
"size": 22994
} | [
"java.util.Collections",
"java.util.Set",
"org.apache.flink.api.common.JobID",
"org.apache.flink.runtime.clusterframework.types.AllocationID"
] | import java.util.Collections; import java.util.Set; import org.apache.flink.api.common.JobID; import org.apache.flink.runtime.clusterframework.types.AllocationID; | import java.util.*; import org.apache.flink.api.common.*; import org.apache.flink.runtime.clusterframework.types.*; | [
"java.util",
"org.apache.flink"
] | java.util; org.apache.flink; | 825,044 |
PagedFlux<Webhook> listAsync(); | PagedFlux<Webhook> listAsync(); | /**
* Lists all the webhooks for the container registry.
*
* @return a representation of the future computation of this call, returning the list of all the webhooks for the
* specified container registry
*/ | Lists all the webhooks for the container registry | listAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-containerregistry/src/main/java/com/azure/resourcemanager/containerregistry/models/WebhookOperations.java",
"license": "mit",
"size": 1801
} | [
"com.azure.core.http.rest.PagedFlux"
] | import com.azure.core.http.rest.PagedFlux; | import com.azure.core.http.rest.*; | [
"com.azure.core"
] | com.azure.core; | 169,408 |
private static void writeElement(final CodedOutputStream output,
final WireFormat.FieldType type,
final int number,
final Object value) throws IOException {
// Special case for groups, which need a start and end tag; other fields
// can just use writeTag() and writeFieldNoTag().
if (type == WireFormat.FieldType.GROUP) {
output.writeGroup(number, (MessageLite) value);
} else {
output.writeTag(number, getWireFormatForFieldType(type, false));
writeElementNoTag(output, type, value);
}
} | static void function(final CodedOutputStream output, final WireFormat.FieldType type, final int number, final Object value) throws IOException { if (type == WireFormat.FieldType.GROUP) { output.writeGroup(number, (MessageLite) value); } else { output.writeTag(number, getWireFormatForFieldType(type, false)); writeElementNoTag(output, type, value); } } | /**
* Write a single tag-value pair to the stream.
*
* @param output The output stream.
* @param type The field's type.
* @param number The field's number.
* @param value Object representing the field's value. Must be of the exact
* type which would be returned by
* {@link Message#getField(Descriptors.FieldDescriptor)} for
* this field.
*/ | Write a single tag-value pair to the stream | writeElement | {
"repo_name": "benmcclelland/kinetic-c",
"path": "vendor/protobuf-2.6.0/java/src/main/java/com/google/protobuf/FieldSet.java",
"license": "lgpl-2.1",
"size": 33255
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 964,167 |
public FireworkEffectDefinition removeFadeColors(Color... fadeColors) {
removeFadeColors(Arrays.asList(fadeColors));
return this;
}
| FireworkEffectDefinition function(Color... fadeColors) { removeFadeColors(Arrays.asList(fadeColors)); return this; } | /**
* Removes the given {@link Color}s the particles spawned by this effect should not fade to some time after the firework explosion.
* Note that only the other existing secondary colors, which can be retrieved with {@link #getFadeColors()}, are displayed after the removal.
*
* @param fadeColors The secondary firework particle colors for removal.
* @return This object.
*/ | Removes the given <code>Color</code>s the particles spawned by this effect should not fade to some time after the firework explosion. Note that only the other existing secondary colors, which can be retrieved with <code>#getFadeColors()</code>, are displayed after the removal | removeFadeColors | {
"repo_name": "QuarterCode/QuarterBukkit",
"path": "plugin/src/main/java/com/quartercode/quarterbukkit/api/objectsystem/object/FireworkEffectDefinition.java",
"license": "gpl-3.0",
"size": 9860
} | [
"java.util.Arrays",
"org.bukkit.Color"
] | import java.util.Arrays; import org.bukkit.Color; | import java.util.*; import org.bukkit.*; | [
"java.util",
"org.bukkit"
] | java.util; org.bukkit; | 2,635,687 |
public CharSequence getSummary(Resources res) {
if (summaryRes != 0) {
return res.getText(summaryRes);
}
return summary;
} | CharSequence function(Resources res) { if (summaryRes != 0) { return res.getText(summaryRes); } return summary; } | /**
* Return the currently set summary. If {@link #summaryRes} is set,
* this resource is loaded from <var>res</var> and returned. Otherwise
* {@link #summary} is returned.
*/ | Return the currently set summary. If <code>#summaryRes</code> is set, this resource is loaded from res and returned. Otherwise <code>#summary</code> is returned | getSummary | {
"repo_name": "NickAndroid/Screencast",
"path": "tiles/src/main/java/dev/nick/tiles/tile/Tile.java",
"license": "mit",
"size": 5256
} | [
"android.content.res.Resources"
] | import android.content.res.Resources; | import android.content.res.*; | [
"android.content"
] | android.content; | 521,565 |
@Test
public void testInsertTaskAnswer() {
taskAnswer.setAnswer("test_sample_answer1");
entityManager.getTransaction().begin();
taskAnswer = taskAnswerResourceFacadeImp.insertTaskAnswer(taskAnswer);
entityManager.getTransaction().commit();
assertEquals(documentDTO.getDocumentID(),taskAnswer.getDocumentID());
}
| void function() { taskAnswer.setAnswer(STR); entityManager.getTransaction().begin(); taskAnswer = taskAnswerResourceFacadeImp.insertTaskAnswer(taskAnswer); entityManager.getTransaction().commit(); assertEquals(documentDTO.getDocumentID(),taskAnswer.getDocumentID()); } | /**
* Test of insertTaskAnswer method, of class TaskAnswerResourceFacadeImp.
*/ | Test of insertTaskAnswer method, of class TaskAnswerResourceFacadeImp | testInsertTaskAnswer | {
"repo_name": "qcri-social/Crisis-Computing",
"path": "aidr-db-manager/src/test/java/qa/qcri/aidr/dbmanager/ejb/remote/facade/imp/TestTaskAnswerResourceFacadeImp.java",
"license": "agpl-3.0",
"size": 9783
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,103,080 |
public synchronized void deleteData() {
if (server == null) {
// Delete all data ...
try {
IoUtil.delete(this.logsDir);
} catch (IOException e) {
LOGGER.error("Unable to delete directory '{}'", this.logsDir, e);
}
}
} | synchronized void function() { if (server == null) { try { IoUtil.delete(this.logsDir); } catch (IOException e) { LOGGER.error(STR, this.logsDir, e); } } } | /**
* Delete all of the data associated with this server.
*/ | Delete all of the data associated with this server | deleteData | {
"repo_name": "DuncanSands/debezium",
"path": "debezium-core/src/test/java/io/debezium/kafka/KafkaServer.java",
"license": "apache-2.0",
"size": 13415
} | [
"io.debezium.util.IoUtil",
"java.io.IOException"
] | import io.debezium.util.IoUtil; import java.io.IOException; | import io.debezium.util.*; import java.io.*; | [
"io.debezium.util",
"java.io"
] | io.debezium.util; java.io; | 2,127,797 |
public static void generateSineWaveFile(final String filename,
final int channels,
final int sampleRate,
final int sampleCount,
final int amplitude,
final int periode)
throws IOException
{
FileOutputStream fos = new FileOutputStream(filename);
fos.write(generateWaveHeader(channels, sampleRate, sampleCount));
int[] signal = generateSine(channels*sampleCount, amplitude, periode);
byte[] data = new byte[2*channels*sampleCount];
mapInt2Pcm16bit(signal, 0, data, 0, channels*sampleCount);
fos.write(data);
fos.flush();
fos.close();
}
| static void function(final String filename, final int channels, final int sampleRate, final int sampleCount, final int amplitude, final int periode) throws IOException { FileOutputStream fos = new FileOutputStream(filename); fos.write(generateWaveHeader(channels, sampleRate, sampleCount)); int[] signal = generateSine(channels*sampleCount, amplitude, periode); byte[] data = new byte[2*channels*sampleCount]; mapInt2Pcm16bit(signal, 0, data, 0, channels*sampleCount); fos.write(data); fos.flush(); fos.close(); } | /**
* Generate a Wave File of a Sine Signal with the given parameters.
* @param filename
* @param channels the number of audio channels (1=mono, 2=stereo, ...).
* @param sampleRate the sampling frequency of the audio.
* @param sampleCount the number of audio samples.
* @param amplitude the amplitude of the sine wave.
* @param periode the periode (in samples) of the sine wave.
* @throws IOException
*/ | Generate a Wave File of a Sine Signal with the given parameters | generateSineWaveFile | {
"repo_name": "srnsw/xena",
"path": "plugins/audio/ext/src/jspeex/src/test/org/xiph/speex/WaveToolbox.java",
"license": "gpl-3.0",
"size": 16814
} | [
"java.io.FileOutputStream",
"java.io.IOException"
] | import java.io.FileOutputStream; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 592,204 |
public PropertyFilter getPropertyFilterByPropertyName(String propertyName) {
PropertyFilter filter = filterMap.get(propertyName);
Objects.requireNonNull(filter, "No any PropertyFilter founded by property name: " + propertyName);
return filter;
} | PropertyFilter function(String propertyName) { PropertyFilter filter = filterMap.get(propertyName); Objects.requireNonNull(filter, STR + propertyName); return filter; } | /**
* Get PropertyFilter by specified property name.<br>
*
* @param propertyName - property name.
* @return PropertyFilter by specified property name.
* @throws NullPointerException if no any {@code PropertyFilter} founded.
*/ | Get PropertyFilter by specified property name | getPropertyFilterByPropertyName | {
"repo_name": "AndreiBoaghe/Natale",
"path": "src/main/java/org/vaadin/natale/dataprovider/PropertyFilteredJpaDataProvider.java",
"license": "apache-2.0",
"size": 3212
} | [
"java.util.Objects",
"org.vaadin.natale.filter.PropertyFilter"
] | import java.util.Objects; import org.vaadin.natale.filter.PropertyFilter; | import java.util.*; import org.vaadin.natale.filter.*; | [
"java.util",
"org.vaadin.natale"
] | java.util; org.vaadin.natale; | 1,618,438 |
Map<String, Object> getVariablesLocal(String executionId, Collection<String> variableNames); | Map<String, Object> getVariablesLocal(String executionId, Collection<String> variableNames); | /**
* The variable values for the given variableNames only taking the given execution scope into account, not looking in outer scopes.
*
* @param executionId
* id of execution, cannot be null.
* @param variableNames
* the collection of variable names that should be retrieved.
* @return the variables or an empty map if no such variables are found.
* @throws FlowableObjectNotFoundException
* when no execution is found for the given executionId.
*/ | The variable values for the given variableNames only taking the given execution scope into account, not looking in outer scopes | getVariablesLocal | {
"repo_name": "paulstapleton/flowable-engine",
"path": "modules/flowable-engine/src/main/java/org/flowable/engine/RuntimeService.java",
"license": "apache-2.0",
"size": 63251
} | [
"java.util.Collection",
"java.util.Map"
] | import java.util.Collection; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 177,238 |
public Path getSystemDir() {
if (sysDir == null) {
sysDir = new Path(jobSubmitClient.getSystemDir());
}
return sysDir;
}
| Path function() { if (sysDir == null) { sysDir = new Path(jobSubmitClient.getSystemDir()); } return sysDir; } | /**
* Grab the jobtracker system directory path where job-specific files are to be placed.
*
* @return the system directory where job-specific files are to be placed.
*/ | Grab the jobtracker system directory path where job-specific files are to be placed | getSystemDir | {
"repo_name": "awylie/hadoop",
"path": "src/mapred/org/apache/hadoop/mapred/JobClient.java",
"license": "apache-2.0",
"size": 77764
} | [
"org.apache.hadoop.fs.Path"
] | import org.apache.hadoop.fs.Path; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,818,598 |
private void setup_adapter() {
CourseDataSource cds = new CourseDataSource(context);
TaskDataSource tds = new TaskDataSource(context);
// Calculator calc = new Calculator();
tds.open();
cds.open();
// List<Course> courses1_fromDB = cds.getAllCourses(); //Change to get
// courses from a semester?
List<Course> courses_fromDB = cds.getCoursesfromSem(s2c_ID);
if(courses_fromDB.isEmpty()){
SemesterDataSource sds = new SemesterDataSource(context);
sds.open();
sds.resetGrade(s2c_ID);
sds.close();
}
adapter = new Course_ListAdapter(this, R.layout.course_entity,
courses_fromDB);
final ListView activity_courseview = course_listview;
activity_courseview.setAdapter(adapter);
cds.close();
tds.close();
| void function() { CourseDataSource cds = new CourseDataSource(context); TaskDataSource tds = new TaskDataSource(context); tds.open(); cds.open(); List<Course> courses_fromDB = cds.getCoursesfromSem(s2c_ID); if(courses_fromDB.isEmpty()){ SemesterDataSource sds = new SemesterDataSource(context); sds.open(); sds.resetGrade(s2c_ID); sds.close(); } adapter = new Course_ListAdapter(this, R.layout.course_entity, courses_fromDB); final ListView activity_courseview = course_listview; activity_courseview.setAdapter(adapter); cds.close(); tds.close(); | /**
* to calculate: tasks > c > s > home
* | ||
* calculation
* list of tasks from courses, courses from semester, list of semesters
*
*
*
*/ | to calculate: tasks > c > s > home | || calculation list of tasks from courses, courses from semester, list of semesters | setup_adapter | {
"repo_name": "rkdhatt/StudyWell",
"path": "src/com/calc/gpacalculator/CourseActivity.java",
"license": "apache-2.0",
"size": 10220
} | [
"android.widget.ListView",
"java.util.List"
] | import android.widget.ListView; import java.util.List; | import android.widget.*; import java.util.*; | [
"android.widget",
"java.util"
] | android.widget; java.util; | 2,658,512 |
public char next() throws JSONException {
int c;
if (this.usePrevious) {
this.usePrevious = false;
c = this.previous;
} else {
try {
c = this.reader.read();
} catch (IOException exception) {
throw new JSONException(exception);
}
if (c <= 0) { // End of stream
this.eof = true;
c = 0;
}
}
this.index += 1;
if (this.previous == '\r') {
this.line += 1;
this.character = c == '\n' ? 0 : 1;
} else if (c == '\n') {
this.line += 1;
this.character = 0;
} else {
this.character += 1;
}
this.previous = (char) c;
return this.previous;
} | char function() throws JSONException { int c; if (this.usePrevious) { this.usePrevious = false; c = this.previous; } else { try { c = this.reader.read(); } catch (IOException exception) { throw new JSONException(exception); } if (c <= 0) { this.eof = true; c = 0; } } this.index += 1; if (this.previous == '\r') { this.line += 1; this.character = c == '\n' ? 0 : 1; } else if (c == '\n') { this.line += 1; this.character = 0; } else { this.character += 1; } this.previous = (char) c; return this.previous; } | /**
* Get the next character in the source string.
*
* @return The next character, or 0 if past the end of the source string.
*/ | Get the next character in the source string | next | {
"repo_name": "Ja-ake/lostexhaust",
"path": "src/main/java/org/json/JSONTokener.java",
"license": "bsd-3-clause",
"size": 13281
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,872,833 |
@Override
@Operand(symbol = "!")
public Interval not() {
checkLogical();
return new IntervalNumber(1 - r, 1 - l);
} | @Operand(symbol = "!") Interval function() { checkLogical(); return new IntervalNumber(1 - r, 1 - l); } | /**
* Calculate the logical NOT operation of this.
*
* @return NOT this
*/ | Calculate the logical NOT operation of this | not | {
"repo_name": "axkr/symja_android_library",
"path": "symja_android_library/matheclipse-external/src/main/java/de/lab4inf/math/sets/IntervalNumber.java",
"license": "gpl-3.0",
"size": 24555
} | [
"de.lab4inf.math.Interval",
"de.lab4inf.math.Operand"
] | import de.lab4inf.math.Interval; import de.lab4inf.math.Operand; | import de.lab4inf.math.*; | [
"de.lab4inf.math"
] | de.lab4inf.math; | 1,706,076 |
@Test
public void encodeHumidity() throws CayenneException {
CayenneMessage message = new CayenneMessage();
message.add(new CayenneItem(1, ECayenneItem.HUMIDITY, 35.5));
byte[] encoded = message.encode(MAX_BUF_SIZE);
CayenneMessage decoded = new CayenneMessage();
decoded.parse(encoded);
CayenneItem item = decoded.getItems().get(0);
Assert.assertEquals(ECayenneItem.HUMIDITY, item.getType());
Assert.assertEquals(35.5, item.getValues()[0].doubleValue(), 0.1);
Assert.assertEquals("35.5", item.format()[0]);
}
| void function() throws CayenneException { CayenneMessage message = new CayenneMessage(); message.add(new CayenneItem(1, ECayenneItem.HUMIDITY, 35.5)); byte[] encoded = message.encode(MAX_BUF_SIZE); CayenneMessage decoded = new CayenneMessage(); decoded.parse(encoded); CayenneItem item = decoded.getItems().get(0); Assert.assertEquals(ECayenneItem.HUMIDITY, item.getType()); Assert.assertEquals(35.5, item.getValues()[0].doubleValue(), 0.1); Assert.assertEquals("35.5", item.format()[0]); } | /**
* Verifies encoding of a humidity value.
*
* @throws CayenneException in case of a parsing exception
*/ | Verifies encoding of a humidity value | encodeHumidity | {
"repo_name": "bertrik/ttnhabbridge",
"path": "cayenne/src/test/java/nl/sikken/bertrik/cayenne/CayenneMessageTest.java",
"license": "mit",
"size": 9561
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 393,261 |
private void processSelfRepairCheck(Player player) {
RocketPlayer rp = RocketInit.getPlayer(player);
if (rp.getBootData() == null)
return;
RocketEnhancement.Enhancement enhancement = rp.getBootData().getEnhancement();
if (enhancement != RocketEnhancement.Enhancement.REPAIR)
return;
ItemStack rocketBoots = player.getInventory().getBoots();
if (rocketBoots == null)
return;
RocketFunctions rocketFunctions = new RocketFunctions();
int repairRate = rocketFunctions.getBootRepairRate(rocketBoots.getType());
if (repairRate > 0) {
short currentDurability = rocketBoots.getDurability();
if (currentDurability > 0) {
rocketBoots.setDurability((short) (currentDurability - repairRate));
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 0.35f, 1.75f);
}
}
} | void function(Player player) { RocketPlayer rp = RocketInit.getPlayer(player); if (rp.getBootData() == null) return; RocketEnhancement.Enhancement enhancement = rp.getBootData().getEnhancement(); if (enhancement != RocketEnhancement.Enhancement.REPAIR) return; ItemStack rocketBoots = player.getInventory().getBoots(); if (rocketBoots == null) return; RocketFunctions rocketFunctions = new RocketFunctions(); int repairRate = rocketFunctions.getBootRepairRate(rocketBoots.getType()); if (repairRate > 0) { short currentDurability = rocketBoots.getDurability(); if (currentDurability > 0) { rocketBoots.setDurability((short) (currentDurability - repairRate)); player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_USE, 0.35f, 1.75f); } } } | /**
* Process self repair check for the given player
* @param player Player who is flying
*/ | Process self repair check for the given player | processSelfRepairCheck | {
"repo_name": "RobotoRaccoon/MinecraftPlugins",
"path": "uRocket/src/main/java/com/ullarah/urocket/task/RocketRepair.java",
"license": "gpl-2.0",
"size": 2011
} | [
"com.ullarah.urocket.RocketFunctions",
"com.ullarah.urocket.RocketInit",
"com.ullarah.urocket.data.RocketPlayer",
"com.ullarah.urocket.init.RocketEnhancement",
"org.bukkit.Sound",
"org.bukkit.entity.Player",
"org.bukkit.inventory.ItemStack"
] | import com.ullarah.urocket.RocketFunctions; import com.ullarah.urocket.RocketInit; import com.ullarah.urocket.data.RocketPlayer; import com.ullarah.urocket.init.RocketEnhancement; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; | import com.ullarah.urocket.*; import com.ullarah.urocket.data.*; import com.ullarah.urocket.init.*; import org.bukkit.*; import org.bukkit.entity.*; import org.bukkit.inventory.*; | [
"com.ullarah.urocket",
"org.bukkit",
"org.bukkit.entity",
"org.bukkit.inventory"
] | com.ullarah.urocket; org.bukkit; org.bukkit.entity; org.bukkit.inventory; | 1,377,804 |
public void fail(RecoveryFailedException e, boolean sendShardFailure) {
if (finished.compareAndSet(false, true)) {
try {
notifyListener(e, sendShardFailure);
} finally {
try {
cancellableThreads.cancel("failed recovery [" + ExceptionsHelper.stackTrace(e) + "]");
} finally {
// release the initial reference. recovery files will be cleaned as soon as ref count goes to zero, potentially now
decRef();
}
}
}
} | void function(RecoveryFailedException e, boolean sendShardFailure) { if (finished.compareAndSet(false, true)) { try { notifyListener(e, sendShardFailure); } finally { try { cancellableThreads.cancel(STR + ExceptionsHelper.stackTrace(e) + "]"); } finally { decRef(); } } } } | /**
* fail the recovery and call listener
*
* @param e exception that encapsulating the failure
* @param sendShardFailure indicates whether to notify the master of the shard failure
*/ | fail the recovery and call listener | fail | {
"repo_name": "coding0011/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java",
"license": "apache-2.0",
"size": 22581
} | [
"org.elasticsearch.ExceptionsHelper"
] | import org.elasticsearch.ExceptionsHelper; | import org.elasticsearch.*; | [
"org.elasticsearch"
] | org.elasticsearch; | 1,911,545 |
protected void deleteEmptyPackageFragment(
IPackageFragment fragment,
boolean forceFlag,
IResource rootResource)
throws JavaModelException {
IContainer resource = (IContainer) ((JavaElement)fragment).resource();
try {
resource.delete(
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY,
getSubProgressMonitor(1));
setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
while (resource instanceof IFolder) {
// deleting a package: delete the parent if it is empty (e.g. deleting x.y where folder x doesn't have resources but y)
// without deleting the package fragment root
resource = resource.getParent();
if (!resource.equals(rootResource) && resource.members().length == 0) {
resource.delete(
forceFlag ? IResource.FORCE | IResource.KEEP_HISTORY : IResource.KEEP_HISTORY,
getSubProgressMonitor(1));
setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
}
}
} catch (CoreException e) {
throw new JavaModelException(e);
}
} | void function( IPackageFragment fragment, boolean forceFlag, IResource rootResource) throws JavaModelException { IContainer resource = (IContainer) ((JavaElement)fragment).resource(); try { resource.delete( forceFlag ? IResource.FORCE IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, getSubProgressMonitor(1)); setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); while (resource instanceof IFolder) { resource = resource.getParent(); if (!resource.equals(rootResource) && resource.members().length == 0) { resource.delete( forceFlag ? IResource.FORCE IResource.KEEP_HISTORY : IResource.KEEP_HISTORY, getSubProgressMonitor(1)); setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE); } } } catch (CoreException e) { throw new JavaModelException(e); } } | /**
* Convenience method to delete an empty package fragment
*/ | Convenience method to delete an empty package fragment | deleteEmptyPackageFragment | {
"repo_name": "gazarenkov/che-sketch",
"path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/core/JavaModelOperation.java",
"license": "epl-1.0",
"size": 35774
} | [
"org.eclipse.core.resources.IContainer",
"org.eclipse.core.resources.IFolder",
"org.eclipse.core.resources.IResource",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.jdt.core.IPackageFragment",
"org.eclipse.jdt.core.JavaModelException"
] | import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.JavaModelException; | import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*; | [
"org.eclipse.core",
"org.eclipse.jdt"
] | org.eclipse.core; org.eclipse.jdt; | 1,551,043 |
public int executeUpdate(StatementScope statementScope, Connection conn, String sql, Object[] parameters)
throws SQLException {
ErrorContext errorContext = statementScope.getErrorContext();
errorContext.setActivity("executing update");
errorContext.setObjectId(sql);
PreparedStatement ps = null;
setupResultObjectFactory(statementScope);
int rows = 0;
try {
errorContext.setMoreInfo("Check the SQL Statement (preparation failed).");
ps = prepareStatement(statementScope.getSession(), conn, sql);
setStatementTimeout(statementScope.getStatement(), ps);
errorContext.setMoreInfo("Check the parameters (set parameters failed).");
statementScope.getParameterMap().setParameters(statementScope, ps, parameters);
errorContext.setMoreInfo("Check the statement (update failed).");
ps.execute();
rows = ps.getUpdateCount();
} finally {
closeStatement(statementScope.getSession(), ps);
cleanupResultObjectFactory();
}
return rows;
} | int function(StatementScope statementScope, Connection conn, String sql, Object[] parameters) throws SQLException { ErrorContext errorContext = statementScope.getErrorContext(); errorContext.setActivity(STR); errorContext.setObjectId(sql); PreparedStatement ps = null; setupResultObjectFactory(statementScope); int rows = 0; try { errorContext.setMoreInfo(STR); ps = prepareStatement(statementScope.getSession(), conn, sql); setStatementTimeout(statementScope.getStatement(), ps); errorContext.setMoreInfo(STR); statementScope.getParameterMap().setParameters(statementScope, ps, parameters); errorContext.setMoreInfo(STR); ps.execute(); rows = ps.getUpdateCount(); } finally { closeStatement(statementScope.getSession(), ps); cleanupResultObjectFactory(); } return rows; } | /**
* Execute an update
*
* @param statementScope
* - the request scope
* @param conn
* - the database connection
* @param sql
* - the sql statement to execute
* @param parameters
* - the parameters for the sql statement
* @return - the number of records changed
* @throws SQLException
* - if the update fails
*/ | Execute an update | executeUpdate | {
"repo_name": "hazendaz/mybatis-2",
"path": "src/main/java/com/ibatis/sqlmap/engine/execution/DefaultSqlExecutor.java",
"license": "apache-2.0",
"size": 32810
} | [
"com.ibatis.sqlmap.engine.scope.ErrorContext",
"com.ibatis.sqlmap.engine.scope.StatementScope",
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.SQLException"
] | import com.ibatis.sqlmap.engine.scope.ErrorContext; import com.ibatis.sqlmap.engine.scope.StatementScope; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; | import com.ibatis.sqlmap.engine.scope.*; import java.sql.*; | [
"com.ibatis.sqlmap",
"java.sql"
] | com.ibatis.sqlmap; java.sql; | 2,057,712 |
T visitDefinition(@NotNull dataParser.DefinitionContext ctx); | T visitDefinition(@NotNull dataParser.DefinitionContext ctx); | /**
* Visit a parse tree produced by {@link dataParser#definition}.
* @param ctx the parse tree
* @return the visitor result
*/ | Visit a parse tree produced by <code>dataParser#definition</code> | visitDefinition | {
"repo_name": "smogpill/dataspace",
"path": "src/grammars/data/dataVisitor.java",
"license": "gpl-3.0",
"size": 3004
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,614,748 |
public short getType() {
return XSConstants.MODEL_GROUP;
} | short function() { return XSConstants.MODEL_GROUP; } | /**
* Get the type of the object, i.e ELEMENT_DECLARATION.
*/ | Get the type of the object, i.e ELEMENT_DECLARATION | getType | {
"repo_name": "jimma/xerces",
"path": "src/org/apache/xerces/impl/xs/XSModelGroupImpl.java",
"license": "apache-2.0",
"size": 7920
} | [
"org.apache.xerces.xs.XSConstants"
] | import org.apache.xerces.xs.XSConstants; | import org.apache.xerces.xs.*; | [
"org.apache.xerces"
] | org.apache.xerces; | 1,824,252 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
// Set to expire far in the past. Prevents caching at the proxy server
response.setHeader("Expires", "Fri, 1 Jan 2010 00:00:00 GMT");
// Set Date Header to expire
response.setDateHeader("Expires", 0);
PrintWriter out = response.getWriter();
try {
CISDataServiceQuery _cisDataServiceQuery = new CISDataServiceQuery();
ArrayList<CISTraffic> list = _cisDataServiceQuery.getCameras();
CISTraffic _cisTraffic;
_cisTraffic = (CISTraffic) list.get(constants.CAMERA_AYE2NDLINK);
request.setAttribute("title", "AYE - 2nd Link");
request.setAttribute("clat", _cisTraffic.getCLatitude());
request.setAttribute("clon", _cisTraffic.getCLongitude());
request.setAttribute("imgLink", _cisTraffic.getCImageURL());
request.getRequestDispatcher("googlemap.jsp").forward(request, response);
return;
} finally {
out.checkError();
out.flush();
out.close();
}
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(STR); response.setHeader(STR, STR); response.addHeader(STR, STR); response.setHeader(STR, STR); response.setHeader(STR, STR); response.setDateHeader(STR, 0); PrintWriter out = response.getWriter(); try { CISDataServiceQuery _cisDataServiceQuery = new CISDataServiceQuery(); ArrayList<CISTraffic> list = _cisDataServiceQuery.getCameras(); CISTraffic _cisTraffic; _cisTraffic = (CISTraffic) list.get(constants.CAMERA_AYE2NDLINK); request.setAttribute("title", STR); request.setAttribute("clat", _cisTraffic.getCLatitude()); request.setAttribute("clon", _cisTraffic.getCLongitude()); request.setAttribute(STR, _cisTraffic.getCImageURL()); request.getRequestDispatcher(STR).forward(request, response); return; } finally { out.checkError(); out.flush(); out.close(); } } | /**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/ | Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods | processRequest | {
"repo_name": "kennetham/LTA-Traffic-Demo",
"path": "LTATraffic/src/java/cispackage/AYE2NDLINK.java",
"license": "mit",
"size": 3780
} | [
"java.io.IOException",
"java.io.PrintWriter",
"java.util.ArrayList",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"java.util",
"javax.servlet"
] | java.io; java.util; javax.servlet; | 1,011,049 |
protected void addImageHandler(String imgComponent, String absPath) {
ImageComponent image = (ImageComponent) formBody
.getComponentByName(imgComponent);
ImageIcon icon = new ImageIcon(absPath);
image.setIcon(icon);
} | void function(String imgComponent, String absPath) { ImageComponent image = (ImageComponent) formBody .getComponentByName(imgComponent); ImageIcon icon = new ImageIcon(absPath); image.setIcon(icon); } | /**
* Instead of create an implementation of ImageHandler that only sets a path
* (FixedImageHandler) this utiliy method sets the image without doing
* anything more
*
* @param imgComponent
* . Name of the abeille widget
* @param absPath
* . Absolute path to the image or relative path from andami.jar
*/ | Instead of create an implementation of ImageHandler that only sets a path (FixedImageHandler) this utiliy method sets the image without doing anything more | addImageHandler | {
"repo_name": "iCarto/siga",
"path": "extNavTableForms/src/es/icarto/gvsig/navtableforms/AbstractForm.java",
"license": "gpl-3.0",
"size": 16946
} | [
"com.jeta.forms.components.image.ImageComponent",
"javax.swing.ImageIcon"
] | import com.jeta.forms.components.image.ImageComponent; import javax.swing.ImageIcon; | import com.jeta.forms.components.image.*; import javax.swing.*; | [
"com.jeta.forms",
"javax.swing"
] | com.jeta.forms; javax.swing; | 1,119,344 |
public static Object[] remove(Object[] oldArr, int index) {
Object[] newArr;
if (oldArr == null)
throw new IllegalArgumentException("Cannot remove from null array.");
else if (index > oldArr.length-1 || index < 0) {
// invalid index
throw new IllegalArgumentException("Index to remove from array is invalid (too small/large).");
}
else if (index == 0) {
// chop the head
newArr = (Object[])(Array.newInstance(getArrayClass(oldArr), oldArr.length-1));
System.arraycopy(oldArr, 1, newArr, 0, oldArr.length-1);
}
else if (index == oldArr.length-1) {
// chop the tail
newArr = (Object[])(Array.newInstance(getArrayClass(oldArr), oldArr.length-1));
System.arraycopy(oldArr, 0, newArr, 0, oldArr.length-1);
}
else {
// chop the middle
newArr = (Object[])(Array.newInstance(getArrayClass(oldArr), oldArr.length-1));
System.arraycopy(oldArr, 0, newArr, 0, index);
System.arraycopy(oldArr, index+1, newArr, index,
oldArr.length-index-1);
}
return newArr;
} | static Object[] function(Object[] oldArr, int index) { Object[] newArr; if (oldArr == null) throw new IllegalArgumentException(STR); else if (index > oldArr.length-1 index < 0) { throw new IllegalArgumentException(STR); } else if (index == 0) { newArr = (Object[])(Array.newInstance(getArrayClass(oldArr), oldArr.length-1)); System.arraycopy(oldArr, 1, newArr, 0, oldArr.length-1); } else if (index == oldArr.length-1) { newArr = (Object[])(Array.newInstance(getArrayClass(oldArr), oldArr.length-1)); System.arraycopy(oldArr, 0, newArr, 0, oldArr.length-1); } else { newArr = (Object[])(Array.newInstance(getArrayClass(oldArr), oldArr.length-1)); System.arraycopy(oldArr, 0, newArr, 0, index); System.arraycopy(oldArr, index+1, newArr, index, oldArr.length-index-1); } return newArr; } | /**
* Remove the object at the specified index.
* The new array type is determined by the type of element 0 in the
* original array.
*
* @param oldArr The original array which we are removing from. May not be
* null or zero length.
* @param index The index to remove from <code>oldArr</code>. Exception
* will be thrown if it is out of range.
* @return An array of the same type as the original array (element 0), without the
* given index. Zero length array if the last element is removed.
* @exception IllegalArgumentException Will occur if the given index is out of range,
* or the given array is null.
* @exception NullPointerException May occur if the source array has null
* values, particularly in the first array position.
* @exception ArrayStoreException May occur if all the objects in the
* array do not match.
*/ | Remove the object at the specified index. The new array type is determined by the type of element 0 in the original array | remove | {
"repo_name": "otmarjr/jtreg-fork",
"path": "dist-with-aspectj/jtreg/lib/javatest/com/sun/javatest/util/DynamicArray.java",
"license": "gpl-2.0",
"size": 10711
} | [
"java.lang.reflect.Array"
] | import java.lang.reflect.Array; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,582,211 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.