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 boolean convertCommandToBooleanValue(Command command) { if (command instanceof OnOffType || command instanceof OpenClosedType || command instanceof UpDownType) { boolean newValue; if (command.equals(OnOffType.ON) || command.equals(UpDownType.UP) || command.equals(OpenClosedType.OPEN)) { newValue = true; } else if (command.equals(OnOffType.OFF) || command.equals(UpDownType.DOWN) || command.equals(OpenClosedType.CLOSED)) { newValue = false; } else { throw new NumberFormatException("Command '" + command + "' not supported"); } return newValue; } else { throw new NumberFormatException("Command '" + command + "' not supported for channel"); } }
static boolean function(Command command) { if (command instanceof OnOffType command instanceof OpenClosedType command instanceof UpDownType) { boolean newValue; if (command.equals(OnOffType.ON) command.equals(UpDownType.UP) command.equals(OpenClosedType.OPEN)) { newValue = true; } else if (command.equals(OnOffType.OFF) command.equals(UpDownType.DOWN) command.equals(OpenClosedType.CLOSED)) { newValue = false; } else { throw new NumberFormatException(STR + command + STR); } return newValue; } else { throw new NumberFormatException(STR + command + STR); } }
/** * Convert openHAB command to boolean. * * @param command * @return */
Convert openHAB command to boolean
convertCommandToBooleanValue
{ "repo_name": "theoweiss/openhab2", "path": "bundles/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/service/DataConverters.java", "license": "epl-1.0", "size": 3124 }
[ "org.eclipse.smarthome.core.library.types.OnOffType", "org.eclipse.smarthome.core.library.types.OpenClosedType", "org.eclipse.smarthome.core.library.types.UpDownType", "org.eclipse.smarthome.core.types.Command" ]
import org.eclipse.smarthome.core.library.types.OnOffType; import org.eclipse.smarthome.core.library.types.OpenClosedType; import org.eclipse.smarthome.core.library.types.UpDownType; import org.eclipse.smarthome.core.types.Command;
import org.eclipse.smarthome.core.library.types.*; import org.eclipse.smarthome.core.types.*;
[ "org.eclipse.smarthome" ]
org.eclipse.smarthome;
1,012,993
public void addPrefLabel(Label label) throws ModelException { checkNotNull(label); checkPrefLabelDoesntExistInLanguage(label); addPrefLabelPostCheck(label); }
void function(Label label) throws ModelException { checkNotNull(label); checkPrefLabelDoesntExistInLanguage(label); addPrefLabelPostCheck(label); }
/** * Adds the preferred label - if there is already a preferred label of this language an exception * is thrown. * * @param label * - the preferred label in the requested language. * @throws ModelException * - thrown if there is already a label of this language for the object */
Adds the preferred label - if there is already a preferred label of this language an exception is thrown
addPrefLabel
{ "repo_name": "Smartlogic-Semaphore-Limited/Java-APIs", "path": "Semaphore-Model-Manipulation/src/main/java/com/smartlogic/semaphoremodel/Concept.java", "license": "apache-2.0", "size": 26583 }
[ "org.apache.jena.ext.com.google.common.base.Preconditions" ]
import org.apache.jena.ext.com.google.common.base.Preconditions;
import org.apache.jena.ext.com.google.common.base.*;
[ "org.apache.jena" ]
org.apache.jena;
446,599
public void createEntryWithContainer(String containerPath, String entryObjectClass, String entryIDField, String entryIDValue) throws LDAPException { this.createEntryWithContainer(containerPath, "organizationalUnit", "ou", entryObjectClass, entryIDField, entryIDValue); }
void function(String containerPath, String entryObjectClass, String entryIDField, String entryIDValue) throws LDAPException { this.createEntryWithContainer(containerPath, STR, "ou", entryObjectClass, entryIDField, entryIDValue); }
/** * Creates a new entry at the given destination in the tree. If the * Container path (parent/superior) of the destination DN does not exist, it * will be created. The automatically created entries to create a container * path will be of the ObjectClass "organizationaUnit". * * @param containerPath * Parent DN of the new entry * @param entryObjectClass * ObjectClass of the new entry * @param entryIDField * Identifying field (Example: "cn") * @param entryIDValue * Value of the ID field * @throws LDAPException */
Creates a new entry at the given destination in the tree. If the Container path (parent/superior) of the destination DN does not exist, it will be created. The automatically created entries to create a container path will be of the ObjectClass "organizationaUnit"
createEntryWithContainer
{ "repo_name": "ebner/collaborilla", "path": "src/se/kth/nada/kmr/collaborilla/ldap/LDAPObject.java", "license": "lgpl-2.1", "size": 26630 }
[ "com.novell.ldap.LDAPException" ]
import com.novell.ldap.LDAPException;
import com.novell.ldap.*;
[ "com.novell.ldap" ]
com.novell.ldap;
2,210,184
TransportBindingMeter getTransportBindingMeter() { return transportBindingMeter; }
TransportBindingMeter getTransportBindingMeter() { return transportBindingMeter; }
/** * Returns the metering object for this tcpTransport * * @return the metering object for this tcpTransport */
Returns the metering object for this tcpTransport
getTransportBindingMeter
{ "repo_name": "johnjianfang/jxse", "path": "src/main/java/net/jxta/impl/endpoint/tcp/TcpMessenger.java", "license": "apache-2.0", "size": 43928 }
[ "net.jxta.impl.endpoint.transportMeter.TransportBindingMeter" ]
import net.jxta.impl.endpoint.transportMeter.TransportBindingMeter;
import net.jxta.impl.endpoint.*;
[ "net.jxta.impl" ]
net.jxta.impl;
990,213
@Override public void handleMessage(final Exchange exchange) throws HandlerException { // identify ourselves exchange.getContext().setProperty(ExchangeCompletionEvent.GATEWAY_NAME, _bindingName, Scope.EXCHANGE) .addLabels(BehaviorLabel.TRANSIENT.label()); if (getState() != State.STARTED) { throw HttpMessages.MESSAGES.bindingNotStarted(_referenceName, _bindingName); } HttpClient httpclient = new DefaultHttpClient(); if (_timeout != null) { HttpParams httpParams = httpclient.getParams(); HttpConnectionParams.setConnectionTimeout(httpParams, _timeout); HttpConnectionParams.setSoTimeout(httpParams, _timeout); } try { if (_credentials != null) { ((DefaultHttpClient)httpclient).getCredentialsProvider().setCredentials(_authScope, _credentials); List<String> authpref = new ArrayList<String>(); authpref.add(AuthPolicy.NTLM); authpref.add(AuthPolicy.BASIC); httpclient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authpref); } if (_proxyHost != null) { httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, _proxyHost); } HttpBindingData httpRequest = _messageComposer.decompose(exchange, new HttpRequestBindingData()); HttpRequestBase request = null; if (_httpMethod.equals(HTTP_GET)) { request = new HttpGet(_baseAddress); } else if (_httpMethod.equals(HTTP_POST)) { request = new HttpPost(_baseAddress); ((HttpPost) request).setEntity(new InputStreamEntity(httpRequest.getBodyBytes(), httpRequest.getBodyBytes().available())); } else if (_httpMethod.equals(HTTP_DELETE)) { request = new HttpDelete(_baseAddress); } else if (_httpMethod.equals(HTTP_HEAD)) { request = new HttpHead(_baseAddress); } else if (_httpMethod.equals(HTTP_PUT)) { request = new HttpPut(_baseAddress); ((HttpPut) request).setEntity(new InputStreamEntity(httpRequest.getBodyBytes(), httpRequest.getBodyBytes().available())); } else if (_httpMethod.equals(HTTP_OPTIONS)) { request = new HttpOptions(_baseAddress); } Iterator<Map.Entry<String, List<String>>> entries = httpRequest.getHeaders().entrySet().iterator(); while (entries.hasNext()) { Map.Entry<String, List<String>> entry = entries.next(); String name = entry.getKey(); List<String> values = entry.getValue(); for (String value : values) { request.addHeader(name, value); } } if (_contentType != null) { request.addHeader("Content-Type", _contentType); } HttpResponse response = null; if ((_credentials != null) && (_credentials instanceof NTCredentials)) { // Send a request for the Negotiation response = httpclient.execute(new HttpGet(_baseAddress)); HttpClientUtils.closeQuietly(response); } if (_authCache != null) { BasicHttpContext context = new BasicHttpContext(); context.setAttribute(ClientContext.AUTH_CACHE, _authCache); response = httpclient.execute(request, context); } else { response = httpclient.execute(request); } int status = response.getStatusLine().getStatusCode(); HttpEntity entity = response.getEntity(); HttpResponseBindingData httpResponse = new HttpResponseBindingData(); Header[] headers = response.getAllHeaders(); for (Header header : headers) { httpResponse.addHeader(header.getName(), header.getValue()); } if (entity != null) { if (entity.getContentType() != null) { httpResponse.setContentType(new ContentType(entity.getContentType().getValue())); } else { httpResponse.setContentType(new ContentType()); } httpResponse.setBodyFromStream(entity.getContent()); } httpResponse.setStatus(status); Message out = _messageComposer.compose(httpResponse, exchange); if (httpResponse.getStatus() < 400) { exchange.send(out); } else { exchange.sendFault(out); } } catch (Exception e) { throw HttpMessages.MESSAGES.unexpectedExceptionHandlingHTTPMessage(e); } finally { // When HttpClient instance is no longer needed, // shut down the connection manager to ensure // immediate deallocation of all system resources httpclient.getConnectionManager().shutdown(); } }
void function(final Exchange exchange) throws HandlerException { exchange.getContext().setProperty(ExchangeCompletionEvent.GATEWAY_NAME, _bindingName, Scope.EXCHANGE) .addLabels(BehaviorLabel.TRANSIENT.label()); if (getState() != State.STARTED) { throw HttpMessages.MESSAGES.bindingNotStarted(_referenceName, _bindingName); } HttpClient httpclient = new DefaultHttpClient(); if (_timeout != null) { HttpParams httpParams = httpclient.getParams(); HttpConnectionParams.setConnectionTimeout(httpParams, _timeout); HttpConnectionParams.setSoTimeout(httpParams, _timeout); } try { if (_credentials != null) { ((DefaultHttpClient)httpclient).getCredentialsProvider().setCredentials(_authScope, _credentials); List<String> authpref = new ArrayList<String>(); authpref.add(AuthPolicy.NTLM); authpref.add(AuthPolicy.BASIC); httpclient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, authpref); } if (_proxyHost != null) { httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, _proxyHost); } HttpBindingData httpRequest = _messageComposer.decompose(exchange, new HttpRequestBindingData()); HttpRequestBase request = null; if (_httpMethod.equals(HTTP_GET)) { request = new HttpGet(_baseAddress); } else if (_httpMethod.equals(HTTP_POST)) { request = new HttpPost(_baseAddress); ((HttpPost) request).setEntity(new InputStreamEntity(httpRequest.getBodyBytes(), httpRequest.getBodyBytes().available())); } else if (_httpMethod.equals(HTTP_DELETE)) { request = new HttpDelete(_baseAddress); } else if (_httpMethod.equals(HTTP_HEAD)) { request = new HttpHead(_baseAddress); } else if (_httpMethod.equals(HTTP_PUT)) { request = new HttpPut(_baseAddress); ((HttpPut) request).setEntity(new InputStreamEntity(httpRequest.getBodyBytes(), httpRequest.getBodyBytes().available())); } else if (_httpMethod.equals(HTTP_OPTIONS)) { request = new HttpOptions(_baseAddress); } Iterator<Map.Entry<String, List<String>>> entries = httpRequest.getHeaders().entrySet().iterator(); while (entries.hasNext()) { Map.Entry<String, List<String>> entry = entries.next(); String name = entry.getKey(); List<String> values = entry.getValue(); for (String value : values) { request.addHeader(name, value); } } if (_contentType != null) { request.addHeader(STR, _contentType); } HttpResponse response = null; if ((_credentials != null) && (_credentials instanceof NTCredentials)) { response = httpclient.execute(new HttpGet(_baseAddress)); HttpClientUtils.closeQuietly(response); } if (_authCache != null) { BasicHttpContext context = new BasicHttpContext(); context.setAttribute(ClientContext.AUTH_CACHE, _authCache); response = httpclient.execute(request, context); } else { response = httpclient.execute(request); } int status = response.getStatusLine().getStatusCode(); HttpEntity entity = response.getEntity(); HttpResponseBindingData httpResponse = new HttpResponseBindingData(); Header[] headers = response.getAllHeaders(); for (Header header : headers) { httpResponse.addHeader(header.getName(), header.getValue()); } if (entity != null) { if (entity.getContentType() != null) { httpResponse.setContentType(new ContentType(entity.getContentType().getValue())); } else { httpResponse.setContentType(new ContentType()); } httpResponse.setBodyFromStream(entity.getContent()); } httpResponse.setStatus(status); Message out = _messageComposer.compose(httpResponse, exchange); if (httpResponse.getStatus() < 400) { exchange.send(out); } else { exchange.sendFault(out); } } catch (Exception e) { throw HttpMessages.MESSAGES.unexpectedExceptionHandlingHTTPMessage(e); } finally { httpclient.getConnectionManager().shutdown(); } }
/** * The handler method that invokes the actual HTTP service when the * component is used as a HTTP consumer. * @param exchange the Exchange * @throws HandlerException handler exception */
The handler method that invokes the actual HTTP service when the component is used as a HTTP consumer
handleMessage
{ "repo_name": "igarashitm/switchyard", "path": "components/http/src/main/java/org/switchyard/component/http/OutboundHandler.java", "license": "apache-2.0", "size": 13243 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "java.util.Map", "org.apache.http.Header", "org.apache.http.HttpEntity", "org.apache.http.HttpResponse", "org.apache.http.auth.NTCredentials", "org.apache.http.auth.params.AuthPNames", "org.apache.http.client.HttpClient", "org.apache.http.client.methods.HttpDelete", "org.apache.http.client.methods.HttpGet", "org.apache.http.client.methods.HttpHead", "org.apache.http.client.methods.HttpOptions", "org.apache.http.client.methods.HttpPost", "org.apache.http.client.methods.HttpPut", "org.apache.http.client.methods.HttpRequestBase", "org.apache.http.client.params.AuthPolicy", "org.apache.http.client.protocol.ClientContext", "org.apache.http.client.utils.HttpClientUtils", "org.apache.http.conn.params.ConnRoutePNames", "org.apache.http.entity.InputStreamEntity", "org.apache.http.impl.client.DefaultHttpClient", "org.apache.http.params.HttpConnectionParams", "org.apache.http.params.HttpParams", "org.apache.http.protocol.BasicHttpContext", "org.switchyard.Exchange", "org.switchyard.HandlerException", "org.switchyard.Message", "org.switchyard.Scope", "org.switchyard.component.http.composer.HttpBindingData", "org.switchyard.component.http.composer.HttpRequestBindingData", "org.switchyard.component.http.composer.HttpResponseBindingData", "org.switchyard.label.BehaviorLabel", "org.switchyard.runtime.event.ExchangeCompletionEvent" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.auth.NTCredentials; import org.apache.http.auth.params.AuthPNames; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; import org.apache.http.client.methods.HttpOptions; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.client.params.AuthPolicy; import org.apache.http.client.protocol.ClientContext; import org.apache.http.client.utils.HttpClientUtils; import org.apache.http.conn.params.ConnRoutePNames; import org.apache.http.entity.InputStreamEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import org.apache.http.protocol.BasicHttpContext; import org.switchyard.Exchange; import org.switchyard.HandlerException; import org.switchyard.Message; import org.switchyard.Scope; import org.switchyard.component.http.composer.HttpBindingData; import org.switchyard.component.http.composer.HttpRequestBindingData; import org.switchyard.component.http.composer.HttpResponseBindingData; import org.switchyard.label.BehaviorLabel; import org.switchyard.runtime.event.ExchangeCompletionEvent;
import java.util.*; import org.apache.http.*; import org.apache.http.auth.*; import org.apache.http.auth.params.*; import org.apache.http.client.*; import org.apache.http.client.methods.*; import org.apache.http.client.params.*; import org.apache.http.client.protocol.*; import org.apache.http.client.utils.*; import org.apache.http.conn.params.*; import org.apache.http.entity.*; import org.apache.http.impl.client.*; import org.apache.http.params.*; import org.apache.http.protocol.*; import org.switchyard.*; import org.switchyard.component.http.composer.*; import org.switchyard.label.*; import org.switchyard.runtime.event.*;
[ "java.util", "org.apache.http", "org.switchyard", "org.switchyard.component", "org.switchyard.label", "org.switchyard.runtime" ]
java.util; org.apache.http; org.switchyard; org.switchyard.component; org.switchyard.label; org.switchyard.runtime;
854,859
private int getMaxPrefWidth(Component[] components) { int maxWidth = 0; int componentWidth = 0; Dimension d = null; for (int i=0; i < components.length; i++) { d = components[i].getPreferredSize(); componentWidth = d.width; if (components[i] instanceof JSeparator) { componentWidth = Math.min(d.width, d.height); } maxWidth = Math.max(maxWidth, componentWidth); } return maxWidth; }
int function(Component[] components) { int maxWidth = 0; int componentWidth = 0; Dimension d = null; for (int i=0; i < components.length; i++) { d = components[i].getPreferredSize(); componentWidth = d.width; if (components[i] instanceof JSeparator) { componentWidth = Math.min(d.width, d.height); } maxWidth = Math.max(maxWidth, componentWidth); } return maxWidth; }
/** * Returns the largest preferred width of the provided components. */
Returns the largest preferred width of the provided components
getMaxPrefWidth
{ "repo_name": "djovanovic/JADE_PROJECT", "path": "src/examples/MarketSimulator/StackLayout.java", "license": "lgpl-2.1", "size": 16413 }
[ "java.awt.Component", "java.awt.Dimension", "javax.swing.JSeparator" ]
import java.awt.Component; import java.awt.Dimension; import javax.swing.JSeparator;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
2,261,610
boolean addAll(CompositeCollection<E> composite, List<Collection<E>> collections, Collection<? extends E> coll);
boolean addAll(CompositeCollection<E> composite, List<Collection<E>> collections, Collection<? extends E> coll);
/** * Called when a collection is to be added to the composite. * * @param composite the CompositeCollection being changed * @param collections all of the Collection instances in this CompositeCollection * @param coll the collection being added * @return true if the collection is changed * @throws UnsupportedOperationException if add is unsupported * @throws ClassCastException if the object cannot be added due to its type * @throws NullPointerException if the object cannot be added because its null * @throws IllegalArgumentException if the object cannot be added */
Called when a collection is to be added to the composite
addAll
{ "repo_name": "krivachy/compgs03_mutation_testing", "path": "src/main/java/org/apache/commons/collections4/collection/CompositeCollection.java", "license": "apache-2.0", "size": 17145 }
[ "java.util.Collection", "java.util.List" ]
import java.util.Collection; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
864,833
public static Collection<ICondition> getAllNonParameteriedConditions(IParameterizedQuery paramQuery) { Map<IExpression, Collection<ICondition>> conditionsMap = getAllSelectedConditions(paramQuery); Collection<ICondition> nonParamConditions = new ArrayList<ICondition>(); for (Collection<ICondition> conditions : conditionsMap.values()) { nonParamConditions.addAll(conditions); } nonParamConditions.removeAll(getAllParameterizedConditions(paramQuery)); return nonParamConditions; }
static Collection<ICondition> function(IParameterizedQuery paramQuery) { Map<IExpression, Collection<ICondition>> conditionsMap = getAllSelectedConditions(paramQuery); Collection<ICondition> nonParamConditions = new ArrayList<ICondition>(); for (Collection<ICondition> conditions : conditionsMap.values()) { nonParamConditions.addAll(conditions); } nonParamConditions.removeAll(getAllParameterizedConditions(paramQuery)); return nonParamConditions; }
/** * This method returns the collection of all non-parameterized conditions form a given query. * * @param paramQuery parameterized query * @return collection of non-parameterized conditions */
This method returns the collection of all non-parameterized conditions form a given query
getAllNonParameteriedConditions
{ "repo_name": "NCIP/cab2b", "path": "software/dependencies/query/QUERY_26_NOV_08/src/edu/wustl/common/querysuite/utils/QueryUtility.java", "license": "bsd-3-clause", "size": 9411 }
[ "edu.wustl.common.querysuite.queryobject.ICondition", "edu.wustl.common.querysuite.queryobject.IExpression", "edu.wustl.common.querysuite.queryobject.IParameterizedQuery", "java.util.ArrayList", "java.util.Collection", "java.util.Map" ]
import edu.wustl.common.querysuite.queryobject.ICondition; import edu.wustl.common.querysuite.queryobject.IExpression; import edu.wustl.common.querysuite.queryobject.IParameterizedQuery; import java.util.ArrayList; import java.util.Collection; import java.util.Map;
import edu.wustl.common.querysuite.queryobject.*; import java.util.*;
[ "edu.wustl.common", "java.util" ]
edu.wustl.common; java.util;
1,274,443
private void promptForCreatableProjectSourceRootDirectory(MWProject project) { String description = resourceRepository().getString("PROJECT_SOURCE_ROOT_DIRECTORY_DIALOG_CHOSEN_DIRECTORY_COULD_NOT_BE_CREATED.message", new Object[] {project.absoluteProjectSourceDirectory()}); promptForDirectory(project, description); }
void function(MWProject project) { String description = resourceRepository().getString(STR, new Object[] {project.absoluteProjectSourceDirectory()}); promptForDirectory(project, description); }
/** * used when the chosen directory could not be created (various reasons) */
used when the chosen directory could not be created (various reasons)
promptForCreatableProjectSourceRootDirectory
{ "repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs", "path": "utils/eclipselink.utils.workbench/mappingsplugin/source/org/eclipse/persistence/tools/workbench/mappingsplugin/ProjectSourceGenerationCoordinator.java", "license": "epl-1.0", "size": 13585 }
[ "org.eclipse.persistence.tools.workbench.mappingsmodel.project.MWProject" ]
import org.eclipse.persistence.tools.workbench.mappingsmodel.project.MWProject;
import org.eclipse.persistence.tools.workbench.mappingsmodel.project.*;
[ "org.eclipse.persistence" ]
org.eclipse.persistence;
558,886
protected void validateHasMethod(CamelContext context, Object bean, Class<?> type, String method) { if (method == null) { return; } if (bean == null && type == null) { throw new IllegalArgumentException("Either bean or type should be provided on " + this); } if (bean == null && hasDefaultPublicNoArgConstructor(type)) { bean = context.getInjector().newInstance(type); } // do not try to validate ognl methods if (OgnlHelper.isValidOgnlExpression(method)) { return; } // if invalid OGNL then fail if (OgnlHelper.isInvalidValidOgnlExpression(method)) { ExpressionIllegalSyntaxException cause = new ExpressionIllegalSyntaxException(method); throw RuntimeCamelException.wrapRuntimeCamelException(new MethodNotFoundException(bean != null ? bean : type, method, cause)); } if (bean != null) { BeanInfo info = new BeanInfo(context, bean.getClass()); if (!info.hasMethod(method)) { throw RuntimeCamelException.wrapRuntimeCamelException(new MethodNotFoundException(null, bean, method)); } } else { BeanInfo info = new BeanInfo(context, type); // must be a static method as we do not have a bean instance to invoke if (!info.hasStaticMethod(method)) { throw RuntimeCamelException.wrapRuntimeCamelException(new MethodNotFoundException(null, type, method, true)); } } }
void function(CamelContext context, Object bean, Class<?> type, String method) { if (method == null) { return; } if (bean == null && type == null) { throw new IllegalArgumentException(STR + this); } if (bean == null && hasDefaultPublicNoArgConstructor(type)) { bean = context.getInjector().newInstance(type); } if (OgnlHelper.isValidOgnlExpression(method)) { return; } if (OgnlHelper.isInvalidValidOgnlExpression(method)) { ExpressionIllegalSyntaxException cause = new ExpressionIllegalSyntaxException(method); throw RuntimeCamelException.wrapRuntimeCamelException(new MethodNotFoundException(bean != null ? bean : type, method, cause)); } if (bean != null) { BeanInfo info = new BeanInfo(context, bean.getClass()); if (!info.hasMethod(method)) { throw RuntimeCamelException.wrapRuntimeCamelException(new MethodNotFoundException(null, bean, method)); } } else { BeanInfo info = new BeanInfo(context, type); if (!info.hasStaticMethod(method)) { throw RuntimeCamelException.wrapRuntimeCamelException(new MethodNotFoundException(null, type, method, true)); } } }
/** * Validates the given bean has the method. * <p/> * This implementation will skip trying to validate OGNL method name expressions. * * @param context camel context * @param bean the bean instance * @param type the bean type * @param method the method, can be <tt>null</tt> if no method name provided * @throws org.apache.camel.RuntimeCamelException is thrown if bean does not have the method */
Validates the given bean has the method. This implementation will skip trying to validate OGNL method name expressions
validateHasMethod
{ "repo_name": "objectiser/camel", "path": "components/camel-bean/src/main/java/org/apache/camel/language/bean/BeanExpression.java", "license": "apache-2.0", "size": 19316 }
[ "org.apache.camel.CamelContext", "org.apache.camel.ExpressionIllegalSyntaxException", "org.apache.camel.RuntimeCamelException", "org.apache.camel.component.bean.BeanInfo", "org.apache.camel.component.bean.MethodNotFoundException", "org.apache.camel.util.ObjectHelper", "org.apache.camel.util.OgnlHelper" ]
import org.apache.camel.CamelContext; import org.apache.camel.ExpressionIllegalSyntaxException; import org.apache.camel.RuntimeCamelException; import org.apache.camel.component.bean.BeanInfo; import org.apache.camel.component.bean.MethodNotFoundException; import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.OgnlHelper;
import org.apache.camel.*; import org.apache.camel.component.bean.*; import org.apache.camel.util.*;
[ "org.apache.camel" ]
org.apache.camel;
2,185,610
@SuppressWarnings("unused") protected void setName(@NotNull final java.lang.String name) { immutableSetName(name); }
@SuppressWarnings(STR) void function(@NotNull final java.lang.String name) { immutableSetName(name); }
/** * Sets field's name. * @param name the name of the field. */
Sets field's name
setName
{ "repo_name": "rydnr/java-commons", "path": "src/main/java/org/acmsl/commons/patterns/dao/ValueObjectField.java", "license": "gpl-2.0", "size": 6429 }
[ "org.jetbrains.annotations.NotNull" ]
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
351,045
public boolean switchBalancer(final boolean b, BalanceSwitchMode mode) throws IOException { boolean oldValue = this.loadBalancerTracker.isBalancerOn(); boolean newValue = b; try { if (this.cpHost != null) { newValue = this.cpHost.preBalanceSwitch(newValue); } try { if (mode == BalanceSwitchMode.SYNC) { synchronized (this.balancer) { this.loadBalancerTracker.setBalancerOn(newValue); } } else { this.loadBalancerTracker.setBalancerOn(newValue); } } catch (KeeperException ke) { throw new IOException(ke); } LOG.info(getClientIdAuditPrefix() + " set balanceSwitch=" + newValue); if (this.cpHost != null) { this.cpHost.postBalanceSwitch(oldValue, newValue); } } catch (IOException ioe) { LOG.warn("Error flipping balance switch", ioe); } return oldValue; }
boolean function(final boolean b, BalanceSwitchMode mode) throws IOException { boolean oldValue = this.loadBalancerTracker.isBalancerOn(); boolean newValue = b; try { if (this.cpHost != null) { newValue = this.cpHost.preBalanceSwitch(newValue); } try { if (mode == BalanceSwitchMode.SYNC) { synchronized (this.balancer) { this.loadBalancerTracker.setBalancerOn(newValue); } } else { this.loadBalancerTracker.setBalancerOn(newValue); } } catch (KeeperException ke) { throw new IOException(ke); } LOG.info(getClientIdAuditPrefix() + STR + newValue); if (this.cpHost != null) { this.cpHost.postBalanceSwitch(oldValue, newValue); } } catch (IOException ioe) { LOG.warn(STR, ioe); } return oldValue; }
/** * Assigns balancer switch according to BalanceSwitchMode * @param b new balancer switch * @param mode BalanceSwitchMode * @return old balancer switch */
Assigns balancer switch according to BalanceSwitchMode
switchBalancer
{ "repo_name": "throughsky/lywebank", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java", "license": "apache-2.0", "size": 125853 }
[ "java.io.IOException", "org.apache.zookeeper.KeeperException" ]
import java.io.IOException; import org.apache.zookeeper.KeeperException;
import java.io.*; import org.apache.zookeeper.*;
[ "java.io", "org.apache.zookeeper" ]
java.io; org.apache.zookeeper;
2,894,046
private int getPageScrollTop() { return DOM.getAbsoluteTop(DOM.getParent(RootPanel.getBodyElement())); }
int function() { return DOM.getAbsoluteTop(DOM.getParent(RootPanel.getBodyElement())); }
/** * Get the offset for the vertical scroll * * @return The offset */
Get the offset for the vertical scroll
getPageScrollTop
{ "repo_name": "MiguelSMendoza/Kunagi", "path": "WEB-INF/classes/ilarkesto/gwt/client/TooltipPopup.java", "license": "agpl-3.0", "size": 4095 }
[ "com.google.gwt.user.client.DOM", "com.google.gwt.user.client.ui.RootPanel" ]
import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.*; import com.google.gwt.user.client.ui.*;
[ "com.google.gwt" ]
com.google.gwt;
2,773,690
private void updateS(Point p) { float h = p.x * 1f / imgWidth; float b = (imgHeight - p.y * 1f) / imgHeight; internalChange = true; hSpinner.setValue(new Integer((int) (h * 365))); internalChange = false; bSpinner.setValue(new Integer((int) (b * 100))); revalidate(); }
void function(Point p) { float h = p.x * 1f / imgWidth; float b = (imgHeight - p.y * 1f) / imgHeight; internalChange = true; hSpinner.setValue(new Integer((int) (h * 365))); internalChange = false; bSpinner.setValue(new Integer((int) (b * 100))); revalidate(); }
/** * This method updates the HB values if Saturation is locked. * * @param p The point where the MouseEvent occurred. */
This method updates the HB values if Saturation is locked
updateS
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/swing/colorchooser/DefaultHSBChooserPanel.java", "license": "gpl-2.0", "size": 25362 }
[ "java.awt.Point" ]
import java.awt.Point;
import java.awt.*;
[ "java.awt" ]
java.awt;
791,064
protected void addSrsDimensionPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_AbstractGeometryType_srsDimension_feature"), getString("_UI_PropertyDescriptor_description", "_UI_AbstractGeometryType_srsDimension_feature", "_UI_AbstractGeometryType_type"), GmlPackage.eINSTANCE.getAbstractGeometryType_SrsDimension(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), GmlPackage.eINSTANCE.getAbstractGeometryType_SrsDimension(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Srs Dimension feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Srs Dimension feature.
addSrsDimensionPropertyDescriptor
{ "repo_name": "markus1978/citygml4emf", "path": "de.hub.citygml.emf.ecore.edit/src/net/opengis/gml/provider/AbstractGeometryTypeItemProvider.java", "license": "apache-2.0", "size": 9205 }
[ "net.opengis.gml.GmlPackage", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import net.opengis.gml.GmlPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import net.opengis.gml.*; import org.eclipse.emf.edit.provider.*;
[ "net.opengis.gml", "org.eclipse.emf" ]
net.opengis.gml; org.eclipse.emf;
1,248,229
private void fetchBuildArtifactDiffData(ArtifactoryRestRequest artifactoryRequest, RestResponse artifactoryResponse, String name, String moduleId, String buildNumber, String comparedBuildNum, String comparedDate, String buildStarted, PagingData pagingData) { BuildParams buildParams = new BuildParams(moduleId, buildNumber, comparedBuildNum, comparedDate, buildStarted, name); buildParams.setAllArtifact(true); List<ModuleArtifact> moduleArtifacts = buildService.getModuleArtifactsForDiffWithPaging(buildParams, pagingData.getStartOffset(), pagingData.getLimit()); List<ModuleArtifactModel> moduleArtifactModels = new ArrayList<>(); if (moduleArtifacts != null && !moduleArtifacts.isEmpty()) { moduleArtifacts.forEach(moduleArtifact -> { String downloadLink = moduleArtifact.getRepoKey() == null ? null : ActionUtils.getDownloadLink(artifactoryRequest.getServletRequest(), moduleArtifact.getRepoKey(), moduleArtifact.getPath()); ModuleArtifactModel artifactModel = new ModuleArtifactModel(moduleArtifact, downloadLink); moduleArtifactModels.add(artifactModel); }); PagingModel pagingModel = new PagingModel(0, moduleArtifactModels); artifactoryResponse.iModel(pagingModel); } }
void function(ArtifactoryRestRequest artifactoryRequest, RestResponse artifactoryResponse, String name, String moduleId, String buildNumber, String comparedBuildNum, String comparedDate, String buildStarted, PagingData pagingData) { BuildParams buildParams = new BuildParams(moduleId, buildNumber, comparedBuildNum, comparedDate, buildStarted, name); buildParams.setAllArtifact(true); List<ModuleArtifact> moduleArtifacts = buildService.getModuleArtifactsForDiffWithPaging(buildParams, pagingData.getStartOffset(), pagingData.getLimit()); List<ModuleArtifactModel> moduleArtifactModels = new ArrayList<>(); if (moduleArtifacts != null && !moduleArtifacts.isEmpty()) { moduleArtifacts.forEach(moduleArtifact -> { String downloadLink = moduleArtifact.getRepoKey() == null ? null : ActionUtils.getDownloadLink(artifactoryRequest.getServletRequest(), moduleArtifact.getRepoKey(), moduleArtifact.getPath()); ModuleArtifactModel artifactModel = new ModuleArtifactModel(moduleArtifact, downloadLink); moduleArtifactModels.add(artifactModel); }); PagingModel pagingModel = new PagingModel(0, moduleArtifactModels); artifactoryResponse.iModel(pagingModel); } }
/** * fetch build artifact diff with another build data * * @param artifactoryRequest - encapsulate data related to request * @param artifactoryResponse - encapsulate data require for responsse * @param name - build name * @param buildNumber - current build number * @param comparedBuildNum - compared build number * @param comparedDate - compared build date * @param buildStarted - current build date * @param pagingData - paging data */
fetch build artifact diff with another build data
fetchBuildArtifactDiffData
{ "repo_name": "alancnet/artifactory", "path": "web/rest-ui/src/main/java/org/artifactory/ui/rest/service/builds/buildsinfo/tabs/builddiff/DiffBuildArtifactService.java", "license": "apache-2.0", "size": 3995 }
[ "java.util.ArrayList", "java.util.List", "org.artifactory.api.build.ModuleArtifact", "org.artifactory.api.build.diff.BuildParams", "org.artifactory.rest.common.service.ArtifactoryRestRequest", "org.artifactory.rest.common.service.PagingData", "org.artifactory.rest.common.service.RestResponse", "org.artifactory.ui.rest.model.artifacts.browse.treebrowser.tabs.permission.PagingModel", "org.artifactory.ui.rest.model.builds.ModuleArtifactModel", "org.artifactory.ui.utils.ActionUtils" ]
import java.util.ArrayList; import java.util.List; import org.artifactory.api.build.ModuleArtifact; import org.artifactory.api.build.diff.BuildParams; import org.artifactory.rest.common.service.ArtifactoryRestRequest; import org.artifactory.rest.common.service.PagingData; import org.artifactory.rest.common.service.RestResponse; import org.artifactory.ui.rest.model.artifacts.browse.treebrowser.tabs.permission.PagingModel; import org.artifactory.ui.rest.model.builds.ModuleArtifactModel; import org.artifactory.ui.utils.ActionUtils;
import java.util.*; import org.artifactory.api.build.*; import org.artifactory.api.build.diff.*; import org.artifactory.rest.common.service.*; import org.artifactory.ui.rest.model.artifacts.browse.treebrowser.tabs.permission.*; import org.artifactory.ui.rest.model.builds.*; import org.artifactory.ui.utils.*;
[ "java.util", "org.artifactory.api", "org.artifactory.rest", "org.artifactory.ui" ]
java.util; org.artifactory.api; org.artifactory.rest; org.artifactory.ui;
414,371
public LinkedList<Patch> patch_make(String text1, LinkedList<Diff> diffs) { if (text1 == null || diffs == null) { throw new IllegalArgumentException("Null inputs. (patch_make)"); } LinkedList<Patch> patches = new LinkedList<Patch>(); if (diffs.isEmpty()) { return patches; // Get rid of the null case. } Patch patch = new Patch(); int char_count1 = 0; // Number of characters into the text1 string. int char_count2 = 0; // Number of characters into the text2 string. // Start with text1 (prepatch_text) and apply the diffs until we arrive at // text2 (postpatch_text). We recreate the patches one by one to determine // context info. String prepatch_text = text1; String postpatch_text = text1; for (Diff aDiff : diffs) { if (patch.diffs.isEmpty() && aDiff.operation != Operation.EQUAL) { // A new patch starts here. patch.start1 = char_count1; patch.start2 = char_count2; } switch (aDiff.operation) { case INSERT: patch.diffs.add(aDiff); patch.length2 += aDiff.text.length(); postpatch_text = postpatch_text.substring(0, char_count2) + aDiff.text + postpatch_text.substring(char_count2); break; case DELETE: patch.length1 += aDiff.text.length(); patch.diffs.add(aDiff); postpatch_text = postpatch_text.substring(0, char_count2) + postpatch_text.substring(char_count2 + aDiff.text.length()); break; case EQUAL: if (aDiff.text.length() <= 2 * Patch_Margin && !patch.diffs.isEmpty() && aDiff != diffs.getLast()) { // Small equality inside a patch. patch.diffs.add(aDiff); patch.length1 += aDiff.text.length(); patch.length2 += aDiff.text.length(); } if (aDiff.text.length() >= 2 * Patch_Margin) { // Time for a new patch. if (!patch.diffs.isEmpty()) { patch_addContext(patch, prepatch_text); patches.add(patch); patch = new Patch(); // Unlike Unidiff, our patch lists have a rolling context. // http://code.google.com/p/google-diff-match-patch/wiki/Unidiff // Update prepatch text & pos to reflect the application of the // just completed patch. prepatch_text = postpatch_text; char_count1 = char_count2; } } break; } // Update the current character count. if (aDiff.operation != Operation.INSERT) { char_count1 += aDiff.text.length(); } if (aDiff.operation != Operation.DELETE) { char_count2 += aDiff.text.length(); } } // Pick up the leftover patch if not empty. if (!patch.diffs.isEmpty()) { patch_addContext(patch, prepatch_text); patches.add(patch); } return patches; }
LinkedList<Patch> function(String text1, LinkedList<Diff> diffs) { if (text1 == null diffs == null) { throw new IllegalArgumentException(STR); } LinkedList<Patch> patches = new LinkedList<Patch>(); if (diffs.isEmpty()) { return patches; } Patch patch = new Patch(); int char_count1 = 0; int char_count2 = 0; String prepatch_text = text1; String postpatch_text = text1; for (Diff aDiff : diffs) { if (patch.diffs.isEmpty() && aDiff.operation != Operation.EQUAL) { patch.start1 = char_count1; patch.start2 = char_count2; } switch (aDiff.operation) { case INSERT: patch.diffs.add(aDiff); patch.length2 += aDiff.text.length(); postpatch_text = postpatch_text.substring(0, char_count2) + aDiff.text + postpatch_text.substring(char_count2); break; case DELETE: patch.length1 += aDiff.text.length(); patch.diffs.add(aDiff); postpatch_text = postpatch_text.substring(0, char_count2) + postpatch_text.substring(char_count2 + aDiff.text.length()); break; case EQUAL: if (aDiff.text.length() <= 2 * Patch_Margin && !patch.diffs.isEmpty() && aDiff != diffs.getLast()) { patch.diffs.add(aDiff); patch.length1 += aDiff.text.length(); patch.length2 += aDiff.text.length(); } if (aDiff.text.length() >= 2 * Patch_Margin) { if (!patch.diffs.isEmpty()) { patch_addContext(patch, prepatch_text); patches.add(patch); patch = new Patch(); prepatch_text = postpatch_text; char_count1 = char_count2; } } break; } if (aDiff.operation != Operation.INSERT) { char_count1 += aDiff.text.length(); } if (aDiff.operation != Operation.DELETE) { char_count2 += aDiff.text.length(); } } if (!patch.diffs.isEmpty()) { patch_addContext(patch, prepatch_text); patches.add(patch); } return patches; }
/** * Compute a list of patches to turn text1 into text2. * text2 is not provided, diffs are the delta between text1 and text2. * @param text1 Old text. * @param diffs Array of Diff objects for text1 to text2. * @return LinkedList of Patch objects. */
Compute a list of patches to turn text1 into text2. text2 is not provided, diffs are the delta between text1 and text2
patch_make
{ "repo_name": "nla/flint", "path": "flint-toolwrappers/src/main/java/name/fraser/neil/plaintext/diff_match_patch.java", "license": "apache-2.0", "size": 89050 }
[ "java.util.LinkedList" ]
import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
2,689,387
private NanoHTTPD.Response getDeviceAcceleration() { return NanoHTTPD.newFixedLengthResponse( NanoHTTPD.Response.Status.OK, MIME_PLAINTEXT, (-deviceAccelX) + " " + (-deviceAccelY) + " " + (-deviceAccelZ)); }
NanoHTTPD.Response function() { return NanoHTTPD.newFixedLengthResponse( NanoHTTPD.Response.Status.OK, MIME_PLAINTEXT, (-deviceAccelX) + " " + (-deviceAccelY) + " " + (-deviceAccelZ)); }
/** * Gets the device's acceleration * * @return Each axis' acceleration separated by spaces */
Gets the device's acceleration
getDeviceAcceleration
{ "repo_name": "BirdBrainTechnologies/BirdBlox-Android-Support", "path": "app/src/main/java/com/birdbraintechnologies/birdblox/httpservice/RequestHandlers/HostDeviceHandler.java", "license": "mit", "size": 22483 }
[ "fi.iki.elonen.NanoHTTPD" ]
import fi.iki.elonen.NanoHTTPD;
import fi.iki.elonen.*;
[ "fi.iki.elonen" ]
fi.iki.elonen;
516,023
public static void merge(List<InputStream> inputs, OutputStream output) throws IOException, DocumentException { Document document = new Document(); try { PdfSmartCopy copy = new PdfSmartCopy(document, output); document.open(); for (InputStream is : inputs) { PdfReader reader = new PdfReader(is); for (int i = 1; i <= reader.getNumberOfPages(); i++) { copy.addPage(copy.getImportedPage(reader, i)); } } output.flush(); document.close(); } finally { IOUtils.closeQuietly(output); } }
static void function(List<InputStream> inputs, OutputStream output) throws IOException, DocumentException { Document document = new Document(); try { PdfSmartCopy copy = new PdfSmartCopy(document, output); document.open(); for (InputStream is : inputs) { PdfReader reader = new PdfReader(is); for (int i = 1; i <= reader.getNumberOfPages(); i++) { copy.addPage(copy.getImportedPage(reader, i)); } } output.flush(); document.close(); } finally { IOUtils.closeQuietly(output); } }
/** * Merge several PDFs into a new one */
Merge several PDFs into a new one
merge
{ "repo_name": "codelibs/n2dms", "path": "src/main/java/com/openkm/util/PDFUtils.java", "license": "gpl-2.0", "size": 10737 }
[ "com.lowagie.text.Document", "com.lowagie.text.DocumentException", "com.lowagie.text.pdf.PdfReader", "com.lowagie.text.pdf.PdfSmartCopy", "java.io.IOException", "java.io.InputStream", "java.io.OutputStream", "java.util.List", "org.apache.commons.io.IOUtils" ]
import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.pdf.PdfReader; import com.lowagie.text.pdf.PdfSmartCopy; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.List; import org.apache.commons.io.IOUtils;
import com.lowagie.text.*; import com.lowagie.text.pdf.*; import java.io.*; import java.util.*; import org.apache.commons.io.*;
[ "com.lowagie.text", "java.io", "java.util", "org.apache.commons" ]
com.lowagie.text; java.io; java.util; org.apache.commons;
1,184,022
public RegDataContainer getValue(String key, String value) throws NativeLibException { return (getRegistry().getValue(key, value)); }
RegDataContainer function(String key, String value) throws NativeLibException { return (getRegistry().getValue(key, value)); }
/** * Returns the contents of the key/value pair if value exist, else an exception is raised. * * @param key the registry key which should be used * @param value the registry value from which the contents should be requested * @return requested value if exist, else an exception * @throws NativeLibException */
Returns the contents of the key/value pair if value exist, else an exception is raised
getValue
{ "repo_name": "Murdock01/izpack", "path": "izpack-installer/src/main/java/com/izforge/izpack/util/os/Win_RegistryHandler.java", "license": "apache-2.0", "size": 12697 }
[ "com.coi.tools.os.win.RegDataContainer", "com.izforge.izpack.api.exception.NativeLibException" ]
import com.coi.tools.os.win.RegDataContainer; import com.izforge.izpack.api.exception.NativeLibException;
import com.coi.tools.os.win.*; import com.izforge.izpack.api.exception.*;
[ "com.coi.tools", "com.izforge.izpack" ]
com.coi.tools; com.izforge.izpack;
1,455,674
@Nullable CommitId findCommitId(@NotNull Condition<CommitId> condition);
CommitId findCommitId(@NotNull Condition<CommitId> condition);
/** * Iterates over known commit ids to find the first one which satisfies given condition. * * @return matching commit or null if no commit matches the given condition */
Iterates over known commit ids to find the first one which satisfies given condition
findCommitId
{ "repo_name": "asedunov/intellij-community", "path": "platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogStorage.java", "license": "apache-2.0", "size": 2578 }
[ "com.intellij.openapi.util.Condition", "com.intellij.vcs.log.CommitId", "org.jetbrains.annotations.NotNull" ]
import com.intellij.openapi.util.Condition; import com.intellij.vcs.log.CommitId; import org.jetbrains.annotations.NotNull;
import com.intellij.openapi.util.*; import com.intellij.vcs.log.*; import org.jetbrains.annotations.*;
[ "com.intellij.openapi", "com.intellij.vcs", "org.jetbrains.annotations" ]
com.intellij.openapi; com.intellij.vcs; org.jetbrains.annotations;
2,747,472
@Test public void testAfterUsePreparedStatement() throws Exception { TJDBCInputProperties fixture = new TJDBCInputProperties("input"); fixture.init(); fixture.usePreparedStatement.setValue(true); fixture.afterUsePreparedStatement(); Form advance = fixture.getForm(Form.ADVANCED); Assert.assertFalse(!advance.getWidget(fixture.preparedStatementTable.getName()).isVisible()); }
void function() throws Exception { TJDBCInputProperties fixture = new TJDBCInputProperties("input"); fixture.init(); fixture.usePreparedStatement.setValue(true); fixture.afterUsePreparedStatement(); Form advance = fixture.getForm(Form.ADVANCED); Assert.assertFalse(!advance.getWidget(fixture.preparedStatementTable.getName()).isVisible()); }
/** * Run the void afterUsePreparedStatement() method test. * * @throws Exception * * @generatedBy CodePro at 17-6-20 PM3:13 */
Run the void afterUsePreparedStatement() method test
testAfterUsePreparedStatement
{ "repo_name": "Talend/components", "path": "components/components-jdbc/components-jdbc-definition/src/test/java/org/talend/components/jdbc/tjdbcinput/TJDBCInputPropertiesTest.java", "license": "apache-2.0", "size": 11537 }
[ "org.junit.Assert", "org.talend.daikon.properties.presentation.Form" ]
import org.junit.Assert; import org.talend.daikon.properties.presentation.Form;
import org.junit.*; import org.talend.daikon.properties.presentation.*;
[ "org.junit", "org.talend.daikon" ]
org.junit; org.talend.daikon;
24,275
switch (initializationState) { case INITIALIZING: throw new CyclicBlockSpecDependencyException(blockSpecification); case ERROR: return null; case UNINITIALIZED: initialize(); return blockSpecification; case INITIALIZED: return blockSpecification; default: throw new IllegalStateException("There should be not alternative!"); } }
switch (initializationState) { case INITIALIZING: throw new CyclicBlockSpecDependencyException(blockSpecification); case ERROR: return null; case UNINITIALIZED: initialize(); return blockSpecification; case INITIALIZED: return blockSpecification; default: throw new IllegalStateException(STR); } }
/** * Returns the wrapped block specification and makes sure that it is * initialized before. If the initialization has failed before, * <code>null</code> is returned. */
Returns the wrapped block specification and makes sure that it is initialized before. If the initialization has failed before, <code>null</code> is returned
accessBlockSpecification
{ "repo_name": "vimaier/conqat", "path": "org.conqat.engine.core/src/org/conqat/engine/core/driver/specification/BlockSpecificationInitializer.java", "license": "apache-2.0", "size": 3559 }
[ "org.conqat.engine.core.driver.error.CyclicBlockSpecDependencyException" ]
import org.conqat.engine.core.driver.error.CyclicBlockSpecDependencyException;
import org.conqat.engine.core.driver.error.*;
[ "org.conqat.engine" ]
org.conqat.engine;
1,113,525
public void setPublic() { m_declaration.modifiers().add(m_ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD)); }
void function() { m_declaration.modifiers().add(m_ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD)); }
/** * Set the public access flag. */
Set the public access flag
setPublic
{ "repo_name": "vkorbut/jibx", "path": "jibx/build/src/org/jibx/schema/codegen/BodyBuilderBase.java", "license": "bsd-3-clause", "size": 4860 }
[ "org.eclipse.jdt.core.dom.Modifier" ]
import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.core.dom.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
1,753,783
protected void process(Object bean, String beanName, Class<? extends Annotation> annotation) { if (Objects.isNull(annotation) || PROXIED_SET.contains(beanName)) { return; } ReflectionUtils.doWithFields(bean.getClass(), field -> { Annotation reference = field.getAnnotation(annotation); if (reference == null) { return; } addTccAdvise(bean, beanName, field, field.getType()); }, field -> !Modifier.isStatic(field.getModifiers()) && (field.isAnnotationPresent(annotation))); PROXIED_SET.add(beanName); }
void function(Object bean, String beanName, Class<? extends Annotation> annotation) { if (Objects.isNull(annotation) PROXIED_SET.contains(beanName)) { return; } ReflectionUtils.doWithFields(bean.getClass(), field -> { Annotation reference = field.getAnnotation(annotation); if (reference == null) { return; } addTccAdvise(bean, beanName, field, field.getType()); }, field -> !Modifier.isStatic(field.getModifiers()) && (field.isAnnotationPresent(annotation))); PROXIED_SET.add(beanName); }
/** * Process annotation * * @param bean the bean * @param beanName the bean name * @param annotation the annotation */
Process annotation
process
{ "repo_name": "seata/seata", "path": "spring/src/main/java/io/seata/spring/tcc/TccAnnotationProcessor.java", "license": "apache-2.0", "size": 4717 }
[ "java.lang.annotation.Annotation", "java.lang.reflect.Modifier", "java.util.Objects", "org.springframework.util.ReflectionUtils" ]
import java.lang.annotation.Annotation; import java.lang.reflect.Modifier; import java.util.Objects; import org.springframework.util.ReflectionUtils;
import java.lang.annotation.*; import java.lang.reflect.*; import java.util.*; import org.springframework.util.*;
[ "java.lang", "java.util", "org.springframework.util" ]
java.lang; java.util; org.springframework.util;
584,301
public void afterPropertiesSet() { PropertyCheck.mandatory(this, "policyComponent", policyComponent); PropertyCheck.mandatory(this, "auditComponent", auditComponent); policyComponent.bindClassBehaviour(BeforeDeleteNodePolicy.QNAME, this, new JavaBehaviour(this, "beforeDeleteNode")); }
void function() { PropertyCheck.mandatory(this, STR, policyComponent); PropertyCheck.mandatory(this, STR, auditComponent); policyComponent.bindClassBehaviour(BeforeDeleteNodePolicy.QNAME, this, new JavaBehaviour(this, STR)); }
/** * Checks that all necessary properties have been set and binds with the policy component. */
Checks that all necessary properties have been set and binds with the policy component
afterPropertiesSet
{ "repo_name": "nguyentienlong/community-edition", "path": "projects/repository/source/java/org/alfresco/repo/node/NodeAuditor.java", "license": "lgpl-3.0", "size": 4031 }
[ "org.alfresco.repo.node.NodeServicePolicies", "org.alfresco.repo.policy.JavaBehaviour", "org.alfresco.util.PropertyCheck" ]
import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.util.PropertyCheck;
import org.alfresco.repo.node.*; import org.alfresco.repo.policy.*; import org.alfresco.util.*;
[ "org.alfresco.repo", "org.alfresco.util" ]
org.alfresco.repo; org.alfresco.util;
497,628
public Map<Label, T> getEntries() { return map; }
Map<Label, T> function() { return map; }
/** * Returns the selector's (configurability pattern --gt; matching values) map. * * <p>Entries in this map retain the order of the entries in the map provided to the {@link * #Selector} constructor. */
Returns the selector's (configurability pattern --gt; matching values) map. Entries in this map retain the order of the entries in the map provided to the <code>#Selector</code> constructor
getEntries
{ "repo_name": "juhalindfors/bazel-patches", "path": "src/main/java/com/google/devtools/build/lib/packages/BuildType.java", "license": "apache-2.0", "size": 23915 }
[ "com.google.devtools.build.lib.cmdline.Label", "java.util.Map" ]
import com.google.devtools.build.lib.cmdline.Label; import java.util.Map;
import com.google.devtools.build.lib.cmdline.*; import java.util.*;
[ "com.google.devtools", "java.util" ]
com.google.devtools; java.util;
2,302,211
public void getRegionFromCache(String region) throws Exception { try { Region subr = this.currRegion.getSubregion(region); if (subr == null) { mkrgn(region); currRegion = this.currRegion.getSubregion(region); } else { currRegion = subr; } } catch (Exception e) { // fail (" unable to get sub-region..."); System.out.println("err: " + e); e.printStackTrace(); throw new Exception(" failed in getRegionFromCache "); } }
void function(String region) throws Exception { try { Region subr = this.currRegion.getSubregion(region); if (subr == null) { mkrgn(region); currRegion = this.currRegion.getSubregion(region); } else { currRegion = subr; } } catch (Exception e) { System.out.println(STR + e); e.printStackTrace(); throw new Exception(STR); } }
/** * Checks whether a region passed in the param exists in the curr region or not. If doesnt exist * then calls mkrgn() to create it. Finally makes data member currRegion point to that region. */
Checks whether a region passed in the param exists in the curr region or not. If doesnt exist then calls mkrgn() to create it. Finally makes data member currRegion point to that region
getRegionFromCache
{ "repo_name": "deepakddixit/incubator-geode", "path": "geode-junit/src/main/java/org/apache/geode/internal/jta/JTAUtils.java", "license": "apache-2.0", "size": 10137 }
[ "org.apache.geode.cache.Region" ]
import org.apache.geode.cache.Region;
import org.apache.geode.cache.*;
[ "org.apache.geode" ]
org.apache.geode;
2,857,721
private void setupDevPod(final Map<String, String> envVariables, final Map<String, String> flowParam) { if (flowParam != null && !flowParam.isEmpty() && flowParam .containsKey(FlowParameters.FLOW_PARAM_ENABLE_DEV_POD)) { envVariables.put(ContainerizedDispatchManagerProperties.ENV_ENABLE_DEV_POD, flowParam.get(FlowParameters.FLOW_PARAM_ENABLE_DEV_POD)); } }
void function(final Map<String, String> envVariables, final Map<String, String> flowParam) { if (flowParam != null && !flowParam.isEmpty() && flowParam .containsKey(FlowParameters.FLOW_PARAM_ENABLE_DEV_POD)) { envVariables.put(ContainerizedDispatchManagerProperties.ENV_ENABLE_DEV_POD, flowParam.get(FlowParameters.FLOW_PARAM_ENABLE_DEV_POD)); } }
/** * This method is used to setup environment variable to enable pod as dev pod which can be helpful * for testing. Based on this environment variable, you can decide to start the flow container or * not. * * @param envVariables * @param flowParam */
This method is used to setup environment variable to enable pod as dev pod which can be helpful for testing. Based on this environment variable, you can decide to start the flow container or not
setupDevPod
{ "repo_name": "azkaban/azkaban", "path": "azkaban-common/src/main/java/azkaban/executor/container/KubernetesContainerizedImpl.java", "license": "apache-2.0", "size": 56420 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,776,782
@Test public void testNotConnectedLoad_RepByRef() throws Exception { JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) ); jej.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_REFERENCE ); jej.setJobObjectId( JOB_ENTRY_JOB_OBJECT_ID ); jej.loadXML( getNode( jej ), databases, servers, null, store ); jej.getJobMeta( null, store, space ); assertEquals( ObjectLocationSpecificationMethod.FILENAME, jej.getSpecificationMethod() ); verifyNew( JobMeta.class ).withArguments( space, null, null, store, null ); }
void function() throws Exception { JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) ); jej.setSpecificationMethod( ObjectLocationSpecificationMethod.REPOSITORY_BY_REFERENCE ); jej.setJobObjectId( JOB_ENTRY_JOB_OBJECT_ID ); jej.loadXML( getNode( jej ), databases, servers, null, store ); jej.getJobMeta( null, store, space ); assertEquals( ObjectLocationSpecificationMethod.FILENAME, jej.getSpecificationMethod() ); verifyNew( JobMeta.class ).withArguments( space, null, null, store, null ); }
/** * When disconnected from the repository and {@link JobEntryJob} references a child job by {@link ObjectId}, * this reference will be invalid to run such job. * Default to {@link ObjectLocationSpecificationMethod}.{@code FILENAME} with a {@code null} file path. */
When disconnected from the repository and <code>JobEntryJob</code> references a child job by <code>ObjectId</code>, this reference will be invalid to run such job. Default to <code>ObjectLocationSpecificationMethod</code>.FILENAME with a null file path
testNotConnectedLoad_RepByRef
{ "repo_name": "emartin-pentaho/pentaho-kettle", "path": "engine/src/test/java/org/pentaho/di/job/entries/job/JobEntryJobTest.java", "license": "apache-2.0", "size": 27102 }
[ "org.junit.Assert", "org.mockito.Mockito", "org.pentaho.di.core.ObjectLocationSpecificationMethod", "org.pentaho.di.job.JobMeta", "org.powermock.api.mockito.PowerMockito" ]
import org.junit.Assert; import org.mockito.Mockito; import org.pentaho.di.core.ObjectLocationSpecificationMethod; import org.pentaho.di.job.JobMeta; import org.powermock.api.mockito.PowerMockito;
import org.junit.*; import org.mockito.*; import org.pentaho.di.core.*; import org.pentaho.di.job.*; import org.powermock.api.mockito.*;
[ "org.junit", "org.mockito", "org.pentaho.di", "org.powermock.api" ]
org.junit; org.mockito; org.pentaho.di; org.powermock.api;
2,463,503
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<PrivateCloudInner>> listSinglePageAsync(Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .list( this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<PrivateCloudInner>> function(Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .list( this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
/** * List private clouds in a subscription. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a paged list of private clouds. */
List private clouds in a subscription
listSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/avs/azure-resourcemanager-avs/src/main/java/com/azure/resourcemanager/avs/implementation/PrivateCloudsClientImpl.java", "license": "mit", "size": 106842 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.Context", "com.azure.resourcemanager.avs.fluent.models.PrivateCloudInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.avs.fluent.models.PrivateCloudInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.avs.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,926,055
private void killErrorButtonActionPerformed(ActionEvent evt) { updateReadPointSelector(); AntennaReadPoint selectedReadPoint = (AntennaReadPoint) ((ReadPointItem) (readPointSelector .getSelectedItem())).getReadPoint(); selectedReadPoint.killFailureOccurred(); }
void function(ActionEvent evt) { updateReadPointSelector(); AntennaReadPoint selectedReadPoint = (AntennaReadPoint) ((ReadPointItem) (readPointSelector .getSelectedItem())).getReadPoint(); selectedReadPoint.killFailureOccurred(); }
/** * Called on an action event on the <code>killErrorButton</code>. * * @param evt * The action event */
Called on an action event on the <code>killErrorButton</code>
killErrorButtonActionPerformed
{ "repo_name": "tavlima/fosstrak-reader", "path": "reader-rprm-core/src/main/java/org/fosstrak/reader/rprm/core/mgmt/simulator/MgmtSimulator.java", "license": "lgpl-2.1", "size": 21576 }
[ "java.awt.event.ActionEvent", "org.fosstrak.reader.rprm.core.AntennaReadPoint" ]
import java.awt.event.ActionEvent; import org.fosstrak.reader.rprm.core.AntennaReadPoint;
import java.awt.event.*; import org.fosstrak.reader.rprm.core.*;
[ "java.awt", "org.fosstrak.reader" ]
java.awt; org.fosstrak.reader;
2,700,351
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLLiteralImplDouble instance) throws SerializationException { deserialize(streamReader, instance); }
void function(SerializationStreamReader streamReader, OWLLiteralImplDouble instance) throws SerializationException { deserialize(streamReader, instance); }
/** * Deserializes the content of the object from the * {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. * @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the * object's content from * @param instance the object instance to deserialize * @throws com.google.gwt.user.client.rpc.SerializationException * if the deserialization operation is not * successful */
Deserializes the content of the object from the <code>com.google.gwt.user.client.rpc.SerializationStreamReader</code>
deserializeInstance
{ "repo_name": "matthewhorridge/owlapi-gwt", "path": "owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplDouble_CustomFieldSerializer.java", "license": "lgpl-3.0", "size": 4114 }
[ "com.google.gwt.user.client.rpc.SerializationException", "com.google.gwt.user.client.rpc.SerializationStreamReader" ]
import com.google.gwt.user.client.rpc.SerializationException; import com.google.gwt.user.client.rpc.SerializationStreamReader;
import com.google.gwt.user.client.rpc.*;
[ "com.google.gwt" ]
com.google.gwt;
118,836
public void stopRecord(){ if(recording){ recording = false; //time at current point recordJumpLand(); endTime(); switch(direction){ case 1: endRightMoveRecord(); break; case -1: endLeftMoveRecord(); break; } if(levelScene.mario.running){ endRunningRecord(); } if(levelScene.mario.ducking){ endDuckRecord(); } if(Mario.large && !Mario.fire){ endLargeRecord(); } if(Mario.fire){ endFireRecord(); } if(!Mario.fire && !Mario.large){ endLittleRecord(); } } }
void function(){ if(recording){ recording = false; recordJumpLand(); endTime(); switch(direction){ case 1: endRightMoveRecord(); break; case -1: endLeftMoveRecord(); break; } if(levelScene.mario.running){ endRunningRecord(); } if(levelScene.mario.ducking){ endDuckRecord(); } if(Mario.large && !Mario.fire){ endLargeRecord(); } if(Mario.fire){ endFireRecord(); } if(!Mario.fire && !Mario.large){ endLittleRecord(); } } }
/** * Closes all of the recording, this should commit the data? */
Closes all of the recording, this should commit the data
stopRecord
{ "repo_name": "takeoutweight/evolution-of-fun", "path": "src/java/dk/itu/mario/engine/DataRecorder.java", "license": "mit", "size": 23444 }
[ "dk.itu.mario.engine.sprites.Mario" ]
import dk.itu.mario.engine.sprites.Mario;
import dk.itu.mario.engine.sprites.*;
[ "dk.itu.mario" ]
dk.itu.mario;
817,276
@VisibleForTesting static void configureColumnInfoList(Configuration conf, List<ColumnInfo> columnInfoList) { conf.set(COLUMN_INFO_CONFKEY, Joiner.on("|").useForNull("").join(columnInfoList)); }
static void configureColumnInfoList(Configuration conf, List<ColumnInfo> columnInfoList) { conf.set(COLUMN_INFO_CONFKEY, Joiner.on(" ").useForNull("").join(columnInfoList)); }
/** * Write the list of to-import columns to a job configuration. * * @param conf configuration to be written to * @param columnInfoList list of ColumnInfo objects to be configured for import */
Write the list of to-import columns to a job configuration
configureColumnInfoList
{ "repo_name": "AyolaJayamaha/phoenix", "path": "phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java", "license": "apache-2.0", "size": 16514 }
[ "com.google.common.base.Joiner", "java.util.List", "org.apache.hadoop.conf.Configuration", "org.apache.phoenix.util.ColumnInfo" ]
import com.google.common.base.Joiner; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.phoenix.util.ColumnInfo;
import com.google.common.base.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.phoenix.util.*;
[ "com.google.common", "java.util", "org.apache.hadoop", "org.apache.phoenix" ]
com.google.common; java.util; org.apache.hadoop; org.apache.phoenix;
367,750
public void createGroup(GroupForm groupForm, JsonEntityBean parent, IPerson creator) { if (!canCreateMemberGroup(creator, parent.getId())) { throw new RuntimeAuthorizationException(creator, IPermission.CREATE_GROUP_ACTIVITY, groupForm.getKey()); } if (log.isDebugEnabled()) { log.debug("Creating new group for group form [" + groupForm.toString() + "] and parent [" + parent.toString() + "]"); } // get the entity type of the parent group EntityEnum type = EntityEnum.getEntityEnum(groupForm.getType()); // create a new group with the parent's entity type IEntityGroup group = GroupService.newGroup(type.getClazz()); // find the current version of this group entity group.setCreatorID(creator.getUserName()); group.setName(groupForm.getName()); group.setDescription(groupForm.getDescription()); // add all the group membership information from the group form // to the group for (JsonEntityBean child : groupForm.getMembers()) { EntityEnum childType = EntityEnum.getEntityEnum(child.getEntityTypeAsString()); if (childType.isGroup()) { IEntityGroup member = GroupService.findGroup(child.getId()); group.addMember(member); } else { IGroupMember member = GroupService.getGroupMember(child.getId(), type.getClazz()); group.addMember(member); } } // save the group, updating both its basic information and group membership group.update(); // add this group to the membership list for the specified parent IEntityGroup parentGroup = GroupService.findGroup(parent.getId()); parentGroup.addMember(group); parentGroup.updateMembers(); }
void function(GroupForm groupForm, JsonEntityBean parent, IPerson creator) { if (!canCreateMemberGroup(creator, parent.getId())) { throw new RuntimeAuthorizationException(creator, IPermission.CREATE_GROUP_ACTIVITY, groupForm.getKey()); } if (log.isDebugEnabled()) { log.debug(STR + groupForm.toString() + STR + parent.toString() + "]"); } EntityEnum type = EntityEnum.getEntityEnum(groupForm.getType()); IEntityGroup group = GroupService.newGroup(type.getClazz()); group.setCreatorID(creator.getUserName()); group.setName(groupForm.getName()); group.setDescription(groupForm.getDescription()); for (JsonEntityBean child : groupForm.getMembers()) { EntityEnum childType = EntityEnum.getEntityEnum(child.getEntityTypeAsString()); if (childType.isGroup()) { IEntityGroup member = GroupService.findGroup(child.getId()); group.addMember(member); } else { IGroupMember member = GroupService.getGroupMember(child.getId(), type.getClazz()); group.addMember(member); } } group.update(); IEntityGroup parentGroup = GroupService.findGroup(parent.getId()); parentGroup.addMember(group); parentGroup.updateMembers(); }
/** * Create a new group under the specified parent. The new group will * automatically be added to the parent group. * * @param groupForm form object representing the new group * @param parent parent group for this new group * @param creator the uPortal user creating the new group */
Create a new group under the specified parent. The new group will automatically be added to the parent group
createGroup
{ "repo_name": "ASU-Capstone/uPortal", "path": "uportal-war/src/main/java/org/jasig/portal/portlets/groupadmin/GroupAdministrationHelper.java", "license": "apache-2.0", "size": 10535 }
[ "org.jasig.portal.groups.IEntityGroup", "org.jasig.portal.groups.IGroupMember", "org.jasig.portal.layout.dlm.remoting.JsonEntityBean", "org.jasig.portal.portlets.groupselector.EntityEnum", "org.jasig.portal.security.IPermission", "org.jasig.portal.security.IPerson", "org.jasig.portal.security.RuntimeAuthorizationException", "org.jasig.portal.services.GroupService" ]
import org.jasig.portal.groups.IEntityGroup; import org.jasig.portal.groups.IGroupMember; import org.jasig.portal.layout.dlm.remoting.JsonEntityBean; import org.jasig.portal.portlets.groupselector.EntityEnum; import org.jasig.portal.security.IPermission; import org.jasig.portal.security.IPerson; import org.jasig.portal.security.RuntimeAuthorizationException; import org.jasig.portal.services.GroupService;
import org.jasig.portal.groups.*; import org.jasig.portal.layout.dlm.remoting.*; import org.jasig.portal.portlets.groupselector.*; import org.jasig.portal.security.*; import org.jasig.portal.services.*;
[ "org.jasig.portal" ]
org.jasig.portal;
465,218
public void removeResourceFromUsersPubList(CmsRequestContext context, Collection<CmsUUID> structureIds) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.removeResourceFromUsersPubList(dbc, context.getCurrentUser().getId(), structureIds); } catch (Exception e) { dbc.report( null, Messages.get().container( Messages.ERR_REMOVE_RESOURCE_FROM_PUBLIST_2, context.getCurrentUser().getName(), structureIds), e); } finally { dbc.clear(); } } /** * Removes a user from a group.<p> * * @param context the current request context * @param username the name of the user that is to be removed from the group * @param groupname the name of the group * @param readRoles if to read roles or groups * * @throws CmsException if operation was not successful * @throws CmsRoleViolationException if the current user does not own the rule {@link CmsRole#ACCOUNT_MANAGER}
void function(CmsRequestContext context, Collection<CmsUUID> structureIds) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.removeResourceFromUsersPubList(dbc, context.getCurrentUser().getId(), structureIds); } catch (Exception e) { dbc.report( null, Messages.get().container( Messages.ERR_REMOVE_RESOURCE_FROM_PUBLIST_2, context.getCurrentUser().getName(), structureIds), e); } finally { dbc.clear(); } } /** * Removes a user from a group.<p> * * @param context the current request context * @param username the name of the user that is to be removed from the group * @param groupname the name of the group * @param readRoles if to read roles or groups * * @throws CmsException if operation was not successful * @throws CmsRoleViolationException if the current user does not own the rule {@link CmsRole#ACCOUNT_MANAGER}
/** * Removes the given resource to the given user's publish list.<p> * * @param context the request context * @param structureIds the collection of structure IDs to remove * * @throws CmsException if something goes wrong */
Removes the given resource to the given user's publish list
removeResourceFromUsersPubList
{ "repo_name": "sbonoc/opencms-core", "path": "src/org/opencms/db/CmsSecurityManager.java", "license": "lgpl-2.1", "size": 287876 }
[ "java.util.Collection", "org.opencms.file.CmsRequestContext", "org.opencms.main.CmsException", "org.opencms.security.CmsRole", "org.opencms.security.CmsRoleViolationException", "org.opencms.util.CmsUUID" ]
import java.util.Collection; import org.opencms.file.CmsRequestContext; import org.opencms.main.CmsException; import org.opencms.security.CmsRole; import org.opencms.security.CmsRoleViolationException; import org.opencms.util.CmsUUID;
import java.util.*; import org.opencms.file.*; import org.opencms.main.*; import org.opencms.security.*; import org.opencms.util.*;
[ "java.util", "org.opencms.file", "org.opencms.main", "org.opencms.security", "org.opencms.util" ]
java.util; org.opencms.file; org.opencms.main; org.opencms.security; org.opencms.util;
2,580,150
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) { return false; }
boolean function(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam) { return false; }
/** * Called on both Client and Server when World#addBlockEvent is called */
Called on both Client and Server when World#addBlockEvent is called
onBlockEventReceived
{ "repo_name": "aebert1/BigTransport", "path": "build/tmp/recompileMc/sources/net/minecraft/block/Block.java", "license": "gpl-3.0", "size": 115325 }
[ "net.minecraft.block.state.IBlockState", "net.minecraft.util.math.BlockPos", "net.minecraft.world.World" ]
import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World;
import net.minecraft.block.state.*; import net.minecraft.util.math.*; import net.minecraft.world.*;
[ "net.minecraft.block", "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.block; net.minecraft.util; net.minecraft.world;
1,530,829
public void deleteSite(long siteId) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException;
void function(long siteId) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException;
/** * Deletes the site with the primary key from the database. Also notifies the appropriate model listeners. * * @param siteId the primary key of the site to delete * @throws PortalException if a site with the primary key could not be found * @throws SystemException if a system exception occurred */
Deletes the site with the primary key from the database. Also notifies the appropriate model listeners
deleteSite
{ "repo_name": "RamkumarChandran/My-Courses-Portlet", "path": "docroot/WEB-INF/service/org/gnenc/internet/mycourses/service/SiteLocalService.java", "license": "gpl-3.0", "size": 10129 }
[ "com.liferay.portal.kernel.exception.PortalException", "com.liferay.portal.kernel.exception.SystemException" ]
import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.exception.*;
[ "com.liferay.portal" ]
com.liferay.portal;
210,856
public static void deleteDirectoryContents(File directory) { File[] files = directory.listFiles(); for (int i = 0; i < files.length; i++) { File file = files[i]; if (file.isDirectory()) { deleteDirectory(file); // recurse through subdirectories } else { if ( ! file.delete()) { throw new RuntimeException("unable to delete file: " + file.getAbsolutePath()); } } } } // ********** copying files **********
static void function(File directory) { File[] files = directory.listFiles(); for (int i = 0; i < files.length; i++) { File file = files[i]; if (file.isDirectory()) { deleteDirectory(file); } else { if ( ! file.delete()) { throw new RuntimeException(STR + file.getAbsolutePath()); } } } }
/** * Delete the contents of the specified directory * (but not the directory itself). * <em>USE WITH CARE.</em> * File#deleteFiles() */
Delete the contents of the specified directory (but not the directory itself). USE WITH CARE. File#deleteFiles()
deleteDirectoryContents
{ "repo_name": "RallySoftware/eclipselink.runtime", "path": "utils/eclipselink.utils.workbench/utility/source/org/eclipse/persistence/tools/workbench/utility/io/FileTools.java", "license": "epl-1.0", "size": 35877 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,491,921
public T getData(Form form) throws ParseException { log.warn("trying to read data from form {}, but getData(Form form) is not overwritten by {}", form, this .getClass().getName()); return null; }
T function(Form form) throws ParseException { log.warn(STR, form, this .getClass().getName()); return null; }
/** * This method will be called by the skysail framework to create the actual * resource from its form representation. * * @param form * the representation of the resource as a form * @return the resource of type T * @throws ParseException * parse exception */
This method will be called by the skysail framework to create the actual resource from its form representation
getData
{ "repo_name": "evandor/skysail", "path": "skysail.server/src/io/skysail/server/restlet/resources/EntityServerResource.java", "license": "apache-2.0", "size": 7247 }
[ "java.text.ParseException", "org.restlet.data.Form" ]
import java.text.ParseException; import org.restlet.data.Form;
import java.text.*; import org.restlet.data.*;
[ "java.text", "org.restlet.data" ]
java.text; org.restlet.data;
550,238
public Polynomial multiply(final Polynomial p) { return new Polynomial(NumArrays.conv(_coefs, p._coefs)); }
Polynomial function(final Polynomial p) { return new Polynomial(NumArrays.conv(_coefs, p._coefs)); }
/*** * Multiply two polynomials * * @param p * Another polynomial * @return Pnew(x) = P(x) * poly */
Multiply two polynomials
multiply
{ "repo_name": "mlopz/ETK4J", "path": "src/com/wildbitsfoundry/etk4j/math/polynomials/Polynomial.java", "license": "apache-2.0", "size": 14739 }
[ "com.wildbitsfoundry.etk4j.util.NumArrays" ]
import com.wildbitsfoundry.etk4j.util.NumArrays;
import com.wildbitsfoundry.etk4j.util.*;
[ "com.wildbitsfoundry.etk4j" ]
com.wildbitsfoundry.etk4j;
1,867,130
public Object value(InternalContextAdapter context) { if (interpolate) { try { Writer writer = new StringBuilderWriter(); nodeTree.render(context, writer); return writer.toString(); } catch (RuntimeException e) { throw e; } catch (IOException e) { String msg = "Error in interpolating string literal"; log.error(msg, e); throw new VelocityException(msg, e, rsvc.getLogContext().getStackTrace()); } } return image; }
Object function(InternalContextAdapter context) { if (interpolate) { try { Writer writer = new StringBuilderWriter(); nodeTree.render(context, writer); return writer.toString(); } catch (RuntimeException e) { throw e; } catch (IOException e) { String msg = STR; log.error(msg, e); throw new VelocityException(msg, e, rsvc.getLogContext().getStackTrace()); } } return image; }
/** * renders the value of the string literal If the properties allow, and the * string literal contains a $ or a # the literal is rendered against the * context Otherwise, the stringlit is returned. * * @param context * @return result of the rendering. */
renders the value of the string literal If the properties allow, and the string literal contains a $ or a # the literal is rendered against the context Otherwise, the stringlit is returned
value
{ "repo_name": "apache/velocity-engine", "path": "velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java", "license": "apache-2.0", "size": 11213 }
[ "java.io.IOException", "java.io.Writer", "org.apache.velocity.context.InternalContextAdapter", "org.apache.velocity.exception.VelocityException", "org.apache.velocity.util.StringBuilderWriter" ]
import java.io.IOException; import java.io.Writer; import org.apache.velocity.context.InternalContextAdapter; import org.apache.velocity.exception.VelocityException; import org.apache.velocity.util.StringBuilderWriter;
import java.io.*; import org.apache.velocity.context.*; import org.apache.velocity.exception.*; import org.apache.velocity.util.*;
[ "java.io", "org.apache.velocity" ]
java.io; org.apache.velocity;
343,390
public final boolean isForUpdate() { if (theResults instanceof NoPutResultSet) return ((NoPutResultSet) theResults).isForUpdate(); return false; }
final boolean function() { if (theResults instanceof NoPutResultSet) return ((NoPutResultSet) theResults).isForUpdate(); return false; }
/** * * Is this result set from a select for update statement? */
Is this result set from a select for update statement
isForUpdate
{ "repo_name": "viaper/DBPlus", "path": "DerbyHodgepodge/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java", "license": "apache-2.0", "size": 178663 }
[ "org.apache.derby.iapi.sql.execute.NoPutResultSet" ]
import org.apache.derby.iapi.sql.execute.NoPutResultSet;
import org.apache.derby.iapi.sql.execute.*;
[ "org.apache.derby" ]
org.apache.derby;
348,583
public static PairGraph createZeroEdgePairGraph(int numBindings, boolean sequentialActivityIds) { return new PairGraph(createBindingGroup(numBindings, sequentialActivityIds), alwaysZeroHeuristic); } /** * Creates a {@link BindingGroup} with the given number of {@link Binding}
static PairGraph function(int numBindings, boolean sequentialActivityIds) { return new PairGraph(createBindingGroup(numBindings, sequentialActivityIds), alwaysZeroHeuristic); } /** * Creates a {@link BindingGroup} with the given number of {@link Binding}
/** * Creates a {@link PairGraph} such that no edges are created between * {@link Binding} objects. Observation IDs are numbered incrementally from * 1-n where n is the number of {@link Binding} nodes. * * @param numBindings * Number of {@link Binding} objects to use * @return PairGraph object */
Creates a <code>PairGraph</code> such that no edges are created between <code>Binding</code> objects. Observation IDs are numbered incrementally from 1-n where n is the number of <code>Binding</code> nodes
createZeroEdgePairGraph
{ "repo_name": "plamenbbn/XDATA", "path": "pint/process-alignment/test/com/bbn/c2s2/pint/testdata/PairGraphFactory.java", "license": "apache-2.0", "size": 6371 }
[ "com.bbn.c2s2.pint.Binding", "com.bbn.c2s2.pint.BindingGroup", "com.bbn.c2s2.pint.pf.PairGraph" ]
import com.bbn.c2s2.pint.Binding; import com.bbn.c2s2.pint.BindingGroup; import com.bbn.c2s2.pint.pf.PairGraph;
import com.bbn.c2s2.pint.*; import com.bbn.c2s2.pint.pf.*;
[ "com.bbn.c2s2" ]
com.bbn.c2s2;
1,894,659
public int removeChannels(String sessionKey, List<Number> serverIds, List<String> configChannelLabels) { User loggedInUser = getLoggedInUser(sessionKey); XmlRpcSystemHelper helper = XmlRpcSystemHelper.getInstance(); List<Server> servers = helper.lookupServers(loggedInUser, serverIds); XmlRpcConfigChannelHelper configHelper = XmlRpcConfigChannelHelper.getInstance(); List <ConfigChannel> channels = configHelper. lookupGlobals(loggedInUser, configChannelLabels); ConfigChannelListProcessor proc = new ConfigChannelListProcessor(); boolean success = true; for (Server server : servers) { success = success && proc.remove(server.getConfigChannels(), channels); } if (success) { return 1; } return 0; }
int function(String sessionKey, List<Number> serverIds, List<String> configChannelLabels) { User loggedInUser = getLoggedInUser(sessionKey); XmlRpcSystemHelper helper = XmlRpcSystemHelper.getInstance(); List<Server> servers = helper.lookupServers(loggedInUser, serverIds); XmlRpcConfigChannelHelper configHelper = XmlRpcConfigChannelHelper.getInstance(); List <ConfigChannel> channels = configHelper. lookupGlobals(loggedInUser, configChannelLabels); ConfigChannelListProcessor proc = new ConfigChannelListProcessor(); boolean success = true; for (Server server : servers) { success = success && proc.remove(server.getConfigChannels(), channels); } if (success) { return 1; } return 0; }
/** * removes selected channels from list of config channels provided * for a given list of servers. * @param sessionKey the sessionkey needed for authentication * @param serverIds the list of server ids. * @param configChannelLabels sets channels labels * @return 1 on success 0 on failure * * @xmlrpc.doc Remove config channels from the given servers. * @xmlrpc.param #session_key() * @xmlrpc.param #array_single("int", "the IDs of the systems from which you * would like to remove configuration channels..") * @xmlrpc.param #array_single("string", * "List of configuration channel labels to remove.") * @xmlrpc.returntype #return_int_success() */
removes selected channels from list of config channels provided for a given list of servers
removeChannels
{ "repo_name": "dmacvicar/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/system/config/ServerConfigHandler.java", "license": "gpl-2.0", "size": 26415 }
[ "com.redhat.rhn.domain.config.ConfigChannel", "com.redhat.rhn.domain.config.ConfigChannelListProcessor", "com.redhat.rhn.domain.server.Server", "com.redhat.rhn.domain.user.User", "com.redhat.rhn.frontend.xmlrpc.configchannel.XmlRpcConfigChannelHelper", "com.redhat.rhn.frontend.xmlrpc.system.XmlRpcSystemHelper", "java.util.List" ]
import com.redhat.rhn.domain.config.ConfigChannel; import com.redhat.rhn.domain.config.ConfigChannelListProcessor; import com.redhat.rhn.domain.server.Server; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.xmlrpc.configchannel.XmlRpcConfigChannelHelper; import com.redhat.rhn.frontend.xmlrpc.system.XmlRpcSystemHelper; import java.util.List;
import com.redhat.rhn.domain.config.*; import com.redhat.rhn.domain.server.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.xmlrpc.configchannel.*; import com.redhat.rhn.frontend.xmlrpc.system.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
827,980
@Override // NameNodeMXBean public String getVersion() { return VersionInfo.getVersion() + ", r" + VersionInfo.getRevision(); }
@Override String function() { return VersionInfo.getVersion() + STR + VersionInfo.getRevision(); }
/** * Class representing Namenode information for JMX interfaces */
Class representing Namenode information for JMX interfaces
getVersion
{ "repo_name": "songweijia/fffs", "path": "sources/hadoop-2.4.1-src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java", "license": "apache-2.0", "size": 292274 }
[ "org.apache.hadoop.util.VersionInfo" ]
import org.apache.hadoop.util.VersionInfo;
import org.apache.hadoop.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,724,497
public SizeValue getAsSize(String setting, SizeValue defaultValue) throws SettingsException { return parseSizeValue(get(setting), defaultValue); }
SizeValue function(String setting, SizeValue defaultValue) throws SettingsException { return parseSizeValue(get(setting), defaultValue); }
/** * Returns the setting value (as size) associated with the setting key. If it does not exists, * returns the default value provided. */
Returns the setting value (as size) associated with the setting key. If it does not exists, returns the default value provided
getAsSize
{ "repo_name": "fred84/elasticsearch", "path": "server/src/main/java/org/elasticsearch/common/settings/Settings.java", "license": "apache-2.0", "size": 58320 }
[ "org.elasticsearch.common.unit.SizeValue" ]
import org.elasticsearch.common.unit.SizeValue;
import org.elasticsearch.common.unit.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
1,011,999
public TiglPoint wingGetChordNormal(final int wingIndex, final int segmentIndex, final double eta, final double xsi) throws TiglException { TiglPoint point = new TiglPoint(); checkTiglConfiguration(); DoubleByReference pointX = new DoubleByReference(); DoubleByReference pointY = new DoubleByReference(); DoubleByReference pointZ = new DoubleByReference(); // get lower Point from TIGL errorCode = TiglNativeInterface.tiglWingGetChordNormal(cpacsHandle, wingIndex, segmentIndex, eta, xsi, pointX, pointY, pointZ); throwIfError("tiglWingGetChordNormal", errorCode); point.setX(pointX.getValue()); point.setY(pointY.getValue()); point.setZ(pointZ.getValue()); return point; }
TiglPoint function(final int wingIndex, final int segmentIndex, final double eta, final double xsi) throws TiglException { TiglPoint point = new TiglPoint(); checkTiglConfiguration(); DoubleByReference pointX = new DoubleByReference(); DoubleByReference pointY = new DoubleByReference(); DoubleByReference pointZ = new DoubleByReference(); errorCode = TiglNativeInterface.tiglWingGetChordNormal(cpacsHandle, wingIndex, segmentIndex, eta, xsi, pointX, pointY, pointZ); throwIfError(STR, errorCode); point.setX(pointX.getValue()); point.setY(pointY.getValue()); point.setZ(pointZ.getValue()); return point; }
/** * Returns the normal direction of the wing chord surface for a given eta, xsi coordinate * * @param wingIndex - The index number of the wing. * @param segmentIndex- the segment index where the relative coordinates belong to. * @param eta - the eta coordinate, going from 0 - 1 * @param xsi - the xsi coordinate, going from 0 - 1 * @return - a Point object with x, y, z. * @throws TiglException */
Returns the normal direction of the wing chord surface for a given eta, xsi coordinate
wingGetChordNormal
{ "repo_name": "DLR-SC/tigl", "path": "bindings/java/src/de/dlr/sc/tigl3/CpacsConfiguration.java", "license": "apache-2.0", "size": 96943 }
[ "com.sun.jna.ptr.DoubleByReference" ]
import com.sun.jna.ptr.DoubleByReference;
import com.sun.jna.ptr.*;
[ "com.sun.jna" ]
com.sun.jna;
1,715,833
public void endElement(String namespaceURI, String localName, String name) throws org.xml.sax.SAXException { if (m_inEntityRef) return; // namespaces declared at the current depth are no longer valid // so get rid of them m_prefixMap.popNamespaces(m_elemContext.m_currentElemDepth, null); try { final java.io.Writer writer = m_writer; if (m_elemContext.m_startTagOpen) { if (m_tracer != null) super.fireStartElem(m_elemContext.m_elementName); int nAttrs = m_attributes.getLength(); if (nAttrs > 0) { processAttributes(m_writer, nAttrs); // clear attributes object for re-use with next element m_attributes.clear(); } if (m_spaceBeforeClose) writer.write(" />"); else writer.write("/>"); } else { if (m_cdataTagOpen) closeCDATA(); if (shouldIndent()) indent(m_elemContext.m_currentElemDepth - 1); writer.write('<'); writer.write('/'); writer.write(name); writer.write('>'); } } catch (IOException e) { throw new SAXException(e); } if (!m_elemContext.m_startTagOpen && m_doIndent) { m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop(); } m_isprevtext = false; // fire off the end element event if (m_tracer != null) super.fireEndElem(name); m_elemContext = m_elemContext.m_prev; }
void function(String namespaceURI, String localName, String name) throws org.xml.sax.SAXException { if (m_inEntityRef) return; m_prefixMap.popNamespaces(m_elemContext.m_currentElemDepth, null); try { final java.io.Writer writer = m_writer; if (m_elemContext.m_startTagOpen) { if (m_tracer != null) super.fireStartElem(m_elemContext.m_elementName); int nAttrs = m_attributes.getLength(); if (nAttrs > 0) { processAttributes(m_writer, nAttrs); m_attributes.clear(); } if (m_spaceBeforeClose) writer.write(STR); else writer.write("/>"); } else { if (m_cdataTagOpen) closeCDATA(); if (shouldIndent()) indent(m_elemContext.m_currentElemDepth - 1); writer.write('<'); writer.write('/'); writer.write(name); writer.write('>'); } } catch (IOException e) { throw new SAXException(e); } if (!m_elemContext.m_startTagOpen && m_doIndent) { m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop(); } m_isprevtext = false; if (m_tracer != null) super.fireEndElem(name); m_elemContext = m_elemContext.m_prev; }
/** * Receive notification of the end of an element. * * * @param namespaceURI The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param localName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param name The element type name * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * * @throws org.xml.sax.SAXException */
Receive notification of the end of an element
endElement
{ "repo_name": "karianna/jdk8_tl", "path": "jaxp/src/com/sun/org/apache/xml/internal/serializer/ToStream.java", "license": "gpl-2.0", "size": 110211 }
[ "java.io.IOException", "java.io.Writer", "org.xml.sax.SAXException" ]
import java.io.IOException; import java.io.Writer; import org.xml.sax.SAXException;
import java.io.*; import org.xml.sax.*;
[ "java.io", "org.xml.sax" ]
java.io; org.xml.sax;
2,719,831
private TextInput getSingleInput (final String paramId, final int maxLength, boolean notEmpty, IWContext iwc) { TextInput textInput = (TextInput) getStyledInterface (new TextInput(paramId)); textInput.setMaxlength(maxLength); if (notEmpty) { final String fieldCanNotBeEmpty = localize (ERROR_FIELD_CAN_NOT_BE_EMPTY_KEY, ERROR_FIELD_CAN_NOT_BE_EMPTY_DEFAULT); final String name = localize(paramId, paramId); textInput.setAsNotEmpty(fieldCanNotBeEmpty + ": " + name); } String param = iwc.getParameter(paramId); if (param != null) { textInput.setContent(param); } return textInput; }
TextInput function (final String paramId, final int maxLength, boolean notEmpty, IWContext iwc) { TextInput textInput = (TextInput) getStyledInterface (new TextInput(paramId)); textInput.setMaxlength(maxLength); if (notEmpty) { final String fieldCanNotBeEmpty = localize (ERROR_FIELD_CAN_NOT_BE_EMPTY_KEY, ERROR_FIELD_CAN_NOT_BE_EMPTY_DEFAULT); final String name = localize(paramId, paramId); textInput.setAsNotEmpty(fieldCanNotBeEmpty + STR + name); } String param = iwc.getParameter(paramId); if (param != null) { textInput.setContent(param); } return textInput; }
/** * Gets input field for the social security number. * @param iwc * @param paramID * @param maxLength * @param notEmpty * @return the input field */
Gets input field for the social security number
getSingleInput
{ "repo_name": "idega/platform2", "path": "src/se/idega/idegaweb/commune/account/citizen/presentation/CitizenAccountForgottenPassword.java", "license": "gpl-3.0", "size": 17732 }
[ "com.idega.presentation.IWContext", "com.idega.presentation.ui.TextInput" ]
import com.idega.presentation.IWContext; import com.idega.presentation.ui.TextInput;
import com.idega.presentation.*; import com.idega.presentation.ui.*;
[ "com.idega.presentation" ]
com.idega.presentation;
926,674
@Override public void clearSlotStorage() throws AndesException { try { wrappedAndesContextStoreInstance.clearSlotStorage(); } catch (AndesStoreUnavailableException exception) { notifyFailures(exception); throw exception; } } /** * {@inheritDoc}
void function() throws AndesException { try { wrappedAndesContextStoreInstance.clearSlotStorage(); } catch (AndesStoreUnavailableException exception) { notifyFailures(exception); throw exception; } } /** * {@inheritDoc}
/** * Clear and reset slot storage * * @throws AndesException */
Clear and reset slot storage
clearSlotStorage
{ "repo_name": "pumudu88/andes", "path": "modules/andes-core/broker/src/main/java/org/wso2/andes/store/FailureObservingAndesContextStore.java", "license": "apache-2.0", "size": 35769 }
[ "org.wso2.andes.kernel.AndesException" ]
import org.wso2.andes.kernel.AndesException;
import org.wso2.andes.kernel.*;
[ "org.wso2.andes" ]
org.wso2.andes;
824,550
private Object getColumnValue(ResultSetMetaData metaData, Class<?>[] expectedColumnTypes, ResultSet result, int i, Calendar cal) throws SQLException, IOException { Object o = null; Class<?> expectedColumnType = expectedColumnTypes[i - 1]; try { if (expectedColumnType.equals(String.class)) { switch (metaData.getColumnType(i)) { case Types.NCLOB: o = nclobToString(result.getNClob(i)); break; case Types.CLOB: o = clobToString(result.getClob(i)); break; case Types.LONGNVARCHAR: case Types.LONGVARCHAR: o = streamToString(result.getCharacterStream(i)); break; case Types.NVARCHAR: case Types.NCHAR: o = result.getNString(i); if (null != o && ((String) o).length() < 1) { o = null; } break; case Types.CHAR: case Types.VARCHAR: default: // log.debug(" varchar-length="+metaData.getColumnDisplaySize(i)); o = result.getString(i); if (null != o && ((String) o).length() < 1) { o = null; } break; } } else if (expectedColumnType.equals(Integer.class)) { int value = result.getInt(i); if (!result.wasNull()) { o = Integer.valueOf(value); } } else if (expectedColumnType.equals(Long.class)) { long value = result.getLong(i); if (!result.wasNull()) { o = Long.valueOf(value); } } else if (expectedColumnType.equals(Double.class)) { double value = result.getDouble(i); if (!result.wasNull()) { o = new Double(value); } } else if (expectedColumnType.equals(Timestamp.class)) { if (cal != null) { o = result.getTimestamp(i, cal); } else { o = result.getTimestamp(i); } } else if (expectedColumnType.equals(byte[].class)) { byte[] bArr = result.getBytes(i); if (!result.wasNull()) { o = bArr; } } else if (expectedColumnType.equals(BigDecimal.class)) { o = result.getBigDecimal(i); } else { o = result.getObject(i); logger.warn("#### unexpected Datatype sqltype=" + metaData.getColumnType(i) + " class=" + o.getClass().getName()); } } catch (SQLException e) { logger.error("getColumnValue error=" + e + " expectedColumnType=" + expectedColumnType + " colIdx=" + i, e); throw e; } return o; }
Object function(ResultSetMetaData metaData, Class<?>[] expectedColumnTypes, ResultSet result, int i, Calendar cal) throws SQLException, IOException { Object o = null; Class<?> expectedColumnType = expectedColumnTypes[i - 1]; try { if (expectedColumnType.equals(String.class)) { switch (metaData.getColumnType(i)) { case Types.NCLOB: o = nclobToString(result.getNClob(i)); break; case Types.CLOB: o = clobToString(result.getClob(i)); break; case Types.LONGNVARCHAR: case Types.LONGVARCHAR: o = streamToString(result.getCharacterStream(i)); break; case Types.NVARCHAR: case Types.NCHAR: o = result.getNString(i); if (null != o && ((String) o).length() < 1) { o = null; } break; case Types.CHAR: case Types.VARCHAR: default: o = result.getString(i); if (null != o && ((String) o).length() < 1) { o = null; } break; } } else if (expectedColumnType.equals(Integer.class)) { int value = result.getInt(i); if (!result.wasNull()) { o = Integer.valueOf(value); } } else if (expectedColumnType.equals(Long.class)) { long value = result.getLong(i); if (!result.wasNull()) { o = Long.valueOf(value); } } else if (expectedColumnType.equals(Double.class)) { double value = result.getDouble(i); if (!result.wasNull()) { o = new Double(value); } } else if (expectedColumnType.equals(Timestamp.class)) { if (cal != null) { o = result.getTimestamp(i, cal); } else { o = result.getTimestamp(i); } } else if (expectedColumnType.equals(byte[].class)) { byte[] bArr = result.getBytes(i); if (!result.wasNull()) { o = bArr; } } else if (expectedColumnType.equals(BigDecimal.class)) { o = result.getBigDecimal(i); } else { o = result.getObject(i); logger.warn(STR + metaData.getColumnType(i) + STR + o.getClass().getName()); } } catch (SQLException e) { logger.error(STR + e + STR + expectedColumnType + STR + i, e); throw e; } return o; }
/** * Helper function to get the value of a column as an object. We know which * types we want to get. * * @param metaData * The select meta data * @param expectedColumnTypes * An array of classes for the column types expected. * @param result * the result set * @param i * the column index * @param cal * The calendar used for timestamp culumns * @return the value * @throws SQLException * if an SQl error occurs * @throws IOException * if an error occurs when reading from a clob. */
Helper function to get the value of a column as an object. We know which types we want to get
getColumnValue
{ "repo_name": "elminsterjimmy/java", "path": "EasyDaoFramework/src/main/java/com/elminster/easydao/db/query/Query.java", "license": "apache-2.0", "size": 51492 }
[ "java.io.IOException", "java.math.BigDecimal", "java.sql.ResultSet", "java.sql.ResultSetMetaData", "java.sql.SQLException", "java.sql.Timestamp", "java.sql.Types", "java.util.Calendar" ]
import java.io.IOException; import java.math.BigDecimal; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Timestamp; import java.sql.Types; import java.util.Calendar;
import java.io.*; import java.math.*; import java.sql.*; import java.util.*;
[ "java.io", "java.math", "java.sql", "java.util" ]
java.io; java.math; java.sql; java.util;
2,050,530
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true) public int getCountriesCount();
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true) int function();
/** * Returns the number of countries. * * @return the number of countries */
Returns the number of countries
getCountriesCount
{ "repo_name": "gamerson/liferay-blade-samples", "path": "maven/apps/service-builder/dsp/dsp-api/src/main/java/com/liferay/blade/samples/dspservicebuilder/service/CountryLocalService.java", "license": "apache-2.0", "size": 10333 }
[ "com.liferay.portal.kernel.transaction.Propagation", "com.liferay.portal.kernel.transaction.Transactional" ]
import com.liferay.portal.kernel.transaction.Propagation; import com.liferay.portal.kernel.transaction.Transactional;
import com.liferay.portal.kernel.transaction.*;
[ "com.liferay.portal" ]
com.liferay.portal;
1,660,268
public IITWindow getItem(int lastParam) { return new IITWindow(Dispatch.call(this, "Item", new Variant(lastParam)).toDispatch()); }
IITWindow function(int lastParam) { return new IITWindow(Dispatch.call(this, "Item", new Variant(lastParam)).toDispatch()); }
/** * Wrapper for calling the ActiveX-Method with input-parameter(s). * * @param lastParam an input-parameter of type int * @return the result is of type IITWindow */
Wrapper for calling the ActiveX-Method with input-parameter(s)
getItem
{ "repo_name": "cpesch/MetaMusic", "path": "itunes-com-library/src/main/java/slash/metamusic/itunes/com/binding/IITWindowCollection.java", "license": "gpl-2.0", "size": 2104 }
[ "com.jacob.com.Dispatch", "com.jacob.com.Variant" ]
import com.jacob.com.Dispatch; import com.jacob.com.Variant;
import com.jacob.com.*;
[ "com.jacob.com" ]
com.jacob.com;
603,504
public Color getColor() { return color; }
Color function() { return color; }
/** * Retorna el color de fondo del MuComponente * * @return Color de fondo del MuComponente */
Retorna el color de fondo del MuComponente
getColor
{ "repo_name": "Mujuanp/Mu", "path": "src/MU/IGU/contenedores/MuComponente.java", "license": "gpl-3.0", "size": 1664 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,456,535
public static IEditorPart openModuleEditor(IFile diagramFile) { if (diagramFile == null) { return null; } IWorkbenchPage workbenchPage = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(); IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry() .getDefaultEditor(diagramFile.getName()); if (desc != null) { try { return workbenchPage.openEditor( new FileEditorInput(diagramFile), desc.getId()); } catch (Exception e) { e.printStackTrace(); return null; } } else { return null; } }
static IEditorPart function(IFile diagramFile) { if (diagramFile == null) { return null; } IWorkbenchPage workbenchPage = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage(); IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry() .getDefaultEditor(diagramFile.getName()); if (desc != null) { try { return workbenchPage.openEditor( new FileEditorInput(diagramFile), desc.getId()); } catch (Exception e) { e.printStackTrace(); return null; } } else { return null; } }
/** * Opens the module diagram. * * @param diagramFile the diagram file. * @return the opened module editor. */
Opens the module diagram
openModuleEditor
{ "repo_name": "kuriking/testdc2", "path": "net.dependableos.dcase.diagram/src/net/dependableos/dcase/diagram/part/PatternUtil.java", "license": "epl-1.0", "size": 34627 }
[ "org.eclipse.core.resources.IFile", "org.eclipse.ui.IEditorDescriptor", "org.eclipse.ui.IEditorPart", "org.eclipse.ui.IWorkbenchPage", "org.eclipse.ui.PlatformUI", "org.eclipse.ui.part.FileEditorInput" ]
import org.eclipse.core.resources.IFile; import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.core.resources.*; import org.eclipse.ui.*; import org.eclipse.ui.part.*;
[ "org.eclipse.core", "org.eclipse.ui" ]
org.eclipse.core; org.eclipse.ui;
1,141,080
@Override public Table clone() { int i, j; SubTable tab = new SubTable(); tab.m = m; tab.n = n; tab.t = new int [m][v.length]; tab.v = new int [v.length]; tab.s = new int [s.length]; for (i = 0; i < m; i++) { for (j = 0; j < v.length; j++) { tab.t[i][j] = t[i][j]; } } for (i = 0; i < v.length; i++) { tab.v[i] = v[i]; } for (i = 0; i < s.length; i++) { tab.s[i] = s[i]; } tab.pos = new HashMap<Integer, Integer>(); tab.pos.putAll(pos); return tab; }
@Override Table function() { int i, j; SubTable tab = new SubTable(); tab.m = m; tab.n = n; tab.t = new int [m][v.length]; tab.v = new int [v.length]; tab.s = new int [s.length]; for (i = 0; i < m; i++) { for (j = 0; j < v.length; j++) { tab.t[i][j] = t[i][j]; } } for (i = 0; i < v.length; i++) { tab.v[i] = v[i]; } for (i = 0; i < s.length; i++) { tab.s[i] = s[i]; } tab.pos = new HashMap<Integer, Integer>(); tab.pos.putAll(pos); return tab; }
/** * Clones whole table - that is returns new object Table, containing separated copy of the table array, the attributes description array, and the attributes subset array. * @return Clone of the object. */
Clones whole table - that is returns new object Table, containing separated copy of the table array, the attributes description array, and the attributes subset array
clone
{ "repo_name": "mateka/dmexl", "path": "bn/src/main/java/pl/edu/mimuw/bn/SubTable.java", "license": "bsd-3-clause", "size": 10078 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,986,227
@Nullable public <T> T removeMeta(int key);
@Nullable <T> T function(int key);
/** * Removes metadata by key. * * @param key Key of the metadata to remove. * @param <T> Type of the value. * @return Value of removed metadata or {@code null}. */
Removes metadata by key
removeMeta
{ "repo_name": "ryanzz/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java", "license": "apache-2.0", "size": 20204 }
[ "org.jetbrains.annotations.Nullable" ]
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
445,110
Observable<ServiceResponse<byte[]>> getBase64UrlEncodedWithServiceResponseAsync();
Observable<ServiceResponse<byte[]>> getBase64UrlEncodedWithServiceResponseAsync();
/** * Get value that is base64url encoded. * * @return the observable to the byte[] object */
Get value that is base64url encoded
getBase64UrlEncodedWithServiceResponseAsync
{ "repo_name": "anudeepsharma/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodystring/Strings.java", "license": "mit", "size": 17112 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
475,569
public Frame decorrelateRel(Values rel) { // There are no inputs, so rel does not need to be changed. return null; }
Frame function(Values rel) { return null; }
/** * Rewrites a {@link Values}. * * @param rel Values to be rewritten */
Rewrites a <code>Values</code>
decorrelateRel
{ "repo_name": "apache/flink", "path": "flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/rules/logical/SubQueryDecorrelator.java", "license": "apache-2.0", "size": 64938 }
[ "org.apache.calcite.rel.core.Values" ]
import org.apache.calcite.rel.core.Values;
import org.apache.calcite.rel.core.*;
[ "org.apache.calcite" ]
org.apache.calcite;
2,025,385
@Test public void wrappedXhtmlWithSingleElem() throws DocumentException, XmlParseException { logInfo("Source TEXT:\n%1$s", wrappedXhtmlSingleElem); ByteArrayInputStream bais = new ByteArrayInputStream(wrappedXhtmlSingleElem.getBytes()); Element legacyElem = parseXMLusingDom4j(bais, Element.XMLElement.mFactory); bais.reset(); Element elem = Element.parseXML(bais); logNewAndLegacyElements(elem, legacyElem); Assert.assertEquals("top node name", "xml", elem.getName()); Assert.assertEquals("Number of sub elements", 3, elem.listElements().size()); Assert.assertEquals("Number of 'fun' sub elements", 1, elem.listElements("fun").size()); Assert.assertEquals("Number of 'wrapper' sub elements", 1, elem.listElements("wrapper").size()); Assert.assertEquals("Number of 'work' sub elements", 1, elem.listElements("work").size()); Element wrapperElem = elem.listElements("wrapper").get(0); Assert.assertEquals("Number of sub elements for wrapper", 1, wrapperElem.listElements().size()); // top level element of xhtml is an Element Element htmlElem = wrapperElem.listElements("html").get(0); // Zero sub-elements - i.e. all children flattened into the text Assert.assertEquals("Number of sub elements for html", 0, htmlElem.listElements().size()); }
void function() throws DocumentException, XmlParseException { logInfo(STR, wrappedXhtmlSingleElem); ByteArrayInputStream bais = new ByteArrayInputStream(wrappedXhtmlSingleElem.getBytes()); Element legacyElem = parseXMLusingDom4j(bais, Element.XMLElement.mFactory); bais.reset(); Element elem = Element.parseXML(bais); logNewAndLegacyElements(elem, legacyElem); Assert.assertEquals(STR, "xml", elem.getName()); Assert.assertEquals(STR, 3, elem.listElements().size()); Assert.assertEquals(STR, 1, elem.listElements("fun").size()); Assert.assertEquals(STR, 1, elem.listElements(STR).size()); Assert.assertEquals(STR, 1, elem.listElements("work").size()); Element wrapperElem = elem.listElements(STR).get(0); Assert.assertEquals(STR, 1, wrapperElem.listElements().size()); Element htmlElem = wrapperElem.listElements("html").get(0); Assert.assertEquals(STR, 0, htmlElem.listElements().size()); }
/** * input text contains xhtml which only has one sub-element - i.e. it isn't mixed text */
input text contains xhtml which only has one sub-element - i.e. it isn't mixed text
wrappedXhtmlWithSingleElem
{ "repo_name": "nico01f/z-pec", "path": "ZimbraCommon/src/java-test/com/zimbra/common/soap/ElementTest.java", "license": "mit", "size": 23419 }
[ "com.zimbra.common.soap.Element", "java.io.ByteArrayInputStream", "org.dom4j.DocumentException", "org.junit.Assert" ]
import com.zimbra.common.soap.Element; import java.io.ByteArrayInputStream; import org.dom4j.DocumentException; import org.junit.Assert;
import com.zimbra.common.soap.*; import java.io.*; import org.dom4j.*; import org.junit.*;
[ "com.zimbra.common", "java.io", "org.dom4j", "org.junit" ]
com.zimbra.common; java.io; org.dom4j; org.junit;
1,431,423
private void initConnection() throws IOException { users = new CopyOnWriteArrayList<>(); socket = new Socket(); connected = false; socket.connect(new InetSocketAddress(host, port)); reader = new Scanner(socket.getInputStream()); writer = new PrintWriter(socket.getOutputStream(), true); writer.println("LOGIN#" + username); String temp = reader.nextLine(); String[] temp2 = temp.split("#"); if (temp2.length > 0 && temp2[0].equalsIgnoreCase("OK")) { if (temp2.length > 1) users.addAll(Arrays.asList(temp2).subList(1, temp2.length)); connected = true; receiver(); } else { System.out.println("LOGIN FAILED!"); // Login seems to have failed! } }
void function() throws IOException { users = new CopyOnWriteArrayList<>(); socket = new Socket(); connected = false; socket.connect(new InetSocketAddress(host, port)); reader = new Scanner(socket.getInputStream()); writer = new PrintWriter(socket.getOutputStream(), true); writer.println(STR + username); String temp = reader.nextLine(); String[] temp2 = temp.split("#"); if (temp2.length > 0 && temp2[0].equalsIgnoreCase("OK")) { if (temp2.length > 1) users.addAll(Arrays.asList(temp2).subList(1, temp2.length)); connected = true; receiver(); } else { System.out.println(STR); } }
/** * Sets up the initial connection and begins receiving messages immediately */
Sets up the initial connection and begins receiving messages immediately
initConnection
{ "repo_name": "NikiSkaarup/CA1ClientLib", "path": "src/main/java/io/skaarup/Client.java", "license": "mit", "size": 5474 }
[ "java.io.IOException", "java.io.PrintWriter", "java.net.InetSocketAddress", "java.net.Socket", "java.util.Arrays", "java.util.Scanner", "java.util.concurrent.CopyOnWriteArrayList" ]
import java.io.IOException; import java.io.PrintWriter; import java.net.InetSocketAddress; import java.net.Socket; import java.util.Arrays; import java.util.Scanner; import java.util.concurrent.CopyOnWriteArrayList;
import java.io.*; import java.net.*; import java.util.*; import java.util.concurrent.*;
[ "java.io", "java.net", "java.util" ]
java.io; java.net; java.util;
899,973
private void writeShortTagPayload(final ShortTag tag) throws IOException { os.writeShort(tag.getValue()); }
void function(final ShortTag tag) throws IOException { os.writeShort(tag.getValue()); }
/** * Writes a <code>TAG_Short</code> tag. * * @param tag * The tag. * @throws IOException * if an I/O error occurs. */
Writes a <code>TAG_Short</code> tag
writeShortTagPayload
{ "repo_name": "CodingBadgers/Perks", "path": "bTransported/src/uk/jnbt/NBTOutputStream.java", "license": "gpl-2.0", "size": 9126 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
742,388
public static KeyPair generateKeyPair(String algorithm, int keySize) throws KeyczarException { try { KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithm); kpg.initialize(keySize); KeyPair pair = kpg.generateKeyPair(); return pair; } catch (GeneralSecurityException e) { throw new KeyczarException(e); } }
static KeyPair function(String algorithm, int keySize) throws KeyczarException { try { KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithm); kpg.initialize(keySize); KeyPair pair = kpg.generateKeyPair(); return pair; } catch (GeneralSecurityException e) { throw new KeyczarException(e); } }
/** * Generate a public/private key pair with the specified algorithm and key size. */
Generate a public/private key pair with the specified algorithm and key size
generateKeyPair
{ "repo_name": "frewsxcv/keyczar", "path": "java/code/src/org/keyczar/util/Util.java", "license": "apache-2.0", "size": 14671 }
[ "java.security.GeneralSecurityException", "java.security.KeyPair", "java.security.KeyPairGenerator", "org.keyczar.exceptions.KeyczarException" ]
import java.security.GeneralSecurityException; import java.security.KeyPair; import java.security.KeyPairGenerator; import org.keyczar.exceptions.KeyczarException;
import java.security.*; import org.keyczar.exceptions.*;
[ "java.security", "org.keyczar.exceptions" ]
java.security; org.keyczar.exceptions;
1,153,723
private void addStaticField(ClassGenerator classGen, String type, String name) { final FieldGen fgen = new FieldGen(ACC_PROTECTED|ACC_STATIC, Util.getJCRefType(type), name, classGen.getConstantPool()); classGen.addField(fgen.getField()); }
void function(ClassGenerator classGen, String type, String name) { final FieldGen fgen = new FieldGen(ACC_PROTECTED ACC_STATIC, Util.getJCRefType(type), name, classGen.getConstantPool()); classGen.addField(fgen.getField()); }
/** * Add a static field */
Add a static field
addStaticField
{ "repo_name": "srnsw/xena", "path": "xena/ext/src/xalan-j_2_7_1/src/org/apache/xalan/xsltc/compiler/Stylesheet.java", "license": "gpl-3.0", "size": 53829 }
[ "org.apache.bcel.generic.FieldGen", "org.apache.xalan.xsltc.compiler.util.ClassGenerator", "org.apache.xalan.xsltc.compiler.util.Util" ]
import org.apache.bcel.generic.FieldGen; import org.apache.xalan.xsltc.compiler.util.ClassGenerator; import org.apache.xalan.xsltc.compiler.util.Util;
import org.apache.bcel.generic.*; import org.apache.xalan.xsltc.compiler.util.*;
[ "org.apache.bcel", "org.apache.xalan" ]
org.apache.bcel; org.apache.xalan;
1,368,847
Attributes getAttributes();
Attributes getAttributes();
/** * Attributes describing stream. This is inherited from the transport attributes, and used * as the basis of {@link io.grpc.ServerCall#getAttributes}. * * @return Attributes container */
Attributes describing stream. This is inherited from the transport attributes, and used as the basis of <code>io.grpc.ServerCall#getAttributes</code>
getAttributes
{ "repo_name": "elandau/grpc-java", "path": "core/src/main/java/io/grpc/internal/ServerStream.java", "license": "apache-2.0", "size": 2919 }
[ "io.grpc.Attributes" ]
import io.grpc.Attributes;
import io.grpc.*;
[ "io.grpc" ]
io.grpc;
880,014
CompilationSupport registerCompileAndArchiveActions(ObjcCommon common) throws RuleErrorException, InterruptedException { return registerCompileAndArchiveActions( common, ExtraCompileArgs.NONE, ImmutableList.<PathFragment>of()); }
CompilationSupport registerCompileAndArchiveActions(ObjcCommon common) throws RuleErrorException, InterruptedException { return registerCompileAndArchiveActions( common, ExtraCompileArgs.NONE, ImmutableList.<PathFragment>of()); }
/** * Registers all actions necessary to compile this rule's sources and archive them. * * @param common common information about this rule and its dependencies * @return this compilation support * @throws RuleErrorException for invalid crosstool files */
Registers all actions necessary to compile this rule's sources and archive them
registerCompileAndArchiveActions
{ "repo_name": "hermione521/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java", "license": "apache-2.0", "size": 47018 }
[ "com.google.common.collect.ImmutableList", "com.google.devtools.build.lib.packages.RuleClass", "com.google.devtools.build.lib.vfs.PathFragment" ]
import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.packages.RuleClass; import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.common.collect.*; import com.google.devtools.build.lib.packages.*; import com.google.devtools.build.lib.vfs.*;
[ "com.google.common", "com.google.devtools" ]
com.google.common; com.google.devtools;
226,056
public CellFactorySPI getSelectedCellFactory() { return selectedCellFactory; } private class CellListRenderer extends JLabel implements ListCellRenderer { /** * {@inheritDoc}
CellFactorySPI function() { return selectedCellFactory; } private class CellListRenderer extends JLabel implements ListCellRenderer { /** * {@inheritDoc}
/** * Returns the selected Cell Factory SPI. * * @return A CellFactorySPI */
Returns the selected Cell Factory SPI
getSelectedCellFactory
{ "repo_name": "AsherBond/MondocosmOS", "path": "wonderland/modules/world/cell-selection/src/classes/org/jdesktop/wonderland/modules/cellselection/client/CellSelectionJDialog.java", "license": "agpl-3.0", "size": 9912 }
[ "javax.swing.JLabel", "javax.swing.ListCellRenderer", "org.jdesktop.wonderland.client.cell.registry.spi.CellFactorySPI" ]
import javax.swing.JLabel; import javax.swing.ListCellRenderer; import org.jdesktop.wonderland.client.cell.registry.spi.CellFactorySPI;
import javax.swing.*; import org.jdesktop.wonderland.client.cell.registry.spi.*;
[ "javax.swing", "org.jdesktop.wonderland" ]
javax.swing; org.jdesktop.wonderland;
777,853
public static Writer getWriter(OutputStream os, Charset charset) throws IOException { if(charset==null) charset=SystemUtil.getCharset(); return new BufferedWriter(new OutputStreamWriter(os,charset)); }
static Writer function(OutputStream os, Charset charset) throws IOException { if(charset==null) charset=SystemUtil.getCharset(); return new BufferedWriter(new OutputStreamWriter(os,charset)); }
/** * returns a Reader for the given InputStream * @param is * @param charset * @return Reader * @throws IOException */
returns a Reader for the given InputStream
getWriter
{ "repo_name": "JordanReiter/railo", "path": "railo-java/railo-core/src/railo/commons/io/IOUtil.java", "license": "lgpl-2.1", "size": 29860 }
[ "java.io.BufferedWriter", "java.io.IOException", "java.io.OutputStream", "java.io.OutputStreamWriter", "java.io.Writer", "java.nio.charset.Charset" ]
import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.nio.charset.Charset;
import java.io.*; import java.nio.charset.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
1,886,608
return RDataFactory.createEvaluatedPromise(state, constantExpression, constantValue); }
return RDataFactory.createEvaluatedPromise(state, constantExpression, constantValue); }
/** * Creates a new {@link RPromise} every time. */
Creates a new <code>RPromise</code> every time
execute
{ "repo_name": "akunft/fastr", "path": "com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/opt/OptConstantPromiseNode.java", "license": "gpl-2.0", "size": 2455 }
[ "com.oracle.truffle.r.runtime.data.RDataFactory" ]
import com.oracle.truffle.r.runtime.data.RDataFactory;
import com.oracle.truffle.r.runtime.data.*;
[ "com.oracle.truffle" ]
com.oracle.truffle;
2,790,454
public AccumuloVertexHandler getVertexHandler() { return vertexHandler; }
AccumuloVertexHandler function() { return vertexHandler; }
/** * Get vertex handler * * @return vertex handler */
Get vertex handler
getVertexHandler
{ "repo_name": "niklasteichmann/gradoop", "path": "gradoop-store/gradoop-accumulo/src/main/java/org/gradoop/storage/config/GradoopAccumuloConfig.java", "license": "apache-2.0", "size": 6187 }
[ "org.gradoop.storage.impl.accumulo.handler.AccumuloVertexHandler" ]
import org.gradoop.storage.impl.accumulo.handler.AccumuloVertexHandler;
import org.gradoop.storage.impl.accumulo.handler.*;
[ "org.gradoop.storage" ]
org.gradoop.storage;
942,779
public SkyframeAnalysisResult analyzeAndExecuteTargets( ExtendedEventHandler eventHandler, List<ConfiguredTargetKey> ctKeys, ImmutableList<TopLevelAspectsKey> topLevelAspectsKey, TopLevelArtifactContext topLevelArtifactContextForConflictPruning, boolean keepGoing, int numThreads, int cpuHeavySkyKeysThreadPoolSize, int mergedPhasesExecutionJobsCount) throws InterruptedException { enableAnalysis(true); EvaluationResult<BuildDriverValue> result; List<BuildDriverKey> buildDriverCTKeys = ctKeys.stream() .map(k -> new BuildDriverKey(k, topLevelArtifactContextForConflictPruning)) .collect(Collectors.toList()); List<BuildDriverKey> buildDriverAspectKeys = topLevelAspectsKey.stream() .map(k -> new BuildDriverKey(k, topLevelArtifactContextForConflictPruning)) .collect(Collectors.toList()); try (SilentCloseable c = Profiler.instance().profile("skyframeExecutor.configureTargets")) { result = skyframeExecutor.evaluateBuildDriverKeys( eventHandler, buildDriverCTKeys, buildDriverAspectKeys, keepGoing, numThreads, cpuHeavySkyKeysThreadPoolSize, mergedPhasesExecutionJobsCount); } finally { enableAnalysis(false); } Map<AspectKey, ConfiguredAspect> aspects = Maps.newHashMapWithExpectedSize(topLevelAspectsKey.size()); for (BuildDriverKey bdAspectKey : buildDriverAspectKeys) { BuildDriverValue value = result.get(bdAspectKey); if (value == null) { // Skip aspects that couldn't be applied to targets. continue; } TopLevelAspectsValue topLevelAspectsValue = (TopLevelAspectsValue) value.getWrappedSkyValue(); for (SkyValue val : topLevelAspectsValue.getTopLevelAspectsValues()) { AspectValue aspectValue = (AspectValue) val; aspects.put(aspectValue.getKey(), aspectValue.getConfiguredAspect()); } } Collection<ConfiguredTarget> cts = Lists.newArrayListWithCapacity(ctKeys.size()); for (BuildDriverKey bdCTKey : buildDriverCTKeys) { BuildDriverValue value = result.get(bdCTKey); if (value == null) { continue; } ConfiguredTargetValue ctValue = (ConfiguredTargetValue) value.getWrappedSkyValue(); cts.add(ctValue.getConfiguredTarget()); } return new SkyframeAnalysisResult( false, false, foundActionConflict, ImmutableList.copyOf(cts), result.getWalkableGraph(), ImmutableMap.copyOf(aspects), null); }
SkyframeAnalysisResult function( ExtendedEventHandler eventHandler, List<ConfiguredTargetKey> ctKeys, ImmutableList<TopLevelAspectsKey> topLevelAspectsKey, TopLevelArtifactContext topLevelArtifactContextForConflictPruning, boolean keepGoing, int numThreads, int cpuHeavySkyKeysThreadPoolSize, int mergedPhasesExecutionJobsCount) throws InterruptedException { enableAnalysis(true); EvaluationResult<BuildDriverValue> result; List<BuildDriverKey> buildDriverCTKeys = ctKeys.stream() .map(k -> new BuildDriverKey(k, topLevelArtifactContextForConflictPruning)) .collect(Collectors.toList()); List<BuildDriverKey> buildDriverAspectKeys = topLevelAspectsKey.stream() .map(k -> new BuildDriverKey(k, topLevelArtifactContextForConflictPruning)) .collect(Collectors.toList()); try (SilentCloseable c = Profiler.instance().profile(STR)) { result = skyframeExecutor.evaluateBuildDriverKeys( eventHandler, buildDriverCTKeys, buildDriverAspectKeys, keepGoing, numThreads, cpuHeavySkyKeysThreadPoolSize, mergedPhasesExecutionJobsCount); } finally { enableAnalysis(false); } Map<AspectKey, ConfiguredAspect> aspects = Maps.newHashMapWithExpectedSize(topLevelAspectsKey.size()); for (BuildDriverKey bdAspectKey : buildDriverAspectKeys) { BuildDriverValue value = result.get(bdAspectKey); if (value == null) { continue; } TopLevelAspectsValue topLevelAspectsValue = (TopLevelAspectsValue) value.getWrappedSkyValue(); for (SkyValue val : topLevelAspectsValue.getTopLevelAspectsValues()) { AspectValue aspectValue = (AspectValue) val; aspects.put(aspectValue.getKey(), aspectValue.getConfiguredAspect()); } } Collection<ConfiguredTarget> cts = Lists.newArrayListWithCapacity(ctKeys.size()); for (BuildDriverKey bdCTKey : buildDriverCTKeys) { BuildDriverValue value = result.get(bdCTKey); if (value == null) { continue; } ConfiguredTargetValue ctValue = (ConfiguredTargetValue) value.getWrappedSkyValue(); cts.add(ctValue.getConfiguredTarget()); } return new SkyframeAnalysisResult( false, false, foundActionConflict, ImmutableList.copyOf(cts), result.getWalkableGraph(), ImmutableMap.copyOf(aspects), null); }
/** * Performs analysis & execution of the CTs and aspects with Skyframe. * * @return the configured targets that should be built along with a WalkableGraph of the analysis. * TODO(b/199053098) Have a more appropriate return type. */
Performs analysis & execution of the CTs and aspects with Skyframe
analyzeAndExecuteTargets
{ "repo_name": "perezd/bazel", "path": "src/main/java/com/google/devtools/build/lib/skyframe/SkyframeBuildView.java", "license": "apache-2.0", "size": 56411 }
[ "com.google.common.collect.ImmutableList", "com.google.common.collect.ImmutableMap", "com.google.common.collect.Lists", "com.google.common.collect.Maps", "com.google.devtools.build.lib.analysis.AspectValue", "com.google.devtools.build.lib.analysis.ConfiguredAspect", "com.google.devtools.build.lib.analysis.ConfiguredTarget", "com.google.devtools.build.lib.analysis.ConfiguredTargetValue", "com.google.devtools.build.lib.analysis.TopLevelArtifactContext", "com.google.devtools.build.lib.events.ExtendedEventHandler", "com.google.devtools.build.lib.profiler.Profiler", "com.google.devtools.build.lib.profiler.SilentCloseable", "com.google.devtools.build.lib.skyframe.AspectKeyCreator", "com.google.devtools.build.lib.skyframe.ToplevelStarlarkAspectFunction", "com.google.devtools.build.skyframe.EvaluationResult", "com.google.devtools.build.skyframe.SkyValue", "java.util.Collection", "java.util.List", "java.util.Map", "java.util.stream.Collectors" ]
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.devtools.build.lib.analysis.AspectValue; import com.google.devtools.build.lib.analysis.ConfiguredAspect; import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.analysis.ConfiguredTargetValue; import com.google.devtools.build.lib.analysis.TopLevelArtifactContext; import com.google.devtools.build.lib.events.ExtendedEventHandler; import com.google.devtools.build.lib.profiler.Profiler; import com.google.devtools.build.lib.profiler.SilentCloseable; import com.google.devtools.build.lib.skyframe.AspectKeyCreator; import com.google.devtools.build.lib.skyframe.ToplevelStarlarkAspectFunction; import com.google.devtools.build.skyframe.EvaluationResult; import com.google.devtools.build.skyframe.SkyValue; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.stream.Collectors;
import com.google.common.collect.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.events.*; import com.google.devtools.build.lib.profiler.*; import com.google.devtools.build.lib.skyframe.*; import com.google.devtools.build.skyframe.*; import java.util.*; import java.util.stream.*;
[ "com.google.common", "com.google.devtools", "java.util" ]
com.google.common; com.google.devtools; java.util;
1,068,606
@Test (timeout=60000) public void testListCacheDirectives() throws Exception { final int poolCount = 7; HashSet<String> poolNames = new HashSet<String>(poolCount); Path path = new Path("/p"); for (int i=0; i<poolCount; i++) { String poolName = "testListCacheDirectives-" + i; CacheDirectiveInfo directiveInfo = new CacheDirectiveInfo.Builder().setPool(poolName).setPath(path).build(); dfs.addCachePool(new CachePoolInfo(poolName)); dfs.addCacheDirective(directiveInfo, EnumSet.of(CacheFlag.FORCE)); poolNames.add(poolName); } listCacheDirectives(poolNames, 0); cluster.transitionToStandby(0); cluster.transitionToActive(1); cluster.waitActive(1); listCacheDirectives(poolNames, 1); }
@Test (timeout=60000) void function() throws Exception { final int poolCount = 7; HashSet<String> poolNames = new HashSet<String>(poolCount); Path path = new Path("/p"); for (int i=0; i<poolCount; i++) { String poolName = STR + i; CacheDirectiveInfo directiveInfo = new CacheDirectiveInfo.Builder().setPool(poolName).setPath(path).build(); dfs.addCachePool(new CachePoolInfo(poolName)); dfs.addCacheDirective(directiveInfo, EnumSet.of(CacheFlag.FORCE)); poolNames.add(poolName); } listCacheDirectives(poolNames, 0); cluster.transitionToStandby(0); cluster.transitionToActive(1); cluster.waitActive(1); listCacheDirectives(poolNames, 1); }
/** * Add a list of cache directives, list cache directives, * switch active NN, and list cache directives again. */
Add a list of cache directives, list cache directives, switch active NN, and list cache directives again
testListCacheDirectives
{ "repo_name": "NJUJYB/disYarn", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestRetryCacheWithHA.java", "license": "apache-2.0", "size": 45234 }
[ "java.util.EnumSet", "java.util.HashSet", "org.apache.hadoop.fs.CacheFlag", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo", "org.apache.hadoop.hdfs.protocol.CachePoolInfo", "org.junit.Test" ]
import java.util.EnumSet; import java.util.HashSet; import org.apache.hadoop.fs.CacheFlag; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo; import org.apache.hadoop.hdfs.protocol.CachePoolInfo; import org.junit.Test;
import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.protocol.*; import org.junit.*;
[ "java.util", "org.apache.hadoop", "org.junit" ]
java.util; org.apache.hadoop; org.junit;
2,737,385
protected void setNewAssignmentParameters(RunData data, boolean validify) { // read the form inputs SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); ParameterParser params = data.getParameters(); String assignmentRef = params.getString("assignmentId"); // put the input value into the state attributes String title = params.getString(NEW_ASSIGNMENT_TITLE); state.setAttribute(NEW_ASSIGNMENT_TITLE, title); String order = params.getString(NEW_ASSIGNMENT_ORDER); state.setAttribute(NEW_ASSIGNMENT_ORDER, order); String groupAssignment = params.getString(NEW_ASSIGNMENT_GROUP_SUBMIT); state.setAttribute( NEW_ASSIGNMENT_GROUP_SUBMIT, (groupAssignment == null ? "0": "1")); if (title == null || title.length() == 0) { // empty assignment title addAlert(state, rb.getString("plespethe1")); } else if (sameAssignmentTitleInContext(assignmentRef, title, (String) state.getAttribute(STATE_CONTEXT_STRING))) { // assignment title already exist addAlert(state, rb.getFormattedMessage("same_assignment_title", new Object[]{title})); } // open time Time openTime = putTimeInputInState(params, state, NEW_ASSIGNMENT_OPENMONTH, NEW_ASSIGNMENT_OPENDAY, NEW_ASSIGNMENT_OPENYEAR, NEW_ASSIGNMENT_OPENHOUR, NEW_ASSIGNMENT_OPENMIN, NEW_ASSIGNMENT_OPENAMPM, "newassig.opedat"); // visible time if (Boolean.valueOf(ServerConfigurationService.getBoolean("assignment.visible.date.enabled", false))) { if (params.get("allowVisibleDateToggle") == null) { state.setAttribute(NEW_ASSIGNMENT_VISIBLETOGGLE, true); } else { Time visibleTime = putTimeInputInState(params, state, NEW_ASSIGNMENT_VISIBLEMONTH, NEW_ASSIGNMENT_VISIBLEDAY, NEW_ASSIGNMENT_VISIBLEYEAR, NEW_ASSIGNMENT_VISIBLEHOUR, NEW_ASSIGNMENT_VISIBLEMIN, NEW_ASSIGNMENT_VISIBLEAMPM, "newassig.visdat"); } } // due time Time dueTime = putTimeInputInState(params, state, NEW_ASSIGNMENT_DUEMONTH, NEW_ASSIGNMENT_DUEDAY, NEW_ASSIGNMENT_DUEYEAR, NEW_ASSIGNMENT_DUEHOUR, NEW_ASSIGNMENT_DUEMIN, NEW_ASSIGNMENT_DUEAMPM, "gen.duedat"); // show alert message when due date is in past. Remove it after user confirms the choice. if (dueTime != null && dueTime.before(TimeService.newTime()) && state.getAttribute(NEW_ASSIGNMENT_PAST_DUE_DATE) == null) { state.setAttribute(NEW_ASSIGNMENT_PAST_DUE_DATE, Boolean.TRUE); } else { // clean the attribute after user confirm state.removeAttribute(NEW_ASSIGNMENT_PAST_DUE_DATE); } if (state.getAttribute(NEW_ASSIGNMENT_PAST_DUE_DATE) != null && validify) { addAlert(state, rb.getString("assig4")); } if (openTime != null && dueTime != null && !dueTime.after(openTime)) { addAlert(state, rb.getString("assig3")); } state.setAttribute(NEW_ASSIGNMENT_ENABLECLOSEDATE, Boolean.valueOf(true)); // close time Time closeTime = putTimeInputInState(params, state, NEW_ASSIGNMENT_CLOSEMONTH, NEW_ASSIGNMENT_CLOSEDAY, NEW_ASSIGNMENT_CLOSEYEAR, NEW_ASSIGNMENT_CLOSEHOUR, NEW_ASSIGNMENT_CLOSEMIN, NEW_ASSIGNMENT_CLOSEAMPM, "date.closedate"); if (openTime != null && closeTime != null && !closeTime.after(openTime)) { addAlert(state, rb.getString("acesubdea3")); } if (dueTime != null && closeTime != null && closeTime.before(dueTime)) { addAlert(state, rb.getString("acesubdea2")); } // SECTION MOD String sections_string = ""; String mode = (String) state.getAttribute(STATE_MODE); if (mode == null) mode = ""; state.setAttribute(NEW_ASSIGNMENT_SECTION, sections_string); Integer submissionType = Integer.valueOf(params.getString(NEW_ASSIGNMENT_SUBMISSION_TYPE)); state.setAttribute(NEW_ASSIGNMENT_SUBMISSION_TYPE, submissionType); // Skip category if it was never set. Long catInt = Long.valueOf(-1); if(params.getString(NEW_ASSIGNMENT_CATEGORY) != null) catInt = Long.valueOf(params.getString(NEW_ASSIGNMENT_CATEGORY)); state.setAttribute(NEW_ASSIGNMENT_CATEGORY, catInt); int gradeType = -1; // grade type and grade points if (state.getAttribute(WITH_GRADES) != null && ((Boolean) state.getAttribute(WITH_GRADES)).booleanValue()) { gradeType = Integer.parseInt(params.getString(NEW_ASSIGNMENT_GRADE_TYPE)); state.setAttribute(NEW_ASSIGNMENT_GRADE_TYPE, Integer.valueOf(gradeType)); } //Peer Assessment boolean peerAssessment = false; String r = params.getString(NEW_ASSIGNMENT_USE_PEER_ASSESSMENT); String b; if (r == null){ b = Boolean.FALSE.toString(); }else{ b = Boolean.TRUE.toString(); peerAssessment = true; } state.setAttribute(NEW_ASSIGNMENT_USE_PEER_ASSESSMENT, b); if(peerAssessment){ //not allowed for group assignments: if("1".equals(groupAssignment)){ addAlert(state, rb.getString("peerassessment.invliadGroupAssignment")); } //do not allow non-electronic assignments if(Assignment.NON_ELECTRONIC_ASSIGNMENT_SUBMISSION == submissionType){ addAlert(state, rb.getString("peerassessment.invliadSubmissionTypeAssignment")); } if (gradeType != Assignment.SCORE_GRADE_TYPE){ addAlert(state, rb.getString("peerassessment.invliadGradeTypeAssignment")); } Time peerPeriodTime = putTimeInputInState(params, state, NEW_ASSIGNMENT_PEERPERIODMONTH, NEW_ASSIGNMENT_PEERPERIODDAY, NEW_ASSIGNMENT_PEERPERIODYEAR, NEW_ASSIGNMENT_PEERPERIODHOUR, NEW_ASSIGNMENT_PEERPERIODMIN, NEW_ASSIGNMENT_PEERPERIODAMPM, "newassig.opedat"); GregorianCalendar peerPeriodMinTimeCal = new GregorianCalendar(); peerPeriodMinTimeCal.setTimeInMillis(closeTime.getTime()); peerPeriodMinTimeCal.add(GregorianCalendar.MINUTE, 10); GregorianCalendar peerPeriodTimeCal = new GregorianCalendar(); peerPeriodTimeCal.setTimeInMillis(peerPeriodTime.getTime()); //peer assessment must complete at a minimum of 10 mins after close time if(peerPeriodTimeCal.before(peerPeriodMinTimeCal)){ addAlert(state, rb.getString("peerassessment.invliadPeriodTime")); } } r = params.getString(NEW_ASSIGNMENT_PEER_ASSESSMENT_ANON_EVAL); if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_PEER_ASSESSMENT_ANON_EVAL, b); r = params.getString(NEW_ASSIGNMENT_PEER_ASSESSMENT_STUDENT_VIEW_REVIEWS); if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_PEER_ASSESSMENT_STUDENT_VIEW_REVIEWS, b); if(peerAssessment){ if(params.get(NEW_ASSIGNMENT_PEER_ASSESSMENT_NUM_REVIEWS) != null && !"".equals(params.get(NEW_ASSIGNMENT_PEER_ASSESSMENT_NUM_REVIEWS))){ try{ int peerAssessmentNumOfReviews = Integer.parseInt(params.getString(NEW_ASSIGNMENT_PEER_ASSESSMENT_NUM_REVIEWS)); if(peerAssessmentNumOfReviews > 0){ state.setAttribute(NEW_ASSIGNMENT_PEER_ASSESSMENT_NUM_REVIEWS, Integer.valueOf(peerAssessmentNumOfReviews)); }else{ addAlert(state, rb.getString("peerassessment.invalidNumReview")); } }catch(Exception e){ addAlert(state, rb.getString("peerassessment.invalidNumReview")); } }else{ addAlert(state, rb.getString("peerassessment.specifyNumReview")); } } String peerAssessmentInstructions = processFormattedTextFromBrowser(state, params.getString(NEW_ASSIGNMENT_PEER_ASSESSMENT_INSTRUCTIONS), true); state.setAttribute(NEW_ASSIGNMENT_PEER_ASSESSMENT_INSTRUCTIONS, peerAssessmentInstructions); //REVIEW SERVICE r = params.getString(NEW_ASSIGNMENT_USE_REVIEW_SERVICE); // set whether we use the review service or not if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_USE_REVIEW_SERVICE, b); //set whether students can view the review service results r = params.getString(NEW_ASSIGNMENT_ALLOW_STUDENT_VIEW); if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_ALLOW_STUDENT_VIEW, b); //set submit options r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_SUBMIT_RADIO); if(r == null || (!NEW_ASSIGNMENT_REVIEW_SERVICE_SUBMIT_STANDARD.equals(r) && !NEW_ASSIGNMENT_REVIEW_SERVICE_SUBMIT_INSITUTION.equals(r))) r = NEW_ASSIGNMENT_REVIEW_SERVICE_SUBMIT_NONE; state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_SUBMIT_RADIO, r); //set originality report options r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_REPORT_RADIO); if(r == null || !NEW_ASSIGNMENT_REVIEW_SERVICE_REPORT_DUE.equals(r)) r = NEW_ASSIGNMENT_REVIEW_SERVICE_REPORT_IMMEDIATELY; state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_REPORT_RADIO, r); //set check repository options: r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_CHECK_TURNITIN); if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_CHECK_TURNITIN, b); r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_CHECK_INTERNET); if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_CHECK_INTERNET, b); r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_CHECK_PUB); if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_CHECK_PUB, b); r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_CHECK_INSTITUTION); if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_CHECK_INSTITUTION, b); //exclude bibliographic materials: r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_BIBLIOGRAPHIC); if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_BIBLIOGRAPHIC, b); //exclude quoted materials: r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_QUOTED); if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_QUOTED, b); //exclude small matches r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SMALL_MATCHES); if (r == null) b = Boolean.FALSE.toString(); else b = Boolean.TRUE.toString(); state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_SMALL_MATCHES, b); //exclude type: //only options are 0=none, 1=words, 2=percentages r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_TYPE); if(!"0".equals(r) && !"1".equals(r) && !"2".equals(r)){ //this really shouldn't ever happen (unless someone's messing with the parameters) r = "0"; } state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_TYPE, r); //exclude value if(!"0".equals(r)){ r = params.getString(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_VALUE); try{ int rInt = Integer.parseInt(r); if(rInt < 0 || rInt > 100){ addAlert(state, rb.getString("review.exclude.matches.value_error")); } }catch (Exception e) { addAlert(state, rb.getString("review.exclude.matches.value_error")); } state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_VALUE, r); }else{ state.setAttribute(NEW_ASSIGNMENT_REVIEW_SERVICE_EXCLUDE_VALUE, "1"); } // treat the new assignment description as formatted text boolean checkForFormattingErrors = true; // instructor is creating a new assignment - so check for errors String description = processFormattedTextFromBrowser(state, params.getCleanString(NEW_ASSIGNMENT_DESCRIPTION), checkForFormattingErrors); state.setAttribute(NEW_ASSIGNMENT_DESCRIPTION, description); if (state.getAttribute(CALENDAR) != null) { // calendar enabled for the site if (params.getString(ResourceProperties.NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE) != null && params.getString(ResourceProperties.NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE).equalsIgnoreCase(Boolean.TRUE.toString())) { state.setAttribute(ResourceProperties.NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE, Boolean.TRUE.toString()); } else { state.setAttribute(ResourceProperties.NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE, Boolean.FALSE.toString()); } } else { // no calendar yet for the site state.removeAttribute(ResourceProperties.NEW_ASSIGNMENT_CHECK_ADD_DUE_DATE); } if (params.getString(ResourceProperties.NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE) != null && params.getString(ResourceProperties.NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE) .equalsIgnoreCase(Boolean.TRUE.toString())) { state.setAttribute(ResourceProperties.NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE, Boolean.TRUE.toString()); } else { state.setAttribute(ResourceProperties.NEW_ASSIGNMENT_CHECK_AUTO_ANNOUNCE, Boolean.FALSE.toString()); } if (params.getString(NEW_ASSIGNMENT_CHECK_HIDE_DUE_DATE) != null && params.getString(NEW_ASSIGNMENT_CHECK_HIDE_DUE_DATE) .equalsIgnoreCase(Boolean.TRUE.toString())) { state.setAttribute(NEW_ASSIGNMENT_CHECK_HIDE_DUE_DATE, Boolean.TRUE.toString()); } else { state.setAttribute(NEW_ASSIGNMENT_CHECK_HIDE_DUE_DATE, Boolean.FALSE.toString()); } String s = params.getString(NEW_ASSIGNMENT_CHECK_ADD_HONOR_PLEDGE); // set the honor pledge to be "no honor pledge" if (s == null) s = "1"; state.setAttribute(NEW_ASSIGNMENT_CHECK_ADD_HONOR_PLEDGE, s); String grading = params.getString(NEW_ASSIGNMENT_ADD_TO_GRADEBOOK); state.setAttribute(NEW_ASSIGNMENT_ADD_TO_GRADEBOOK, grading); // only when choose to associate with assignment in Gradebook String associateAssignment = params.getString(AssignmentService.PROP_ASSIGNMENT_ASSOCIATE_GRADEBOOK_ASSIGNMENT); if (grading != null) { if (grading.equals(AssignmentService.GRADEBOOK_INTEGRATION_ASSOCIATE)) { state.setAttribute(AssignmentService.PROP_ASSIGNMENT_ASSOCIATE_GRADEBOOK_ASSIGNMENT, associateAssignment); } else { state.setAttribute(AssignmentService.PROP_ASSIGNMENT_ASSOCIATE_GRADEBOOK_ASSIGNMENT, ""); } if (!grading.equals(AssignmentService.GRADEBOOK_INTEGRATION_NO)) { // gradebook integration only available to point-grade assignment if (gradeType != Assignment.SCORE_GRADE_TYPE) { addAlert(state, rb.getString("addtogradebook.wrongGradeScale")); } // if chosen as "associate", have to choose one assignment from Gradebook if (grading.equals(AssignmentService.GRADEBOOK_INTEGRATION_ASSOCIATE) && StringUtils.trimToNull(associateAssignment) == null) { addAlert(state, rb.getString("grading.associate.alert")); } } } List attachments = (List) state.getAttribute(ATTACHMENTS); if (attachments == null || attachments.isEmpty()) { // read from vm file String[] attachmentIds = data.getParameters().getStrings("attachments"); if (attachmentIds != null && attachmentIds.length != 0) { attachments = new ArrayList(); for (int i= 0; i<attachmentIds.length;i++) { attachments.add(EntityManager.newReference(attachmentIds[i])); } } } state.setAttribute(NEW_ASSIGNMENT_ATTACHMENT, attachments); if (validify) { if ((description == null) || (description.length() == 0) || ("<br/>".equals(description)) && ((attachments == null || attachments.size() == 0))) { // if there is no description nor an attachment, show the following alert message. // One could ignore the message and still post the assignment if (state.getAttribute(NEW_ASSIGNMENT_DESCRIPTION_EMPTY) == null) { state.setAttribute(NEW_ASSIGNMENT_DESCRIPTION_EMPTY, Boolean.TRUE.toString()); } else { state.removeAttribute(NEW_ASSIGNMENT_DESCRIPTION_EMPTY); } } else { state.removeAttribute(NEW_ASSIGNMENT_DESCRIPTION_EMPTY); } } if (validify && state.getAttribute(NEW_ASSIGNMENT_DESCRIPTION_EMPTY) != null) { addAlert(state, rb.getString("thiasshas")); } // assignment range? String range = data.getParameters().getString("range"); state.setAttribute(NEW_ASSIGNMENT_RANGE, range); if ("groups".equals(range)) { String[] groupChoice = data.getParameters().getStrings("selectedGroups"); if (groupChoice != null && groupChoice.length != 0) { state.setAttribute(NEW_ASSIGNMENT_GROUPS, new ArrayList(Arrays.asList(groupChoice))); } else { state.setAttribute(NEW_ASSIGNMENT_GROUPS, null); addAlert(state, rb.getString("java.alert.youchoosegroup")); } } else { state.removeAttribute(NEW_ASSIGNMENT_GROUPS); } // check groups for duplicate members here if ("1".equals(params.getString(NEW_ASSIGNMENT_GROUP_SUBMIT))) { Collection<String> _dupUsers = usersInMultipleGroups(state, "groups".equals(range),("groups".equals(range) ? data.getParameters().getStrings("selectedGroups") : null), false, null); if (_dupUsers.size() > 0) { StringBuilder _sb = new StringBuilder(rb.getString("group.user.multiple.warning") + " "); Iterator<String> _it = _dupUsers.iterator(); if (_it.hasNext()) _sb.append(_it.next()); while (_it.hasNext()) _sb.append(", " + _it.next()); addAlert(state, _sb.toString()); M_log.warn(this + ":post_save_assignment at least one user in multiple groups."); } } // allow resubmission numbers if (params.getString("allowResToggle") != null && params.getString(AssignmentSubmission.ALLOW_RESUBMIT_NUMBER) != null) { // read in allowResubmit params Time resubmitCloseTime = readAllowResubmitParams(params, state, null); if (resubmitCloseTime != null) { // check the date is valid if (openTime != null && ! resubmitCloseTime.after(openTime)) { addAlert(state, rb.getString("acesubdea6")); } } } else { resetAllowResubmitParams(state); } // assignment notification option String notiOption = params.getString(ASSIGNMENT_INSTRUCTOR_NOTIFICATIONS); if (notiOption != null) { state.setAttribute(Assignment.ASSIGNMENT_INSTRUCTOR_NOTIFICATIONS_VALUE, notiOption); } // release grade notification option String releaseGradeOption = params.getString(ASSIGNMENT_RELEASEGRADE_NOTIFICATION); if (releaseGradeOption != null) { state.setAttribute(Assignment.ASSIGNMENT_RELEASEGRADE_NOTIFICATION_VALUE, releaseGradeOption); } // release resubmission notification option String releaseResubmissionOption = params.getString(ASSIGNMENT_RELEASERESUBMISSION_NOTIFICATION); if (releaseResubmissionOption != null){ state.setAttribute(Assignment.ASSIGNMENT_RELEASERESUBMISSION_NOTIFICATION_VALUE, releaseResubmissionOption); } // read inputs for supplement items setNewAssignmentParametersSupplementItems(validify, state, params); if (state.getAttribute(WITH_GRADES) != null && ((Boolean) state.getAttribute(WITH_GRADES)).booleanValue()) { // the grade point String gradePoints = params.getString(NEW_ASSIGNMENT_GRADE_POINTS); state.setAttribute(NEW_ASSIGNMENT_GRADE_POINTS, gradePoints); if (gradePoints != null) { if (gradeType == 3) { if ((gradePoints.length() == 0)) { // in case of point grade assignment, user must specify maximum grade point addAlert(state, rb.getString("plespethe3")); } else { validPointGrade(state, gradePoints); // when scale is points, grade must be integer and less than maximum value if (state.getAttribute(STATE_MESSAGE) == null) { gradePoints = scalePointGrade(state, gradePoints); } if (state.getAttribute(STATE_MESSAGE) == null) { state.setAttribute(NEW_ASSIGNMENT_GRADE_POINTS, gradePoints); } } } } } } // setNewAssignmentParameters
void function(RunData data, boolean validify) { SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); ParameterParser params = data.getParameters(); String assignmentRef = params.getString(STR); String title = params.getString(NEW_ASSIGNMENT_TITLE); state.setAttribute(NEW_ASSIGNMENT_TITLE, title); String order = params.getString(NEW_ASSIGNMENT_ORDER); state.setAttribute(NEW_ASSIGNMENT_ORDER, order); String groupAssignment = params.getString(NEW_ASSIGNMENT_GROUP_SUBMIT); state.setAttribute( NEW_ASSIGNMENT_GROUP_SUBMIT, (groupAssignment == null ? "0": "1")); if (title == null title.length() == 0) { addAlert(state, rb.getString(STR)); } else if (sameAssignmentTitleInContext(assignmentRef, title, (String) state.getAttribute(STATE_CONTEXT_STRING))) { addAlert(state, rb.getFormattedMessage(STR, new Object[]{title})); } Time openTime = putTimeInputInState(params, state, NEW_ASSIGNMENT_OPENMONTH, NEW_ASSIGNMENT_OPENDAY, NEW_ASSIGNMENT_OPENYEAR, NEW_ASSIGNMENT_OPENHOUR, NEW_ASSIGNMENT_OPENMIN, NEW_ASSIGNMENT_OPENAMPM, STR); if (Boolean.valueOf(ServerConfigurationService.getBoolean(STR, false))) { if (params.get(STR) == null) { state.setAttribute(NEW_ASSIGNMENT_VISIBLETOGGLE, true); } else { Time visibleTime = putTimeInputInState(params, state, NEW_ASSIGNMENT_VISIBLEMONTH, NEW_ASSIGNMENT_VISIBLEDAY, NEW_ASSIGNMENT_VISIBLEYEAR, NEW_ASSIGNMENT_VISIBLEHOUR, NEW_ASSIGNMENT_VISIBLEMIN, NEW_ASSIGNMENT_VISIBLEAMPM, STR); } } Time dueTime = putTimeInputInState(params, state, NEW_ASSIGNMENT_DUEMONTH, NEW_ASSIGNMENT_DUEDAY, NEW_ASSIGNMENT_DUEYEAR, NEW_ASSIGNMENT_DUEHOUR, NEW_ASSIGNMENT_DUEMIN, NEW_ASSIGNMENT_DUEAMPM, STR); if (dueTime != null && dueTime.before(TimeService.newTime()) && state.getAttribute(NEW_ASSIGNMENT_PAST_DUE_DATE) == null) { state.setAttribute(NEW_ASSIGNMENT_PAST_DUE_DATE, Boolean.TRUE); } else { state.removeAttribute(NEW_ASSIGNMENT_PAST_DUE_DATE); } if (state.getAttribute(NEW_ASSIGNMENT_PAST_DUE_DATE) != null && validify) { addAlert(state, rb.getString(STR)); } if (openTime != null && dueTime != null && !dueTime.after(openTime)) { addAlert(state, rb.getString(STR)); } state.setAttribute(NEW_ASSIGNMENT_ENABLECLOSEDATE, Boolean.valueOf(true)); Time closeTime = putTimeInputInState(params, state, NEW_ASSIGNMENT_CLOSEMONTH, NEW_ASSIGNMENT_CLOSEDAY, NEW_ASSIGNMENT_CLOSEYEAR, NEW_ASSIGNMENT_CLOSEHOUR, NEW_ASSIGNMENT_CLOSEMIN, NEW_ASSIGNMENT_CLOSEAMPM, STR); if (openTime != null && closeTime != null && !closeTime.after(openTime)) { addAlert(state, rb.getString(STR)); } if (dueTime != null && closeTime != null && closeTime.before(dueTime)) { addAlert(state, rb.getString(STR)); } String sections_string = STRSTR1STRpeerassessment.invliadGroupAssignmentSTRpeerassessment.invliadSubmissionTypeAssignmentSTRpeerassessment.invliadGradeTypeAssignment")); } Time peerPeriodTime = putTimeInputInState(params, state, NEW_ASSIGNMENT_PEERPERIODMONTH, NEW_ASSIGNMENT_PEERPERIODDAY, NEW_ASSIGNMENT_PEERPERIODYEAR, NEW_ASSIGNMENT_PEERPERIODHOUR, NEW_ASSIGNMENT_PEERPERIODMIN, NEW_ASSIGNMENT_PEERPERIODAMPM, STR); GregorianCalendar peerPeriodMinTimeCal = new GregorianCalendar(); peerPeriodMinTimeCal.setTimeInMillis(closeTime.getTime()); peerPeriodMinTimeCal.add(GregorianCalendar.MINUTE, 10); GregorianCalendar peerPeriodTimeCal = new GregorianCalendar(); peerPeriodTimeCal.setTimeInMillis(peerPeriodTime.getTime()); if(peerPeriodTimeCal.before(peerPeriodMinTimeCal)){ addAlert(state, rb.getString("peerassessment.invliadPeriodTimeSTRSTRpeerassessment.invalidNumReviewSTRpeerassessment.invalidNumReviewSTRpeerassessment.specifyNumReviewSTR0STR1STR2STR0STR0STRreview.exclude.matches.value_errorSTRreview.exclude.matches.value_errorSTR1STR1STRSTRaddtogradebook.wrongGradeScaleSTRgrading.associate.alertSTRattachmentsSTR<br/>STRthiasshasSTRrangeSTRgroupsSTRselectedGroupsSTRjava.alert.youchoosegroupSTR1STRgroupsSTRgroupsSTRselectedGroupsSTRgroup.user.multiple.warningSTR STR, STR:post_save_assignment at least one user in multiple groups.STRallowResToggleSTRacesubdea6STRplespethe3")); } else { validPointGrade(state, gradePoints); if (state.getAttribute(STATE_MESSAGE) == null) { gradePoints = scalePointGrade(state, gradePoints); } if (state.getAttribute(STATE_MESSAGE) == null) { state.setAttribute(NEW_ASSIGNMENT_GRADE_POINTS, gradePoints); } } } } } }
/** * Action is to save the input infos for assignment fields * * @param validify * Need to validify the inputs or not */
Action is to save the input infos for assignment fields
setNewAssignmentParameters
{ "repo_name": "harfalm/Sakai-10.1", "path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java", "license": "apache-2.0", "size": 605178 }
[ "java.util.GregorianCalendar", "org.sakaiproject.cheftool.JetspeedRunData", "org.sakaiproject.cheftool.RunData", "org.sakaiproject.component.cover.ServerConfigurationService", "org.sakaiproject.event.api.SessionState", "org.sakaiproject.time.api.Time", "org.sakaiproject.time.cover.TimeService", "org.sakaiproject.util.ParameterParser" ]
import java.util.GregorianCalendar; import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.RunData; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.event.api.SessionState; import org.sakaiproject.time.api.Time; import org.sakaiproject.time.cover.TimeService; import org.sakaiproject.util.ParameterParser;
import java.util.*; import org.sakaiproject.cheftool.*; import org.sakaiproject.component.cover.*; import org.sakaiproject.event.api.*; import org.sakaiproject.time.api.*; import org.sakaiproject.time.cover.*; import org.sakaiproject.util.*;
[ "java.util", "org.sakaiproject.cheftool", "org.sakaiproject.component", "org.sakaiproject.event", "org.sakaiproject.time", "org.sakaiproject.util" ]
java.util; org.sakaiproject.cheftool; org.sakaiproject.component; org.sakaiproject.event; org.sakaiproject.time; org.sakaiproject.util;
1,498,548
protected boolean isReserved(String word) { SqlAbstractParserImpl.Metadata metadata = fixture().parser().getMetadata(); return metadata.isReservedWord(word.toUpperCase(Locale.ROOT)); }
boolean function(String word) { SqlAbstractParserImpl.Metadata metadata = fixture().parser().getMetadata(); return metadata.isReservedWord(word.toUpperCase(Locale.ROOT)); }
/** Returns whether a word is reserved in this parser. This method can be * used to disable tests that behave differently with different collections * of reserved words. */
Returns whether a word is reserved in this parser. This method can be used to disable tests that behave differently with different collections
isReserved
{ "repo_name": "apache/calcite", "path": "testkit/src/main/java/org/apache/calcite/sql/parser/SqlParserTest.java", "license": "apache-2.0", "size": 391214 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
2,227,233
public GeoBoundingBoxFilterBuilder geohash(String geohash) { topLeft = new GeoPoint(); bottomRight = new GeoPoint(); GeoHashUtils.decodeCell(geohash, topLeft, bottomRight); return this; }
GeoBoundingBoxFilterBuilder function(String geohash) { topLeft = new GeoPoint(); bottomRight = new GeoPoint(); GeoHashUtils.decodeCell(geohash, topLeft, bottomRight); return this; }
/** * Adds top left and bottom right by geohash cell. * * @param geohash the geohash of the cell definign the boundingbox */
Adds top left and bottom right by geohash cell
geohash
{ "repo_name": "exercitussolus/yolo", "path": "src/main/java/org/elasticsearch/index/query/GeoBoundingBoxFilterBuilder.java", "license": "agpl-3.0", "size": 4861 }
[ "org.elasticsearch.common.geo.GeoHashUtils", "org.elasticsearch.common.geo.GeoPoint" ]
import org.elasticsearch.common.geo.GeoHashUtils; import org.elasticsearch.common.geo.GeoPoint;
import org.elasticsearch.common.geo.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
2,229,818
public static void display(String page) { try { File f = File.createTempFile("temp", ".html"); FileUtils.write(f, page); display(f); // f.deleteOnExit(); bad idea } catch (IOException e) { throw new WrappedException(e); } }
static void function(String page) { try { File f = File.createTempFile("temp", ".html"); FileUtils.write(f, page); display(f); } catch (IOException e) { throw new WrappedException(e); } }
/** * Open an html page in a web browser. * * @param page * This is an HTML page. It is not a url! */
Open an html page in a web browser
display
{ "repo_name": "sodash/open-code", "path": "winterwell.utils/src/com/winterwell/utils/web/WebUtils.java", "license": "mit", "size": 57030 }
[ "com.winterwell.utils.WrappedException", "com.winterwell.utils.io.FileUtils", "java.io.File", "java.io.IOException" ]
import com.winterwell.utils.WrappedException; import com.winterwell.utils.io.FileUtils; import java.io.File; import java.io.IOException;
import com.winterwell.utils.*; import com.winterwell.utils.io.*; import java.io.*;
[ "com.winterwell.utils", "java.io" ]
com.winterwell.utils; java.io;
2,871,310
protected static void setTableStateToDisabled(final MasterProcedureEnv env, final TableName tableName) throws IOException { // Flip the table to disabled env.getMasterServices().getTableStateManager().setTableState(tableName, TableState.State.DISABLED); LOG.info("Set {} to state={}", tableName, TableState.State.DISABLED); }
static void function(final MasterProcedureEnv env, final TableName tableName) throws IOException { env.getMasterServices().getTableStateManager().setTableState(tableName, TableState.State.DISABLED); LOG.info(STR, tableName, TableState.State.DISABLED); }
/** * Mark table state to Disabled * @param env MasterProcedureEnv */
Mark table state to Disabled
setTableStateToDisabled
{ "repo_name": "ChinmaySKulkarni/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DisableTableProcedure.java", "license": "apache-2.0", "size": 13255 }
[ "java.io.IOException", "org.apache.hadoop.hbase.TableName", "org.apache.hadoop.hbase.client.TableState" ]
import java.io.IOException; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.TableState;
import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,299,884
@Override public int read(byte buffer[]) throws IOException { return read(buffer, 0, buffer.length); }
int function(byte buffer[]) throws IOException { return read(buffer, 0, buffer.length); }
/*** * Reads the next number of bytes from the stream into an array and * returns the number of bytes read. Returns -1 if the end of the * stream has been reached. * <p> * @param buffer The byte array in which to store the data. * @return The number of bytes read. Returns -1 if the * end of the message has been reached. * @exception IOException If an error occurs in reading the underlying * stream. ***/
Reads the next number of bytes from the stream into an array and returns the number of bytes read. Returns -1 if the end of the stream has been reached.
read
{ "repo_name": "rwinston/netling", "path": "src/main/java/org/netling/io/FromNetASCIIInputStream.java", "license": "apache-2.0", "size": 7448 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,566,272
public boolean wasAnalyzed(HashId hashId) throws FileStoreException;
boolean function(HashId hashId) throws FileStoreException;
/** * Checks whether a code with a given id was analyzed or not. * * @param hashId * is the id of the file for which the analysis availability is * to be checked. * @return <code>true</code> is returned in case the file was analyzed * already. <code>false</code> is returned otherwise. * @throws FileStoreException * is thrown in cases of issues with file store. */
Checks whether a code with a given id was analyzed or not
wasAnalyzed
{ "repo_name": "PureSolTechnologies/Purifinity", "path": "analysis/server/server/core.api/src/main/java/com/puresoltechnologies/purifinity/server/core/api/analysis/store/CommonFileStore.java", "license": "agpl-3.0", "size": 4964 }
[ "com.puresoltechnologies.commons.misc.hash.HashId" ]
import com.puresoltechnologies.commons.misc.hash.HashId;
import com.puresoltechnologies.commons.misc.hash.*;
[ "com.puresoltechnologies.commons" ]
com.puresoltechnologies.commons;
1,627,003
IBindingSetEditpart getBindingSet();
IBindingSetEditpart getBindingSet();
/** * Returns the bindingSet that is responsible to handle bindings. * * @return */
Returns the bindingSet that is responsible to handle bindings
getBindingSet
{ "repo_name": "lunifera/lunifera-ecview", "path": "org.lunifera.ecview.core.common/src/org/lunifera/ecview/core/common/editpart/IViewEditpart.java", "license": "epl-1.0", "size": 5321 }
[ "org.lunifera.ecview.core.common.editpart.binding.IBindingSetEditpart" ]
import org.lunifera.ecview.core.common.editpart.binding.IBindingSetEditpart;
import org.lunifera.ecview.core.common.editpart.binding.*;
[ "org.lunifera.ecview" ]
org.lunifera.ecview;
1,446,886
static Deck shuffleDeck(Deck origDeck){ Deck sDeck = origDeck; Random randm = new Random(System.nanoTime()); int randInt = 0; Card temp = new Card(); for (int sIndex = DECK_SIZE; sIndex > CARD_INIT; ){ --sIndex; randInt = randm.nextInt(sIndex); if(randInt == ZERO){ randInt = CARD_INIT; // there is no "zero" card, set } // it to 1 temp = sDeck.deck[randInt]; sDeck.deck[randInt] = sDeck.deck[sIndex]; sDeck.deck[sIndex] = temp; } return sDeck; } // -- DISPLAY FUNCTIONS (TEXT/COMMAND LINE VERSIONS) -----------------------
static Deck shuffleDeck(Deck origDeck){ Deck sDeck = origDeck; Random randm = new Random(System.nanoTime()); int randInt = 0; Card temp = new Card(); for (int sIndex = DECK_SIZE; sIndex > CARD_INIT; ){ --sIndex; randInt = randm.nextInt(sIndex); if(randInt == ZERO){ randInt = CARD_INIT; } temp = sDeck.deck[randInt]; sDeck.deck[randInt] = sDeck.deck[sIndex]; sDeck.deck[sIndex] = temp; } return sDeck; }
/** shuffleDeck * Randomizes a deck of cards according to the Fisher-Yates algorithm. See * https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm * for more details. Starting with card ID# 52, it swaps places with a * random card from the deck, and repeats while counting downward. * * @param origDeck Standard (unshuffled) deck * @return Shuffled deck * */
shuffleDeck Randomizes a deck of cards according to the Fisher-Yates algorithm. See HREF for more details. Starting with card ID# 52, it swaps places with a random card from the deck, and repeats while counting downward
shuffleDeck
{ "repo_name": "dementia13/jPoker", "path": "poker.java", "license": "bsd-2-clause", "size": 24086 }
[ "java.util.Random" ]
import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
2,560,211
public int setBaseUrl(String baseUrl) { String url = getContextBaseUrl() + "/configuration/strongbox/baseUrl/" + baseUrl; WebTarget resource = getClientInstance().target(url); setupAuthentication(resource); Response response = resource.request(MediaType.TEXT_PLAIN).put(Entity.entity(baseUrl, MediaType.TEXT_PLAIN)); return response.getStatus(); }
int function(String baseUrl) { String url = getContextBaseUrl() + STR + baseUrl; WebTarget resource = getClientInstance().target(url); setupAuthentication(resource); Response response = resource.request(MediaType.TEXT_PLAIN).put(Entity.entity(baseUrl, MediaType.TEXT_PLAIN)); return response.getStatus(); }
/** * Sets the base URL of the server. * * @param baseUrl The base URL. * @return The response code. */
Sets the base URL of the server
setBaseUrl
{ "repo_name": "ivanursul/strongbox", "path": "strongbox-rest-client/src/main/java/org/carlspring/strongbox/client/RestClient.java", "license": "apache-2.0", "size": 18274 }
[ "javax.ws.rs.client.Entity", "javax.ws.rs.client.WebTarget", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response" ]
import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
import javax.ws.rs.client.*; import javax.ws.rs.core.*;
[ "javax.ws" ]
javax.ws;
721,338
@Test public void testHBaseBinaryConverter() throws IOException { prepareTable(TESTTABLE_1, true, DataFormat.HBaseBinary); scanTable1(pig, DataFormat.HBaseBinary); Iterator<Tuple> it = pig.openIterator("a"); int index = 0; LOG.info("testHBaseBinaryConverter Starting"); while (it.hasNext()) { Tuple t = it.next(); String rowKey = (String) t.get(0); int col_a = (Integer) t.get(1); double col_b = (Double) t.get(2); String col_c = (String) t.get(3); Assert.assertEquals("00".substring((index + "").length()) + index, rowKey); Assert.assertEquals(index, col_a); Assert.assertEquals(index + 0.0, col_b, 1e-6); Assert.assertEquals("Text_" + index, col_c); index++; } LOG.info("testHBaseBinaryConverter done"); }
void function() throws IOException { prepareTable(TESTTABLE_1, true, DataFormat.HBaseBinary); scanTable1(pig, DataFormat.HBaseBinary); Iterator<Tuple> it = pig.openIterator("a"); int index = 0; LOG.info(STR); while (it.hasNext()) { Tuple t = it.next(); String rowKey = (String) t.get(0); int col_a = (Integer) t.get(1); double col_b = (Double) t.get(2); String col_c = (String) t.get(3); Assert.assertEquals("00".substring((index + STRText_STRtestHBaseBinaryConverter done"); }
/** * Test Load from hbase using HBaseBinaryConverter */
Test Load from hbase using HBaseBinaryConverter
testHBaseBinaryConverter
{ "repo_name": "kellyzly/pig", "path": "test/org/apache/pig/test/TestHBaseStorage.java", "license": "apache-2.0", "size": 67470 }
[ "java.io.IOException", "java.util.Iterator", "org.apache.pig.data.Tuple", "org.junit.Assert" ]
import java.io.IOException; import java.util.Iterator; import org.apache.pig.data.Tuple; import org.junit.Assert;
import java.io.*; import java.util.*; import org.apache.pig.data.*; import org.junit.*;
[ "java.io", "java.util", "org.apache.pig", "org.junit" ]
java.io; java.util; org.apache.pig; org.junit;
2,905,245
@Test public void testUnbind() throws Exception { envContext.bind("sub31", null); gemfireContext.bind("env/ejb/sub32", new String("UnbindObject")); // Unbind initialContext.unbind("java:gf/env/sub31"); dataSourceContext.unbind("sub32"); try { envContext.lookup("sub31"); fail(); } catch (NameNotFoundException expected) { } try { initialContext.lookup("java:gf/env/sub32"); fail(); } catch (NameNotFoundException expected) { } // Unbind non-existing name dataSourceContext.unbind("doesNotExist"); // Unbind non-existing name, when subcontext does not exists try { gemfireContext.unbind("env/x/y"); fail(); } catch (NameNotFoundException expected) { } }
void function() throws Exception { envContext.bind("sub31", null); gemfireContext.bind(STR, new String(STR)); initialContext.unbind(STR); dataSourceContext.unbind("sub32"); try { envContext.lookup("sub31"); fail(); } catch (NameNotFoundException expected) { } try { initialContext.lookup(STR); fail(); } catch (NameNotFoundException expected) { } dataSourceContext.unbind(STR); try { gemfireContext.unbind(STR); fail(); } catch (NameNotFoundException expected) { } }
/** * Tests ability to unbind names. */
Tests ability to unbind names
testUnbind
{ "repo_name": "smgoller/geode", "path": "geode-core/src/test/java/org/apache/geode/internal/jndi/ContextJUnitTest.java", "license": "apache-2.0", "size": 11271 }
[ "javax.naming.NameNotFoundException", "org.junit.Assert" ]
import javax.naming.NameNotFoundException; import org.junit.Assert;
import javax.naming.*; import org.junit.*;
[ "javax.naming", "org.junit" ]
javax.naming; org.junit;
212,717
public void testTheObjectType() throws Exception { // implicit prototype assertTypeEquals(OBJECT_PROTOTYPE, OBJECT_TYPE.getImplicitPrototype()); // isXxx assertFalse(OBJECT_TYPE.isNoObjectType()); assertFalse(OBJECT_TYPE.isNoType()); assertFalse(OBJECT_TYPE.isArrayType()); assertFalse(OBJECT_TYPE.isBooleanValueType()); assertFalse(OBJECT_TYPE.isDateType()); assertFalse(OBJECT_TYPE.isEnumElementType()); assertFalse(OBJECT_TYPE.isNullType()); assertFalse(OBJECT_TYPE.isNamedType()); assertFalse(OBJECT_TYPE.isNullType()); assertFalse(OBJECT_TYPE.isNumber()); assertFalse(OBJECT_TYPE.isNumberObjectType()); assertFalse(OBJECT_TYPE.isNumberValueType()); assertTrue(OBJECT_TYPE.isObject()); assertFalse(OBJECT_TYPE.isFunctionPrototypeType()); assertTrue(OBJECT_TYPE.getImplicitPrototype().isFunctionPrototypeType()); assertFalse(OBJECT_TYPE.isRegexpType()); assertFalse(OBJECT_TYPE.isString()); assertFalse(OBJECT_TYPE.isStringObjectType()); assertFalse(OBJECT_TYPE.isStringValueType()); assertFalse(OBJECT_TYPE.isSymbol()); assertFalse(OBJECT_TYPE.isSymbolObjectType()); assertFalse(OBJECT_TYPE.isSymbolValueType()); assertFalse(OBJECT_TYPE.isEnumType()); assertFalse(OBJECT_TYPE.isUnionType()); assertFalse(OBJECT_TYPE.isStruct()); assertFalse(OBJECT_TYPE.isDict()); assertFalse(OBJECT_TYPE.isAllType()); assertFalse(OBJECT_TYPE.isVoidType()); assertFalse(OBJECT_TYPE.isConstructor()); assertTrue(OBJECT_TYPE.isInstanceType()); // isSubtype assertFalse(OBJECT_TYPE.isSubtypeOf(NO_TYPE)); assertTrue(OBJECT_TYPE.isSubtypeOf(ALL_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(STRING_OBJECT_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(SYMBOL_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(SYMBOL_OBJECT_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(NUMBER_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(functionType)); assertFalse(OBJECT_TYPE.isSubtypeOf(recordType)); assertFalse(OBJECT_TYPE.isSubtypeOf(NULL_TYPE)); assertTrue(OBJECT_TYPE.isSubtypeOf(OBJECT_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(DATE_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(namedGoogBar)); assertTrue(OBJECT_TYPE.isSubtypeOf(unresolvedNamedType)); assertFalse(OBJECT_TYPE.isSubtypeOf(REGEXP_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(ARRAY_TYPE)); assertTrue(OBJECT_TYPE.isSubtypeOf(UNKNOWN_TYPE)); // canBeCalled assertFalse(OBJECT_TYPE.canBeCalled()); // canTestForEqualityWith assertCanTestForEqualityWith(OBJECT_TYPE, ALL_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, STRING_OBJECT_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, SYMBOL_OBJECT_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, SYMBOL_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, NUMBER_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, STRING_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, BOOLEAN_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, functionType); assertCanTestForEqualityWith(OBJECT_TYPE, recordType); assertCannotTestForEqualityWith(OBJECT_TYPE, VOID_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, OBJECT_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, DATE_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, REGEXP_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, ARRAY_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, UNKNOWN_TYPE); // canTestForShallowEqualityWith assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(NO_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(NO_OBJECT_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(ARRAY_TYPE)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(BOOLEAN_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(BOOLEAN_OBJECT_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(DATE_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(functionType)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(recordType)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(NULL_TYPE)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(NUMBER_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(NUMBER_OBJECT_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(OBJECT_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(REGEXP_TYPE)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(STRING_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(STRING_OBJECT_TYPE)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(SYMBOL_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(SYMBOL_OBJECT_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(ALL_TYPE)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(VOID_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(UNKNOWN_TYPE)); // isNullable assertFalse(OBJECT_TYPE.isNullable()); assertFalse(OBJECT_TYPE.isVoidable()); // getLeastSupertype assertTypeEquals(ALL_TYPE, OBJECT_TYPE.getLeastSupertype(ALL_TYPE)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(STRING_OBJECT_TYPE)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(SYMBOL_OBJECT_TYPE)); assertTypeEquals( createUnionType(OBJECT_TYPE, SYMBOL_TYPE), OBJECT_TYPE.getLeastSupertype(SYMBOL_TYPE)); assertTypeEquals(createUnionType(OBJECT_TYPE, NUMBER_TYPE), OBJECT_TYPE.getLeastSupertype(NUMBER_TYPE)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(functionType)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(OBJECT_TYPE)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(DATE_TYPE)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(REGEXP_TYPE)); // getPropertyType assertEquals(7, OBJECT_TYPE.getPropertiesCount()); assertReturnTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getPropertyType("constructor")); assertReturnTypeEquals(STRING_TYPE, OBJECT_TYPE.getPropertyType("toString")); assertReturnTypeEquals(STRING_TYPE, OBJECT_TYPE.getPropertyType("toLocaleString")); assertReturnTypeEquals(UNKNOWN_TYPE, OBJECT_TYPE.getPropertyType("valueOf")); assertReturnTypeEquals(BOOLEAN_TYPE, OBJECT_TYPE.getPropertyType("hasOwnProperty")); assertReturnTypeEquals(BOOLEAN_TYPE, OBJECT_TYPE.getPropertyType("isPrototypeOf")); assertReturnTypeEquals(BOOLEAN_TYPE, OBJECT_TYPE.getPropertyType("propertyIsEnumerable")); // matchesXxx assertFalse(OBJECT_TYPE.matchesNumberContext()); assertTrue(OBJECT_TYPE.matchesObjectContext()); assertTrue(OBJECT_TYPE.matchesStringContext()); assertFalse(OBJECT_TYPE.matchesSymbolContext()); // implicit prototype assertTypeEquals(OBJECT_PROTOTYPE, OBJECT_TYPE.getImplicitPrototype()); // toString assertEquals("Object", OBJECT_TYPE.toString()); assertTrue(OBJECT_TYPE.isNativeObjectType()); assertTrue(OBJECT_TYPE.getImplicitPrototype().isNativeObjectType()); Asserts.assertResolvesToSame(OBJECT_TYPE); assertFalse(OBJECT_TYPE.isNominalConstructor()); assertTrue(OBJECT_TYPE.getConstructor().isNominalConstructor()); }
void function() throws Exception { assertTypeEquals(OBJECT_PROTOTYPE, OBJECT_TYPE.getImplicitPrototype()); assertFalse(OBJECT_TYPE.isNoObjectType()); assertFalse(OBJECT_TYPE.isNoType()); assertFalse(OBJECT_TYPE.isArrayType()); assertFalse(OBJECT_TYPE.isBooleanValueType()); assertFalse(OBJECT_TYPE.isDateType()); assertFalse(OBJECT_TYPE.isEnumElementType()); assertFalse(OBJECT_TYPE.isNullType()); assertFalse(OBJECT_TYPE.isNamedType()); assertFalse(OBJECT_TYPE.isNullType()); assertFalse(OBJECT_TYPE.isNumber()); assertFalse(OBJECT_TYPE.isNumberObjectType()); assertFalse(OBJECT_TYPE.isNumberValueType()); assertTrue(OBJECT_TYPE.isObject()); assertFalse(OBJECT_TYPE.isFunctionPrototypeType()); assertTrue(OBJECT_TYPE.getImplicitPrototype().isFunctionPrototypeType()); assertFalse(OBJECT_TYPE.isRegexpType()); assertFalse(OBJECT_TYPE.isString()); assertFalse(OBJECT_TYPE.isStringObjectType()); assertFalse(OBJECT_TYPE.isStringValueType()); assertFalse(OBJECT_TYPE.isSymbol()); assertFalse(OBJECT_TYPE.isSymbolObjectType()); assertFalse(OBJECT_TYPE.isSymbolValueType()); assertFalse(OBJECT_TYPE.isEnumType()); assertFalse(OBJECT_TYPE.isUnionType()); assertFalse(OBJECT_TYPE.isStruct()); assertFalse(OBJECT_TYPE.isDict()); assertFalse(OBJECT_TYPE.isAllType()); assertFalse(OBJECT_TYPE.isVoidType()); assertFalse(OBJECT_TYPE.isConstructor()); assertTrue(OBJECT_TYPE.isInstanceType()); assertFalse(OBJECT_TYPE.isSubtypeOf(NO_TYPE)); assertTrue(OBJECT_TYPE.isSubtypeOf(ALL_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(STRING_OBJECT_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(SYMBOL_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(SYMBOL_OBJECT_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(NUMBER_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(functionType)); assertFalse(OBJECT_TYPE.isSubtypeOf(recordType)); assertFalse(OBJECT_TYPE.isSubtypeOf(NULL_TYPE)); assertTrue(OBJECT_TYPE.isSubtypeOf(OBJECT_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(DATE_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(namedGoogBar)); assertTrue(OBJECT_TYPE.isSubtypeOf(unresolvedNamedType)); assertFalse(OBJECT_TYPE.isSubtypeOf(REGEXP_TYPE)); assertFalse(OBJECT_TYPE.isSubtypeOf(ARRAY_TYPE)); assertTrue(OBJECT_TYPE.isSubtypeOf(UNKNOWN_TYPE)); assertFalse(OBJECT_TYPE.canBeCalled()); assertCanTestForEqualityWith(OBJECT_TYPE, ALL_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, STRING_OBJECT_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, SYMBOL_OBJECT_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, SYMBOL_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, NUMBER_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, STRING_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, BOOLEAN_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, functionType); assertCanTestForEqualityWith(OBJECT_TYPE, recordType); assertCannotTestForEqualityWith(OBJECT_TYPE, VOID_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, OBJECT_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, DATE_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, REGEXP_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, ARRAY_TYPE); assertCanTestForEqualityWith(OBJECT_TYPE, UNKNOWN_TYPE); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(NO_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(NO_OBJECT_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(ARRAY_TYPE)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(BOOLEAN_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(BOOLEAN_OBJECT_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(DATE_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(functionType)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(recordType)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(NULL_TYPE)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(NUMBER_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(NUMBER_OBJECT_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(OBJECT_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(REGEXP_TYPE)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(STRING_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(STRING_OBJECT_TYPE)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(SYMBOL_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(SYMBOL_OBJECT_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(ALL_TYPE)); assertFalse(OBJECT_TYPE.canTestForShallowEqualityWith(VOID_TYPE)); assertTrue(OBJECT_TYPE.canTestForShallowEqualityWith(UNKNOWN_TYPE)); assertFalse(OBJECT_TYPE.isNullable()); assertFalse(OBJECT_TYPE.isVoidable()); assertTypeEquals(ALL_TYPE, OBJECT_TYPE.getLeastSupertype(ALL_TYPE)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(STRING_OBJECT_TYPE)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(SYMBOL_OBJECT_TYPE)); assertTypeEquals( createUnionType(OBJECT_TYPE, SYMBOL_TYPE), OBJECT_TYPE.getLeastSupertype(SYMBOL_TYPE)); assertTypeEquals(createUnionType(OBJECT_TYPE, NUMBER_TYPE), OBJECT_TYPE.getLeastSupertype(NUMBER_TYPE)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(functionType)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(OBJECT_TYPE)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(DATE_TYPE)); assertTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getLeastSupertype(REGEXP_TYPE)); assertEquals(7, OBJECT_TYPE.getPropertiesCount()); assertReturnTypeEquals(OBJECT_TYPE, OBJECT_TYPE.getPropertyType(STR)); assertReturnTypeEquals(STRING_TYPE, OBJECT_TYPE.getPropertyType(STR)); assertReturnTypeEquals(STRING_TYPE, OBJECT_TYPE.getPropertyType(STR)); assertReturnTypeEquals(UNKNOWN_TYPE, OBJECT_TYPE.getPropertyType(STR)); assertReturnTypeEquals(BOOLEAN_TYPE, OBJECT_TYPE.getPropertyType(STR)); assertReturnTypeEquals(BOOLEAN_TYPE, OBJECT_TYPE.getPropertyType(STR)); assertReturnTypeEquals(BOOLEAN_TYPE, OBJECT_TYPE.getPropertyType(STR)); assertFalse(OBJECT_TYPE.matchesNumberContext()); assertTrue(OBJECT_TYPE.matchesObjectContext()); assertTrue(OBJECT_TYPE.matchesStringContext()); assertFalse(OBJECT_TYPE.matchesSymbolContext()); assertTypeEquals(OBJECT_PROTOTYPE, OBJECT_TYPE.getImplicitPrototype()); assertEquals(STR, OBJECT_TYPE.toString()); assertTrue(OBJECT_TYPE.isNativeObjectType()); assertTrue(OBJECT_TYPE.getImplicitPrototype().isNativeObjectType()); Asserts.assertResolvesToSame(OBJECT_TYPE); assertFalse(OBJECT_TYPE.isNominalConstructor()); assertTrue(OBJECT_TYPE.getConstructor().isNominalConstructor()); }
/** * Tests the behavior of the Object type (the object * at the top of the JavaScript hierarchy). */
Tests the behavior of the Object type (the object at the top of the JavaScript hierarchy)
testTheObjectType
{ "repo_name": "tdelmas/closure-compiler", "path": "test/com/google/javascript/rhino/jstype/JSTypeTest.java", "license": "apache-2.0", "size": 265769 }
[ "com.google.javascript.rhino.testing.Asserts" ]
import com.google.javascript.rhino.testing.Asserts;
import com.google.javascript.rhino.testing.*;
[ "com.google.javascript" ]
com.google.javascript;
1,297,859
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); if (jdate == null) { jdate = jcal.newCalendarDate(getZone()); cachedFixedDate = Long.MIN_VALUE; } }
void function(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); if (jdate == null) { jdate = jcal.newCalendarDate(getZone()); cachedFixedDate = Long.MIN_VALUE; } }
/** * Updates internal state. */
Updates internal state
readObject
{ "repo_name": "evanman/Java-Source", "path": "util/JapaneseImperialCalendar.java", "license": "lgpl-2.1", "size": 99847 }
[ "java.io.IOException", "java.io.ObjectInputStream" ]
import java.io.IOException; import java.io.ObjectInputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,324,717
EReference getDocumentRoot_XSISchemaLocation();
EReference getDocumentRoot_XSISchemaLocation();
/** * Returns the meta object for the map '{@link org.omg.spec.bpmn.non.normative.color.DocumentRoot#getXSISchemaLocation <em>XSI Schema Location</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the map '<em>XSI Schema Location</em>'. * @see org.omg.spec.bpmn.non.normative.color.DocumentRoot#getXSISchemaLocation() * @see #getDocumentRoot() * @generated */
Returns the meta object for the map '<code>org.omg.spec.bpmn.non.normative.color.DocumentRoot#getXSISchemaLocation XSI Schema Location</code>'.
getDocumentRoot_XSISchemaLocation
{ "repo_name": "romartin/kie-wb-common", "path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/omg/spec/bpmn/non/normative/color/ColorPackage.java", "license": "apache-2.0", "size": 9754 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,246,309
protected boolean doProcess(PDFGenerator generator, adams.data.spreadsheet.SpreadSheet sheet) throws Exception { boolean result; Row row; Cell cell; int i; PdfPTable table; PdfPCell pdfCell; String pattern; DecimalFormat format; Paragraph para; Paragraph paraComments; ColumnText ct; pattern = "#0"; for (i = 0; i < m_NumDecimals; i++) { if (i == 0) pattern += "."; pattern += "0"; } format = new DecimalFormat(pattern); result = (sheet != null); if (!result) return false; // comments paraComments = null; if (m_AddComments) paraComments = new Paragraph(Utils.flatten(sheet.getComments(), "\n"), m_FontComments.toFont(m_ColorComments)); // table // 1. header table = new PdfPTable(sheet.getColumnCount()); row = sheet.getHeaderRow(); for (String key: sheet.getHeaderRow().cellKeys()) { cell = row.getCell(key); para = new Paragraph(cell.toString(), m_FontTableHeader.toFont(m_ColorTableHeader)); pdfCell = new PdfPCell(para); pdfCell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(pdfCell); } // 2. data for (i = 0; i < sheet.getRowCount(); i++) { row = sheet.getRow(i); for (String key: sheet.getHeaderRow().cellKeys()) { cell = row.getCell(key); if ((cell == null) || cell.isMissing()) { pdfCell = new PdfPCell(new Paragraph("")); } else if (cell.isNumeric()) { pdfCell = new PdfPCell(new Paragraph(format.format(cell.toDouble()), m_FontNumericContent.toFont(m_ColorNumericContent))); pdfCell.setHorizontalAlignment(Element.ALIGN_RIGHT); } else { pdfCell = new PdfPCell(new Paragraph(cell.toString(), m_FontGeneralContent.toFont(m_ColorGeneralContent))); pdfCell.setHorizontalAlignment(Element.ALIGN_LEFT); } table.addCell(pdfCell); } } if (m_UseAbsolutePosition) { ct = addColumnTextAt(generator, m_X, m_Y); if (paraComments != null) { ct.addElement(paraComments); ct.addElement(new Paragraph("\n")); } ct.addElement(new Paragraph("\n")); ct.addElement(table); ct.go(); generator.getState().contentAdded(); } else { if (paraComments != null) { result = addElement(generator, paraComments); if (result) result = addElement(generator, new Paragraph("\n")); } if (result) result = addElement(generator, new Paragraph("\n")); if (result) result = addElement(generator, table); } return result; }
boolean function(PDFGenerator generator, adams.data.spreadsheet.SpreadSheet sheet) throws Exception { boolean result; Row row; Cell cell; int i; PdfPTable table; PdfPCell pdfCell; String pattern; DecimalFormat format; Paragraph para; Paragraph paraComments; ColumnText ct; pattern = "#0"; for (i = 0; i < m_NumDecimals; i++) { if (i == 0) pattern += "."; pattern += "0"; } format = new DecimalFormat(pattern); result = (sheet != null); if (!result) return false; paraComments = null; if (m_AddComments) paraComments = new Paragraph(Utils.flatten(sheet.getComments(), "\n"), m_FontComments.toFont(m_ColorComments)); table = new PdfPTable(sheet.getColumnCount()); row = sheet.getHeaderRow(); for (String key: sheet.getHeaderRow().cellKeys()) { cell = row.getCell(key); para = new Paragraph(cell.toString(), m_FontTableHeader.toFont(m_ColorTableHeader)); pdfCell = new PdfPCell(para); pdfCell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(pdfCell); } for (i = 0; i < sheet.getRowCount(); i++) { row = sheet.getRow(i); for (String key: sheet.getHeaderRow().cellKeys()) { cell = row.getCell(key); if ((cell == null) cell.isMissing()) { pdfCell = new PdfPCell(new Paragraph(STR\nSTR\nSTR\nSTR\n")); if (result) result = addElement(generator, table); } return result; }
/** * The actual processing of the document. * * @param generator the context * @param sheet the spreadsheet to add * @return true if successfully added * @throws Exception if something goes wrong */
The actual processing of the document
doProcess
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-pdf/src/main/java/adams/flow/transformer/pdfproclet/SpreadSheet.java", "license": "gpl-3.0", "size": 24104 }
[ "com.itextpdf.text.Element", "com.itextpdf.text.Paragraph", "com.itextpdf.text.pdf.ColumnText", "com.itextpdf.text.pdf.PdfPCell", "com.itextpdf.text.pdf.PdfPTable", "java.text.DecimalFormat" ]
import com.itextpdf.text.Element; import com.itextpdf.text.Paragraph; import com.itextpdf.text.pdf.ColumnText; import com.itextpdf.text.pdf.PdfPCell; import com.itextpdf.text.pdf.PdfPTable; import java.text.DecimalFormat;
import com.itextpdf.text.*; import com.itextpdf.text.pdf.*; import java.text.*;
[ "com.itextpdf.text", "java.text" ]
com.itextpdf.text; java.text;
2,699,442
@Override public void initGui() { super.initGui(); buttonList.clear(); Keyboard.enableRepeatEvents(true); this.buttonList.add(GuiVC.buttonMM1); this.buttonList.add(GuiVC.buttonMM2); this.buttonList.add(GuiVC.buttonMM3); this.buttonList.add(GuiVC.buttonMM4); this.buttonList.add(GuiVC.buttonMM5); this.buttonList.add(GuiVC.button501); this.buttonList.add(GuiVC.button502); //this.buttonList.add(GuiVC.button503); //this.buttonList.add(GuiVC.button504); this.buttonList.add(GuiVC.button505); this.buttonList.add(GuiVC.buttonB00); this.buttonList.add(GuiVC.buttonB01); this.buttonList.add(GuiVC.buttonB02); //this.buttonList.add(GuiVC.buttonB03); //this.buttonList.add(GuiVC.buttonB04); GuiVC.buttonMM3.enabled = false; }
void function() { super.initGui(); buttonList.clear(); Keyboard.enableRepeatEvents(true); this.buttonList.add(GuiVC.buttonMM1); this.buttonList.add(GuiVC.buttonMM2); this.buttonList.add(GuiVC.buttonMM3); this.buttonList.add(GuiVC.buttonMM4); this.buttonList.add(GuiVC.buttonMM5); this.buttonList.add(GuiVC.button501); this.buttonList.add(GuiVC.button502); this.buttonList.add(GuiVC.button505); this.buttonList.add(GuiVC.buttonB00); this.buttonList.add(GuiVC.buttonB01); this.buttonList.add(GuiVC.buttonB02); GuiVC.buttonMM3.enabled = false; }
/** * Adds the buttons (and other controls) to the screen in question. */
Adds the buttons (and other controls) to the screen in question
initGui
{ "repo_name": "Weisses/Ebonheart-Mods", "path": "ViesCraft/1.12.2 - 2655/src/main/java/com/viesis/viescraft/client/gui/airship/customize/core/sub/GuiCustomizeMenuCoreModelEnginePg1.java", "license": "mit", "size": 4640 }
[ "com.viesis.viescraft.api.GuiVC", "org.lwjgl.input.Keyboard" ]
import com.viesis.viescraft.api.GuiVC; import org.lwjgl.input.Keyboard;
import com.viesis.viescraft.api.*; import org.lwjgl.input.*;
[ "com.viesis.viescraft", "org.lwjgl.input" ]
com.viesis.viescraft; org.lwjgl.input;
2,464,916
public RedeliveryPolicy retryAttemptedLogLevel(LoggingLevel retryAttemptedLogLevel) { setRetryAttemptedLogLevel(retryAttemptedLogLevel); return this; }
RedeliveryPolicy function(LoggingLevel retryAttemptedLogLevel) { setRetryAttemptedLogLevel(retryAttemptedLogLevel); return this; }
/** * Sets the logging level to use for log messages when retries are attempted. */
Sets the logging level to use for log messages when retries are attempted
retryAttemptedLogLevel
{ "repo_name": "logzio/camel", "path": "camel-core/src/main/java/org/apache/camel/processor/RedeliveryPolicy.java", "license": "apache-2.0", "size": 24812 }
[ "org.apache.camel.LoggingLevel" ]
import org.apache.camel.LoggingLevel;
import org.apache.camel.*;
[ "org.apache.camel" ]
org.apache.camel;
647,487
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; // DocumentProvider if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { // ExternalStorageProvider if (isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; if ("primary".equalsIgnoreCase(type)) { return Environment.getExternalStorageDirectory() + "/" + split[1]; } // TODO handle non-primary volumes } // DownloadsProvider else if (isDownloadsDocument(uri)) { final String id = DocumentsContract.getDocumentId(uri); final Uri contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); return getDataColumn(context, contentUri, null, null); } // MediaProvider else if (isMediaDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; } else if ("audio".equals(type)) { contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; } final String selection = "_id=?"; final String[] selectionArgs = new String[] { split[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } } // MediaStore (and general) else if ("content".equalsIgnoreCase(uri.getScheme())) { // Return the remote address if (isGooglePhotosUri(uri)) return uri.getLastPathSegment(); return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; }
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0]; if (STR.equalsIgnoreCase(type)) { return Environment.getExternalStorageDirectory() + "/" + split[1]; } } else if (isDownloadsDocument(uri)) { final String id = DocumentsContract.getDocumentId(uri); final Uri contentUri = ContentUris.withAppendedId( Uri.parse(STR:STRimageSTRvideoSTRaudioSTR_id=?STRcontentSTRfile".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; }
/** * Get a file path from a Uri. This will get the the path for Storage Access * Framework Documents, as well as the _data field for the MediaStore and * other file-based ContentProviders. * * @param context The context. * @param uri The Uri to query. * @author paulburke */
Get a file path from a Uri. This will get the the path for Storage Access Framework Documents, as well as the _data field for the MediaStore and other file-based ContentProviders
getPath
{ "repo_name": "KnRex/Video_Stitching_android_ffmpeg", "path": "app/src/main/java/com/genie/videostitchingexample/Utils.java", "license": "mit", "size": 5504 }
[ "android.content.ContentUris", "android.net.Uri", "android.os.Build", "android.os.Environment", "android.provider.DocumentsContract" ]
import android.content.ContentUris; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.DocumentsContract;
import android.content.*; import android.net.*; import android.os.*; import android.provider.*;
[ "android.content", "android.net", "android.os", "android.provider" ]
android.content; android.net; android.os; android.provider;
1,492,162
public Builder<TYPE> mandatoryProvidersList( Iterable<? extends Iterable<StarlarkProviderIdentifier>> providersList) { Preconditions.checkState(type.getLabelClass() == LabelClass.DEPENDENCY, "must be a label-valued type"); for (Iterable<StarlarkProviderIdentifier> providers : providersList) { this.requiredProvidersBuilder.addStarlarkSet(ImmutableSet.copyOf(providers)); } return this; }
Builder<TYPE> function( Iterable<? extends Iterable<StarlarkProviderIdentifier>> providersList) { Preconditions.checkState(type.getLabelClass() == LabelClass.DEPENDENCY, STR); for (Iterable<StarlarkProviderIdentifier> providers : providersList) { this.requiredProvidersBuilder.addStarlarkSet(ImmutableSet.copyOf(providers)); } return this; }
/** * Sets a list of sets of mandatory Starlark providers. Every configured target occurring in * this label type attribute has to provide all the providers from one of those sets, or be one * of {@link #allowedRuleClasses}, otherwise an error is produced during the analysis phase. */
Sets a list of sets of mandatory Starlark providers. Every configured target occurring in this label type attribute has to provide all the providers from one of those sets, or be one of <code>#allowedRuleClasses</code>, otherwise an error is produced during the analysis phase
mandatoryProvidersList
{ "repo_name": "twitter-forks/bazel", "path": "src/main/java/com/google/devtools/build/lib/packages/Attribute.java", "license": "apache-2.0", "size": 98336 }
[ "com.google.common.base.Preconditions", "com.google.common.collect.ImmutableSet", "com.google.devtools.build.lib.packages.Type" ]
import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.packages.Type;
import com.google.common.base.*; import com.google.common.collect.*; import com.google.devtools.build.lib.packages.*;
[ "com.google.common", "com.google.devtools" ]
com.google.common; com.google.devtools;
2,774,471
public static byte[] stringToBytes(String str) { try { return str.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new Error("UTF-8 Not Supported", e); } }
static byte[] function(String str) { try { return str.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new Error(STR, e); } }
/** * Convert String to byte[] (with UTF-8 encoding) * @param str String * @return Byte array (byte[]) */
Convert String to byte[] (with UTF-8 encoding)
stringToBytes
{ "repo_name": "Phazyck/nullpominai", "path": "src/mu/nu/nullpo/game/net/NetUtil.java", "license": "mit", "size": 8903 }
[ "java.io.UnsupportedEncodingException" ]
import java.io.UnsupportedEncodingException;
import java.io.*;
[ "java.io" ]
java.io;
2,128,052
public StringValue appendTo(StringValue builder) throws IOException { if (_is != null) return builder.append(_is); else return builder; }
StringValue function(StringValue builder) throws IOException { if (_is != null) return builder.append(_is); else return builder; }
/** * Appends to a string builder. */
Appends to a string builder
appendTo
{ "repo_name": "dwango/quercus", "path": "src/main/java/com/caucho/quercus/lib/file/HttpInputOutput.java", "license": "gpl-2.0", "size": 9829 }
[ "com.caucho.quercus.env.StringValue", "java.io.IOException" ]
import com.caucho.quercus.env.StringValue; import java.io.IOException;
import com.caucho.quercus.env.*; import java.io.*;
[ "com.caucho.quercus", "java.io" ]
com.caucho.quercus; java.io;
1,788,750
public TypeUse build( XSSimpleType type ) { XSSimpleType oldi = initiatingType; this.initiatingType = type; TypeUse e = checkRefererCustomization(type); if(e==null) e = compose(type); initiatingType = oldi; return e; }
TypeUse function( XSSimpleType type ) { XSSimpleType oldi = initiatingType; this.initiatingType = type; TypeUse e = checkRefererCustomization(type); if(e==null) e = compose(type); initiatingType = oldi; return e; }
/** * Entry point from outside. Builds a BGM type expression * from a simple type schema component. * * @param type * the simple type to be bound. */
Entry point from outside. Builds a BGM type expression from a simple type schema component
build
{ "repo_name": "FauxFaux/jdk9-jaxws", "path": "src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/xmlschema/SimpleTypeBuilder.java", "license": "gpl-2.0", "size": 36489 }
[ "com.sun.tools.internal.xjc.model.TypeUse", "com.sun.xml.internal.xsom.XSSimpleType" ]
import com.sun.tools.internal.xjc.model.TypeUse; import com.sun.xml.internal.xsom.XSSimpleType;
import com.sun.tools.internal.xjc.model.*; import com.sun.xml.internal.xsom.*;
[ "com.sun.tools", "com.sun.xml" ]
com.sun.tools; com.sun.xml;
140,064
public static String getAt(GString text, int index) { return (String) getAt(text.toString(), index); }
static String function(GString text, int index) { return (String) getAt(text.toString(), index); }
/** * Support the subscript operator for GString. * * @param text a GString * @param index the index of the Character to get * @return the Character at the given index * @since 2.3.7 */
Support the subscript operator for GString
getAt
{ "repo_name": "pledbrook/incubator-groovy", "path": "src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java", "license": "apache-2.0", "size": 142054 }
[ "groovy.lang.GString" ]
import groovy.lang.GString;
import groovy.lang.*;
[ "groovy.lang" ]
groovy.lang;
1,893,610
protected Control createNameControl(Composite composite) { return fNameGroup.createControl(composite); }
Control function(Composite composite) { return fNameGroup.createControl(composite); }
/** * Creates the controls for the name field. * * @param composite the parent composite * @return the created control */
Creates the controls for the name field
createNameControl
{ "repo_name": "kumattau/JDTPatch", "path": "org.eclipse.jdt.ui/src/org/eclipse/jdt/ui/wizards/NewJavaProjectWizardPageOne.java", "license": "epl-1.0", "size": 49557 }
[ "org.eclipse.swt.widgets.Composite", "org.eclipse.swt.widgets.Control" ]
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
2,823,400
@GET @Path("mappers") @Produces(MediaType.APPLICATION_JSON) @NoCache public List<IdentityProviderMapperRepresentation> getMappers() { this.auth.realm().requireViewIdentityProviders(); if (identityProviderModel == null) { throw new javax.ws.rs.NotFoundException(); } List<IdentityProviderMapperRepresentation> mappers = new LinkedList<>(); for (IdentityProviderMapperModel model : realm.getIdentityProviderMappersByAlias(identityProviderModel.getAlias())) { mappers.add(ModelToRepresentation.toRepresentation(model)); } return mappers; }
@Path(STR) @Produces(MediaType.APPLICATION_JSON) List<IdentityProviderMapperRepresentation> function() { this.auth.realm().requireViewIdentityProviders(); if (identityProviderModel == null) { throw new javax.ws.rs.NotFoundException(); } List<IdentityProviderMapperRepresentation> mappers = new LinkedList<>(); for (IdentityProviderMapperModel model : realm.getIdentityProviderMappersByAlias(identityProviderModel.getAlias())) { mappers.add(ModelToRepresentation.toRepresentation(model)); } return mappers; }
/** * Get mappers for identity provider */
Get mappers for identity provider
getMappers
{ "repo_name": "mhajas/keycloak", "path": "services/src/main/java/org/keycloak/services/resources/admin/IdentityProviderResource.java", "license": "apache-2.0", "size": 19477 }
[ "java.util.LinkedList", "java.util.List", "javax.ws.rs.NotFoundException", "javax.ws.rs.Path", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "org.keycloak.models.IdentityProviderMapperModel", "org.keycloak.models.utils.ModelToRepresentation", "org.keycloak.representations.idm.IdentityProviderMapperRepresentation" ]
import java.util.LinkedList; import java.util.List; import javax.ws.rs.NotFoundException; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.keycloak.models.IdentityProviderMapperModel; import org.keycloak.models.utils.ModelToRepresentation; import org.keycloak.representations.idm.IdentityProviderMapperRepresentation;
import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.keycloak.models.*; import org.keycloak.models.utils.*; import org.keycloak.representations.idm.*;
[ "java.util", "javax.ws", "org.keycloak.models", "org.keycloak.representations" ]
java.util; javax.ws; org.keycloak.models; org.keycloak.representations;
2,512,156