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 void log(PaxosValue value) { // Is this is a proposal or a commutative set? String key = null; if(value instanceof Proposal) { key = "proposal"; } else { key = "set"; } log(key, value); }
void function(PaxosValue value) { String key = null; if(value instanceof Proposal) { key = STR; } else { key = "set"; } log(key, value); }
/** * Log the value with the default label. The default * label changes depending on the value type. * * @param value Value to log */
Log the value with the default label. The default label changes depending on the value type
log
{ "repo_name": "jhorey/Paja", "path": "src/gov/ornl/paja/roles/PaxosRecovery.java", "license": "apache-2.0", "size": 4750 }
[ "gov.ornl.paja.proto.PaxosValue", "gov.ornl.paja.proto.Proposal" ]
import gov.ornl.paja.proto.PaxosValue; import gov.ornl.paja.proto.Proposal;
import gov.ornl.paja.proto.*;
[ "gov.ornl.paja" ]
gov.ornl.paja;
429,048
protected void importSerializedRule(String serializedRule) { try { String[] values = serializedRule.split(Character.toString(SERIALIZATION_SEPARATOR), 4); int userId = Integer.parseInt(values[0]); AccessRule rule = AccessRule.valueOf(values[1]); String nodeName = new String(Base64.decodeBase64(values[2])); URI uri = new URI(values[3], true); SiteTreeNode node = new SiteTreeNode(nodeName, uri); getUserRules(userId).put(node, rule); if (log.isDebugEnabled()) { log.debug( String.format( "Imported access control rule (context, userId, node, rule): (%d, %d, %s, %s) ", context.getId(), userId, uri.toString(), rule)); } } catch (Exception ex) { log.error( "Unable to import serialized rule for context " + context.getId() + ":" + serializedRule, ex); } }
void function(String serializedRule) { try { String[] values = serializedRule.split(Character.toString(SERIALIZATION_SEPARATOR), 4); int userId = Integer.parseInt(values[0]); AccessRule rule = AccessRule.valueOf(values[1]); String nodeName = new String(Base64.decodeBase64(values[2])); URI uri = new URI(values[3], true); SiteTreeNode node = new SiteTreeNode(nodeName, uri); getUserRules(userId).put(node, rule); if (log.isDebugEnabled()) { log.debug( String.format( STR, context.getId(), userId, uri.toString(), rule)); } } catch (Exception ex) { log.error( STR + context.getId() + ":" + serializedRule, ex); } }
/** * Import a rule from a serialized representation. The rule should have been exported via the * {@link #exportSerializedRules()} method. * * @param serializedRule the serialized rule */
Import a rule from a serialized representation. The rule should have been exported via the <code>#exportSerializedRules()</code> method
importSerializedRule
{ "repo_name": "zapbot/zap-extensions", "path": "addOns/accessControl/src/main/java/org/zaproxy/zap/extension/accessControl/ContextAccessRulesManager.java", "license": "apache-2.0", "size": 14131 }
[ "org.apache.commons.codec.binary.Base64", "org.zaproxy.zap.extension.accessControl.widgets.SiteTreeNode" ]
import org.apache.commons.codec.binary.Base64; import org.zaproxy.zap.extension.accessControl.widgets.SiteTreeNode;
import org.apache.commons.codec.binary.*; import org.zaproxy.zap.extension.*;
[ "org.apache.commons", "org.zaproxy.zap" ]
org.apache.commons; org.zaproxy.zap;
1,892,506
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<RevisionInner>> getRevisionWithResponseAsync( String resourceGroupName, String containerAppName, String name, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (containerAppName == null) { return Mono .error(new IllegalArgumentException("Parameter containerAppName is required and cannot be null.")); } if (name == null) { return Mono.error(new IllegalArgumentException("Parameter name 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 .getRevision( this.client.getEndpoint(), resourceGroupName, containerAppName, name, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<RevisionInner>> function( String resourceGroupName, String containerAppName, String name, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (containerAppName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (name == 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 .getRevision( this.client.getEndpoint(), resourceGroupName, containerAppName, name, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context); }
/** * Get a revision of a Container App. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param containerAppName Name of the Container App. * @param name Name of the Container App Revision. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws DefaultErrorResponseErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a revision of a Container App along with {@link Response} on successful completion of {@link Mono}. */
Get a revision of a Container App
getRevisionWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/implementation/ContainerAppsRevisionsClientImpl.java", "license": "mit", "size": 51756 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.resourcemanager.appservice.fluent.models.RevisionInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.appservice.fluent.models.RevisionInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.appservice.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
527,287
void setValue(Object aValue,boolean isSelected); Component getComponent();
void setValue(Object aValue,boolean isSelected); Component getComponent();
/** * Returns the component used to render the value. * * @return the Component responsible for displaying the value */
Returns the component used to render the value
getComponent
{ "repo_name": "flyzsd/java-code-snippets", "path": "ibm.jdk8/src/javax/swing/Renderer.java", "license": "mit", "size": 1350 }
[ "java.awt.Component" ]
import java.awt.Component;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,616,398
public ModelMap getModelMap() { if (this.model == null) { this.model = new ModelMap(); } return this.model; }
ModelMap function() { if (this.model == null) { this.model = new ModelMap(); } return this.model; }
/** * Return the underlying {@code ModelMap} instance (never {@code null}). */
Return the underlying ModelMap instance (never null)
getModelMap
{ "repo_name": "lamsfoundation/lams", "path": "3rdParty_sources/spring/org/springframework/web/servlet/ModelAndView.java", "license": "gpl-2.0", "size": 10708 }
[ "org.springframework.ui.ModelMap" ]
import org.springframework.ui.ModelMap;
import org.springframework.ui.*;
[ "org.springframework.ui" ]
org.springframework.ui;
2,009,860
private static void toString(SBLimitedLength buf, Class<?> cls, Object val) { if (val == null) { buf.a("null"); return; } if (cls == null) cls = val.getClass(); if (cls.isPrimitive()) { buf.a(val); return; } IdentityHashMap<Object, EntryReference> svdObjs = savedObjects.get(); if (handleRecursion(buf, val, cls, svdObjs)) return; svdObjs.put(val, new EntryReference(buf.length())); try { if (cls.isArray()) addArray(buf, cls, val); else if (val instanceof Collection) addCollection(buf, (Collection) val); else if (val instanceof Map) addMap(buf, (Map<?, ?>) val); else buf.a(val); } finally { svdObjs.remove(val); } }
static void function(SBLimitedLength buf, Class<?> cls, Object val) { if (val == null) { buf.a("null"); return; } if (cls == null) cls = val.getClass(); if (cls.isPrimitive()) { buf.a(val); return; } IdentityHashMap<Object, EntryReference> svdObjs = savedObjects.get(); if (handleRecursion(buf, val, cls, svdObjs)) return; svdObjs.put(val, new EntryReference(buf.length())); try { if (cls.isArray()) addArray(buf, cls, val); else if (val instanceof Collection) addCollection(buf, (Collection) val); else if (val instanceof Map) addMap(buf, (Map<?, ?>) val); else buf.a(val); } finally { svdObjs.remove(val); } }
/** * Print value with length limitation. * * @param buf buffer to print to. * @param cls value class. * @param val value to print. */
Print value with length limitation
toString
{ "repo_name": "nizhikov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/tostring/GridToStringBuilder.java", "license": "apache-2.0", "size": 66364 }
[ "java.util.Collection", "java.util.IdentityHashMap", "java.util.Map" ]
import java.util.Collection; import java.util.IdentityHashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
43,085
public void process(Set<MultiKey<EventBean>> newEvents, Set<MultiKey<EventBean>> oldEvents, ExprEvaluatorContext exprEvaluatorContext) { if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled())) { log.debug(".process Received update, " + " newData.length==" + ((newEvents == null) ? 0 : newEvents.size()) + " oldData.length==" + ((oldEvents == null) ? 0 : oldEvents.size())); } resultSetProcessor.processJoinResult(newEvents, oldEvents, false); if (!super.checkAfterCondition(newEvents)) { return; } int newEventsSize = 0; if (newEvents != null) { // add the incoming events to the event batches newEventsSize = newEvents.size(); } int oldEventsSize = 0; if (oldEvents != null) { oldEventsSize = oldEvents.size(); } outputCondition.updateOutputCondition(newEventsSize, oldEventsSize); }
void function(Set<MultiKey<EventBean>> newEvents, Set<MultiKey<EventBean>> oldEvents, ExprEvaluatorContext exprEvaluatorContext) { if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled())) { log.debug(STR + STR + ((newEvents == null) ? 0 : newEvents.size()) + STR + ((oldEvents == null) ? 0 : oldEvents.size())); } resultSetProcessor.processJoinResult(newEvents, oldEvents, false); if (!super.checkAfterCondition(newEvents)) { return; } int newEventsSize = 0; if (newEvents != null) { newEventsSize = newEvents.size(); } int oldEventsSize = 0; if (oldEvents != null) { oldEventsSize = oldEvents.size(); } outputCondition.updateOutputCondition(newEventsSize, oldEventsSize); }
/** * This process (update) method is for participation in a join. * @param newEvents - new events * @param oldEvents - old events */
This process (update) method is for participation in a join
process
{ "repo_name": "intelie/esper", "path": "esper/src/main/java/com/espertech/esper/epl/view/OutputProcessViewSnapshot.java", "license": "gpl-2.0", "size": 9077 }
[ "com.espertech.esper.client.EventBean", "com.espertech.esper.collection.MultiKey", "com.espertech.esper.epl.expression.ExprEvaluatorContext", "com.espertech.esper.util.ExecutionPathDebugLog", "java.util.Set" ]
import com.espertech.esper.client.EventBean; import com.espertech.esper.collection.MultiKey; import com.espertech.esper.epl.expression.ExprEvaluatorContext; import com.espertech.esper.util.ExecutionPathDebugLog; import java.util.Set;
import com.espertech.esper.client.*; import com.espertech.esper.collection.*; import com.espertech.esper.epl.expression.*; import com.espertech.esper.util.*; import java.util.*;
[ "com.espertech.esper", "java.util" ]
com.espertech.esper; java.util;
987,935
private void releaseEvaluatorContextIfEmpty(DriverState driverState, EvaluatorContext ctx, String folder) { synchronized(driverState.contextMap) { if(ctx != null) { if(ctx.getScenarioInstances().size() > 0) { } else { driverState.contextMap.remove(folder); } } } }
void function(DriverState driverState, EvaluatorContext ctx, String folder) { synchronized(driverState.contextMap) { if(ctx != null) { if(ctx.getScenarioInstances().size() > 0) { } else { driverState.contextMap.remove(folder); } } } }
/** * Release the evaluator context if there are no active scenarios. * @param driverState DriverState * @param ctx EvaluatorContext * @param folder String */
Release the evaluator context if there are no active scenarios
releaseEvaluatorContextIfEmpty
{ "repo_name": "nguyentienlong/community-edition", "path": "projects/repository/source/java/org/alfresco/filesys/repo/NonTransactionalRuleContentDiskDriver.java", "license": "lgpl-3.0", "size": 23798 }
[ "org.alfresco.filesys.repo.rules.EvaluatorContext" ]
import org.alfresco.filesys.repo.rules.EvaluatorContext;
import org.alfresco.filesys.repo.rules.*;
[ "org.alfresco.filesys" ]
org.alfresco.filesys;
106,574
public List<HostRoleCommand> getAllTasksByRequestIds(Collection<Long> requestIds);
List<HostRoleCommand> function(Collection<Long> requestIds);
/** * Given a list of request ids, get all the tasks that belong to these requests */
Given a list of request ids, get all the tasks that belong to these requests
getAllTasksByRequestIds
{ "repo_name": "alexryndin/ambari", "path": "ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java", "license": "apache-2.0", "size": 7966 }
[ "java.util.Collection", "java.util.List" ]
import java.util.Collection; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
452,665
private static void closeStream(Closeable stream) { if(stream != null) { try { stream.close(); } catch(IOException e) { // Ignore } } }
static void function(Closeable stream) { if(stream != null) { try { stream.close(); } catch(IOException e) { } } }
/** * Closes the specified stream. * * @param stream The stream to close. */
Closes the specified stream
closeStream
{ "repo_name": "ivanovpv/darksms", "path": "psm/src/main/java/ru/ivanovpv/gorets/psm/Eula.java", "license": "apache-2.0", "size": 4736 }
[ "java.io.Closeable", "java.io.IOException" ]
import java.io.Closeable; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,736,466
public void testObjectMixin( ObjectWriterTester<BaseClass> writer ) { BaseClass bean = new BaseClass( "a", "b" ); String json = writer.write( bean ); assertEquals( "{\"b\":\"b\",\"hashCode\":" + bean.hashCode() + "}", json ); }
void function( ObjectWriterTester<BaseClass> writer ) { BaseClass bean = new BaseClass( "a", "b" ); String json = writer.write( bean ); assertEquals( "{\"b\":\"b\",\"hashCode\":" + bean.hashCode() + "}", json ); }
/** * Unit test for verifying that it is actually possible to attach * mix-in annotations to basic <code>Object.class</code>. This * will essentially apply to any and all Objects. */
Unit test for verifying that it is actually possible to attach mix-in annotations to basic <code>Object.class</code>. This will essentially apply to any and all Objects
testObjectMixin
{ "repo_name": "nmorel/gwt-jackson", "path": "gwt-jackson/src/test/java/com/github/nmorel/gwtjackson/shared/mixins/MixinSerForMethodsTester.java", "license": "apache-2.0", "size": 5788 }
[ "com.github.nmorel.gwtjackson.shared.ObjectWriterTester" ]
import com.github.nmorel.gwtjackson.shared.ObjectWriterTester;
import com.github.nmorel.gwtjackson.shared.*;
[ "com.github.nmorel" ]
com.github.nmorel;
1,166,569
void writeContainerEnd() throws IOException;
void writeContainerEnd() throws IOException;
/** * End writing a container. */
End writing a container
writeContainerEnd
{ "repo_name": "jdubrule/bond", "path": "java/core/src/main/java/org/bondlib/ProtocolWriter.java", "license": "mit", "size": 4355 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,665,704
T visitParExpression(@NotNull JavaParser.ParExpressionContext ctx);
T visitParExpression(@NotNull JavaParser.ParExpressionContext ctx);
/** * Visit a parse tree produced by {@link JavaParser#parExpression}. * @param ctx the parse tree * @return the visitor result */
Visit a parse tree produced by <code>JavaParser#parExpression</code>
visitParExpression
{ "repo_name": "hgkmail/HelloJava", "path": "src/cn/hgk/hellojava/JavaVisitor.java", "license": "gpl-2.0", "size": 22753 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
2,380,627
public void execute(TaskExecutionContext context) throws RuntimeException { Process p; try { p = exec(); } catch (IOException e) { throw new RuntimeException(toString() + " cannot be started", e); } InputStream in = buildInputStream(stdinFile); OutputStream out = buildOutputStream(stdoutFile); OutputStream err = buildOutputStream(stderrFile); if (in != null) { StreamBridge b = new StreamBridge(in, p.getOutputStream()); b.start(); } if (out != null) { StreamBridge b = new StreamBridge(p.getInputStream(), out); b.start(); } if (err != null) { StreamBridge b = new StreamBridge(p.getErrorStream(), err); b.start(); } int r; try { r = p.waitFor(); } catch (InterruptedException e) { throw new RuntimeException(toString() + " has been interrupted"); } finally { if (in != null) { try { in.close(); } catch (Throwable e) { } } if (out != null) { try { out.close(); } catch (Throwable e) { } } if (err != null) { try { err.close(); } catch (Throwable e) { } } p.destroy(); } if (r != 0) { throw new RuntimeException(toString() + " returns with error code " + r); } }
void function(TaskExecutionContext context) throws RuntimeException { Process p; try { p = exec(); } catch (IOException e) { throw new RuntimeException(toString() + STR, e); } InputStream in = buildInputStream(stdinFile); OutputStream out = buildOutputStream(stdoutFile); OutputStream err = buildOutputStream(stderrFile); if (in != null) { StreamBridge b = new StreamBridge(in, p.getOutputStream()); b.start(); } if (out != null) { StreamBridge b = new StreamBridge(p.getInputStream(), out); b.start(); } if (err != null) { StreamBridge b = new StreamBridge(p.getErrorStream(), err); b.start(); } int r; try { r = p.waitFor(); } catch (InterruptedException e) { throw new RuntimeException(toString() + STR); } finally { if (in != null) { try { in.close(); } catch (Throwable e) { } } if (out != null) { try { out.close(); } catch (Throwable e) { } } if (err != null) { try { err.close(); } catch (Throwable e) { } } p.destroy(); } if (r != 0) { throw new RuntimeException(toString() + STR + r); } }
/** * Implements {@link Task#execute(TaskExecutionContext)}. Runs the given * command as a separate process and waits for its end. */
Implements <code>Task#execute(TaskExecutionContext)</code>. Runs the given command as a separate process and waits for its end
execute
{ "repo_name": "ZobsDope/bankbot.old", "path": "src/main/java/it/sauronsoftware/cron4j/ProcessTask.java", "license": "gpl-2.0", "size": 10623 }
[ "java.io.IOException", "java.io.InputStream", "java.io.OutputStream" ]
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,889,166
void deleteSelectedExpenses(List<ExpenseDetail> expenses, RequestContext ctx);
void deleteSelectedExpenses(List<ExpenseDetail> expenses, RequestContext ctx);
/** * Delete selected expenses. * * @param expenses * @param ctx */
Delete selected expenses
deleteSelectedExpenses
{ "repo_name": "arunkpatra/expense-tracker", "path": "src/main/java/com/exp/tracker/services/api/ExpenseService.java", "license": "apache-2.0", "size": 3143 }
[ "com.exp.tracker.data.model.ExpenseDetail", "java.util.List", "org.springframework.webflow.execution.RequestContext" ]
import com.exp.tracker.data.model.ExpenseDetail; import java.util.List; import org.springframework.webflow.execution.RequestContext;
import com.exp.tracker.data.model.*; import java.util.*; import org.springframework.webflow.execution.*;
[ "com.exp.tracker", "java.util", "org.springframework.webflow" ]
com.exp.tracker; java.util; org.springframework.webflow;
1,678,249
Set<ConfiguredPropertyDescriptor> getConfiguredPropertiesByType(Class<?> type, boolean includeArrays);
Set<ConfiguredPropertyDescriptor> getConfiguredPropertiesByType(Class<?> type, boolean includeArrays);
/** * Gets all configuration properties of a particular type (including * subtypes) * * @see Configured * * @param type * the type of property to look for * @param includeArrays * a boolean indicating whether or not configuration properties * that are arrays of the provided type should be included * @return a set of properties that match the specified type query */
Gets all configuration properties of a particular type (including subtypes)
getConfiguredPropertiesByType
{ "repo_name": "datacleaner/DataCleaner", "path": "api/src/main/java/org/datacleaner/descriptors/ComponentDescriptor.java", "license": "lgpl-3.0", "size": 7033 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,366,501
private void processSelectedProduct() { Product selectedProduct = getSelectedProduct(); if (selectedProduct != null) { boolean isSentinel2 = StringHelper.startsWithIgnoreCase(selectedProduct.getProductType(), "S2_MSI_Level"); boolean isSpot = StringHelper.startsWithIgnoreCase(selectedProduct.getProductType(), "SPOTSCENE"); BindingContext bindingContext = getBindingContext(); PropertySet propertySet = bindingContext.getPropertySet(); propertySet.setDefaultValues(); String propertyName = "solarIrradiance"; if (bindingContext.getBinding(propertyName) != null) { bindingContext.setComponentsEnabled(propertyName, !(isSentinel2 || isSpot)); } propertyName = "incidenceAngle"; if (bindingContext.getBinding(propertyName) != null) { bindingContext.setComponentsEnabled(propertyName, !isSentinel2); if (isSpot) { propertySet.setValue(propertyName, ReflectanceToRadianceOp.extractIncidenceAngleFromSpotProduct(selectedProduct)); } } propertyName = "u"; if (bindingContext.getBinding(propertyName) != null) { if (isSentinel2) { propertySet.setValue(propertyName, ReflectanceToRadianceOp.extractUFromSentinelProduct(selectedProduct)); } bindingContext.setComponentsEnabled(propertyName, true); } } }
void function() { Product selectedProduct = getSelectedProduct(); if (selectedProduct != null) { boolean isSentinel2 = StringHelper.startsWithIgnoreCase(selectedProduct.getProductType(), STR); boolean isSpot = StringHelper.startsWithIgnoreCase(selectedProduct.getProductType(), STR); BindingContext bindingContext = getBindingContext(); PropertySet propertySet = bindingContext.getPropertySet(); propertySet.setDefaultValues(); String propertyName = STR; if (bindingContext.getBinding(propertyName) != null) { bindingContext.setComponentsEnabled(propertyName, !(isSentinel2 isSpot)); } propertyName = STR; if (bindingContext.getBinding(propertyName) != null) { bindingContext.setComponentsEnabled(propertyName, !isSentinel2); if (isSpot) { propertySet.setValue(propertyName, ReflectanceToRadianceOp.extractIncidenceAngleFromSpotProduct(selectedProduct)); } } propertyName = "u"; if (bindingContext.getBinding(propertyName) != null) { if (isSentinel2) { propertySet.setValue(propertyName, ReflectanceToRadianceOp.extractUFromSentinelProduct(selectedProduct)); } bindingContext.setComponentsEnabled(propertyName, true); } } }
/** * Sets the incidence angle and the quantification value according to the selected product. */
Sets the incidence angle and the quantification value according to the selected product
processSelectedProduct
{ "repo_name": "oscarpicas/s2tbx", "path": "s2tbx-reflectance-to-radiance-ui/src/main/java/org/esa/s2tbx/reflectance2radiance/ReflectanceTargetProductDialog.java", "license": "gpl-3.0", "size": 4126 }
[ "com.bc.ceres.binding.PropertySet", "com.bc.ceres.swing.binding.BindingContext", "org.esa.snap.core.datamodel.Product", "org.esa.snap.utils.StringHelper" ]
import com.bc.ceres.binding.PropertySet; import com.bc.ceres.swing.binding.BindingContext; import org.esa.snap.core.datamodel.Product; import org.esa.snap.utils.StringHelper;
import com.bc.ceres.binding.*; import com.bc.ceres.swing.binding.*; import org.esa.snap.core.datamodel.*; import org.esa.snap.utils.*;
[ "com.bc.ceres", "org.esa.snap" ]
com.bc.ceres; org.esa.snap;
345,304
public void addHook(String hook, Hook func) { if (!hooks.containsKey(hook) || hooks.get(hook) == null) { hooks.put(hook, new ArrayList<Hook>()); } boolean found = false; for (Hook h : hooks.get(hook)) { if (func.equals(h)) { found = true; break; } } if (!found) { hooks.get(hook).add(func); } }
void function(String hook, Hook func) { if (!hooks.containsKey(hook) hooks.get(hook) == null) { hooks.put(hook, new ArrayList<Hook>()); } boolean found = false; for (Hook h : hooks.get(hook)) { if (func.equals(h)) { found = true; break; } } if (!found) { hooks.get(hook).add(func); } }
/** * Add a function to hook. Ignore if already on hook. * * @param hook The name of the hook. * @param func A class implements interface Hook and contains the function to add. */
Add a function to hook. Ignore if already on hook
addHook
{ "repo_name": "vstabile/chinese-flashcards-android", "path": "src/com/hichinaschool/flashcards/libanki/hooks/Hooks.java", "license": "gpl-3.0", "size": 5148 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,338,007
@POST @Produces(MediaType.APPLICATION_JSON) public Response addCondicionesZona(@HeaderParam("condicion") String condicion, @HeaderParam("zona") String zona,@HeaderParam("usuarioId")Long usuarioId) { condicion=condicion.replaceAll(RotondAndesTM.SPACE, " "); zona=zona.replaceAll(RotondAndesTM.SPACE, " "); RotondAndesTM tm = new RotondAndesTM(getPath()); try { UsuarioMinimum u = tm.usuarioBuscarUsuarioMinimumPorId( usuarioId ); if(!(u.getRol().equals(Rol.OPERADOR) || u.getRol().equals(Rol.ORGANIZADORES))) { throw new Exception("El usuario no tiene permitido usar el sistema"); } tm.condicionZonaInsertarPorCondicionYZona(condicion, zona); } catch (Exception e) { return Response.status(500).entity(doErrorMessage(e)).build(); } return Response.status(200).entity(zona).build(); }
@Produces(MediaType.APPLICATION_JSON) Response function(@HeaderParam(STR) String condicion, @HeaderParam("zona") String zona,@HeaderParam(STR)Long usuarioId) { condicion=condicion.replaceAll(RotondAndesTM.SPACE, " "); zona=zona.replaceAll(RotondAndesTM.SPACE, " "); RotondAndesTM tm = new RotondAndesTM(getPath()); try { UsuarioMinimum u = tm.usuarioBuscarUsuarioMinimumPorId( usuarioId ); if(!(u.getRol().equals(Rol.OPERADOR) u.getRol().equals(Rol.ORGANIZADORES))) { throw new Exception(STR); } tm.condicionZonaInsertarPorCondicionYZona(condicion, zona); } catch (Exception e) { return Response.status(500).entity(doErrorMessage(e)).build(); } return Response.status(200).entity(zona).build(); }
/** * Metodo que expone servicio REST usando POST que agrega la zona que recibe en Json * <b>URL: </b> http://"ip o nombre de host":8080/CondicionesZonaAndes/rest/zonas/zona * @param zona - zona a agregar * @param condicion - condición a agregar * @param usuarioId Id del usuario que realiza la solicitud. * @return Json con la zona que agrego o Json con el error que se produjo */
Metodo que expone servicio REST usando POST que agrega la zona que recibe en Json
addCondicionesZona
{ "repo_name": "js-diaz/sistrans", "path": "src/rest/CondicionZonaServices.java", "license": "mit", "size": 11093 }
[ "javax.ws.rs.HeaderParam", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response" ]
import javax.ws.rs.HeaderParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "javax.ws" ]
javax.ws;
835,509
public void setDefaultText(String v) { if (!ObjectUtils.equals(this.defaultText, v)) { this.defaultText = v; setModified(true); } }
void function(String v) { if (!ObjectUtils.equals(this.defaultText, v)) { this.defaultText = v; setModified(true); } }
/** * Set the value of DefaultText * * @param v new value */
Set the value of DefaultText
setDefaultText
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTTextBoxSettings.java", "license": "gpl-3.0", "size": 59636 }
[ "org.apache.commons.lang.ObjectUtils" ]
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.*;
[ "org.apache.commons" ]
org.apache.commons;
2,001,098
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
collectNewChildDescriptors
{ "repo_name": "FraunhoferESK/ernest-eclipse-integration", "path": "de.fraunhofer.esk.ernest.core.analysismodel.edit/src/ernest/architecture/provider/ActuatorItemProvider.java", "license": "epl-1.0", "size": 3167 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,561,207
public Boxing withIntent(Context context, Class<?> cls, ArrayList<? extends BaseMedia> selectedMedias) { mIntent.setClass(context, cls); if (selectedMedias != null && !selectedMedias.isEmpty()) { mIntent.putExtra(EXTRA_SELECTED_MEDIA, selectedMedias); } return this; }
Boxing function(Context context, Class<?> cls, ArrayList<? extends BaseMedia> selectedMedias) { mIntent.setClass(context, cls); if (selectedMedias != null && !selectedMedias.isEmpty()) { mIntent.putExtra(EXTRA_SELECTED_MEDIA, selectedMedias); } return this; }
/** * {@link Intent#setClass(Context, Class)} with input medias. */
<code>Intent#setClass(Context, Class)</code> with input medias
withIntent
{ "repo_name": "backustech/boxing", "path": "boxing/src/main/java/com/bilibili/boxing/Boxing.java", "license": "apache-2.0", "size": 8562 }
[ "android.content.Context", "com.bilibili.boxing.model.entity.BaseMedia", "java.util.ArrayList" ]
import android.content.Context; import com.bilibili.boxing.model.entity.BaseMedia; import java.util.ArrayList;
import android.content.*; import com.bilibili.boxing.model.entity.*; import java.util.*;
[ "android.content", "com.bilibili.boxing", "java.util" ]
android.content; com.bilibili.boxing; java.util;
1,690,295
public Field getExtraField();
Field function();
/** * * get extra field * * @return */
get extra field
getExtraField
{ "repo_name": "mztaylor/rice-git", "path": "rice-middleware/kns/src/main/java/org/kuali/rice/kns/lookup/Lookupable.java", "license": "apache-2.0", "size": 8341 }
[ "org.kuali.rice.kns.web.ui.Field" ]
import org.kuali.rice.kns.web.ui.Field;
import org.kuali.rice.kns.web.ui.*;
[ "org.kuali.rice" ]
org.kuali.rice;
737,504
@Override public DataDrivenParameterArray calculateParameterArray(final String className, final DataDrivenParameterArray inputParameterArray) { //need to have input array DataDrivenParameterArray transferArray = inputParameterArray; //need to change it, as we cannot touch the input array if (transferArray == null) { // we do not have, so then we have to simulate the data driven approach transferArray = new DataDrivenParameterArray(); String[] parameterNames = new String[1]; parameterNames[0] = "MULTIPLIER"; transferArray.setParameterNames(parameterNames); String[] newRow = new String[1]; newRow[0] = ""; transferArray.put(0, newRow); //put the only row into the input array } // now we have the transfer parameter array, for sure //recalculate the parent array DataDrivenParameterArray newArray = new DataDrivenParameterArray(); Integer arrayKey = 0; //this will be our new key for (int i = 1; i <= multiplier; i++) { //as this feeder is a multiplier //iterate through to old array and add the same value to every row for (String[] original : transferArray.values()) { String[] newRow = new String[original.length]; System.arraycopy(original, 0, newRow, 0, original.length); newRow[0] = original[0] + " - #" + i; newArray.put(arrayKey, newRow); //put the new row into the new array arrayKey++; //prepare the next key } } //plus we should recreate the parameter names newArray.setParameterNames(transferArray.getParameterNames()); return newArray; }
DataDrivenParameterArray function(final String className, final DataDrivenParameterArray inputParameterArray) { DataDrivenParameterArray transferArray = inputParameterArray; if (transferArray == null) { transferArray = new DataDrivenParameterArray(); String[] parameterNames = new String[1]; parameterNames[0] = STR; transferArray.setParameterNames(parameterNames); String[] newRow = new String[1]; newRow[0] = STR - #" + i; newArray.put(arrayKey, newRow); arrayKey++; } } newArray.setParameterNames(transferArray.getParameterNames()); return newArray; }
/** * This Data Feeder just multiplies the data as many times as requested in the parameter. * @param className is the name of the caller test class * @param inputParameterArray is the original data parameter array * @return with the updated data parameter array */
This Data Feeder just multiplies the data as many times as requested in the parameter
calculateParameterArray
{ "repo_name": "epam/Wilma", "path": "wilma-functionaltest/src/main/java/com/epam/gepard/datadriven/feeders/BruteMultiplierDataFeeder.java", "license": "gpl-3.0", "size": 4145 }
[ "com.epam.gepard.datadriven.DataDrivenParameterArray" ]
import com.epam.gepard.datadriven.DataDrivenParameterArray;
import com.epam.gepard.datadriven.*;
[ "com.epam.gepard" ]
com.epam.gepard;
683,644
DiskImage getAncestor(Guid id, Guid userID, boolean isFiltered);
DiskImage getAncestor(Guid id, Guid userID, boolean isFiltered);
/** * Retrieves the ancestor of the given image (or the image itself, if it has no ancestors). * * @param id * the id of the image to get the ancestor for. * @param userID * the ID of the user requesting the information * @param isFiltered * Whether the results should be filtered according to the user's permissions * @return The ancestral image. */
Retrieves the ancestor of the given image (or the image itself, if it has no ancestors)
getAncestor
{ "repo_name": "OpenUniversity/ovirt-engine", "path": "backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/DiskImageDao.java", "license": "apache-2.0", "size": 4296 }
[ "org.ovirt.engine.core.common.businessentities.storage.DiskImage", "org.ovirt.engine.core.compat.Guid" ]
import org.ovirt.engine.core.common.businessentities.storage.DiskImage; import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.common.businessentities.storage.*; import org.ovirt.engine.core.compat.*;
[ "org.ovirt.engine" ]
org.ovirt.engine;
2,423,616
private void storeKeys(String key, String secret) { // Save the access key for later SharedPreferences prefs = mContext.getSharedPreferences(ACCOUNT_PREFS_NAME, 0); Editor edit = prefs.edit(); edit.putString(ACCESS_KEY_NAME, key); edit.putString(ACCESS_SECRET_NAME, secret); edit.commit(); }
void function(String key, String secret) { SharedPreferences prefs = mContext.getSharedPreferences(ACCOUNT_PREFS_NAME, 0); Editor edit = prefs.edit(); edit.putString(ACCESS_KEY_NAME, key); edit.putString(ACCESS_SECRET_NAME, secret); edit.commit(); }
/** * Shows keeping the access keys returned from Trusted Authenticator in a local * store, rather than storing user name & password, and re-authenticating each * time (which is not to be done, ever). */
Shows keeping the access keys returned from Trusted Authenticator in a local store, rather than storing user name & password, and re-authenticating each time (which is not to be done, ever)
storeKeys
{ "repo_name": "Git-Host/DropboxText", "path": "src/com/dropBoxText/alexVasquez/DropBox.java", "license": "mit", "size": 12076 }
[ "android.content.SharedPreferences" ]
import android.content.SharedPreferences;
import android.content.*;
[ "android.content" ]
android.content;
989,911
public static Builder builder(KeyStoreConfig keystore) { return new Builder(keystore); } public static class Builder { private final Configurable<? extends Configuration> jaxrsConfig; private final KeyStoreConfig keyStoreConfig; private int socketTimeoutMs = DEFAULT_SOCKET_TIMEOUT_MS; private int connectTimeoutMs = DEFAULT_CONNECT_TIMEOUT_MS; private Optional<String> customUserAgentPart = Optional.empty(); private URI serviceRoot = ServiceUri.PRODUCTION.uri; private Optional<Sender> globalSender = Optional.empty(); private Iterable<String> certificatePaths = Certificates.PRODUCTION.certificatePaths; private CertificateChainValidation serverCertificateTrustStrategy = new OrganizationNumberValidation("984661185"); // Posten Norge AS organization number private Optional<LoggingFeature> loggingFeature = Optional.empty(); private List<DocumentBundleProcessor> documentBundleProcessors = new ArrayList<>(); private Clock clock = Clock.systemDefaultZone(); private Builder(KeyStoreConfig keyStoreConfig) { this.keyStoreConfig = keyStoreConfig; this.jaxrsConfig = new ClientConfig(); }
static Builder function(KeyStoreConfig keystore) { return new Builder(keystore); } public static class Builder { private final Configurable<? extends Configuration> jaxrsConfig; private final KeyStoreConfig keyStoreConfig; private int socketTimeoutMs = DEFAULT_SOCKET_TIMEOUT_MS; private int connectTimeoutMs = DEFAULT_CONNECT_TIMEOUT_MS; private Optional<String> customUserAgentPart = Optional.empty(); private URI serviceRoot = ServiceUri.PRODUCTION.uri; private Optional<Sender> globalSender = Optional.empty(); private Iterable<String> certificatePaths = Certificates.PRODUCTION.certificatePaths; private CertificateChainValidation serverCertificateTrustStrategy = new OrganizationNumberValidation(STR); private Optional<LoggingFeature> loggingFeature = Optional.empty(); private List<DocumentBundleProcessor> documentBundleProcessors = new ArrayList<>(); private Clock clock = Clock.systemDefaultZone(); private Builder(KeyStoreConfig keyStoreConfig) { this.keyStoreConfig = keyStoreConfig; this.jaxrsConfig = new ClientConfig(); }
/** * Build a new {@link ClientConfiguration}. */
Build a new <code>ClientConfiguration</code>
builder
{ "repo_name": "digipost/signature-api-client-java", "path": "src/main/java/no/digipost/signature/client/ClientConfiguration.java", "license": "apache-2.0", "size": 18599 }
[ "java.time.Clock", "java.util.ArrayList", "java.util.List", "java.util.Optional", "javax.ws.rs.core.Configurable", "javax.ws.rs.core.Configuration", "no.digipost.signature.client.asice.DocumentBundleProcessor", "no.digipost.signature.client.core.Sender", "no.digipost.signature.client.security.CertificateChainValidation", "no.digipost.signature.client.security.KeyStoreConfig", "no.digipost.signature.client.security.OrganizationNumberValidation", "org.glassfish.jersey.client.ClientConfig", "org.glassfish.jersey.logging.LoggingFeature" ]
import java.time.Clock; import java.util.ArrayList; import java.util.List; import java.util.Optional; import javax.ws.rs.core.Configurable; import javax.ws.rs.core.Configuration; import no.digipost.signature.client.asice.DocumentBundleProcessor; import no.digipost.signature.client.core.Sender; import no.digipost.signature.client.security.CertificateChainValidation; import no.digipost.signature.client.security.KeyStoreConfig; import no.digipost.signature.client.security.OrganizationNumberValidation; import org.glassfish.jersey.client.ClientConfig; import org.glassfish.jersey.logging.LoggingFeature;
import java.time.*; import java.util.*; import javax.ws.rs.core.*; import no.digipost.signature.client.asice.*; import no.digipost.signature.client.core.*; import no.digipost.signature.client.security.*; import org.glassfish.jersey.client.*; import org.glassfish.jersey.logging.*;
[ "java.time", "java.util", "javax.ws", "no.digipost.signature", "org.glassfish.jersey" ]
java.time; java.util; javax.ws; no.digipost.signature; org.glassfish.jersey;
943,174
public static String getDateAndTime(long date) { GregorianCalendar g = new GregorianCalendar(); g.setTimeInMillis(date); int year = g.get(Calendar.YEAR); int month = g.get(Calendar.MONTH) + 1; int day = g.get(Calendar.DAY_OF_MONTH); int hour = g.get(Calendar.HOUR_OF_DAY); int min = g.get(Calendar.MINUTE); int sec = g.get(Calendar.SECOND); String mS = String.valueOf(month); String dS = String.valueOf(day); String hS = String.valueOf(hour); String minS = String.valueOf(min); String sS = String.valueOf(sec); mS = mS.length() < 2 ? "0" + mS : mS; dS = dS.length() < 2 ? "0" + dS : dS; hS = hS.length() < 2 ? "0" + hS : hS; minS = minS.length() < 2 ? "0" + minS : minS; sS = sS.length() < 2 ? "0" + sS : sS; return dS + "." + mS + "." + year + "-" + hS + ":" + minS + ":" + sS; }
static String function(long date) { GregorianCalendar g = new GregorianCalendar(); g.setTimeInMillis(date); int year = g.get(Calendar.YEAR); int month = g.get(Calendar.MONTH) + 1; int day = g.get(Calendar.DAY_OF_MONTH); int hour = g.get(Calendar.HOUR_OF_DAY); int min = g.get(Calendar.MINUTE); int sec = g.get(Calendar.SECOND); String mS = String.valueOf(month); String dS = String.valueOf(day); String hS = String.valueOf(hour); String minS = String.valueOf(min); String sS = String.valueOf(sec); mS = mS.length() < 2 ? "0" + mS : mS; dS = dS.length() < 2 ? "0" + dS : dS; hS = hS.length() < 2 ? "0" + hS : hS; minS = minS.length() < 2 ? "0" + minS : minS; sS = sS.length() < 2 ? "0" + sS : sS; return dS + "." + mS + "." + year + "-" + hS + ":" + minS + ":" + sS; }
/** * Get a date string in local format for a specific date. * * @param date * The date in millis. * @return The formatted date string. */
Get a date string in local format for a specific date
getDateAndTime
{ "repo_name": "dtag-dbu/speechalyzer", "path": "src/FelixUtil/src/com/felix/util/Util.java", "license": "lgpl-2.1", "size": 19087 }
[ "java.util.Calendar", "java.util.GregorianCalendar" ]
import java.util.Calendar; import java.util.GregorianCalendar;
import java.util.*;
[ "java.util" ]
java.util;
2,914,310
public String[] searchSubreddits(String startswith, boolean withNSFW) throws RedditEngineException{ StringBuilder path = new StringBuilder(); path.append("/api/search_reddit_names"); String url = UrlUtils.getGetUrl(path.toString()); List<NameValuePair> params = new ArrayList<NameValuePair>(); if (startswith != null) { params.add(new BasicNameValuePair("query", startswith)); } params.add(new BasicNameValuePair("include_over_18", String.valueOf(withNSFW))); List<String> names = new ArrayList<String>(); try { SimpleHttpClient client = SimpleHttpClient.getInstance(); InputStream in = client.post(url, params); // TODO make a wrapper class from this? Map<String, List<String>> maplist = GsonTemplate.fromInputStream(in, Map.class); in.close(); names = maplist.get("names"); } catch (ClientProtocolException e) { throw new RedditEngineException(e); } catch (IOException e) { throw new RedditEngineException(e); } catch (UnexpectedHttpResponseException e) { throw new RedditEngineException(e); } return names.toArray(new String[names.size()]); }
String[] function(String startswith, boolean withNSFW) throws RedditEngineException{ StringBuilder path = new StringBuilder(); path.append(STR); String url = UrlUtils.getGetUrl(path.toString()); List<NameValuePair> params = new ArrayList<NameValuePair>(); if (startswith != null) { params.add(new BasicNameValuePair("query", startswith)); } params.add(new BasicNameValuePair(STR, String.valueOf(withNSFW))); List<String> names = new ArrayList<String>(); try { SimpleHttpClient client = SimpleHttpClient.getInstance(); InputStream in = client.post(url, params); Map<String, List<String>> maplist = GsonTemplate.fromInputStream(in, Map.class); in.close(); names = maplist.get("names"); } catch (ClientProtocolException e) { throw new RedditEngineException(e); } catch (IOException e) { throw new RedditEngineException(e); } catch (UnexpectedHttpResponseException e) { throw new RedditEngineException(e); } return names.toArray(new String[names.size()]); }
/** * List subreddit names that begin with a query string * * @param startswith a string up to 50 characters long, consisting of printable characters * @param withNSFW boolean value * @return subreddit names * @throws RedditEngineException */
List subreddit names that begin with a query string
searchSubreddits
{ "repo_name": "fizzl/RedditEngine", "path": "src/net/fizzl/redditengine/impl/SubredditsApi.java", "license": "lgpl-3.0", "size": 14459 }
[ "java.io.IOException", "java.io.InputStream", "java.util.ArrayList", "java.util.List", "java.util.Map", "net.fizzl.redditengine.data.GsonTemplate", "org.apache.http.NameValuePair", "org.apache.http.client.ClientProtocolException", "org.apache.http.message.BasicNameValuePair" ]
import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.Map; import net.fizzl.redditengine.data.GsonTemplate; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.message.BasicNameValuePair;
import java.io.*; import java.util.*; import net.fizzl.redditengine.data.*; import org.apache.http.*; import org.apache.http.client.*; import org.apache.http.message.*;
[ "java.io", "java.util", "net.fizzl.redditengine", "org.apache.http" ]
java.io; java.util; net.fizzl.redditengine; org.apache.http;
334,470
void remove(String key) throws UnexplainableDatabaseServiceException;
void remove(String key) throws UnexplainableDatabaseServiceException;
/** * Remove data. * * @param key */
Remove data
remove
{ "repo_name": "clement-elbaz/somedamnmusic", "path": "src/main/java/com/somedamnmusic/apis/DatabaseService.java", "license": "apache-2.0", "size": 1038 }
[ "com.somedamnmusic.database.UnexplainableDatabaseServiceException" ]
import com.somedamnmusic.database.UnexplainableDatabaseServiceException;
import com.somedamnmusic.database.*;
[ "com.somedamnmusic.database" ]
com.somedamnmusic.database;
1,652,271
public List<Class> getAnnotationTypes() { List<Class> types = new ArrayList<Class>(); Iterator<JCheckBox> i = annotationTypes.keySet().iterator(); JCheckBox box; if (!withAnnotation.isSelected()) { while (i.hasNext()) { box = i.next(); types.add(annotationTypes.get(box)); } } else { while (i.hasNext()) { box = i.next(); if (!box.isSelected()) types.add(annotationTypes.get(box)); } } return types; }
List<Class> function() { List<Class> types = new ArrayList<Class>(); Iterator<JCheckBox> i = annotationTypes.keySet().iterator(); JCheckBox box; if (!withAnnotation.isSelected()) { while (i.hasNext()) { box = i.next(); types.add(annotationTypes.get(box)); } } else { while (i.hasNext()) { box = i.next(); if (!box.isSelected()) types.add(annotationTypes.get(box)); } } return types; }
/** * Returns the types of annotations to keep. * * @return See above. */
Returns the types of annotations to keep
getAnnotationTypes
{ "repo_name": "simleo/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/treeviewer/view/DeleteBox.java", "license": "gpl-2.0", "size": 12271 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "javax.swing.JCheckBox" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.swing.JCheckBox;
import java.util.*; import javax.swing.*;
[ "java.util", "javax.swing" ]
java.util; javax.swing;
1,750,376
Stream<TargetType> map(Collection<? extends SourceType> source, Supplier<TargetType> supplier);
Stream<TargetType> map(Collection<? extends SourceType> source, Supplier<TargetType> supplier);
/** * Do map if you have collection of source objects. * * @param source * @param supplier * supplier eg. Target::new * @return Stream of target objects */
Do map if you have collection of source objects
map
{ "repo_name": "rpridal/J8Mapper", "path": "src/main/java/cz/rpridal/j8mapper/mapper/Mapper.java", "license": "gpl-2.0", "size": 1893 }
[ "java.util.Collection", "java.util.function.Supplier", "java.util.stream.Stream" ]
import java.util.Collection; import java.util.function.Supplier; import java.util.stream.Stream;
import java.util.*; import java.util.function.*; import java.util.stream.*;
[ "java.util" ]
java.util;
2,200,664
public void close() { serialPort.removeEventListener(); IOUtils.closeQuietly(inputStream); IOUtils.closeQuietly(outputStream); serialPort.close(); } } public static class PollJob implements Job {
void function() { serialPort.removeEventListener(); IOUtils.closeQuietly(inputStream); IOUtils.closeQuietly(outputStream); serialPort.close(); } } public static class PollJob implements Job {
/** * Close this serial device */
Close this serial device
close
{ "repo_name": "falkena/openhab", "path": "bundles/binding/org.openhab.binding.oceanic/src/main/java/org/openhab/binding/oceanic/internal/OceanicBinding.java", "license": "epl-1.0", "size": 23830 }
[ "org.apache.commons.io.IOUtils", "org.quartz.Job" ]
import org.apache.commons.io.IOUtils; import org.quartz.Job;
import org.apache.commons.io.*; import org.quartz.*;
[ "org.apache.commons", "org.quartz" ]
org.apache.commons; org.quartz;
2,140,540
public RelBuilder scan(String... tableNames) { return scan(ImmutableList.copyOf(tableNames)); }
RelBuilder function(String... tableNames) { return scan(ImmutableList.copyOf(tableNames)); }
/** Creates a {@link TableScan} of the table * with a given name. * * <p>Throws if the table does not exist. * * <p>Returns this builder. * * @param tableNames Name of table (can optionally be qualified) */
Creates a <code>TableScan</code> of the table with a given name. Throws if the table does not exist. Returns this builder
scan
{ "repo_name": "xhoong/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/tools/RelBuilder.java", "license": "apache-2.0", "size": 108300 }
[ "com.google.common.collect.ImmutableList" ]
import com.google.common.collect.ImmutableList;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
1,988,045
protected static boolean isHashCodeMethod(Method method) { return method.getReturnType() == int.class && method.getParameterTypes().length == 0 && method.getName().equals("hashCode"); }
static boolean function(Method method) { return method.getReturnType() == int.class && method.getParameterTypes().length == 0 && method.getName().equals(STR); }
/** * Checks if the method is derived from Object.hashCode() * * @param method * method being tested * @return true if the method is defined from Object.hashCode(), false otherwise */
Checks if the method is derived from Object.hashCode()
isHashCodeMethod
{ "repo_name": "astubbs/wicket.get-portals2", "path": "wicket-ioc/src/main/java/org/apache/wicket/proxy/LazyInitProxyFactory.java", "license": "apache-2.0", "size": 14116 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,143,697
private static String readResourcesFile(final String fileName) throws IOException { final InputStream inputStream = TestUtils.class.getResourceAsStream(fileName); final ByteArrayOutputStream result = new ByteArrayOutputStream(); final byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer)) != -1) { result.write(buffer, 0, length); } return result.toString("UTF-8"); }
static String function(final String fileName) throws IOException { final InputStream inputStream = TestUtils.class.getResourceAsStream(fileName); final ByteArrayOutputStream result = new ByteArrayOutputStream(); final byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer)) != -1) { result.write(buffer, 0, length); } return result.toString("UTF-8"); }
/** * This method can only load a resource placed in the same package as this java file * inside the test resources folder * @param fileName Name of the file to read from disk * @return Text representation of the contents of the file * @throws IOException In case something went wrong reading the file from disk */
This method can only load a resource placed in the same package as this java file inside the test resources folder
readResourcesFile
{ "repo_name": "sebaslogen/Blendletje", "path": "app/src/testShared/java/utils/TestUtils.java", "license": "mit", "size": 2101 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException", "java.io.InputStream" ]
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,985,132
public void checkDatabase() { try { this.getConnection().createStatement().execute("CREATE TABLE IF NOT EXISTS permissionDataP(uuid VARCHAR(255), groupname VARCHAR(255), selfpermissions LONGTEXT)"); this.getConnection().createStatement().execute("CREATE TABLE IF NOT EXISTS permissionDataG(groupname VARCHAR(255), permissions LONGTEXT)"); ResultSet rs = this.getPreparedStatement("SELECT COUNT(*) FROM permissionDataG WHERE groupname='default';").executeQuery(); rs.next(); if (rs.getInt(1) == 0) { this.getConnection().createStatement().execute("INSERT INTO permissionDataG (groupname, permissions) VALUES('default', '')"); } ResultSet rs1 = this.getPreparedStatement("SELECT COUNT(*) FROM permissionDataG WHERE groupname='Owner';").executeQuery(); rs1.next(); if (rs1.getInt(1) == 0) { this.getConnection().createStatement().execute("INSERT INTO permissionDataG (groupname, permissions) VALUES('Owner', '')"); } Main.getInstance().getLogger().log(Level.INFO, "Successfully connected to the PermissionsAPI database!"); } catch (SQLException | ClassNotFoundException e) { e.printStackTrace(); System.out.println("--------------------------------------------"); System.out.println("*FATAL* Could not connect to the PermissionsAPI database! Disabling plugin... *FATAL*"); System.out.println("--------------------------------------------"); Main.getInstance().getPluginLoader().disablePlugin(Main.getInstance()); } }
void function() { try { this.getConnection().createStatement().execute(STR); this.getConnection().createStatement().execute(STR); ResultSet rs = this.getPreparedStatement(STR).executeQuery(); rs.next(); if (rs.getInt(1) == 0) { this.getConnection().createStatement().execute(STR); } ResultSet rs1 = this.getPreparedStatement(STR).executeQuery(); rs1.next(); if (rs1.getInt(1) == 0) { this.getConnection().createStatement().execute(STR); } Main.getInstance().getLogger().log(Level.INFO, STR); } catch (SQLException ClassNotFoundException e) { e.printStackTrace(); System.out.println(STR); System.out.println(STR); System.out.println(STR); Main.getInstance().getPluginLoader().disablePlugin(Main.getInstance()); } }
/** * Check the Database */
Check the Database
checkDatabase
{ "repo_name": "ModernDayPlayer/Permissions", "path": "src/main/java/me/legitmodern/PermissionsAPI/Utils/SQL/DatabaseManager.java", "license": "mit", "size": 7766 }
[ "java.sql.ResultSet", "java.sql.SQLException", "java.util.logging.Level", "me.legitmodern.PermissionsAPI" ]
import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import me.legitmodern.PermissionsAPI;
import java.sql.*; import java.util.logging.*; import me.legitmodern.*;
[ "java.sql", "java.util", "me.legitmodern" ]
java.sql; java.util; me.legitmodern;
415,941
protected Options setOptions() { Options options = setBaseOptions(new Options()); // Note: // Command line options already provided by RBNBBase include: // -h "Print help" // -s "RBNB Server Hostname" // -p "RBNB Server Port Number" // -S "RBNB Source Name" // -v "Print Version information" // Command line options already provided by RBNBSource include: // -z "Cache size" // -Z "Archive size" // add command line options here options.addOption("H", true, "Source host name or IP e.g. " + getHostName()); options.addOption("C", true, "RBNB source channel name e.g. " + getRBNBChannelName()); options.addOption("s", true, "RBNB Server Hostname"); options.addOption("p", true, "RBNB Server Port Number"); return options; }
Options function() { Options options = setBaseOptions(new Options()); options.addOption("H", true, STR + getHostName()); options.addOption("C", true, STR + getRBNBChannelName()); options.addOption("s", true, STR); options.addOption("p", true, STR); return options; }
/** * A method that sets the command line options for this class. This method * calls the <code>RBNBSource.setBaseOptions()</code> method in order to set * properties such as the sourceHostName, sourceHostPort, serverName, and * serverPort. * * @return options The command line options being set */
A method that sets the command line options for this class. This method calls the <code>RBNBSource.setBaseOptions()</code> method in order to set properties such as the sourceHostName, sourceHostPort, serverName, and serverPort
setOptions
{ "repo_name": "csjx/realtime-data", "path": "src/main/java/edu/hawaii/soest/hioos/storx/StorXDispatcher.java", "license": "gpl-2.0", "size": 43862 }
[ "org.apache.commons.cli.Options" ]
import org.apache.commons.cli.Options;
import org.apache.commons.cli.*;
[ "org.apache.commons" ]
org.apache.commons;
1,693,623
@Deprecated public static <K, V> ListMultimap<K, V> unmodifiableListMultimap( ImmutableListMultimap<K, V> delegate) { return checkNotNull(delegate); }
@Deprecated static <K, V> ListMultimap<K, V> function( ImmutableListMultimap<K, V> delegate) { return checkNotNull(delegate); }
/** * Simply returns its argument. * * @deprecated no need to use this * @since 10.0 */
Simply returns its argument
unmodifiableListMultimap
{ "repo_name": "user234/setyon-guava-libraries-clone", "path": "guava/src/com/google/common/collect/Multimaps.java", "license": "apache-2.0", "size": 95760 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
497,080
return Sync4jModule; } private Sync4jConnector Sync4jConnector;
return Sync4jModule; } private Sync4jConnector Sync4jConnector;
/** * Returns property Sync4jModule */
Returns property Sync4jModule
getSync4jModule
{ "repo_name": "accesstest3/cfunambol", "path": "admin-suite/admin/src/com/funambol/admin/module/nodes/SyncSourceExceptionNode.java", "license": "agpl-3.0", "size": 9173 }
[ "com.funambol.framework.server.Sync4jConnector", "com.funambol.framework.server.Sync4jModule" ]
import com.funambol.framework.server.Sync4jConnector; import com.funambol.framework.server.Sync4jModule;
import com.funambol.framework.server.*;
[ "com.funambol.framework" ]
com.funambol.framework;
2,321,521
public void downloadFile(final String path, final DownloadListener downloadListener) throws IOException, ServerException { Link link = cloudApi.getDownloadLink(path); new RestClientIO(client, credentials.getHeaders()) .downloadUrl(link.getHref(), downloadListener); }
void function(final String path, final DownloadListener downloadListener) throws IOException, ServerException { Link link = cloudApi.getDownloadLink(path); new RestClientIO(client, credentials.getHeaders()) .downloadUrl(link.getHref(), downloadListener); }
/** * Downloading a file from Disk * * @see <p>API reference <a href="http://api.yandex.com/disk/api/reference/content.xml">english</a>, * <a href="https://tech.yandex.ru/disk/api/reference/content-docpage/">russian</a></p> */
Downloading a file from Disk
downloadFile
{ "repo_name": "yandex-disk/yandex-disk-restapi-java", "path": "disk-restapi-sdk/src/main/java/com/yandex/disk/rest/RestClient.java", "license": "apache-2.0", "size": 19562 }
[ "com.yandex.disk.rest.exceptions.ServerException", "com.yandex.disk.rest.json.Link", "java.io.IOException" ]
import com.yandex.disk.rest.exceptions.ServerException; import com.yandex.disk.rest.json.Link; import java.io.IOException;
import com.yandex.disk.rest.exceptions.*; import com.yandex.disk.rest.json.*; import java.io.*;
[ "com.yandex.disk", "java.io" ]
com.yandex.disk; java.io;
307,194
public void stop() throws Exception { log.info("Stopping..."); serviceLocator.getService(EmbeddedJetty.class).stop(); log.info("Stopped"); }
void function() throws Exception { log.info(STR); serviceLocator.getService(EmbeddedJetty.class).stop(); log.info(STR); }
/** * Informs the server to stop. * @throws Exception Stop error. */
Informs the server to stop
stop
{ "repo_name": "expanset/expanset", "path": "samples/samples-getting-started/src/main/java/com/expanset/samples/getstart/App.java", "license": "apache-2.0", "size": 3413 }
[ "com.expanset.jersey.jetty.EmbeddedJetty" ]
import com.expanset.jersey.jetty.EmbeddedJetty;
import com.expanset.jersey.jetty.*;
[ "com.expanset.jersey" ]
com.expanset.jersey;
235,605
public final List<String> getLastLogs(int count) { if (count > m_logList.size()) { count = m_logList.size(); } if (m_logList.size() == 0) { return new ArrayList<>(0); } else { final ArrayDeque<String> list = new ArrayDeque<>(count); count--; int start = m_logList.size() - 1; int end = start - count; for (int i = start; i >= end; i--) { list.push(m_logList.get(i)); } return new ArrayList<>(list); } }
final List<String> function(int count) { if (count > m_logList.size()) { count = m_logList.size(); } if (m_logList.size() == 0) { return new ArrayList<>(0); } else { final ArrayDeque<String> list = new ArrayDeque<>(count); count--; int start = m_logList.size() - 1; int end = start - count; for (int i = start; i >= end; i--) { list.push(m_logList.get(i)); } return new ArrayList<>(list); } }
/** * Return a {@link List} with the last count of log statements. If there haven't been any yet, an empty list is returned. */
Return a <code>List</code> with the last count of log statements. If there haven't been any yet, an empty list is returned
getLastLogs
{ "repo_name": "iDevicesInc/SweetBlue", "path": "library/src/main/java/com/idevicesinc/sweetblue/utils/DebugLogger.java", "license": "gpl-3.0", "size": 5181 }
[ "java.util.ArrayDeque", "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayDeque; import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
134,331
@Test public void shouldReturnDifferenceBetwenOfTwoArgumentsPassed() { Calculator calculator = new Calculator(); calculator.substruct(11.0, 6.5); assertThat(calculator.getResult(), is(4.5)); }
void function() { Calculator calculator = new Calculator(); calculator.substruct(11.0, 6.5); assertThat(calculator.getResult(), is(4.5)); }
/** * Test substruct. */
Test substruct
shouldReturnDifferenceBetwenOfTwoArgumentsPassed
{ "repo_name": "AleksVira/apetrov", "path": "chapter_001/src/test/java/ru/job4j/CalculatorTest.java", "license": "apache-2.0", "size": 1190 }
[ "org.hamcrest.core.Is", "org.junit.Assert" ]
import org.hamcrest.core.Is; import org.junit.Assert;
import org.hamcrest.core.*; import org.junit.*;
[ "org.hamcrest.core", "org.junit" ]
org.hamcrest.core; org.junit;
2,888,076
public void putFrame() { if (currImage != null) { super.putFrame(currImage, objectRects, new Scalar(0, 255, 0), 0); } } //putFrame
void function() { if (currImage != null) { super.putFrame(currImage, objectRects, new Scalar(0, 255, 0), 0); } }
/** * This method update the video stream with the detected targets overlay on the image as rectangles. */
This method update the video stream with the detected targets overlay on the image as rectangles
putFrame
{ "repo_name": "trc492/Frc2017FirstSteamWorks", "path": "src/frclib/FrcVisionTarget.java", "license": "mit", "size": 6100 }
[ "org.opencv.core.Scalar" ]
import org.opencv.core.Scalar;
import org.opencv.core.*;
[ "org.opencv.core" ]
org.opencv.core;
2,085,614
public Key getKey() { return keyImpl; }
Key function() { return keyImpl; }
/** * Returns the key data. * * @return key */
Returns the key data
getKey
{ "repo_name": "chenxiuheng/rtsp-proxy", "path": "src/main/java/gov/nist/javax/sdp/SessionDescriptionImpl.java", "license": "gpl-2.0", "size": 26046 }
[ "javax.sdp.Key" ]
import javax.sdp.Key;
import javax.sdp.*;
[ "javax.sdp" ]
javax.sdp;
105,765
protected void createMarkerColumn(int aModelIdx) { // add Marker Column int colSize = 40; TableColumn newColumn = new TableColumn(aModelIdx, colSize, createMarkerRenderer(), null); newColumn.setHeaderValue(""); newColumn.setMaxWidth(colSize);newColumn.setMinWidth(colSize); newColumn.setWidth(colSize); this.addColumn(newColumn); }
void function(int aModelIdx) { int colSize = 40; TableColumn newColumn = new TableColumn(aModelIdx, colSize, createMarkerRenderer(), null); newColumn.setHeaderValue(""); newColumn.setMaxWidth(colSize);newColumn.setMinWidth(colSize); newColumn.setWidth(colSize); this.addColumn(newColumn); }
/** * Set the first column as a marker * */
Set the first column as a marker
createMarkerColumn
{ "repo_name": "schnurlei/jdynameta", "path": "jdy/jdy.view.swing/src/main/java/de/jdynameta/metainfoview/metainfo/table/ClassInfoColumnModel.java", "license": "apache-2.0", "size": 11814 }
[ "javax.swing.table.TableColumn" ]
import javax.swing.table.TableColumn;
import javax.swing.table.*;
[ "javax.swing" ]
javax.swing;
936,108
QueryService getQueryService();
QueryService getQueryService();
/** * Return the QueryService for this region service. For a region service in a client the returned * QueryService will execute queries on the server. For a region service not in a client the * returned QueryService will execute queries on the local and peer regions. */
Return the QueryService for this region service. For a region service in a client the returned QueryService will execute queries on the server. For a region service not in a client the returned QueryService will execute queries on the local and peer regions
getQueryService
{ "repo_name": "smgoller/geode", "path": "geode-core/src/main/java/org/apache/geode/cache/RegionService.java", "license": "apache-2.0", "size": 5548 }
[ "org.apache.geode.cache.query.QueryService" ]
import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.query.*;
[ "org.apache.geode" ]
org.apache.geode;
2,611,790
private void setFilters(Map<String, Object> configProps) throws WIMSystemException { // If no ldap type configured, return if (iLdapType == null) return; // Determine the Ldap type configured. //name under which filters are put String key = null; if (iLdapType.equalsIgnoreCase(LdapConstants.AD_LDAP_SERVER)) { key = ConfigConstants.CONFIG_ACTIVE_DIRECTORY_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.CUSTOM_LDAP_SERVER)) { key = ConfigConstants.CONFIG_CUSTOM_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.DOMINO_LDAP_SERVER)) { key = ConfigConstants.CONFIG_DOMINO_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.NOVELL_LDAP_SERVER)) { key = ConfigConstants.CONFIG_NOVELL_DIRECTORY_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.IDS_LDAP_SERVER)) { key = ConfigConstants.CONFIG_TDS_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.SUN_LDAP_SERVER)) { key = ConfigConstants.CONFIG_SUN_DIRECTORY_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.NETSCAPE_LDAP_SERVER)) { key = ConfigConstants.CONFIG_NETSCAPE_DIRECTORY_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.SECUREWAY_LDAP_SERVER)) { key = ConfigConstants.CONFIG_SECUREWAY_DIRECTORY_FILTERS; } else { return; } List<Map<String, Object>> filterList = Nester.nest(key, configProps); // If config is found, if (!filterList.isEmpty()) { Map<String, Object> props = filterList.get(0); if (props.get(ConfigConstants.CONFIG_USER_FILTER) != null) iUserFilter = (String) props.get(ConfigConstants.CONFIG_USER_FILTER); if (props.get(ConfigConstants.CONFIG_GROUP_FILTER) != null) iGroupFilter = (String) props.get(ConfigConstants.CONFIG_GROUP_FILTER); if (props.get(ConfigConstants.CONFIG_USER_ID_FILTER) != null) iUserIdMap = (String) props.get(ConfigConstants.CONFIG_USER_ID_FILTER); if (props.get(ConfigConstants.CONFIG_GROUP_ID_FILTER) != null) iGroupIdMap = (String) props.get(ConfigConstants.CONFIG_GROUP_ID_FILTER); if (props.get(ConfigConstants.CONFIG_GROUP_MEMBER_ID_FILTER) != null) iGroupMemberIdMap = (String) props.get(ConfigConstants.CONFIG_GROUP_MEMBER_ID_FILTER); // Update the Ldap entities with search filters. String objectClassStr = "objectclass="; if (iLdapType.equalsIgnoreCase(LdapConstants.AD_LDAP_SERVER)) objectClassStr = "objectcategory="; int length = objectClassStr.length(); // Parse the User filter and extract the applicable objectclass names // We only use the userFilter if loginProperty is not defined. // Additionally, a warning is issued if this is the case. if (iUserFilter != null && !isLoginPropertyDefined) { if (!iUserFilter.contains(FILTER_VALUE_PATTERN)) { String msg = Tr.formatMessage(tc, WIMMessageKey.FILTER_MISSING_PERCENT_V, iUserFilter, ConfigConstants.CONFIG_USER_FILTER, "(uid=%v)"); throw new WIMSystemException(WIMMessageKey.FILTER_MISSING_PERCENT_V, msg); } LdapEntity ldapEntity = getLdapEntity(SchemaConstants.DO_PERSON_ACCOUNT); if (ldapEntity != null) { Set<String> objClsSet = new HashSet<String>(); int index = iUserFilter.indexOf(objectClassStr); while (index > -1) { int endIndex = iUserFilter.indexOf(")", index); String objectClass = iUserFilter.substring(index + length, endIndex); objClsSet.add(objectClass); index = endIndex + 1; index = iUserFilter.indexOf(objectClassStr, endIndex); } if (objClsSet.size() > 0) { ldapEntity.getObjectClasses().clear(); ldapEntity.getObjectClasses().addAll(objClsSet); } } // If loginProperties are not defined and we are using the userFilter, // remove the default uid login property. In this case, the first attribute // in the userFilter should be the principal. if (iLoginAttrs != null) iLoginAttrs.remove(0); if (iLoginProps != null) iLoginProps.remove(0); int startIndex = 0; boolean hasLoginProperties = true; LdapEntity acct = getLdapEntity(iPersonAccountTypes.get(iPersonAccountTypes.size() - 1)); while (hasLoginProperties) { int index = iUserFilter.indexOf(FILTER_VALUE_PATTERN, startIndex); int beginIndex = index; if (index > -1) { for (; beginIndex > 0; beginIndex--) { if (iUserFilter.charAt(beginIndex) == ' ' || iUserFilter.charAt(beginIndex) == '(') break; } String propName = iUserFilter.substring(beginIndex + 1, index); if (iLoginAttrs != null && !iLoginAttrs.contains(propName)) { if (tc.isDebugEnabled()) Tr.debug(tc, "Setting login property from UserFilter as [" + propName + "]"); //iLoginAttrs.add(propName); iLoginAttrs.add(getAttributeName(acct, propName)); iLoginProps.add(propName); } startIndex = index + 1; } else hasLoginProperties = false; } if (ldapEntity != null) { try { ldapEntity.addPropertyAttributeMap(SchemaConstants.PROP_PRINCIPAL_NAME, iLoginAttrs.get(0)); } catch (IndexOutOfBoundsException e) { String msg = Tr.formatMessage(tc, WIMMessageKey.MALFORMED_SEARCH_EXPRESSION, WIMMessageHelper.generateMsgParms(e.toString())); throw new WIMSystemException(WIMMessageKey.MALFORMED_SEARCH_EXPRESSION, msg); } } } else if (iUserFilter != null && isLoginPropertyDefined) { //Issue a warning that the filter built using loginProperty is taking precedence over the defined userFilter. if (tc.isWarningEnabled()) { Tr.warning(tc, WIMMessageKey.LOGINPROPERTY_OVERRIDE_USERFILTER); } } // Parse the Group filter and extract the applicable objectclass names if (iGroupFilter != null) { if (!iGroupFilter.contains(FILTER_VALUE_PATTERN)) { String msg = Tr.formatMessage(tc, WIMMessageKey.FILTER_MISSING_PERCENT_V, iGroupFilter, ConfigConstants.CONFIG_GROUP_FILTER, "(cn=%v)"); throw new WIMSystemException(WIMMessageKey.FILTER_MISSING_PERCENT_V, msg); } LdapEntity ldapEntity = getLdapEntity(SchemaConstants.DO_GROUP); if (ldapEntity != null) { Set<String> objClsSet = new HashSet<String>(); int index = iGroupFilter.indexOf(objectClassStr); while (index > -1) { int endIndex = iGroupFilter.indexOf(")", index); String objectClass = iGroupFilter.substring(index + length, endIndex); objClsSet.add(objectClass); index = endIndex + 1; index = iGroupFilter.indexOf(objectClassStr, endIndex); } if (objClsSet.size() > 0) { ldapEntity.getObjectClasses().clear(); ldapEntity.getObjectClasses().addAll(objClsSet); } } } // Parse the user id map if (iUserIdMap != null) { StringTokenizer strtok = new StringTokenizer(iUserIdMap, ":;"); LdapEntity ldapEntity = getLdapEntity(SchemaConstants.DO_PERSON_ACCOUNT); if (ldapEntity != null) { List<String> rdnPropList = new ArrayList<String>(); List<String> objClsList = new ArrayList<String>(); while (strtok.hasMoreTokens()) { String objectClass = strtok.nextToken(); if (!strtok.hasMoreTokens()) { Tr.warning(tc, WIMMessageKey.IDMAP_INVALID_FORMAT, iUserIdMap, "userIdMap"); break; } String attribute = strtok.nextToken(); // Handle samAccountName. Set<String> propNames = null; if (LdapConstants.LDAP_ATTR_SAM_ACCOUNT_NAME.equalsIgnoreCase(attribute)) { propNames = getPropertyName(ldapEntity, "cn"); // propNames.addAll(getPropertyName(ldapEntity, attribute)); } else propNames = getPropertyName(ldapEntity, attribute); rdnPropList.addAll(propNames); if (!SchemaConstants.VALUE_ALL_PROPERTIES.equalsIgnoreCase(objectClass)) { for (int idx = 0; idx < propNames.size(); idx++) { objClsList.add(objectClass); } } } if (rdnPropList.size() > 0) { String[][] rdnProps = new String[rdnPropList.size()][]; String[][] rdnAttrs = new String[rdnPropList.size()][]; String rdnObjCls[][] = new String[objClsList.size()][]; String objCls[] = new String[objClsList.size()]; objCls = objClsList.toArray(objCls); for (int j = 0; j < rdnPropList.size(); j++) { rdnProps[j] = LdapHelper.getRDNs(rdnPropList.get(j)); rdnAttrs[j] = new String[rdnProps[j].length]; for (int k = 0; k < rdnProps[j].length; k++) { String rdnProp = rdnProps[j][k]; rdnAttrs[j][k] = getAttributeName(ldapEntity, rdnProp); } if (objCls.length > 0) { rdnObjCls[j] = new String[objCls.length]; rdnObjCls[j][0] = objCls[j]; } } if (isVMMRdnPropertiesDefined) { String updatedRdnAttrs[][] = null; String updatedRdnObjCls[][] = null; String orgRdnAttr[][] = ldapEntity.getRDNAttributes(); if (orgRdnAttr != null && orgRdnAttr.length > 0) { updatedRdnAttrs = new String[orgRdnAttr.length + rdnAttrs.length][]; for (int i = 0; i < orgRdnAttr.length; i++) { updatedRdnAttrs[i] = new String[orgRdnAttr[i].length]; for (int j = 0; j < orgRdnAttr[i].length; j++) updatedRdnAttrs[i][j] = orgRdnAttr[i][j]; } int len = orgRdnAttr.length; for (int i = 0; i < rdnAttrs.length; i++) { updatedRdnAttrs[len] = new String[rdnAttrs[i].length]; for (int j = 0; j < rdnAttrs[i].length; j++) updatedRdnAttrs[len][j] = rdnAttrs[i][j]; len++; } } String[][] orgRdnObjCls = ldapEntity.getRDNObjectclasses(); if (orgRdnObjCls != null && orgRdnObjCls.length > 0) { updatedRdnObjCls = new String[orgRdnObjCls.length + rdnObjCls.length][]; for (int i = 0; i < orgRdnObjCls.length; i++) { updatedRdnObjCls[i] = new String[orgRdnObjCls[i].length]; for (int j = 0; j < orgRdnObjCls[i].length; j++) updatedRdnObjCls[i][j] = orgRdnObjCls[i][j]; } int len = orgRdnObjCls.length; for (int i = 0; i < rdnObjCls.length; i++) { updatedRdnObjCls[len] = new String[rdnObjCls[i].length]; for (int j = 0; j < rdnObjCls[i].length; j++) updatedRdnObjCls[len][j] = rdnObjCls[i][j]; len++; } } ldapEntity.setRDNAttributes(updatedRdnAttrs, updatedRdnObjCls); ldapEntity.setRDNProperties(rdnProps, updatedRdnAttrs); } else { ldapEntity.setRDNAttributes(rdnAttrs, rdnObjCls); } if (ldapEntity.needTranslateRDN()) { iNeedTranslateRDN = true; } } } else { if (tc.isDebugEnabled()) Tr.debug(tc, "Could not find entity for PersonAccount!!"); } } // Parse the group id map if (iGroupIdMap != null) { StringTokenizer strtok = new StringTokenizer(iGroupIdMap, ":;"); LdapEntity ldapEntity = getLdapEntity(SchemaConstants.DO_GROUP); if (ldapEntity != null) { List<String> rdnPropList = new ArrayList<String>(); Set<String> objClsSet = new HashSet<String>(); while (strtok.hasMoreTokens()) { String objectClass = strtok.nextToken(); if (!strtok.hasMoreTokens()) { Tr.warning(tc, WIMMessageKey.IDMAP_INVALID_FORMAT, iGroupIdMap, "groupIdMap"); break; } String attribute = strtok.nextToken(); Set<String> propNames = getPropertyName(ldapEntity, attribute); rdnPropList.add(propNames.iterator().next()); if (!SchemaConstants.VALUE_ALL_PROPERTIES.equalsIgnoreCase(objectClass)) objClsSet.add(objectClass); } if (rdnPropList.size() > 0) { String[][] rdnProps = new String[rdnPropList.size()][]; String[][] rdnAttrs = new String[rdnPropList.size()][]; for (int j = 0; j < rdnPropList.size(); j++) { rdnProps[j] = LdapHelper.getRDNs(rdnPropList.get(j)); rdnAttrs[j] = new String[rdnProps[j].length]; for (int k = 0; k < rdnProps[j].length; k++) { String rdnProp = rdnProps[j][k]; rdnAttrs[j][k] = getAttributeName(ldapEntity, rdnProp); } } ldapEntity.setRDNProperties(rdnProps, rdnAttrs); if (ldapEntity.needTranslateRDN()) { iNeedTranslateRDN = true; } } } else if (tc.isDebugEnabled()) Tr.debug(tc, "Could not find entity for Group!!"); } // Parse the group member id map if (iGroupMemberIdMap != null) { // Check if iGroupMemberIdMap have ibm-allGroups , if true then do the nested search for group members iLdapOperationalAttr = iGroupMemberIdMap.toLowerCase().contains(IBM_ALL_GROUPS.toLowerCase()); // Clear the membership attribute if we were using the default. Otherwise keep it, as it was explicitly set if (iDefaultMembershipAttr) { iMembershipAttrName = null; } LdapEntity ldapEntity = null; List<String> grpTypes = getGroupTypes(); List<String> objectClasses = new ArrayList<String>(); for (int i = 0; i < grpTypes.size(); i++) { ldapEntity = getLdapEntity(grpTypes.get(i)); List<String> objClses = ldapEntity.getObjectClasses(); for (int j = 0; j < objClses.size(); j++) { String objCls = objClses.get(j); objectClasses.add(objCls); } } List<String> attrScopes = new ArrayList<String>(); List<String> attrNames = new ArrayList<String>(); StringTokenizer strtok = new StringTokenizer(iGroupMemberIdMap, ":;"); if (ldapEntity != null) { while (strtok.hasMoreTokens()) { String objectClass = strtok.nextToken(); String attribute = strtok.nextToken(); String scope = LdapConstants.LDAP_DIRECT_GROUP_MEMBERSHIP_STRING; if (SchemaConstants.VALUE_ALL_PROPERTIES.equalsIgnoreCase(objectClass)) { for (int j = 0; j < objectClasses.size(); j++) { iMbrAttrMap.put(objectClasses.get(j), attribute); } } else { iMbrAttrMap.put(objectClass.toLowerCase(), attribute); } if (!attrNames.contains(attribute)) { attrNames.add(attribute); attrScopes.add(scope); } if (objectClass != null && !objectClasses.contains(objectClass.toLowerCase()) && (getGroupTypes() != null && getGroupTypes().size() > 0) && !SchemaConstants.VALUE_ALL_PROPERTIES.equals(objectClass)) { getLdapEntity(getGroupTypes().get(0)).addObjectClass(objectClass); } } iMbrAttrs = attrNames.toArray(new String[0]); iMbrAttrScope = new short[iMbrAttrs.length]; iMbrAttrsAllScope = true; iMbrAttrsNestedScope = true; for (int i = 0; i < attrScopes.size(); i++) { iMbrAttrScope[i] = LdapHelper.getMembershipScope(attrScopes.get(i)); if (iMbrAttrScope[i] == LdapConstants.LDAP_DIRECT_GROUP_MEMBERSHIP) { iMbrAttrsAllScope = false; iMbrAttrsNestedScope = false; } else if (iMbrAttrScope[i] == LdapConstants.LDAP_NESTED_GROUP_MEMBERSHIP) { iMbrAttrsAllScope = false; } } } else if (tc.isDebugEnabled()) { Tr.debug(tc, "Could not find entity for Group!!"); } } // check if this is a RACF configuration if (checkIfRacf()) { initializeRacfFilters(); } resetEntitySearchFilters(); } }
void function(Map<String, Object> configProps) throws WIMSystemException { if (iLdapType == null) return; String key = null; if (iLdapType.equalsIgnoreCase(LdapConstants.AD_LDAP_SERVER)) { key = ConfigConstants.CONFIG_ACTIVE_DIRECTORY_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.CUSTOM_LDAP_SERVER)) { key = ConfigConstants.CONFIG_CUSTOM_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.DOMINO_LDAP_SERVER)) { key = ConfigConstants.CONFIG_DOMINO_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.NOVELL_LDAP_SERVER)) { key = ConfigConstants.CONFIG_NOVELL_DIRECTORY_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.IDS_LDAP_SERVER)) { key = ConfigConstants.CONFIG_TDS_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.SUN_LDAP_SERVER)) { key = ConfigConstants.CONFIG_SUN_DIRECTORY_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.NETSCAPE_LDAP_SERVER)) { key = ConfigConstants.CONFIG_NETSCAPE_DIRECTORY_FILTERS; } else if (iLdapType.equalsIgnoreCase(LdapConstants.SECUREWAY_LDAP_SERVER)) { key = ConfigConstants.CONFIG_SECUREWAY_DIRECTORY_FILTERS; } else { return; } List<Map<String, Object>> filterList = Nester.nest(key, configProps); if (!filterList.isEmpty()) { Map<String, Object> props = filterList.get(0); if (props.get(ConfigConstants.CONFIG_USER_FILTER) != null) iUserFilter = (String) props.get(ConfigConstants.CONFIG_USER_FILTER); if (props.get(ConfigConstants.CONFIG_GROUP_FILTER) != null) iGroupFilter = (String) props.get(ConfigConstants.CONFIG_GROUP_FILTER); if (props.get(ConfigConstants.CONFIG_USER_ID_FILTER) != null) iUserIdMap = (String) props.get(ConfigConstants.CONFIG_USER_ID_FILTER); if (props.get(ConfigConstants.CONFIG_GROUP_ID_FILTER) != null) iGroupIdMap = (String) props.get(ConfigConstants.CONFIG_GROUP_ID_FILTER); if (props.get(ConfigConstants.CONFIG_GROUP_MEMBER_ID_FILTER) != null) iGroupMemberIdMap = (String) props.get(ConfigConstants.CONFIG_GROUP_MEMBER_ID_FILTER); String objectClassStr = STR; if (iLdapType.equalsIgnoreCase(LdapConstants.AD_LDAP_SERVER)) objectClassStr = STR; int length = objectClassStr.length(); if (iUserFilter != null && !isLoginPropertyDefined) { if (!iUserFilter.contains(FILTER_VALUE_PATTERN)) { String msg = Tr.formatMessage(tc, WIMMessageKey.FILTER_MISSING_PERCENT_V, iUserFilter, ConfigConstants.CONFIG_USER_FILTER, STR); throw new WIMSystemException(WIMMessageKey.FILTER_MISSING_PERCENT_V, msg); } LdapEntity ldapEntity = getLdapEntity(SchemaConstants.DO_PERSON_ACCOUNT); if (ldapEntity != null) { Set<String> objClsSet = new HashSet<String>(); int index = iUserFilter.indexOf(objectClassStr); while (index > -1) { int endIndex = iUserFilter.indexOf(")", index); String objectClass = iUserFilter.substring(index + length, endIndex); objClsSet.add(objectClass); index = endIndex + 1; index = iUserFilter.indexOf(objectClassStr, endIndex); } if (objClsSet.size() > 0) { ldapEntity.getObjectClasses().clear(); ldapEntity.getObjectClasses().addAll(objClsSet); } } if (iLoginAttrs != null) iLoginAttrs.remove(0); if (iLoginProps != null) iLoginProps.remove(0); int startIndex = 0; boolean hasLoginProperties = true; LdapEntity acct = getLdapEntity(iPersonAccountTypes.get(iPersonAccountTypes.size() - 1)); while (hasLoginProperties) { int index = iUserFilter.indexOf(FILTER_VALUE_PATTERN, startIndex); int beginIndex = index; if (index > -1) { for (; beginIndex > 0; beginIndex--) { if (iUserFilter.charAt(beginIndex) == ' ' iUserFilter.charAt(beginIndex) == '(') break; } String propName = iUserFilter.substring(beginIndex + 1, index); if (iLoginAttrs != null && !iLoginAttrs.contains(propName)) { if (tc.isDebugEnabled()) Tr.debug(tc, STR + propName + "]"); iLoginAttrs.add(getAttributeName(acct, propName)); iLoginProps.add(propName); } startIndex = index + 1; } else hasLoginProperties = false; } if (ldapEntity != null) { try { ldapEntity.addPropertyAttributeMap(SchemaConstants.PROP_PRINCIPAL_NAME, iLoginAttrs.get(0)); } catch (IndexOutOfBoundsException e) { String msg = Tr.formatMessage(tc, WIMMessageKey.MALFORMED_SEARCH_EXPRESSION, WIMMessageHelper.generateMsgParms(e.toString())); throw new WIMSystemException(WIMMessageKey.MALFORMED_SEARCH_EXPRESSION, msg); } } } else if (iUserFilter != null && isLoginPropertyDefined) { if (tc.isWarningEnabled()) { Tr.warning(tc, WIMMessageKey.LOGINPROPERTY_OVERRIDE_USERFILTER); } } if (iGroupFilter != null) { if (!iGroupFilter.contains(FILTER_VALUE_PATTERN)) { String msg = Tr.formatMessage(tc, WIMMessageKey.FILTER_MISSING_PERCENT_V, iGroupFilter, ConfigConstants.CONFIG_GROUP_FILTER, STR); throw new WIMSystemException(WIMMessageKey.FILTER_MISSING_PERCENT_V, msg); } LdapEntity ldapEntity = getLdapEntity(SchemaConstants.DO_GROUP); if (ldapEntity != null) { Set<String> objClsSet = new HashSet<String>(); int index = iGroupFilter.indexOf(objectClassStr); while (index > -1) { int endIndex = iGroupFilter.indexOf(")", index); String objectClass = iGroupFilter.substring(index + length, endIndex); objClsSet.add(objectClass); index = endIndex + 1; index = iGroupFilter.indexOf(objectClassStr, endIndex); } if (objClsSet.size() > 0) { ldapEntity.getObjectClasses().clear(); ldapEntity.getObjectClasses().addAll(objClsSet); } } } if (iUserIdMap != null) { StringTokenizer strtok = new StringTokenizer(iUserIdMap, ":;"); LdapEntity ldapEntity = getLdapEntity(SchemaConstants.DO_PERSON_ACCOUNT); if (ldapEntity != null) { List<String> rdnPropList = new ArrayList<String>(); List<String> objClsList = new ArrayList<String>(); while (strtok.hasMoreTokens()) { String objectClass = strtok.nextToken(); if (!strtok.hasMoreTokens()) { Tr.warning(tc, WIMMessageKey.IDMAP_INVALID_FORMAT, iUserIdMap, STR); break; } String attribute = strtok.nextToken(); Set<String> propNames = null; if (LdapConstants.LDAP_ATTR_SAM_ACCOUNT_NAME.equalsIgnoreCase(attribute)) { propNames = getPropertyName(ldapEntity, "cn"); } else propNames = getPropertyName(ldapEntity, attribute); rdnPropList.addAll(propNames); if (!SchemaConstants.VALUE_ALL_PROPERTIES.equalsIgnoreCase(objectClass)) { for (int idx = 0; idx < propNames.size(); idx++) { objClsList.add(objectClass); } } } if (rdnPropList.size() > 0) { String[][] rdnProps = new String[rdnPropList.size()][]; String[][] rdnAttrs = new String[rdnPropList.size()][]; String rdnObjCls[][] = new String[objClsList.size()][]; String objCls[] = new String[objClsList.size()]; objCls = objClsList.toArray(objCls); for (int j = 0; j < rdnPropList.size(); j++) { rdnProps[j] = LdapHelper.getRDNs(rdnPropList.get(j)); rdnAttrs[j] = new String[rdnProps[j].length]; for (int k = 0; k < rdnProps[j].length; k++) { String rdnProp = rdnProps[j][k]; rdnAttrs[j][k] = getAttributeName(ldapEntity, rdnProp); } if (objCls.length > 0) { rdnObjCls[j] = new String[objCls.length]; rdnObjCls[j][0] = objCls[j]; } } if (isVMMRdnPropertiesDefined) { String updatedRdnAttrs[][] = null; String updatedRdnObjCls[][] = null; String orgRdnAttr[][] = ldapEntity.getRDNAttributes(); if (orgRdnAttr != null && orgRdnAttr.length > 0) { updatedRdnAttrs = new String[orgRdnAttr.length + rdnAttrs.length][]; for (int i = 0; i < orgRdnAttr.length; i++) { updatedRdnAttrs[i] = new String[orgRdnAttr[i].length]; for (int j = 0; j < orgRdnAttr[i].length; j++) updatedRdnAttrs[i][j] = orgRdnAttr[i][j]; } int len = orgRdnAttr.length; for (int i = 0; i < rdnAttrs.length; i++) { updatedRdnAttrs[len] = new String[rdnAttrs[i].length]; for (int j = 0; j < rdnAttrs[i].length; j++) updatedRdnAttrs[len][j] = rdnAttrs[i][j]; len++; } } String[][] orgRdnObjCls = ldapEntity.getRDNObjectclasses(); if (orgRdnObjCls != null && orgRdnObjCls.length > 0) { updatedRdnObjCls = new String[orgRdnObjCls.length + rdnObjCls.length][]; for (int i = 0; i < orgRdnObjCls.length; i++) { updatedRdnObjCls[i] = new String[orgRdnObjCls[i].length]; for (int j = 0; j < orgRdnObjCls[i].length; j++) updatedRdnObjCls[i][j] = orgRdnObjCls[i][j]; } int len = orgRdnObjCls.length; for (int i = 0; i < rdnObjCls.length; i++) { updatedRdnObjCls[len] = new String[rdnObjCls[i].length]; for (int j = 0; j < rdnObjCls[i].length; j++) updatedRdnObjCls[len][j] = rdnObjCls[i][j]; len++; } } ldapEntity.setRDNAttributes(updatedRdnAttrs, updatedRdnObjCls); ldapEntity.setRDNProperties(rdnProps, updatedRdnAttrs); } else { ldapEntity.setRDNAttributes(rdnAttrs, rdnObjCls); } if (ldapEntity.needTranslateRDN()) { iNeedTranslateRDN = true; } } } else { if (tc.isDebugEnabled()) Tr.debug(tc, STR); } } if (iGroupIdMap != null) { StringTokenizer strtok = new StringTokenizer(iGroupIdMap, ":;"); LdapEntity ldapEntity = getLdapEntity(SchemaConstants.DO_GROUP); if (ldapEntity != null) { List<String> rdnPropList = new ArrayList<String>(); Set<String> objClsSet = new HashSet<String>(); while (strtok.hasMoreTokens()) { String objectClass = strtok.nextToken(); if (!strtok.hasMoreTokens()) { Tr.warning(tc, WIMMessageKey.IDMAP_INVALID_FORMAT, iGroupIdMap, STR); break; } String attribute = strtok.nextToken(); Set<String> propNames = getPropertyName(ldapEntity, attribute); rdnPropList.add(propNames.iterator().next()); if (!SchemaConstants.VALUE_ALL_PROPERTIES.equalsIgnoreCase(objectClass)) objClsSet.add(objectClass); } if (rdnPropList.size() > 0) { String[][] rdnProps = new String[rdnPropList.size()][]; String[][] rdnAttrs = new String[rdnPropList.size()][]; for (int j = 0; j < rdnPropList.size(); j++) { rdnProps[j] = LdapHelper.getRDNs(rdnPropList.get(j)); rdnAttrs[j] = new String[rdnProps[j].length]; for (int k = 0; k < rdnProps[j].length; k++) { String rdnProp = rdnProps[j][k]; rdnAttrs[j][k] = getAttributeName(ldapEntity, rdnProp); } } ldapEntity.setRDNProperties(rdnProps, rdnAttrs); if (ldapEntity.needTranslateRDN()) { iNeedTranslateRDN = true; } } } else if (tc.isDebugEnabled()) Tr.debug(tc, STR); } if (iGroupMemberIdMap != null) { iLdapOperationalAttr = iGroupMemberIdMap.toLowerCase().contains(IBM_ALL_GROUPS.toLowerCase()); if (iDefaultMembershipAttr) { iMembershipAttrName = null; } LdapEntity ldapEntity = null; List<String> grpTypes = getGroupTypes(); List<String> objectClasses = new ArrayList<String>(); for (int i = 0; i < grpTypes.size(); i++) { ldapEntity = getLdapEntity(grpTypes.get(i)); List<String> objClses = ldapEntity.getObjectClasses(); for (int j = 0; j < objClses.size(); j++) { String objCls = objClses.get(j); objectClasses.add(objCls); } } List<String> attrScopes = new ArrayList<String>(); List<String> attrNames = new ArrayList<String>(); StringTokenizer strtok = new StringTokenizer(iGroupMemberIdMap, ":;"); if (ldapEntity != null) { while (strtok.hasMoreTokens()) { String objectClass = strtok.nextToken(); String attribute = strtok.nextToken(); String scope = LdapConstants.LDAP_DIRECT_GROUP_MEMBERSHIP_STRING; if (SchemaConstants.VALUE_ALL_PROPERTIES.equalsIgnoreCase(objectClass)) { for (int j = 0; j < objectClasses.size(); j++) { iMbrAttrMap.put(objectClasses.get(j), attribute); } } else { iMbrAttrMap.put(objectClass.toLowerCase(), attribute); } if (!attrNames.contains(attribute)) { attrNames.add(attribute); attrScopes.add(scope); } if (objectClass != null && !objectClasses.contains(objectClass.toLowerCase()) && (getGroupTypes() != null && getGroupTypes().size() > 0) && !SchemaConstants.VALUE_ALL_PROPERTIES.equals(objectClass)) { getLdapEntity(getGroupTypes().get(0)).addObjectClass(objectClass); } } iMbrAttrs = attrNames.toArray(new String[0]); iMbrAttrScope = new short[iMbrAttrs.length]; iMbrAttrsAllScope = true; iMbrAttrsNestedScope = true; for (int i = 0; i < attrScopes.size(); i++) { iMbrAttrScope[i] = LdapHelper.getMembershipScope(attrScopes.get(i)); if (iMbrAttrScope[i] == LdapConstants.LDAP_DIRECT_GROUP_MEMBERSHIP) { iMbrAttrsAllScope = false; iMbrAttrsNestedScope = false; } else if (iMbrAttrScope[i] == LdapConstants.LDAP_NESTED_GROUP_MEMBERSHIP) { iMbrAttrsAllScope = false; } } } else if (tc.isDebugEnabled()) { Tr.debug(tc, STR); } } if (checkIfRacf()) { initializeRacfFilters(); } resetEntitySearchFilters(); } }
/** * Set the filters depending on the ldap type selected. * * @param configProps */
Set the filters depending on the ldap type selected
setFilters
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConfigManager.java", "license": "epl-1.0", "size": 143111 }
[ "com.ibm.websphere.ras.Tr", "com.ibm.websphere.security.wim.ConfigConstants", "com.ibm.websphere.security.wim.ras.WIMMessageHelper", "com.ibm.websphere.security.wim.ras.WIMMessageKey", "com.ibm.ws.config.xml.internal.nester.Nester", "com.ibm.wsspi.security.wim.SchemaConstants", "com.ibm.wsspi.security.wim.exception.WIMSystemException", "java.util.ArrayList", "java.util.HashSet", "java.util.List", "java.util.Map", "java.util.Set", "java.util.StringTokenizer" ]
import com.ibm.websphere.ras.Tr; import com.ibm.websphere.security.wim.ConfigConstants; import com.ibm.websphere.security.wim.ras.WIMMessageHelper; import com.ibm.websphere.security.wim.ras.WIMMessageKey; import com.ibm.ws.config.xml.internal.nester.Nester; import com.ibm.wsspi.security.wim.SchemaConstants; import com.ibm.wsspi.security.wim.exception.WIMSystemException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer;
import com.ibm.websphere.ras.*; import com.ibm.websphere.security.wim.*; import com.ibm.websphere.security.wim.ras.*; import com.ibm.ws.config.xml.internal.nester.*; import com.ibm.wsspi.security.wim.*; import com.ibm.wsspi.security.wim.exception.*; import java.util.*;
[ "com.ibm.websphere", "com.ibm.ws", "com.ibm.wsspi", "java.util" ]
com.ibm.websphere; com.ibm.ws; com.ibm.wsspi; java.util;
1,739,580
public ServiceFuture<VirtualHubInner> createOrUpdateAsync(String resourceGroupName, String virtualHubName, VirtualHubInner virtualHubParameters, final ServiceCallback<VirtualHubInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualHubName, virtualHubParameters), serviceCallback); }
ServiceFuture<VirtualHubInner> function(String resourceGroupName, String virtualHubName, VirtualHubInner virtualHubParameters, final ServiceCallback<VirtualHubInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualHubName, virtualHubParameters), serviceCallback); }
/** * Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. * * @param resourceGroupName The resource group name of the VirtualHub. * @param virtualHubName The name of the VirtualHub. * @param virtualHubParameters Parameters supplied to create or update VirtualHub. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub
createOrUpdateAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualHubsInner.java", "license": "mit", "size": 72294 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
906,713
@MXBeanDescription("Direct send buffer.") public boolean isDirectSendBuffer();
@MXBeanDescription(STR) boolean function();
/** * Gets flag defining whether direct send buffer should be used. * * @return {@code True} if direct buffers should be used. */
Gets flag defining whether direct send buffer should be used
isDirectSendBuffer
{ "repo_name": "tkpanther/ignite", "path": "modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java", "license": "apache-2.0", "size": 9304 }
[ "org.apache.ignite.mxbean.MXBeanDescription" ]
import org.apache.ignite.mxbean.MXBeanDescription;
import org.apache.ignite.mxbean.*;
[ "org.apache.ignite" ]
org.apache.ignite;
82,521
public Set<Edge> getColumnData (final Object columnObj);
Set<Edge> function (final Object columnObj);
/** * get the edges associated with a particular column object * In a directed graph these will be the edges where the node is the sink * In an undirected (symmetric) graph these will be edges where the node is either source or sink * @param columnObj * @return Set<Edge> a set of edges for the argument node object */
get the edges associated with a particular column object In a directed graph these will be the edges where the node is the sink In an undirected (symmetric) graph these will be edges where the node is either source or sink
getColumnData
{ "repo_name": "martingraham/JSwingPlus", "path": "src/model/matrix/MatrixTableModel.java", "license": "apache-2.0", "size": 1748 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
876,970
public static BufferedImage chartImage(ChartType type, ChartData data, int pixelWidth, int pixelHeight) { return new JFreeChartGenerator(data, pixelWidth, pixelHeight).image(type); }
static BufferedImage function(ChartType type, ChartData data, int pixelWidth, int pixelHeight) { return new JFreeChartGenerator(data, pixelWidth, pixelHeight).image(type); }
/** * Generate an image of a chart. * @param data * @param pixelWidth * @param pixelHeight * @return */
Generate an image of a chart
chartImage
{ "repo_name": "skyvers/skyve", "path": "skyve-ext/src/main/java/org/skyve/EXT.java", "license": "lgpl-2.1", "size": 15079 }
[ "java.awt.image.BufferedImage", "org.skyve.impl.generate.charts.JFreeChartGenerator", "org.skyve.impl.metadata.view.widget.Chart", "org.skyve.metadata.view.model.chart.ChartData" ]
import java.awt.image.BufferedImage; import org.skyve.impl.generate.charts.JFreeChartGenerator; import org.skyve.impl.metadata.view.widget.Chart; import org.skyve.metadata.view.model.chart.ChartData;
import java.awt.image.*; import org.skyve.impl.generate.charts.*; import org.skyve.impl.metadata.view.widget.*; import org.skyve.metadata.view.model.chart.*;
[ "java.awt", "org.skyve.impl", "org.skyve.metadata" ]
java.awt; org.skyve.impl; org.skyve.metadata;
1,434,247
public void testInvalidKeyUpdate() throws Exception { startClientVMs(1, 0, null); startServerVMs(1, 0, "SG1"); clientSQLExecute(1, "create table t1(id int not null, primary key(id))"); // avoid default colocation/partitioning else update will fail due to // update on partitioning column clientSQLExecute(1, "create table t2(id int not null, fkId int not null, " + "primary key(id), foreign key (fkId) references t1(id)) " + "server groups (sg1)"); clientSQLExecute(1, "insert into t1 values(1)"); clientSQLExecute(1, "insert into t2 values(1, 1)"); addExpectedException(new int[] { 1 }, new int[] { 1 }, new Object[] { FunctionExecutionException.class, "java.sql.SQLIntegrityConstraintViolationException", FunctionException.class }); for (int i = 20; i < 30; i++) { checkFKViolation(i % 2 == 0 ? 1 : -1, "update t2 set t2.fkId=" + i + " where t2.fkId=1"); } removeExpectedException(new int[] { 1 }, new int[] { 1 }, new Object[] { FunctionException.class, FunctionExecutionException.class, "java.sql.SQLIntegrityConstraintViolationException" }); clientSQLExecute(1, "drop table t2"); clientSQLExecute(1, "drop table t1"); }
void function() throws Exception { startClientVMs(1, 0, null); startServerVMs(1, 0, "SG1"); clientSQLExecute(1, STR); clientSQLExecute(1, STR + STR + STR); clientSQLExecute(1, STR); clientSQLExecute(1, STR); addExpectedException(new int[] { 1 }, new int[] { 1 }, new Object[] { FunctionExecutionException.class, STR, FunctionException.class }); for (int i = 20; i < 30; i++) { checkFKViolation(i % 2 == 0 ? 1 : -1, STR + i + STR); } removeExpectedException(new int[] { 1 }, new int[] { 1 }, new Object[] { FunctionException.class, FunctionExecutionException.class, STR }); clientSQLExecute(1, STR); clientSQLExecute(1, STR); }
/** * Test update to an invalid foreign key. */
Test update to an invalid foreign key
testInvalidKeyUpdate
{ "repo_name": "gemxd/gemfirexd-oss", "path": "gemfirexd/tools/src/dunit/java/com/pivotal/gemfirexd/insert/InsertUpdateForeignKeyDUnit.java", "license": "apache-2.0", "size": 26394 }
[ "com.gemstone.gemfire.cache.execute.FunctionException", "com.pivotal.gemfirexd.internal.engine.distributed.FunctionExecutionException" ]
import com.gemstone.gemfire.cache.execute.FunctionException; import com.pivotal.gemfirexd.internal.engine.distributed.FunctionExecutionException;
import com.gemstone.gemfire.cache.execute.*; import com.pivotal.gemfirexd.internal.engine.distributed.*;
[ "com.gemstone.gemfire", "com.pivotal.gemfirexd" ]
com.gemstone.gemfire; com.pivotal.gemfirexd;
200,044
public JsonFluentAssert matches(Matcher<?> matcher) { internalMatcher.matches(matcher); return this; } public static class ArrayAssert { private final InternalMatcher.ArrayMatcher arrayMatcher; ArrayAssert(InternalMatcher.ArrayMatcher arrayMatcher) { this.arrayMatcher = arrayMatcher; }
JsonFluentAssert function(Matcher<?> matcher) { internalMatcher.matches(matcher); return this; } public static class ArrayAssert { private final InternalMatcher.ArrayMatcher arrayMatcher; ArrayAssert(InternalMatcher.ArrayMatcher arrayMatcher) { this.arrayMatcher = arrayMatcher; }
/** * Matches the node using Hamcrest internalMatcher. * * <ul> * <li>Numbers are mapped to BigDecimal</li> * <li>Arrays are mapped to a Collection</li> * <li>Objects are mapped to a map so you can use json(Part)Equals or a Map internalMatcher</li> * </ul> * * @param matcher * @return */
Matches the node using Hamcrest internalMatcher. Numbers are mapped to BigDecimal Arrays are mapped to a Collection Objects are mapped to a map so you can use json(Part)Equals or a Map internalMatcher
matches
{ "repo_name": "lukas-krecan/JsonUnit", "path": "json-unit-fluent/src/main/java/net/javacrumbs/jsonunit/fluent/JsonFluentAssert.java", "license": "apache-2.0", "size": 13282 }
[ "net.javacrumbs.jsonunit.core.internal.matchers.InternalMatcher", "org.hamcrest.Matcher" ]
import net.javacrumbs.jsonunit.core.internal.matchers.InternalMatcher; import org.hamcrest.Matcher;
import net.javacrumbs.jsonunit.core.internal.matchers.*; import org.hamcrest.*;
[ "net.javacrumbs.jsonunit", "org.hamcrest" ]
net.javacrumbs.jsonunit; org.hamcrest;
2,523,673
public static float norm1(final float[][] x) { // squareCheck(x); final int n = x.length; final int m = x[0].length; int j; float amax, norm = 0; for (int i = 0; i < m; norm = max(norm, amax), i++) for (amax = 0, j = 0; j < n; amax += abs(x[j][i]), j++) ; return norm; }
static float function(final float[][] x) { final int n = x.length; final int m = x[0].length; int j; float amax, norm = 0; for (int i = 0; i < m; norm = max(norm, amax), i++) for (amax = 0, j = 0; j < n; amax += abs(x[j][i]), j++) ; return norm; }
/** * L1 (column) norm of a NxM matrix. * * @param x float[][] the matrix * @return float the norm */
L1 (column) norm of a NxM matrix
norm1
{ "repo_name": "axkr/symja_android_library", "path": "symja_android_library/matheclipse-external/src/main/java/de/lab4inf/math/lapack/LinearAlgebra.java", "license": "gpl-3.0", "size": 103733 }
[ "java.lang.Math" ]
import java.lang.Math;
import java.lang.*;
[ "java.lang" ]
java.lang;
23,494
LibraryFactory getLibraryFactory(); interface Literals { EEnum BOOK_CATEGORY = eINSTANCE.getBookCategory(); }
LibraryFactory getLibraryFactory(); interface Literals { EEnum BOOK_CATEGORY = eINSTANCE.getBookCategory(); }
/** * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the factory that creates the instances of the model. * @generated */
Returns the factory that creates the instances of the model.
getLibraryFactory
{ "repo_name": "planger/collaborative-modeling-tutorial", "path": "org.eclipse.papyrus.training.library.profile/src/org/eclipse/papyrus/training/library/profile/library/LibraryPackage.java", "license": "epl-1.0", "size": 3420 }
[ "org.eclipse.emf.ecore.EEnum" ]
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,036,975
public List<Qualifier> getQualifiers() { return qualifiers; }
List<Qualifier> function() { return qualifiers; }
/** * The qualifiers associated with this source reference. * * @return The qualifiers associated with this source reference. */
The qualifiers associated with this source reference
getQualifiers
{ "repo_name": "FamilySearch/fs-platform-android", "path": "fs-android/src/main/java/org/gedcomx/source/SourceReference.java", "license": "apache-2.0", "size": 3139 }
[ "java.util.List", "org.gedcomx.common.Qualifier" ]
import java.util.List; import org.gedcomx.common.Qualifier;
import java.util.*; import org.gedcomx.common.*;
[ "java.util", "org.gedcomx.common" ]
java.util; org.gedcomx.common;
1,616,708
public Enumeration<String> getFileParameterNames() { return new IteratorEnumeration(this.files.keySet().iterator()); }
Enumeration<String> function() { return new IteratorEnumeration(this.files.keySet().iterator()); }
/** * Fetches the names of all file parameters in the request. Note that these are not the file * names, but the names given to the form fields in which the files are specified. * * @return the names of all file parameters in the request. */
Fetches the names of all file parameters in the request. Note that these are not the file names, but the names given to the form fields in which the files are specified
getFileParameterNames
{ "repo_name": "scarcher2/stripes", "path": "stripes/src/net/sourceforge/stripes/controller/multipart/CommonsMultipartWrapper.java", "license": "apache-2.0", "size": 9495 }
[ "java.util.Enumeration" ]
import java.util.Enumeration;
import java.util.*;
[ "java.util" ]
java.util;
1,982,376
public Date getAlarmbegin() { return alarmbegin; }
Date function() { return alarmbegin; }
/** * This method was generated by MyBatis Generator. * This method returns the value of the database column nfjd502.dbo.BAlarmData.AlarmBegin * * @return the value of nfjd502.dbo.BAlarmData.AlarmBegin * * @mbggenerated Thu Mar 02 11:23:21 CST 2017 */
This method was generated by MyBatis Generator. This method returns the value of the database column nfjd502.dbo.BAlarmData.AlarmBegin
getAlarmbegin
{ "repo_name": "xtwxy/cassandra-tests", "path": "mstar-server-dao/src/main/java/com/wincom/mstar/domain/BAlarmData.java", "license": "apache-2.0", "size": 25523 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,661,627
double readTos() throws IOException { byte[] buffer = new byte[2]; int readedBytes = this.read(3,buffer, 0, 2); log.trace("readTos readedBytes: " + readedBytes); if(readedBytes>0) log.trace("BUFFER0:"+ buffer[0]);; if(readedBytes>1) log.trace("BUFFER1:"+ buffer[1]);; return convertBytesToTemperatur(buffer); }
double readTos() throws IOException { byte[] buffer = new byte[2]; int readedBytes = this.read(3,buffer, 0, 2); log.trace(STR + readedBytes); if(readedBytes>0) log.trace(STR+ buffer[0]);; if(readedBytes>1) log.trace(STR+ buffer[1]);; return convertBytesToTemperatur(buffer); }
/** * read current Tos-Status from register 03 * @return * @throws IOException */
read current Tos-Status from register 03
readTos
{ "repo_name": "eddi888/ultra-pi2c", "path": "src/main/java/org/atomspace/pi2c/device/lm75/Lm75.java", "license": "apache-2.0", "size": 5890 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,666,725
public String getInput() { return input; } } public static class JSONParseException extends ParseException { public JSONParseException(String input, JSONException e) { super(input, e); } }
String function() { return input; } } public static class JSONParseException extends ParseException { public JSONParseException(String input, JSONException e) { super(input, e); } }
/** * Returns the original text that failed to be parsed */
Returns the original text that failed to be parsed
getInput
{ "repo_name": "tmalahie/aQuery", "path": "main/java/aquery/com/aquery/$Utils.java", "license": "lgpl-3.0", "size": 65615 }
[ "org.json.JSONException" ]
import org.json.JSONException;
import org.json.*;
[ "org.json" ]
org.json;
2,280,444
Annotation createWeakWarningAnnotation(@NotNull ASTNode node, @Nullable String message);
Annotation createWeakWarningAnnotation(@NotNull ASTNode node, @Nullable String message);
/** * Creates an annotation with severity {@link HighlightSeverity#WEAK_WARNING} ('weak warning') with the specified * message over the specified AST node. * * @param node the node over which the annotation is created. * @param message the info message. * @return the annotation (which can be modified to set additional annotation parameters) */
Creates an annotation with severity <code>HighlightSeverity#WEAK_WARNING</code> ('weak warning') with the specified message over the specified AST node
createWeakWarningAnnotation
{ "repo_name": "akosyakov/intellij-community", "path": "platform/analysis-api/src/com/intellij/lang/annotation/AnnotationHolder.java", "license": "apache-2.0", "size": 7924 }
[ "com.intellij.lang.ASTNode", "org.jetbrains.annotations.NotNull", "org.jetbrains.annotations.Nullable" ]
import com.intellij.lang.ASTNode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
import com.intellij.lang.*; import org.jetbrains.annotations.*;
[ "com.intellij.lang", "org.jetbrains.annotations" ]
com.intellij.lang; org.jetbrains.annotations;
118,044
private void copyConfigurationFiles() throws IOException { for (Entry<String, String> entry : filePathMap.entrySet()) { String sourceFileName = entry.getKey(); String fileDestinationPath = entry.getValue(); File file; if (SolrConstants.SOLR_HOME.equals(fileDestinationPath)) { file = new File(solrHome, sourceFileName); } else if (SolrConstants.SOLR_CORE.equals(fileDestinationPath)) { file = new File(confDir.getParentFile(), sourceFileName); } else if (SolrConstants.SOLR_CONF_LANG.equals(fileDestinationPath)) { file = new File(langDir, sourceFileName); } else { file = new File(confDir, sourceFileName); } if (!file.exists()) { write2File(sourceFileName, file); } } }
void function() throws IOException { for (Entry<String, String> entry : filePathMap.entrySet()) { String sourceFileName = entry.getKey(); String fileDestinationPath = entry.getValue(); File file; if (SolrConstants.SOLR_HOME.equals(fileDestinationPath)) { file = new File(solrHome, sourceFileName); } else if (SolrConstants.SOLR_CORE.equals(fileDestinationPath)) { file = new File(confDir.getParentFile(), sourceFileName); } else if (SolrConstants.SOLR_CONF_LANG.equals(fileDestinationPath)) { file = new File(langDir, sourceFileName); } else { file = new File(confDir, sourceFileName); } if (!file.exists()) { write2File(sourceFileName, file); } } }
/** * Copy solr configuration files in resource folder to solr home folder. * @throws IOException */
Copy solr configuration files in resource folder to solr home folder
copyConfigurationFiles
{ "repo_name": "arunasujith/carbon-registry", "path": "components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/solr/SolrClient.java", "license": "apache-2.0", "size": 53679 }
[ "java.io.File", "java.io.IOException", "java.util.Map", "org.wso2.carbon.registry.indexing.SolrConstants" ]
import java.io.File; import java.io.IOException; import java.util.Map; import org.wso2.carbon.registry.indexing.SolrConstants;
import java.io.*; import java.util.*; import org.wso2.carbon.registry.indexing.*;
[ "java.io", "java.util", "org.wso2.carbon" ]
java.io; java.util; org.wso2.carbon;
1,722,424
boolean isUserOwner() { long userID = ImViewerAgent.getUserDetails().getId(); return EditorUtil.isUserOwner(getImage(), userID); }
boolean isUserOwner() { long userID = ImViewerAgent.getUserDetails().getId(); return EditorUtil.isUserOwner(getImage(), userID); }
/** * Returns <code>true</code> if the user logged in is the owner of the * image, <code>false</code> otherwise. * * @return See above. */
Returns <code>true</code> if the user logged in is the owner of the image, <code>false</code> otherwise
isUserOwner
{ "repo_name": "stelfrich/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java", "license": "gpl-2.0", "size": 80456 }
[ "org.openmicroscopy.shoola.agents.imviewer.ImViewerAgent", "org.openmicroscopy.shoola.agents.util.EditorUtil" ]
import org.openmicroscopy.shoola.agents.imviewer.ImViewerAgent; import org.openmicroscopy.shoola.agents.util.EditorUtil;
import org.openmicroscopy.shoola.agents.imviewer.*; import org.openmicroscopy.shoola.agents.util.*;
[ "org.openmicroscopy.shoola" ]
org.openmicroscopy.shoola;
592,084
@Deprecated public void setScanDir (File dir) { _scanDirs = new ArrayList(); _scanDirs.add(dir); }
void function (File dir) { _scanDirs = new ArrayList(); _scanDirs.add(dir); }
/** * Set the location of the directory to scan. * @param dir * @deprecated use setScanDirs(List dirs) instead */
Set the location of the directory to scan
setScanDir
{ "repo_name": "mabrek/jetty", "path": "jetty-util/src/main/java/org/eclipse/jetty/util/Scanner.java", "license": "apache-2.0", "size": 13694 }
[ "java.io.File", "java.util.ArrayList" ]
import java.io.File; import java.util.ArrayList;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,843,242
private void updateVmsOfInstanceType() { if (!isInstanceType()) { return; } // get vms from db List<VM> vmsToUpdate = getVmDao().getVmsListByInstanceType(getVmTemplateId()); for (VM vm : vmsToUpdate) { VmManagementParametersBase params = new VmManagementParametersBase(vm); params.setApplyChangesLater(true); runInternalAction(VdcActionType.UpdateVm, params); } }
void function() { if (!isInstanceType()) { return; } List<VM> vmsToUpdate = getVmDao().getVmsListByInstanceType(getVmTemplateId()); for (VM vm : vmsToUpdate) { VmManagementParametersBase params = new VmManagementParametersBase(vm); params.setApplyChangesLater(true); runInternalAction(VdcActionType.UpdateVm, params); } }
/** * only in case of InstanceType update, update all vms that are bound to it */
only in case of InstanceType update, update all vms that are bound to it
updateVmsOfInstanceType
{ "repo_name": "yingyun001/ovirt-engine", "path": "backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java", "license": "apache-2.0", "size": 23352 }
[ "java.util.List", "org.ovirt.engine.core.common.action.VdcActionType", "org.ovirt.engine.core.common.action.VmManagementParametersBase" ]
import java.util.List; import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VmManagementParametersBase;
import java.util.*; import org.ovirt.engine.core.common.action.*;
[ "java.util", "org.ovirt.engine" ]
java.util; org.ovirt.engine;
2,849,615
private boolean isPublicOrProtected(DetailAST aAST) { final DetailAST modifiersAST = aAST.findFirstToken(TokenTypes.MODIFIERS); final DetailAST publicAST = modifiersAST.findFirstToken(TokenTypes.LITERAL_PUBLIC); final DetailAST protectedAST = modifiersAST.findFirstToken(TokenTypes.LITERAL_PROTECTED); return (publicAST != null) || (protectedAST != null); }
boolean function(DetailAST aAST) { final DetailAST modifiersAST = aAST.findFirstToken(TokenTypes.MODIFIERS); final DetailAST publicAST = modifiersAST.findFirstToken(TokenTypes.LITERAL_PUBLIC); final DetailAST protectedAST = modifiersAST.findFirstToken(TokenTypes.LITERAL_PROTECTED); return (publicAST != null) (protectedAST != null); }
/** * Checks if given method declared as public or * protected and non-static. * @param aAST method definition node * @return true if given method is declared as public or protected */
Checks if given method declared as public or protected and non-static
isPublicOrProtected
{ "repo_name": "gkzhong/checkstyle", "path": "src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/JUnitTestCaseCheck.java", "license": "lgpl-2.1", "size": 7836 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST", "com.puppycrawl.tools.checkstyle.api.TokenTypes" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
2,255,383
public void ping(InetAddress host, long timeout, int retries, int packetsize, int sequenceId, PingResponseCallback cb) throws Exception;
void function(InetAddress host, long timeout, int retries, int packetsize, int sequenceId, PingResponseCallback cb) throws Exception;
/** * This method is used to ping a remote host to test for ICMP support. Calls * the callback method upon success or error. * * @param host The {@link java.net.InetAddress} address to poll. * @param timeout The time to wait between each retry. * @param retries The number of times to retry. * @param packetsize The size in byte of the ICMP packet. * @param sequenceId an ID representing the ping * * @param cb the {@link org.opennms.netmgt.ping.PingResponseCallback} callback to call upon success or error */
This method is used to ping a remote host to test for ICMP support. Calls the callback method upon success or error
ping
{ "repo_name": "bugcy013/opennms-tmp-tools", "path": "opennms-icmp/opennms-icmp-api/src/main/java/org/opennms/netmgt/icmp/Pinger.java", "license": "gpl-2.0", "size": 6042 }
[ "java.net.InetAddress" ]
import java.net.InetAddress;
import java.net.*;
[ "java.net" ]
java.net;
2,394,301
@Override protected Size2D arrangeFN(Graphics2D g2, double w) { g2.setFont(getFont()); FontMetrics fm = g2.getFontMetrics(getFont()); Rectangle2D bounds = TextUtilities.getTextBounds(getText(), g2, fm); if (bounds.getWidth() <= w) { return new Size2D(w, bounds.getHeight()); } else { return new Size2D(0.0, 0.0); } }
Size2D function(Graphics2D g2, double w) { g2.setFont(getFont()); FontMetrics fm = g2.getFontMetrics(getFont()); Rectangle2D bounds = TextUtilities.getTextBounds(getText(), g2, fm); if (bounds.getWidth() <= w) { return new Size2D(w, bounds.getHeight()); } else { return new Size2D(0.0, 0.0); } }
/** * Arranges the content for this title assuming a fixed width and no bounds * on the height, and returns the required size. This will reflect the * fact that a text title positioned on the left or right of a chart will * be rotated by 90 degrees. * * @param g2 the graphics target. * @param w the width. * * @return The content size. */
Arranges the content for this title assuming a fixed width and no bounds on the height, and returns the required size. This will reflect the fact that a text title positioned on the left or right of a chart will be rotated by 90 degrees
arrangeFN
{ "repo_name": "hongliangpan/manydesigns.cn", "path": "trunk/portofino-chart/jfreechat.src/org/jfree/chart/title/ShortTextTitle.java", "license": "lgpl-3.0", "size": 8222 }
[ "java.awt.FontMetrics", "java.awt.Graphics2D", "java.awt.geom.Rectangle2D", "org.jfree.text.TextUtilities", "org.jfree.ui.Size2D" ]
import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import org.jfree.text.TextUtilities; import org.jfree.ui.Size2D;
import java.awt.*; import java.awt.geom.*; import org.jfree.text.*; import org.jfree.ui.*;
[ "java.awt", "org.jfree.text", "org.jfree.ui" ]
java.awt; org.jfree.text; org.jfree.ui;
2,551,796
public void onClick(ClickEvent event) { if (isEnabled()) { if (!m_item.getCheckBox().isChecked()) { if (m_isSingleSelection) { deselectAll(m_item.getId()); m_singleResult = m_item.getId(); } else { Iterator<Widget> it = m_scrollList.iterator(); while (it.hasNext()) { selectAllParents((CmsTreeItem)it.next(), m_item.getId()); } } } else { if (m_isSingleSelection) { deselectAll(""); } else { deselect(m_item, ""); deselectParent(m_item); } } m_item.getCheckBox().setChecked(!m_item.getCheckBox().isChecked()); fireValueChange(); } } } protected static final I_CmsCategoryDialogCss DIALOG_CSS = I_CmsLayoutBundle.INSTANCE.categoryDialogCss(); private static final int FILTER_DELAY = 100; private static final String TM_GALLERY_SORT = "gallerySort"; private static I_CmsCategoryTreeUiBinder uiBinder = GWT.create(I_CmsCategoryTreeUiBinder.class); protected Map<String, CmsTreeItem> m_categories; protected ValueChangeEvent<String> m_event; protected HasText m_infoLabel; protected boolean m_isSingleSelection; protected boolean m_listView; @UiField protected FlowPanel m_options; protected CmsTextBox m_quickSearch; protected List<CmsCategoryTreeEntry> m_resultList; protected CmsList<CmsTreeItem> m_scrollList; protected CmsPushButton m_searchButton; protected List<String> m_selectedCategories; protected String m_singleResult = ""; protected CmsSelectBox m_sortSelectBox; @UiField CmsScrollPanel m_list; @UiField FlowPanel m_tab; private String m_disabledReason; private Timer m_filterTimer; private boolean m_isEnalbled; public CmsCategoryTree() { uiBinder.createAndBindUi(this); initWidget(uiBinder.createAndBindUi(this)); m_isEnalbled = true; } public CmsCategoryTree( List<String> selectedCategories, int height, boolean isSingleValue, List<CmsCategoryTreeEntry> resultList) { this(); m_isSingleSelection = isSingleValue; addStyleName(I_CmsInputLayoutBundle.INSTANCE.inputCss().categoryItem()); m_list.addStyleName(I_CmsInputLayoutBundle.INSTANCE.inputCss().categoryScrollPanel()); m_selectedCategories = selectedCategories; Iterator<String> it = selectedCategories.iterator(); while (it.hasNext()) { m_singleResult = it.next(); } m_scrollList = createScrollList(); m_list.setHeight(height + "px"); m_resultList = resultList; m_list.add(m_scrollList); updateContentTree(resultList, m_selectedCategories); init(); }
void function(ClickEvent event) { if (isEnabled()) { if (!m_item.getCheckBox().isChecked()) { if (m_isSingleSelection) { deselectAll(m_item.getId()); m_singleResult = m_item.getId(); } else { Iterator<Widget> it = m_scrollList.iterator(); while (it.hasNext()) { selectAllParents((CmsTreeItem)it.next(), m_item.getId()); } } } else { if (m_isSingleSelection) { deselectAll(STRSTRgallerySortSTRSTRpx"); m_resultList = resultList; m_list.add(m_scrollList); updateContentTree(resultList, m_selectedCategories); init(); }
/** * Is triggered if the DataValue widget is clicked.<p> * If its check box was selected the click will deselect this box otherwise it will select it. * * @param event The event that is triggered * */
Is triggered if the DataValue widget is clicked. If its check box was selected the click will deselect this box otherwise it will select it
onClick
{ "repo_name": "victos/opencms-core", "path": "src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java", "license": "lgpl-2.1", "size": 39765 }
[ "com.google.gwt.event.dom.client.ClickEvent", "com.google.gwt.user.client.ui.Widget", "java.util.Iterator", "org.opencms.gwt.client.ui.tree.CmsTreeItem" ]
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.user.client.ui.Widget; import java.util.Iterator; import org.opencms.gwt.client.ui.tree.CmsTreeItem;
import com.google.gwt.event.dom.client.*; import com.google.gwt.user.client.ui.*; import java.util.*; import org.opencms.gwt.client.ui.tree.*;
[ "com.google.gwt", "java.util", "org.opencms.gwt" ]
com.google.gwt; java.util; org.opencms.gwt;
242,122
public FeedMetaDataHolder getHolder() { return holder; }
FeedMetaDataHolder function() { return holder; }
/** * Returns holder to fill with information. * * @return holder to fill. */
Returns holder to fill with information
getHolder
{ "repo_name": "pitosalas/blogbridge", "path": "src/com/salas/bb/discovery/MDDiscoveryRequest.java", "license": "gpl-2.0", "size": 4426 }
[ "com.salas.bb.domain.FeedMetaDataHolder" ]
import com.salas.bb.domain.FeedMetaDataHolder;
import com.salas.bb.domain.*;
[ "com.salas.bb" ]
com.salas.bb;
1,157,269
public static Properties load(String name) throws IOException { return load(ClassUtils.getDefaultClassLoader().getResourceAsStream(Objects.requireNonNull(name))); }
static Properties function(String name) throws IOException { return load(ClassUtils.getDefaultClassLoader().getResourceAsStream(Objects.requireNonNull(name))); }
/** * Returns a {@link Properties} loaded by a given properties file. * * @param name * The path of the {@link Properties} file to be loaded. Might not be <code>null</code>. * @return The {@link Properties} load of the given file. * @throws IOException * If the given file does not exist. */
Returns a <code>Properties</code> loaded by a given properties file
load
{ "repo_name": "alessandroleite/greenapi", "path": "core/src/main/java/greenapi/core/common/base/PropertiesUtils.java", "license": "mit", "size": 6269 }
[ "java.io.IOException", "java.util.Objects", "java.util.Properties" ]
import java.io.IOException; import java.util.Objects; import java.util.Properties;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
675,029
public TProcessor wrapNonAssumingProcessor(TProcessor processor) { return new TUGIAssumingProcessor(processor, secretManager, false); } final static ThreadLocal<InetAddress> remoteAddress = new ThreadLocal<InetAddress>() {
TProcessor function(TProcessor processor) { return new TUGIAssumingProcessor(processor, secretManager, false); } final static ThreadLocal<InetAddress> remoteAddress = new ThreadLocal<InetAddress>() {
/** * Wrap a TProcessor to capture the client information like connecting userid, ip etc */
Wrap a TProcessor to capture the client information like connecting userid, ip etc
wrapNonAssumingProcessor
{ "repo_name": "b-slim/hive", "path": "standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/security/HadoopThriftAuthBridge.java", "license": "apache-2.0", "size": 26866 }
[ "java.net.InetAddress", "org.apache.thrift.TProcessor" ]
import java.net.InetAddress; import org.apache.thrift.TProcessor;
import java.net.*; import org.apache.thrift.*;
[ "java.net", "org.apache.thrift" ]
java.net; org.apache.thrift;
2,033,023
public List<FrameworkField> getAnnotatedFields( Class<? extends Annotation> annotationClass) { return Collections.unmodifiableList(getAnnotatedMembers(fieldsForAnnotations, annotationClass, false)); }
List<FrameworkField> function( Class<? extends Annotation> annotationClass) { return Collections.unmodifiableList(getAnnotatedMembers(fieldsForAnnotations, annotationClass, false)); }
/** * Returns, efficiently, all the non-overridden fields in this class and its * superclasses that are annotated with {@code annotationClass}. */
Returns, efficiently, all the non-overridden fields in this class and its superclasses that are annotated with annotationClass
getAnnotatedFields
{ "repo_name": "mekwin87/junit4", "path": "src/main/java/org/junit/runners/model/TestClass.java", "license": "epl-1.0", "size": 11602 }
[ "java.lang.annotation.Annotation", "java.util.Collections", "java.util.List" ]
import java.lang.annotation.Annotation; import java.util.Collections; import java.util.List;
import java.lang.annotation.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
818,643
ChronoLocalDate getMinimumLocalDate();
ChronoLocalDate getMinimumLocalDate();
/** * Get the minimum value for the column. * @return minimum value as a LocalDate */
Get the minimum value for the column
getMinimumLocalDate
{ "repo_name": "omalley/orc", "path": "java/core/src/java/org/apache/orc/DateColumnStatistics.java", "license": "apache-2.0", "size": 1884 }
[ "java.time.chrono.ChronoLocalDate" ]
import java.time.chrono.ChronoLocalDate;
import java.time.chrono.*;
[ "java.time" ]
java.time;
1,847,579
public static TestResult generateTAPTestResult(ITestResult testResult, Integer number, boolean yaml) { final TestResult tapTestResult = new TestResult(); String testResultDescription = generateTAPTestResultDescription(testResult); tapTestResult.setDescription(testResultDescription); TapTestNGUtil.setTapTestResultStatus(tapTestResult, testResult.getStatus()); if (yaml) { TapTestNGYamlUtil.createTestNGYAMLishData(tapTestResult, testResult); } return tapTestResult; }
static TestResult function(ITestResult testResult, Integer number, boolean yaml) { final TestResult tapTestResult = new TestResult(); String testResultDescription = generateTAPTestResultDescription(testResult); tapTestResult.setDescription(testResultDescription); TapTestNGUtil.setTapTestResultStatus(tapTestResult, testResult.getStatus()); if (yaml) { TapTestNGYamlUtil.createTestNGYAMLishData(tapTestResult, testResult); } return tapTestResult; }
/** * Generates a TAP TestResult from a given TestNG TestResult. * * @param testResult TestNG Test Result * @param number TAP Test Number * @param yaml whether YAML is enabled or not * @return TAP TestResult */
Generates a TAP TestResult from a given TestNG TestResult
generateTAPTestResult
{ "repo_name": "s2oBCN/tap4j", "path": "tap4j-ext/src/main/java/org/tap4j/ext/testng/util/TapTestNGUtil.java", "license": "mit", "size": 10461 }
[ "org.tap4j.model.TestResult", "org.testng.ITestResult" ]
import org.tap4j.model.TestResult; import org.testng.ITestResult;
import org.tap4j.model.*; import org.testng.*;
[ "org.tap4j.model", "org.testng" ]
org.tap4j.model; org.testng;
1,334,316
public static boolean contentEquals(Reader input1, Reader input2) throws IOException { if (!(input1 instanceof BufferedReader)) { input1 = new BufferedReader(input1); } if (!(input2 instanceof BufferedReader)) { input2 = new BufferedReader(input2); } int ch = input1.read(); while (-1 != ch) { int ch2 = input2.read(); if (ch != ch2) { return false; } ch = input1.read(); } int ch2 = input2.read(); return (ch2 == -1); }
static boolean function(Reader input1, Reader input2) throws IOException { if (!(input1 instanceof BufferedReader)) { input1 = new BufferedReader(input1); } if (!(input2 instanceof BufferedReader)) { input2 = new BufferedReader(input2); } int ch = input1.read(); while (-1 != ch) { int ch2 = input2.read(); if (ch != ch2) { return false; } ch = input1.read(); } int ch2 = input2.read(); return (ch2 == -1); }
/** * Compare the contents of two Readers to determine if they are equal or * not. * <p> * This method buffers the input internally using * <code>BufferedReader</code> if they are not already buffered. * * @param input1 the first reader * @param input2 the second reader * @return true if the content of the readers are equal or they both don't * exist, false otherwise * @throws NullPointerException if either input is null * @throws IOException if an I/O error occurs * @since Commons IO 1.1 */
Compare the contents of two Readers to determine if they are equal or not. This method buffers the input internally using <code>BufferedReader</code> if they are not already buffered
contentEquals
{ "repo_name": "rytina/dukecon_appsgenerator", "path": "org.apache.commons.io/source-bundle/org/apache/commons/io/IOUtils.java", "license": "epl-1.0", "size": 62217 }
[ "java.io.BufferedReader", "java.io.IOException", "java.io.Reader" ]
import java.io.BufferedReader; import java.io.IOException; import java.io.Reader;
import java.io.*;
[ "java.io" ]
java.io;
531,411
private void saveModels(Workbook wb, I_State state) { Sheet sheet = wb.getSheetAt(MODEL_SHEET); List<Integer> modelsToDelete = new ArrayList<Integer>(); for (Row row : sheet) { if (row.getRowNum() == 0 || isRowEmpty(row)) continue; if (row.getCell(MODEL_STATE_ID).getNumericCellValue() == state.getTid()) { boolean isModelFound = false; for (I_DemandModel model : state.getDemandModels()) { if (model.getTid() == row.getCell(MODEL_ID).getNumericCellValue()) { isModelFound = true; break; } } if (!isModelFound) modelsToDelete.add((int) row.getCell(MODEL_ID).getNumericCellValue()); } } for (Integer i : modelsToDelete) { deleteModel(wb, i); } for (I_DemandModel model : state.getDemandModels()) { int rowNum = -1, maxTid = 0; for (Row row : sheet) { if (row.getRowNum() == 0 || isRowEmpty(row)) continue; if (row.getCell(MODEL_ID).getNumericCellValue() == model.getTid()) { rowNum = row.getRowNum(); } maxTid = (int) Math.max(maxTid, row.getCell(MODEL_ID).getNumericCellValue()); } Row row = null; if (rowNum < 0) { // model not found in database -- create new entry rowNum = getLastNonEmptyRow(sheet) + 1; model.setTid(maxTid + 1); row = sheet.getRow(rowNum); if (row == null) { row = sheet.createRow(rowNum); } } else { row = sheet.getRow(rowNum); } row.getCell(MODEL_ID).setCellValue(model.getTid()); row.getCell(MODEL_TYPE).setCellValue(model.getDemandModelType().getName()); row.getCell(MODEL_STATE_ID).setCellValue(state.getTid()); row.getCell(MODEL_NAME).setCellValue(model.getName()); if (model.getDemandModelType() == DemandModelType.TIMED_IMPULSE || model.getDemandModelType() == DemandModelType.RATED) { saveDemands(wb, model); } else if (model.getDemandModelType() == DemandModelType.SPARING_BY_MASS) { row.getCell(MODEL_PARTS_LIST).setCellValue(((SparingByMassDemandModel) model).isPartsListEnabled()); row.getCell(MODEL_UNPRESS_RATE).setCellValue(((SparingByMassDemandModel) model).getUnpressurizedSparesRate()); row.getCell(MODEL_PRESS_RATE).setCellValue(((SparingByMassDemandModel) model).getPressurizedSparesRate()); } } }
void function(Workbook wb, I_State state) { Sheet sheet = wb.getSheetAt(MODEL_SHEET); List<Integer> modelsToDelete = new ArrayList<Integer>(); for (Row row : sheet) { if (row.getRowNum() == 0 isRowEmpty(row)) continue; if (row.getCell(MODEL_STATE_ID).getNumericCellValue() == state.getTid()) { boolean isModelFound = false; for (I_DemandModel model : state.getDemandModels()) { if (model.getTid() == row.getCell(MODEL_ID).getNumericCellValue()) { isModelFound = true; break; } } if (!isModelFound) modelsToDelete.add((int) row.getCell(MODEL_ID).getNumericCellValue()); } } for (Integer i : modelsToDelete) { deleteModel(wb, i); } for (I_DemandModel model : state.getDemandModels()) { int rowNum = -1, maxTid = 0; for (Row row : sheet) { if (row.getRowNum() == 0 isRowEmpty(row)) continue; if (row.getCell(MODEL_ID).getNumericCellValue() == model.getTid()) { rowNum = row.getRowNum(); } maxTid = (int) Math.max(maxTid, row.getCell(MODEL_ID).getNumericCellValue()); } Row row = null; if (rowNum < 0) { rowNum = getLastNonEmptyRow(sheet) + 1; model.setTid(maxTid + 1); row = sheet.getRow(rowNum); if (row == null) { row = sheet.createRow(rowNum); } } else { row = sheet.getRow(rowNum); } row.getCell(MODEL_ID).setCellValue(model.getTid()); row.getCell(MODEL_TYPE).setCellValue(model.getDemandModelType().getName()); row.getCell(MODEL_STATE_ID).setCellValue(state.getTid()); row.getCell(MODEL_NAME).setCellValue(model.getName()); if (model.getDemandModelType() == DemandModelType.TIMED_IMPULSE model.getDemandModelType() == DemandModelType.RATED) { saveDemands(wb, model); } else if (model.getDemandModelType() == DemandModelType.SPARING_BY_MASS) { row.getCell(MODEL_PARTS_LIST).setCellValue(((SparingByMassDemandModel) model).isPartsListEnabled()); row.getCell(MODEL_UNPRESS_RATE).setCellValue(((SparingByMassDemandModel) model).getUnpressurizedSparesRate()); row.getCell(MODEL_PRESS_RATE).setCellValue(((SparingByMassDemandModel) model).getPressurizedSparesRate()); } } }
/** * Saves the associated demand models contained within a state. Removed * models will be deleted from the data source, changed models will be * updated, and added models will assigned a new TID and be inserted. * * @param wb the workbook * @param state the state */
Saves the associated demand models contained within a state. Removed models will be deleted from the data source, changed models will be updated, and added models will assigned a new TID and be inserted
saveModels
{ "repo_name": "ptgrogan/spacenet", "path": "src/main/java/edu/mit/spacenet/data/Spreadsheet_2_5.java", "license": "apache-2.0", "size": 99299 }
[ "edu.mit.spacenet.domain.element.State", "edu.mit.spacenet.domain.model.DemandModelType", "edu.mit.spacenet.domain.model.SparingByMassDemandModel", "java.util.ArrayList", "java.util.List", "org.apache.poi.ss.usermodel.Row", "org.apache.poi.ss.usermodel.Sheet", "org.apache.poi.ss.usermodel.Workbook" ]
import edu.mit.spacenet.domain.element.State; import edu.mit.spacenet.domain.model.DemandModelType; import edu.mit.spacenet.domain.model.SparingByMassDemandModel; import java.util.ArrayList; import java.util.List; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook;
import edu.mit.spacenet.domain.element.*; import edu.mit.spacenet.domain.model.*; import java.util.*; import org.apache.poi.ss.usermodel.*;
[ "edu.mit.spacenet", "java.util", "org.apache.poi" ]
edu.mit.spacenet; java.util; org.apache.poi;
461,933
public void setMonth(int month) { if(month<DatatypeConstants.JANUARY || DatatypeConstants.DECEMBER<month) if(month!=DatatypeConstants.FIELD_UNDEFINED) invalidFieldValue(MONTH, month); this.month = month; }
void function(int month) { if(month<DatatypeConstants.JANUARY DatatypeConstants.DECEMBER<month) if(month!=DatatypeConstants.FIELD_UNDEFINED) invalidFieldValue(MONTH, month); this.month = month; }
/** * <p>Set month.</p> * * <p>Unset this field by invoking the setter with a parameter value of {@link DatatypeConstants#FIELD_UNDEFINED}.</p> * * @param month value constraints summarized in <a href="#datetimefield-month">month field of date/time field mapping table</a>. * * @throws IllegalArgumentException if <code>month</code> parameter is * outside value constraints for the field as specified in * <a href="#datetimefieldmapping">date/time field mapping table</a>. */
Set month. Unset this field by invoking the setter with a parameter value of <code>DatatypeConstants#FIELD_UNDEFINED</code>
setMonth
{ "repo_name": "shun634501730/java_source_cn", "path": "src_en/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java", "license": "apache-2.0", "size": 115945 }
[ "javax.xml.datatype.DatatypeConstants" ]
import javax.xml.datatype.DatatypeConstants;
import javax.xml.datatype.*;
[ "javax.xml" ]
javax.xml;
548,704
public RatioValue getAsRatio(String[] settings, String defaultValue) throws SettingsException { return RatioValue.parseRatioValue(get(settings, defaultValue)); }
RatioValue function(String[] settings, String defaultValue) throws SettingsException { return RatioValue.parseRatioValue(get(settings, defaultValue)); }
/** * Returns the setting value (as a RatioValue) associated with the setting key. Provided values can * either be a percentage value (eg. 23%), or expressed as a floating point number (eg. 0.23). If * it does not exist, parses the default value provided. */
Returns the setting value (as a RatioValue) associated with the setting key. Provided values can either be a percentage value (eg. 23%), or expressed as a floating point number (eg. 0.23). If it does not exist, parses the default value provided
getAsRatio
{ "repo_name": "mapr/elasticsearch", "path": "core/src/main/java/org/elasticsearch/common/settings/Settings.java", "license": "apache-2.0", "size": 49124 }
[ "org.elasticsearch.common.unit.RatioValue" ]
import org.elasticsearch.common.unit.RatioValue;
import org.elasticsearch.common.unit.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
2,888,316
public void runEndOfStreamTest() throws Exception { final int elementCount = 300; final String topic = writeSequence("testEndOfStream", elementCount, 1, 1); // read using custom schema final StreamExecutionEnvironment env1 = StreamExecutionEnvironment.getExecutionEnvironment(); env1.setParallelism(1); env1.getConfig().setRestartStrategy(RestartStrategies.noRestart()); env1.getConfig().disableSysoutLogging(); Properties props = new Properties(); props.putAll(standardProps); props.putAll(secureProps);
void function() throws Exception { final int elementCount = 300; final String topic = writeSequence(STR, elementCount, 1, 1); final StreamExecutionEnvironment env1 = StreamExecutionEnvironment.getExecutionEnvironment(); env1.setParallelism(1); env1.getConfig().setRestartStrategy(RestartStrategies.noRestart()); env1.getConfig().disableSysoutLogging(); Properties props = new Properties(); props.putAll(standardProps); props.putAll(secureProps);
/** * Test that ensures that DeserializationSchema.isEndOfStream() is properly evaluated. * * @throws Exception */
Test that ensures that DeserializationSchema.isEndOfStream() is properly evaluated
runEndOfStreamTest
{ "repo_name": "hongyuhong/flink", "path": "flink-connectors/flink-connector-kafka-base/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaConsumerTestBase.java", "license": "apache-2.0", "size": 80465 }
[ "java.util.Properties", "org.apache.flink.api.common.restartstrategy.RestartStrategies", "org.apache.flink.streaming.api.environment.StreamExecutionEnvironment" ]
import java.util.Properties; import org.apache.flink.api.common.restartstrategy.RestartStrategies; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import java.util.*; import org.apache.flink.api.common.restartstrategy.*; import org.apache.flink.streaming.api.environment.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
759,512
public Model getModel2() { return models[1]; }
Model function() { return models[1]; }
/** * Gets the model2. * * @return the model2 */
Gets the model2
getModel2
{ "repo_name": "cortical-io/java-client-sdk", "path": "retina-service-java-api-client/src/main/java/io/cortical/services/Compare.java", "license": "bsd-2-clause", "size": 4859 }
[ "io.cortical.rest.model.Model" ]
import io.cortical.rest.model.Model;
import io.cortical.rest.model.*;
[ "io.cortical.rest" ]
io.cortical.rest;
1,727,847
public void setIndividualProviders( Set<IndividualProvider> invividualProviders) { this.individualProviders = invividualProviders; }
void function( Set<IndividualProvider> invividualProviders) { this.individualProviders = invividualProviders; }
/** * Sets the individual providers. * * @param invividualProviders the new individual providers */
Sets the individual providers
setIndividualProviders
{ "repo_name": "tlin-fei/ds4p", "path": "DS4P/consent2share/core/src/main/java/gov/samhsa/consent2share/service/dto/PatientProfileDto.java", "license": "bsd-3-clause", "size": 13597 }
[ "gov.samhsa.consent2share.domain.provider.IndividualProvider", "java.util.Set" ]
import gov.samhsa.consent2share.domain.provider.IndividualProvider; import java.util.Set;
import gov.samhsa.consent2share.domain.provider.*; import java.util.*;
[ "gov.samhsa.consent2share", "java.util" ]
gov.samhsa.consent2share; java.util;
1,454,952
public Collection<OpenstackPort> getPorts() { Invocation.Builder builder = getClientBuilder(neutronUrl, URI_PORTS); if (builder == null) { log.warn("Failed to get ports"); return Collections.EMPTY_LIST; } String response = builder.accept(MediaType.APPLICATION_JSON_TYPE). header(HEADER_AUTH_TOKEN, getToken()).get(String.class); ObjectMapper mapper = new ObjectMapper(); List<OpenstackPort> openstackPorts = Lists.newArrayList(); try { ObjectNode node = (ObjectNode) mapper.readTree(response); ArrayNode portList = (ArrayNode) node.path(PATH_PORTS); OpenstackPortCodec portCodec = new OpenstackPortCodec(); portList.forEach(p -> openstackPorts.add(portCodec.decode((ObjectNode) p, null))); } catch (IOException e) { log.warn("getPorts()", e); } log.debug("port response:" + response); openstackPorts.forEach(n -> log.debug("port ID: {}", n.id())); return openstackPorts; }
Collection<OpenstackPort> function() { Invocation.Builder builder = getClientBuilder(neutronUrl, URI_PORTS); if (builder == null) { log.warn(STR); return Collections.EMPTY_LIST; } String response = builder.accept(MediaType.APPLICATION_JSON_TYPE). header(HEADER_AUTH_TOKEN, getToken()).get(String.class); ObjectMapper mapper = new ObjectMapper(); List<OpenstackPort> openstackPorts = Lists.newArrayList(); try { ObjectNode node = (ObjectNode) mapper.readTree(response); ArrayNode portList = (ArrayNode) node.path(PATH_PORTS); OpenstackPortCodec portCodec = new OpenstackPortCodec(); portList.forEach(p -> openstackPorts.add(portCodec.decode((ObjectNode) p, null))); } catch (IOException e) { log.warn(STR, e); } log.debug(STR + response); openstackPorts.forEach(n -> log.debug(STR, n.id())); return openstackPorts; }
/** * Returns port information stored in Neutron. * * @return List of OpenstackPort */
Returns port information stored in Neutron
getPorts
{ "repo_name": "wuwenbin2/onos_bgp_evpn", "path": "apps/openstackinterface/app/src/main/java/org/onosproject/openstackinterface/impl/OpenstackInterfaceManager.java", "license": "apache-2.0", "size": 21924 }
[ "com.fasterxml.jackson.databind.ObjectMapper", "com.fasterxml.jackson.databind.node.ArrayNode", "com.fasterxml.jackson.databind.node.ObjectNode", "com.google.common.collect.Lists", "java.io.IOException", "java.util.Collection", "java.util.Collections", "java.util.List", "javax.ws.rs.client.Invocation", "javax.ws.rs.core.MediaType", "org.onosproject.openstackinterface.OpenstackPort", "org.onosproject.openstackinterface.web.OpenstackPortCodec" ]
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.Lists; import java.io.IOException; import java.util.Collection; import java.util.Collections; import java.util.List; import javax.ws.rs.client.Invocation; import javax.ws.rs.core.MediaType; import org.onosproject.openstackinterface.OpenstackPort; import org.onosproject.openstackinterface.web.OpenstackPortCodec;
import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.node.*; import com.google.common.collect.*; import java.io.*; import java.util.*; import javax.ws.rs.client.*; import javax.ws.rs.core.*; import org.onosproject.openstackinterface.*; import org.onosproject.openstackinterface.web.*;
[ "com.fasterxml.jackson", "com.google.common", "java.io", "java.util", "javax.ws", "org.onosproject.openstackinterface" ]
com.fasterxml.jackson; com.google.common; java.io; java.util; javax.ws; org.onosproject.openstackinterface;
2,753,893
@Test public void testSingleHostByIdFetch() { final ProviderId pid = new ProviderId("of", "foo"); final MacAddress mac1 = MacAddress.valueOf("00:00:11:00:00:01"); final Set<IpAddress> ips1 = ImmutableSet.of(IpAddress.valueOf("1111:1111:1111:1::")); final Host host1 = new DefaultHost(pid, HostId.hostId(mac1), valueOf(1), vlanId((short) 1), new HostLocation(DeviceId.deviceId("1"), portNumber(11), 1), ips1); hosts.add(host1); expect(mockHostService.getHost(HostId.hostId("00:00:11:00:00:01/1"))) .andReturn(host1) .anyTimes(); replay(mockHostService); WebResource rs = resource(); String response = rs.path("hosts/00:00:11:00:00:01%2F1").get(String.class); final JsonObject result = JsonObject.readFrom(response); assertThat(result, matchesHost(host1)); }
void function() { final ProviderId pid = new ProviderId("of", "foo"); final MacAddress mac1 = MacAddress.valueOf(STR); final Set<IpAddress> ips1 = ImmutableSet.of(IpAddress.valueOf(STR)); final Host host1 = new DefaultHost(pid, HostId.hostId(mac1), valueOf(1), vlanId((short) 1), new HostLocation(DeviceId.deviceId("1"), portNumber(11), 1), ips1); hosts.add(host1); expect(mockHostService.getHost(HostId.hostId(STR))) .andReturn(host1) .anyTimes(); replay(mockHostService); WebResource rs = resource(); String response = rs.path(STR).get(String.class); final JsonObject result = JsonObject.readFrom(response); assertThat(result, matchesHost(host1)); }
/** * Tests fetch of one host by Id. */
Tests fetch of one host by Id
testSingleHostByIdFetch
{ "repo_name": "ravikumaran2015/ravikumaran201504", "path": "web/api/src/test/java/org/onosproject/rest/HostResourceTest.java", "license": "apache-2.0", "size": 12752 }
[ "com.eclipsesource.json.JsonObject", "com.google.common.collect.ImmutableSet", "com.sun.jersey.api.client.WebResource", "java.util.Set", "org.easymock.EasyMock", "org.junit.Assert", "org.onlab.packet.IpAddress", "org.onlab.packet.MacAddress", "org.onlab.packet.VlanId", "org.onosproject.net.DefaultHost", "org.onosproject.net.DeviceId", "org.onosproject.net.Host", "org.onosproject.net.HostId", "org.onosproject.net.HostLocation", "org.onosproject.net.PortNumber", "org.onosproject.net.provider.ProviderId" ]
import com.eclipsesource.json.JsonObject; import com.google.common.collect.ImmutableSet; import com.sun.jersey.api.client.WebResource; import java.util.Set; import org.easymock.EasyMock; import org.junit.Assert; import org.onlab.packet.IpAddress; import org.onlab.packet.MacAddress; import org.onlab.packet.VlanId; import org.onosproject.net.DefaultHost; import org.onosproject.net.DeviceId; import org.onosproject.net.Host; import org.onosproject.net.HostId; import org.onosproject.net.HostLocation; import org.onosproject.net.PortNumber; import org.onosproject.net.provider.ProviderId;
import com.eclipsesource.json.*; import com.google.common.collect.*; import com.sun.jersey.api.client.*; import java.util.*; import org.easymock.*; import org.junit.*; import org.onlab.packet.*; import org.onosproject.net.*; import org.onosproject.net.provider.*;
[ "com.eclipsesource.json", "com.google.common", "com.sun.jersey", "java.util", "org.easymock", "org.junit", "org.onlab.packet", "org.onosproject.net" ]
com.eclipsesource.json; com.google.common; com.sun.jersey; java.util; org.easymock; org.junit; org.onlab.packet; org.onosproject.net;
1,921,228
public void setQueryParams(Map<String, String> queryParams) { m_queryParams = queryParams; }
void function(Map<String, String> queryParams) { m_queryParams = queryParams; }
/** * Sets the query parameters. * @param queryParams NV maps with query parameters. */
Sets the query parameters
setQueryParams
{ "repo_name": "vthangathurai/SOA-Runtime", "path": "soa-server/src/main/java/org/ebayopensource/turmeric/runtime/spf/pipeline/RequestMetaContext.java", "license": "apache-2.0", "size": 4324 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
936,123
public void setEntryPoint(CFunctionPointer fnptr) { entryPoint = fnptr; }
void function(CFunctionPointer fnptr) { entryPoint = fnptr; }
/** * Sets the native address for the {@code native} method represented by this object. */
Sets the native address for the native method represented by this object
setEntryPoint
{ "repo_name": "smarr/Truffle", "path": "substratevm/src/com.oracle.svm.jni/src/com/oracle/svm/jni/access/JNINativeLinkage.java", "license": "gpl-2.0", "size": 7921 }
[ "org.graalvm.nativeimage.c.function.CFunctionPointer" ]
import org.graalvm.nativeimage.c.function.CFunctionPointer;
import org.graalvm.nativeimage.c.function.*;
[ "org.graalvm.nativeimage" ]
org.graalvm.nativeimage;
1,093,494
public void setRouteTemplates(List<RouteTemplateDefinition> routeTemplates) { this.routeTemplates = routeTemplates; }
void function(List<RouteTemplateDefinition> routeTemplates) { this.routeTemplates = routeTemplates; }
/** * Contains the Camel route templates */
Contains the Camel route templates
setRouteTemplates
{ "repo_name": "adessaigne/camel", "path": "components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java", "license": "apache-2.0", "size": 49808 }
[ "java.util.List", "org.apache.camel.model.RouteTemplateDefinition" ]
import java.util.List; import org.apache.camel.model.RouteTemplateDefinition;
import java.util.*; import org.apache.camel.model.*;
[ "java.util", "org.apache.camel" ]
java.util; org.apache.camel;
2,695,765
public static Object readFully(final Object self, final Object file) throws IOException { File f = null; if (file instanceof File) { f = (File)file; } else if (JSType.isString(file)) { f = new java.io.File(((CharSequence)file).toString()); } if (f == null || !f.isFile()) { throw typeError("not.a.file", ScriptRuntime.safeToString(file)); } return new String(Source.readFully(f)); }
static Object function(final Object self, final Object file) throws IOException { File f = null; if (file instanceof File) { f = (File)file; } else if (JSType.isString(file)) { f = new java.io.File(((CharSequence)file).toString()); } if (f == null !f.isFile()) { throw typeError(STR, ScriptRuntime.safeToString(file)); } return new String(Source.readFully(f)); }
/** * Nashorn extension: Read the entire contents of a text file and return as String. * * @param self self reference * @param file The input file whose content is read. * * @return String content of the input file. * * @throws IOException if an exception occurs */
Nashorn extension: Read the entire contents of a text file and return as String
readFully
{ "repo_name": "md-5/jdk10", "path": "src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptingFunctions.java", "license": "gpl-2.0", "size": 9309 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
677,364
ReceiveSubscriptionMessageResult receiveSubscriptionMessage( String topicPath, String subscriptionName) throws ServiceException;
ReceiveSubscriptionMessageResult receiveSubscriptionMessage( String topicPath, String subscriptionName) throws ServiceException;
/** * Receives a subscription message. * * @param topicPath * A <code>String</code> object that represents the name of the * topic to receive. * @param subscriptionName * A <code>String</code> object that represents the name of the * subscription from the message will be received. * @return A <code>ReceiveSubscriptionMessageResult</code> object that * represents the result. * @throws ServiceException * If a service exception is encountered. */
Receives a subscription message
receiveSubscriptionMessage
{ "repo_name": "flydream2046/azure-sdk-for-java", "path": "services/azure-servicebus/src/main/java/com/microsoft/windowsazure/services/servicebus/ServiceBusContract.java", "license": "apache-2.0", "size": 23765 }
[ "com.microsoft.windowsazure.exception.ServiceException", "com.microsoft.windowsazure.services.servicebus.models.ReceiveSubscriptionMessageResult" ]
import com.microsoft.windowsazure.exception.ServiceException; import com.microsoft.windowsazure.services.servicebus.models.ReceiveSubscriptionMessageResult;
import com.microsoft.windowsazure.exception.*; import com.microsoft.windowsazure.services.servicebus.models.*;
[ "com.microsoft.windowsazure" ]
com.microsoft.windowsazure;
330,661
protected void addCatalogNamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_CreateProcedureType_catalogName_feature"), getString("_UI_PropertyDescriptor_description", "_UI_CreateProcedureType_catalogName_feature", "_UI_CreateProcedureType_type"), DbchangelogPackage.eINSTANCE.getCreateProcedureType_CatalogName(), 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), DbchangelogPackage.eINSTANCE.getCreateProcedureType_CatalogName(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Catalog Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Catalog Name feature.
addCatalogNamePropertyDescriptor
{ "repo_name": "dzonekl/LiquibaseEditor", "path": "plugins/org.liquidbase.model.edit/src/org/liquibase/xml/ns/dbchangelog/provider/CreateProcedureTypeItemProvider.java", "license": "mit", "size": 13404 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor", "org.liquibase.xml.ns.dbchangelog.DbchangelogPackage" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.liquibase.xml.ns.dbchangelog.DbchangelogPackage;
import org.eclipse.emf.edit.provider.*; import org.liquibase.xml.ns.dbchangelog.*;
[ "org.eclipse.emf", "org.liquibase.xml" ]
org.eclipse.emf; org.liquibase.xml;
2,429,374
public Map<Contributor,Integer> getMapOfGlycanSequenceCountByContributor() { return Contributor.getMapOfGlycanSequenceCountByContributor(); }
Map<Contributor,Integer> function() { return Contributor.getMapOfGlycanSequenceCountByContributor(); }
/** * Returns a {@link Map} of {@link Contributor}s to the number of {@link GlycanSequence}s * they have contributed. */
Returns a <code>Map</code> of <code>Contributor</code>s to the number of <code>GlycanSequence</code>s they have contributed
getMapOfGlycanSequenceCountByContributor
{ "repo_name": "glycoinfo/eurocarbdb", "path": "application/Eurocarbdb/src/java/org/eurocarbdb/action/core/ShowContributor.java", "license": "gpl-3.0", "size": 4401 }
[ "java.util.Map", "org.eurocarbdb.dataaccess.core.Contributor" ]
import java.util.Map; import org.eurocarbdb.dataaccess.core.Contributor;
import java.util.*; import org.eurocarbdb.dataaccess.core.*;
[ "java.util", "org.eurocarbdb.dataaccess" ]
java.util; org.eurocarbdb.dataaccess;
881,243
@ServiceMethod(returns = ReturnType.SINGLE) public ServerDnsAliasInner createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { return createOrUpdateAsync(resourceGroupName, serverName, dnsAliasName).block(); }
@ServiceMethod(returns = ReturnType.SINGLE) ServerDnsAliasInner function(String resourceGroupName, String serverName, String dnsAliasName) { return createOrUpdateAsync(resourceGroupName, serverName, dnsAliasName).block(); }
/** * Creates a server dns alias. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value * from the Azure Resource Manager API or the portal. * @param serverName The name of the server that the alias is pointing to. * @param dnsAliasName The name of the server DNS alias. * @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 server DNS alias. */
Creates a server dns alias
createOrUpdate
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-sql/src/main/java/com/azure/resourcemanager/sql/implementation/ServerDnsAliasesClientImpl.java", "license": "mit", "size": 72569 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.sql.fluent.models.ServerDnsAliasInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.sql.fluent.models.ServerDnsAliasInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.sql.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,912,107
Iterator<EncryptionProperty> getEncryptionProperties();
Iterator<EncryptionProperty> getEncryptionProperties();
/** * Returns an <code>Iterator</code> over all the * <code>EncryptionPropterty</code> elements contained in this * <code>EncryptionProperties</code>. * * @return an <code>Iterator</code> over all the encryption properties. */
Returns an <code>Iterator</code> over all the <code>EncryptionPropterty</code> elements contained in this <code>EncryptionProperties</code>
getEncryptionProperties
{ "repo_name": "apache/santuario-java", "path": "src/main/java/org/apache/xml/security/encryption/EncryptionProperties.java", "license": "apache-2.0", "size": 2552 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,510,076
public static List<String> linesOf(File file, Charset charset) { return Files.linesOf(file, charset); }
static List<String> function(File file, Charset charset) { return Files.linesOf(file, charset); }
/** * Loads the text content of a file into a list of strings, each string corresponding to a line. * The line endings are either \n, \r or \r\n. * * @param file the file. * @param charset the character set to use. * @return the content of the file. * @throws NullPointerException if the given charset is {@code null}. * @throws UncheckedIOException if an I/O exception occurs. */
Loads the text content of a file into a list of strings, each string corresponding to a line. The line endings are either \n, \r or \r\n
linesOf
{ "repo_name": "xasx/assertj-core", "path": "src/main/java/org/assertj/core/api/Assertions.java", "license": "apache-2.0", "size": 123012 }
[ "java.io.File", "java.nio.charset.Charset", "java.util.List", "org.assertj.core.util.Files" ]
import java.io.File; import java.nio.charset.Charset; import java.util.List; import org.assertj.core.util.Files;
import java.io.*; import java.nio.charset.*; import java.util.*; import org.assertj.core.util.*;
[ "java.io", "java.nio", "java.util", "org.assertj.core" ]
java.io; java.nio; java.util; org.assertj.core;
2,081,955
private static String addKeyIdCheckToWhereStatement(String whereStatement, long id) { String newWhereStatement; if (TextUtils.isEmpty(whereStatement)) newWhereStatement = ""; else newWhereStatement = whereStatement + " AND "; // Append the key id to the end of the WHERE statement. return newWhereStatement + CharacterContract.CharacterEntry._ID + " = '" + id + "'"; }
static String function(String whereStatement, long id) { String newWhereStatement; if (TextUtils.isEmpty(whereStatement)) newWhereStatement = STR AND STR = 'STR'"; }
/** * Helper method that appends a given key id to the end of the * WHERE statement parameter. */
Helper method that appends a given key id to the end of the WHERE statement parameter
addKeyIdCheckToWhereStatement
{ "repo_name": "geniusgeek/mobilecloud-15", "path": "ex/HobbitContentProvider/app/src/main/java/vandy/mooc/provider/HobbitProviderSQLite.java", "license": "apache-2.0", "size": 10464 }
[ "android.text.TextUtils" ]
import android.text.TextUtils;
import android.text.*;
[ "android.text" ]
android.text;
2,297,140
@Internal public Hyphenation getHresiOld() { return field_40_hresiOld; }
Hyphenation function() { return field_40_hresiOld; }
/** * Get the hresiOld field for the CHP record. */
Get the hresiOld field for the CHP record
getHresiOld
{ "repo_name": "rmage/gnvc-ims", "path": "stratchpad/org/apache/poi/hwpf/model/types/CHPAbstractType.java", "license": "lgpl-3.0", "size": 92260 }
[ "org.apache.poi.hwpf.model.Hyphenation" ]
import org.apache.poi.hwpf.model.Hyphenation;
import org.apache.poi.hwpf.model.*;
[ "org.apache.poi" ]
org.apache.poi;
357,837
public static void main(String [] args) { boolean useRepo = false; File directory = null; ContentName userNamespace = null; boolean publishKeysToRepo = true; Flosser flosser = null; String [] userNames = null; CreateUserData td = null; int arg = 0; if (args.length < 2) { usage(); return; } if (args[arg].equals("-f")) { arg++; if (args.length < 3) { usage(); return; } directory = new File(args[arg++]); } else { if (args[arg].equals("-r")) { arg++; useRepo = true; if (args.length < 3) { usage(); return; } } // Generate and write to repo try { userNamespace = ContentName.fromURI(args[arg]); if (!useRepo) { flosser = new Flosser(userNamespace); } } catch (Exception e) { System.out.println("Exception parsing user namespace " + args[arg]); e.printStackTrace(); return; } arg++; } if ((args.length - arg) >= 2) { String userNamesString = args[arg++]; userNames = userNamesString.split(","); } else userNames = USER_NAMES; int count = Integer.valueOf(args[arg++]); String password = UserConfiguration.keystorePassword(); if (arg < args.length) { password = args[arg++]; } try { if (null != directory) { td = new CreateUserData(directory, userNames, count, password.toCharArray()); if (publishKeysToRepo) { td.publishUserKeysToRepository(); } } else { td = new CreateUserData(userNamespace, userNames, count, useRepo, password.toCharArray()); if (publishKeysToRepo) { td.publishUserKeysToRepository(); } } System.out.println("Generated/retrieved " + td.count() + " user keystores, for users : " + td.friendlyNames()); } catch (Exception e) { System.out.println("Exception generating/reading user data: " + e); e.printStackTrace(); } finally { if (null != flosser) flosser.stop(); } if (null != td) { td.closeAll(); } System.out.println("Finished."); System.exit(0); }
static void function(String [] args) { boolean useRepo = false; File directory = null; ContentName userNamespace = null; boolean publishKeysToRepo = true; Flosser flosser = null; String [] userNames = null; CreateUserData td = null; int arg = 0; if (args.length < 2) { usage(); return; } if (args[arg].equals("-f")) { arg++; if (args.length < 3) { usage(); return; } directory = new File(args[arg++]); } else { if (args[arg].equals("-r")) { arg++; useRepo = true; if (args.length < 3) { usage(); return; } } try { userNamespace = ContentName.fromURI(args[arg]); if (!useRepo) { flosser = new Flosser(userNamespace); } } catch (Exception e) { System.out.println(STR + args[arg]); e.printStackTrace(); return; } arg++; } if ((args.length - arg) >= 2) { String userNamesString = args[arg++]; userNames = userNamesString.split(","); } else userNames = USER_NAMES; int count = Integer.valueOf(args[arg++]); String password = UserConfiguration.keystorePassword(); if (arg < args.length) { password = args[arg++]; } try { if (null != directory) { td = new CreateUserData(directory, userNames, count, password.toCharArray()); if (publishKeysToRepo) { td.publishUserKeysToRepository(); } } else { td = new CreateUserData(userNamespace, userNames, count, useRepo, password.toCharArray()); if (publishKeysToRepo) { td.publishUserKeysToRepository(); } } System.out.println(STR + td.count() + STR + td.friendlyNames()); } catch (Exception e) { System.out.println(STR + e); e.printStackTrace(); } finally { if (null != flosser) flosser.stop(); } if (null != td) { td.closeAll(); } System.out.println(STR); System.exit(0); }
/** * Command-line driver to generate key data. */
Command-line driver to generate key data
main
{ "repo_name": "MobileCloudNetworking/icnaas", "path": "mcn-ccn-router/ccnx-0.8.2/javasrc/src/main/org/ccnx/ccn/utils/CreateUserData.java", "license": "apache-2.0", "size": 20969 }
[ "java.io.File", "org.ccnx.ccn.config.UserConfiguration", "org.ccnx.ccn.protocol.ContentName", "org.ccnx.ccn.utils.Flosser" ]
import java.io.File; import org.ccnx.ccn.config.UserConfiguration; import org.ccnx.ccn.protocol.ContentName; import org.ccnx.ccn.utils.Flosser;
import java.io.*; import org.ccnx.ccn.config.*; import org.ccnx.ccn.protocol.*; import org.ccnx.ccn.utils.*;
[ "java.io", "org.ccnx.ccn" ]
java.io; org.ccnx.ccn;
2,520,355
protected Set<IPrimitive> postProcess(Changeset cs, ProgressMonitor monitor) { if (monitor == null) { monitor = NullProgressMonitor.INSTANCE; } try { monitor.beginTask("Postprocessing uploaded data ..."); monitor.setTicksCount(primitives.size()); monitor.setTicks(0); for (IPrimitive p : primitives) { monitor.worked(1); DiffResultEntry entry = diffResults.get(p.getPrimitiveId()); if (entry == null) { continue; } processed.add(p); if (!p.isDeleted()) { p.setOsmId(entry.new_id, entry.new_version); p.setVisible(true); } else { p.setVisible(false); } if (cs != null && !cs.isNew()) { p.setChangesetId(cs.getId()); } } return processed; } finally { monitor.finishTask(); } } private class Parser extends DefaultHandler { private Locator locator;
Set<IPrimitive> function(Changeset cs, ProgressMonitor monitor) { if (monitor == null) { monitor = NullProgressMonitor.INSTANCE; } try { monitor.beginTask(STR); monitor.setTicksCount(primitives.size()); monitor.setTicks(0); for (IPrimitive p : primitives) { monitor.worked(1); DiffResultEntry entry = diffResults.get(p.getPrimitiveId()); if (entry == null) { continue; } processed.add(p); if (!p.isDeleted()) { p.setOsmId(entry.new_id, entry.new_version); p.setVisible(true); } else { p.setVisible(false); } if (cs != null && !cs.isNew()) { p.setChangesetId(cs.getId()); } } return processed; } finally { monitor.finishTask(); } } private class Parser extends DefaultHandler { private Locator locator;
/** * Postprocesses the diff result read and parsed from the server. * * Uploaded objects are assigned their new id (if they got assigned a new * id by the server), their new version (if the version was incremented), * and the id of the changeset to which they were uploaded. * * @param cs the current changeset. Ignored if null. * @param monitor the progress monitor. Set to {@link NullProgressMonitor#INSTANCE} if null * @return the collection of processed primitives */
Postprocesses the diff result read and parsed from the server. Uploaded objects are assigned their new id (if they got assigned a new id by the server), their new version (if the version was incremented), and the id of the changeset to which they were uploaded
postProcess
{ "repo_name": "CURocketry/Ground_Station_GUI", "path": "src/org/openstreetmap/josm/io/DiffResultProcessor.java", "license": "gpl-3.0", "size": 6950 }
[ "java.util.Set", "org.openstreetmap.josm.data.osm.Changeset", "org.openstreetmap.josm.data.osm.IPrimitive", "org.openstreetmap.josm.gui.progress.NullProgressMonitor", "org.openstreetmap.josm.gui.progress.ProgressMonitor", "org.xml.sax.Locator", "org.xml.sax.helpers.DefaultHandler" ]
import java.util.Set; import org.openstreetmap.josm.data.osm.Changeset; import org.openstreetmap.josm.data.osm.IPrimitive; import org.openstreetmap.josm.gui.progress.NullProgressMonitor; import org.openstreetmap.josm.gui.progress.ProgressMonitor; import org.xml.sax.Locator; import org.xml.sax.helpers.DefaultHandler;
import java.util.*; import org.openstreetmap.josm.data.osm.*; import org.openstreetmap.josm.gui.progress.*; import org.xml.sax.*; import org.xml.sax.helpers.*;
[ "java.util", "org.openstreetmap.josm", "org.xml.sax" ]
java.util; org.openstreetmap.josm; org.xml.sax;
2,782,299