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
private JPanel getInfoPanel() { if (infoPanel == null) { infoPanel = new JPanel(); infoPanel.setLayout(new BorderLayout()); infoPanel.add(getJPanel1(), java.awt.BorderLayout.NORTH); infoPanel.add(getInfoButtonPanel(), BorderLayout.SOUTH); } return infoPanel; }
JPanel function() { if (infoPanel == null) { infoPanel = new JPanel(); infoPanel.setLayout(new BorderLayout()); infoPanel.add(getJPanel1(), java.awt.BorderLayout.NORTH); infoPanel.add(getInfoButtonPanel(), BorderLayout.SOUTH); } return infoPanel; }
/** * This method initializes infoPanel * * @return javax.swing.JPanel */
This method initializes infoPanel
getInfoPanel
{ "repo_name": "NCIP/cagrid-core", "path": "caGrid/projects/gaards-ui/src/org/cagrid/gaards/ui/dorian/idp/AccountProfileWindow.java", "license": "bsd-3-clause", "size": 28266 }
[ "java.awt.BorderLayout", "javax.swing.JPanel" ]
import java.awt.BorderLayout; import javax.swing.JPanel;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
2,192,396
protected Directive getDirective(String tagName, String attrName, Restriction restriction) { try { AngularProject angularProject = AngularProject.getAngularProject(project); return AngularModulesManager.getInstance().getDirective(angularProject, tagName, attrName, restriction); } catch (CoreException e) { // should never done Trace.trace(Trace.SEVERE, "Error while getting angular project", e); } return null; }
Directive function(String tagName, String attrName, Restriction restriction) { try { AngularProject angularProject = AngularProject.getAngularProject(project); return AngularModulesManager.getInstance().getDirective(angularProject, tagName, attrName, restriction); } catch (CoreException e) { Trace.trace(Trace.SEVERE, STR, e); } return null; }
/** * Returns the angular directive * * @param tagName * @param attrName * @param restriction * @return */
Returns the angular directive
getDirective
{ "repo_name": "angelozerr/angularjs-eclipse", "path": "org.eclipse.angularjs.core/src/org/eclipse/angularjs/internal/core/validation/AbstractHTMLAngularValidator.java", "license": "epl-1.0", "size": 2742 }
[ "org.eclipse.angularjs.core.AngularProject", "org.eclipse.angularjs.internal.core.Trace", "org.eclipse.core.runtime.CoreException" ]
import org.eclipse.angularjs.core.AngularProject; import org.eclipse.angularjs.internal.core.Trace; import org.eclipse.core.runtime.CoreException;
import org.eclipse.angularjs.core.*; import org.eclipse.angularjs.internal.core.*; import org.eclipse.core.runtime.*;
[ "org.eclipse.angularjs", "org.eclipse.core" ]
org.eclipse.angularjs; org.eclipse.core;
342,773
private JPanel getJPanelDummy() { if (jPanelDummy == null) { jPanelDummy = new JPanel(); jPanelDummy.setLayout(new GridBagLayout()); } return jPanelDummy; }
JPanel function() { if (jPanelDummy == null) { jPanelDummy = new JPanel(); jPanelDummy.setLayout(new GridBagLayout()); } return jPanelDummy; }
/** * This method initializes jPanelDummy * @return javax.swing.JPanel */
This method initializes jPanelDummy
getJPanelDummy
{ "repo_name": "EnFlexIT/AgentWorkbench", "path": "eclipseProjects/org.agentgui/bundles/org.agentgui.core/src/agentgui/core/gui/options/OIDCOptions.java", "license": "lgpl-2.1", "size": 9842 }
[ "java.awt.GridBagLayout", "javax.swing.JPanel" ]
import java.awt.GridBagLayout; import javax.swing.JPanel;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
822,067
public static ControllerMethodInvoker build( Method functionalMethod, Method implementationMethod, Injector injector, NinjaProperties ninjaProperties) { // get both the parameters... final Type[] genericParameterTypes = implementationMethod.getGenericParameterTypes(); final MethodParameter[] methodParameters = MethodParameter.convertIntoMethodParameters(genericParameterTypes); // ... and all annotations for the parameters final Annotation[][] paramAnnotations = implementationMethod .getParameterAnnotations(); ArgumentExtractor<?>[] argumentExtractors = new ArgumentExtractor<?>[methodParameters.length]; // now we skip through the parameters and process the annotations for (int i = 0; i < methodParameters.length; i++) { try { argumentExtractors[i] = getArgumentExtractor(methodParameters[i], paramAnnotations[i], injector); } catch (RoutingException e) { throw new RoutingException("Error building argument extractor for parameter " + i + " in method " + implementationMethod.getDeclaringClass().getName() + "." + implementationMethod.getName() + "()", e); } } // Replace a null extractor with a bodyAs extractor, but make sure there's only one int bodyAsFound = -1; for (int i = 0; i < argumentExtractors.length; i++) { if (argumentExtractors[i] == null) { if (bodyAsFound > -1) { throw new RoutingException("Only one parameter may be deserialised as the body " + implementationMethod.getDeclaringClass().getName() + "." + implementationMethod.getName() + "()\n" + "Extracted parameter is type: " + methodParameters[bodyAsFound].parameterClass.getName() + "\n" + "Extra parmeter is type: " + methodParameters[i].parameterClass.getName()); } else { argumentExtractors[i] = new ArgumentExtractors.BodyAsExtractor(methodParameters[i].parameterClass); bodyAsFound = i; } } } // Now that every parameter has an argument extractor we can run validation on the annotated // parameters for (int i = 0; i < argumentExtractors.length; i++) { argumentExtractors[i] = validateArgumentWithExtractor( methodParameters[i], paramAnnotations[i], injector, argumentExtractors[i]); } boolean useStrictArgumentExtractors = determineWhetherToUseStrictArgumentExtractorMode(ninjaProperties); return new ControllerMethodInvoker(functionalMethod, argumentExtractors, useStrictArgumentExtractors); }
static ControllerMethodInvoker function( Method functionalMethod, Method implementationMethod, Injector injector, NinjaProperties ninjaProperties) { final Type[] genericParameterTypes = implementationMethod.getGenericParameterTypes(); final MethodParameter[] methodParameters = MethodParameter.convertIntoMethodParameters(genericParameterTypes); final Annotation[][] paramAnnotations = implementationMethod .getParameterAnnotations(); ArgumentExtractor<?>[] argumentExtractors = new ArgumentExtractor<?>[methodParameters.length]; for (int i = 0; i < methodParameters.length; i++) { try { argumentExtractors[i] = getArgumentExtractor(methodParameters[i], paramAnnotations[i], injector); } catch (RoutingException e) { throw new RoutingException(STR + i + STR + implementationMethod.getDeclaringClass().getName() + "." + implementationMethod.getName() + "()", e); } } int bodyAsFound = -1; for (int i = 0; i < argumentExtractors.length; i++) { if (argumentExtractors[i] == null) { if (bodyAsFound > -1) { throw new RoutingException(STR + implementationMethod.getDeclaringClass().getName() + "." + implementationMethod.getName() + "()\n" + STR + methodParameters[bodyAsFound].parameterClass.getName() + "\n" + STR + methodParameters[i].parameterClass.getName()); } else { argumentExtractors[i] = new ArgumentExtractors.BodyAsExtractor(methodParameters[i].parameterClass); bodyAsFound = i; } } } for (int i = 0; i < argumentExtractors.length; i++) { argumentExtractors[i] = validateArgumentWithExtractor( methodParameters[i], paramAnnotations[i], injector, argumentExtractors[i]); } boolean useStrictArgumentExtractors = determineWhetherToUseStrictArgumentExtractorMode(ninjaProperties); return new ControllerMethodInvoker(functionalMethod, argumentExtractors, useStrictArgumentExtractors); }
/** * Builds an invoker for a functional method. Understands what parameters * to inject and extract based on type and annotations. * @param functionalMethod The method to be invoked * @param implementationMethod The method to use for determining what * actual parameters and annotations to use for each argument. Useful * when type/lambda erasure makes the functional interface not reliable * for reflecting. * @param injector The guice injector * @param ninjaProperties The NinjaProperties of this application * @return An invoker */
Builds an invoker for a functional method. Understands what parameters to inject and extract based on type and annotations
build
{ "repo_name": "raphaelbauer/ninja", "path": "ninja-core/src/main/java/ninja/params/ControllerMethodInvoker.java", "license": "apache-2.0", "size": 20735 }
[ "com.google.inject.Injector", "java.lang.annotation.Annotation", "java.lang.reflect.Method", "java.lang.reflect.Type", "ninja.utils.NinjaProperties" ]
import com.google.inject.Injector; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.lang.reflect.Type; import ninja.utils.NinjaProperties;
import com.google.inject.*; import java.lang.annotation.*; import java.lang.reflect.*; import ninja.utils.*;
[ "com.google.inject", "java.lang", "ninja.utils" ]
com.google.inject; java.lang; ninja.utils;
1,646,398
public void removeMenuPresenter(MenuPresenter presenter) { for (WeakReference<MenuPresenter> ref : mPresenters) { final MenuPresenter item = ref.get(); if (item == null || item == presenter) { mPresenters.remove(ref); } } }
void function(MenuPresenter presenter) { for (WeakReference<MenuPresenter> ref : mPresenters) { final MenuPresenter item = ref.get(); if (item == null item == presenter) { mPresenters.remove(ref); } } }
/** * Remove a presenter from this menu. That presenter will no longer receive notifications of * updates to this menu's data. * * @param presenter The presenter to remove */
Remove a presenter from this menu. That presenter will no longer receive notifications of updates to this menu's data
removeMenuPresenter
{ "repo_name": "aosp-mirror/platform_frameworks_support", "path": "v7/appcompat/src/main/java/androidx/appcompat/view/menu/MenuBuilder.java", "license": "apache-2.0", "size": 47015 }
[ "java.lang.ref.WeakReference" ]
import java.lang.ref.WeakReference;
import java.lang.ref.*;
[ "java.lang" ]
java.lang;
2,778,949
@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": "debabratahazra/DS", "path": "designstudio/components/page/ui/com.odcgroup.page.edit/src/generated/java/com/odcgroup/page/model/provider/PropertyItemProvider.java", "license": "epl-1.0", "size": 7577 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
710,755
public MethodHandle addLoggingToHandle(final Class<? extends Loggable> clazz, final MethodHandle mh, final Supplier<String> text) { return addLoggingToHandle(clazz, Level.INFO, mh, Integer.MAX_VALUE, false, text); }
MethodHandle function(final Class<? extends Loggable> clazz, final MethodHandle mh, final Supplier<String> text) { return addLoggingToHandle(clazz, Level.INFO, mh, Integer.MAX_VALUE, false, text); }
/** * Given a Loggable class, weave debug info info a method handle for that logger. * Level.INFO is used * * @param clazz loggable * @param mh method handle * @param text debug printout to add * * @return instrumented method handle, or null if logger not enabled */
Given a Loggable class, weave debug info info a method handle for that logger. Level.INFO is used
addLoggingToHandle
{ "repo_name": "md-5/jdk10", "path": "src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java", "license": "gpl-2.0", "size": 70447 }
[ "java.lang.invoke.MethodHandle", "java.util.function.Supplier", "java.util.logging.Level" ]
import java.lang.invoke.MethodHandle; import java.util.function.Supplier; import java.util.logging.Level;
import java.lang.invoke.*; import java.util.function.*; import java.util.logging.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
1,246,729
@Test public void testDecommissionWithExcludeHosts() throws Exception { Configuration conf = new Configuration(); conf.set(YarnConfiguration.RM_NODES_EXCLUDE_FILE_PATH, hostFile .getAbsolutePath()); writeToHostsFile(""); rm = new MockRM(conf); rm.start(); MockNM nm1 = rm.registerNode("host1:1234", 5120); MockNM nm2 = rm.registerNode("host2:5678", 10240); MockNM nm3 = rm.registerNode("localhost:4433", 1024); int metricCount = ClusterMetrics.getMetrics().getNumDecommisionedNMs(); NodeHeartbeatResponse nodeHeartbeat = nm1.nodeHeartbeat(true); Assert.assertTrue(NodeAction.NORMAL.equals(nodeHeartbeat.getNodeAction())); nodeHeartbeat = nm2.nodeHeartbeat(true); Assert.assertTrue(NodeAction.NORMAL.equals(nodeHeartbeat.getNodeAction())); rm.drainEvents(); // To test that IPs also work String ip = NetUtils.normalizeHostName("localhost"); writeToHostsFile("host2", ip); rm.getNodesListManager().refreshNodes(conf); checkDecommissionedNMCount(rm, metricCount + 2); nodeHeartbeat = nm1.nodeHeartbeat(true); Assert.assertTrue(NodeAction.NORMAL.equals(nodeHeartbeat.getNodeAction())); nodeHeartbeat = nm2.nodeHeartbeat(true); Assert.assertTrue("The decommisioned metrics are not updated", NodeAction.SHUTDOWN.equals(nodeHeartbeat.getNodeAction())); nodeHeartbeat = nm3.nodeHeartbeat(true); Assert.assertTrue("The decommisioned metrics are not updated", NodeAction.SHUTDOWN.equals(nodeHeartbeat.getNodeAction())); rm.drainEvents(); writeToHostsFile(""); rm.getNodesListManager().refreshNodes(conf); nm3 = rm.registerNode("localhost:4433", 1024); nodeHeartbeat = nm3.nodeHeartbeat(true); rm.drainEvents(); Assert.assertTrue(NodeAction.NORMAL.equals(nodeHeartbeat.getNodeAction())); // decommissined node is 1 since 1 node is rejoined after updating exclude // file checkDecommissionedNMCount(rm, metricCount + 1); }
void function() throws Exception { Configuration conf = new Configuration(); conf.set(YarnConfiguration.RM_NODES_EXCLUDE_FILE_PATH, hostFile .getAbsolutePath()); writeToHostsFile(STRhost1:1234STRhost2:5678STRlocalhost:4433STRlocalhostSTRhost2STRThe decommisioned metrics are not updatedSTRThe decommisioned metrics are not updatedSTRSTRlocalhost:4433", 1024); nodeHeartbeat = nm3.nodeHeartbeat(true); rm.drainEvents(); Assert.assertTrue(NodeAction.NORMAL.equals(nodeHeartbeat.getNodeAction())); checkDecommissionedNMCount(rm, metricCount + 1); }
/** * Decommissioning using a pre-configured exclude hosts file */
Decommissioning using a pre-configured exclude hosts file
testDecommissionWithExcludeHosts
{ "repo_name": "JingchengDu/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceTrackerService.java", "license": "apache-2.0", "size": 133083 }
[ "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.yarn.conf.YarnConfiguration", "org.apache.hadoop.yarn.server.api.records.NodeAction", "org.junit.Assert" ]
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.server.api.records.NodeAction; import org.junit.Assert;
import org.apache.hadoop.conf.*; import org.apache.hadoop.yarn.conf.*; import org.apache.hadoop.yarn.server.api.records.*; import org.junit.*;
[ "org.apache.hadoop", "org.junit" ]
org.apache.hadoop; org.junit;
2,770,408
@Test @Category(ValidatesRunner.class) public void testTupleInjectionTransform() throws Exception { PCollection<Integer> input = pipeline .apply(Create.<Integer>of(1, 2, 3, 4)); TupleTag<Integer> tag = new TupleTag<Integer>(); PCollectionTuple output = input .apply("ProjectTag", new TupleInjectionTransform<Integer>(tag)); PAssert.that(output.get(tag)).containsInAnyOrder(1, 2, 3, 4); pipeline.run(); } private static class TupleInjectionTransform<T> extends PTransform<PCollection<T>, PCollectionTuple> { private TupleTag<T> tag; public TupleInjectionTransform(TupleTag<T> tag) { this.tag = tag; }
@Category(ValidatesRunner.class) void function() throws Exception { PCollection<Integer> input = pipeline .apply(Create.<Integer>of(1, 2, 3, 4)); TupleTag<Integer> tag = new TupleTag<Integer>(); PCollectionTuple output = input .apply(STR, new TupleInjectionTransform<Integer>(tag)); PAssert.that(output.get(tag)).containsInAnyOrder(1, 2, 3, 4); pipeline.run(); } private static class TupleInjectionTransform<T> extends PTransform<PCollection<T>, PCollectionTuple> { private TupleTag<T> tag; public TupleInjectionTransform(TupleTag<T> tag) { this.tag = tag; }
/** * Tests that Pipeline supports putting an element into a tuple as a transform. */
Tests that Pipeline supports putting an element into a tuple as a transform
testTupleInjectionTransform
{ "repo_name": "xsm110/Apache-Beam", "path": "sdks/java/core/src/test/java/org/apache/beam/sdk/PipelineTest.java", "license": "apache-2.0", "size": 14974 }
[ "org.apache.beam.sdk.testing.PAssert", "org.apache.beam.sdk.testing.ValidatesRunner", "org.apache.beam.sdk.transforms.Create", "org.apache.beam.sdk.transforms.PTransform", "org.apache.beam.sdk.values.PCollection", "org.apache.beam.sdk.values.PCollectionTuple", "org.apache.beam.sdk.values.TupleTag", "org.junit.experimental.categories.Category" ]
import org.apache.beam.sdk.testing.PAssert; import org.apache.beam.sdk.testing.ValidatesRunner; import org.apache.beam.sdk.transforms.Create; import org.apache.beam.sdk.transforms.PTransform; import org.apache.beam.sdk.values.PCollection; import org.apache.beam.sdk.values.PCollectionTuple; import org.apache.beam.sdk.values.TupleTag; import org.junit.experimental.categories.Category;
import org.apache.beam.sdk.testing.*; import org.apache.beam.sdk.transforms.*; import org.apache.beam.sdk.values.*; import org.junit.experimental.categories.*;
[ "org.apache.beam", "org.junit.experimental" ]
org.apache.beam; org.junit.experimental;
1,648,930
public void setRewindIncrementMs(int rewindMs) { Assertions.checkState(controller != null); controller.setRewindIncrementMs(rewindMs); }
void function(int rewindMs) { Assertions.checkState(controller != null); controller.setRewindIncrementMs(rewindMs); }
/** * Sets the rewind increment in milliseconds. * * @param rewindMs The rewind increment in milliseconds. */
Sets the rewind increment in milliseconds
setRewindIncrementMs
{ "repo_name": "YouKim/ExoPlayer", "path": "library/ui/src/main/java/com/google/android/exoplayer2/ui/SimpleExoPlayerView.java", "license": "apache-2.0", "size": 27082 }
[ "com.google.android.exoplayer2.util.Assertions" ]
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.*;
[ "com.google.android" ]
com.google.android;
2,451,291
List<ServerName> clearDeadServers(List<ServerName> servers) throws IOException;
List<ServerName> clearDeadServers(List<ServerName> servers) throws IOException;
/** * Clear dead region servers from master. * @param servers list of dead region servers. * @throws IOException if a remote or network exception occurs * @return List of servers that are not cleared */
Clear dead region servers from master
clearDeadServers
{ "repo_name": "ultratendency/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java", "license": "apache-2.0", "size": 97030 }
[ "java.io.IOException", "java.util.List", "org.apache.hadoop.hbase.ServerName" ]
import java.io.IOException; import java.util.List; import org.apache.hadoop.hbase.ServerName;
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
822,855
protected ClusterHealthStatus ensureSearchable(String... indices) { // this is just a temporary thing but it's easier to change if it is encapsulated. return ensureGreen(indices); }
ClusterHealthStatus function(String... indices) { return ensureGreen(indices); }
/** * Ensures the cluster is in a searchable state for the given indices. This means a searchable copy of each * shard is available on the cluster. */
Ensures the cluster is in a searchable state for the given indices. This means a searchable copy of each shard is available on the cluster
ensureSearchable
{ "repo_name": "shreejay/elasticsearch", "path": "test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java", "license": "apache-2.0", "size": 105253 }
[ "org.elasticsearch.cluster.health.ClusterHealthStatus" ]
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.cluster.health.*;
[ "org.elasticsearch.cluster" ]
org.elasticsearch.cluster;
396,445
public Map<String,Map<String,String>> toElementMap() { HashMap<String,Map<String,String>> elementMap = new HashMap<String,Map<String,String>>(); populateElementMap(elementMap); return elementMap; }
Map<String,Map<String,String>> function() { HashMap<String,Map<String,String>> elementMap = new HashMap<String,Map<String,String>>(); populateElementMap(elementMap); return elementMap; }
/** * Produces a new map of element properties to their ids. * * @return a dictionary mapping Element ids to a dictionary containing the * properties for each Element */
Produces a new map of element properties to their ids
toElementMap
{ "repo_name": "Disha10/SANA", "path": "app/src/main/java/org/sana/android/procedure/ProcedurePage.java", "license": "bsd-3-clause", "size": 14486 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,239,099
default AdvancedJooqEndpointConsumerBuilder exchangePattern( ExchangePattern exchangePattern) { setProperty("exchangePattern", exchangePattern); return this; }
default AdvancedJooqEndpointConsumerBuilder exchangePattern( ExchangePattern exchangePattern) { setProperty(STR, exchangePattern); return this; }
/** * Sets the exchange pattern when the consumer creates an exchange. * * The option is a: <code>org.apache.camel.ExchangePattern</code> type. * * Group: consumer (advanced) */
Sets the exchange pattern when the consumer creates an exchange. The option is a: <code>org.apache.camel.ExchangePattern</code> type. Group: consumer (advanced)
exchangePattern
{ "repo_name": "davidkarlsen/camel", "path": "core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/JooqEndpointBuilderFactory.java", "license": "apache-2.0", "size": 33782 }
[ "org.apache.camel.ExchangePattern" ]
import org.apache.camel.ExchangePattern;
import org.apache.camel.*;
[ "org.apache.camel" ]
org.apache.camel;
2,006,898
public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { if (children == null) { children = new THashMap<>(1, 1.0f); } WeakPropertyChangeSupport child = children.get(propertyName); if (child == null) { child = createChild(); children.put(propertyName, child); } child.addPropertyChangeListener(listener); }
synchronized void function(String propertyName, PropertyChangeListener listener) { if (children == null) { children = new THashMap<>(1, 1.0f); } WeakPropertyChangeSupport child = children.get(propertyName); if (child == null) { child = createChild(); children.put(propertyName, child); } child.addPropertyChangeListener(listener); }
/** * Add a PropertyChangeListener for a specific property. The listener will be * invoked only when a call on firePropertyChange names that specific * property. * * @param propertyName * The name of the property to listen on. * @param listener * The PropertyChangeListener to be added */
Add a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property
addPropertyChangeListener
{ "repo_name": "jspresso/jspresso-ce", "path": "util/src/main/java/org/jspresso/framework/util/bean/WeakPropertyChangeSupport.java", "license": "lgpl-3.0", "size": 14264 }
[ "gnu.trove.map.hash.THashMap", "java.beans.PropertyChangeListener" ]
import gnu.trove.map.hash.THashMap; import java.beans.PropertyChangeListener;
import gnu.trove.map.hash.*; import java.beans.*;
[ "gnu.trove.map", "java.beans" ]
gnu.trove.map; java.beans;
657,575
private static boolean isOp(EntityPlayer entityPlayer) { if (!entityPlayer.worldObj.isRemote) { return ((EntityPlayerMP)entityPlayer).mcServer.getConfigurationManager().isPlayerOpped(entityPlayer.getDisplayName()); } else { return false; } }
static boolean function(EntityPlayer entityPlayer) { if (!entityPlayer.worldObj.isRemote) { return ((EntityPlayerMP)entityPlayer).mcServer.getConfigurationManager().isPlayerOpped(entityPlayer.getDisplayName()); } else { return false; } }
/** * Returns true if player is operator. * Can only return true if called server-side. */
Returns true if player is operator. Can only return true if called server-side
isOp
{ "repo_name": "LorenzoDCC/carpentersblocks", "path": "carpentersblocks/util/PlayerPermissions.java", "license": "lgpl-2.1", "size": 1148 }
[ "net.minecraft.entity.player.EntityPlayer", "net.minecraft.entity.player.EntityPlayerMP" ]
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
953,783
private static Method findMethod(Method[] methodsCache, String methodName){ if (methodName.equals(INIT_METHOD)){ return methodsCache[INIT]; } else if (methodName.equals(DESTROY_METHOD)){ return methodsCache[DESTROY]; } else if (methodName.equals(SERVICE_METHOD)){ return methodsCache[SERVICE]; } else if (methodName.equals(DOFILTER_METHOD)){ return methodsCache[DOFILTER]; } else if (methodName.equals(EVENT_METHOD)){ return methodsCache[EVENT]; } else if (methodName.equals(DOFILTEREVENT_METHOD)){ return methodsCache[DOFILTEREVENT]; } return null; }
static Method function(Method[] methodsCache, String methodName){ if (methodName.equals(INIT_METHOD)){ return methodsCache[INIT]; } else if (methodName.equals(DESTROY_METHOD)){ return methodsCache[DESTROY]; } else if (methodName.equals(SERVICE_METHOD)){ return methodsCache[SERVICE]; } else if (methodName.equals(DOFILTER_METHOD)){ return methodsCache[DOFILTER]; } else if (methodName.equals(EVENT_METHOD)){ return methodsCache[EVENT]; } else if (methodName.equals(DOFILTEREVENT_METHOD)){ return methodsCache[DOFILTEREVENT]; } return null; }
/** * Find a method stored within the cache. * @param methodsCache the cache used to store method instance * @param methodName the method to apply the security restriction * @return the method instance, null if not yet created. */
Find a method stored within the cache
findMethod
{ "repo_name": "sdw2330976/apache-tomcat-7.0.57", "path": "target/classes/org/apache/catalina/security/SecurityUtil.java", "license": "apache-2.0", "size": 16384 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,644,869
public boolean loadDirectory (String path, String[] exts) { say("Load directory: " + path); // Get a directory handle. File dh = new File(path);
boolean function (String path, String[] exts) { say(STR + path); File dh = new File(path);
/** * Load a directory full of RiveScript documents, specifying a custom * list of valid file extensions. * * @param path The path to the directory containing RiveScript documents. * @param exts A string array containing file extensions to look for. */
Load a directory full of RiveScript documents, specifying a custom list of valid file extensions
loadDirectory
{ "repo_name": "elehuitouze/rivescript-java", "path": "com/rivescript/RiveScript.java", "license": "mit", "size": 62935 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,120,905
public void testEntireObjectNestedSearch3() throws ApplicationException { DemocraticGovt searchObject = new DemocraticGovt(); Collection results = getApplicationService().search("gov.nih.nci.cacoresdk.domain.inheritance.twolevelinheritance.sametable.DemocraticGovt",searchObject ); assertNotNull(results); assertEquals(2,results.size()); for(Iterator i = results.iterator();i.hasNext();) { DemocraticGovt result = (DemocraticGovt)i.next(); assertNotNull(result); assertNotNull(result.getId()); assertEquals(result.getId().getRoot(),II_ROOT_GLOBAL_CONSTANT_VALUE); assertNotNull(result.getCountry()); } }
void function() throws ApplicationException { DemocraticGovt searchObject = new DemocraticGovt(); Collection results = getApplicationService().search(STR,searchObject ); assertNotNull(results); assertEquals(2,results.size()); for(Iterator i = results.iterator();i.hasNext();) { DemocraticGovt result = (DemocraticGovt)i.next(); assertNotNull(result); assertNotNull(result.getId()); assertEquals(result.getId().getRoot(),II_ROOT_GLOBAL_CONSTANT_VALUE); assertNotNull(result.getCountry()); } }
/** * Uses Nested Search Criteria for search * Verifies that the results are returned * Verifies size of the result set * Verifies that none of the attribute is null * * @throws ApplicationException */
Uses Nested Search Criteria for search Verifies that the results are returned Verifies size of the result set Verifies that none of the attribute is null
testEntireObjectNestedSearch3
{ "repo_name": "NCIP/cacore-sdk", "path": "sdk-toolkit/iso-example-project/junit/src/test/gov/nih/nci/cacoresdk/domain/inheritance/twolevelinheritance/sametable/TwoLevelInheritanceSametableTest.java", "license": "bsd-3-clause", "size": 18057 }
[ "gov.nih.nci.cacoresdk.domain.inheritance.twolevelinheritance.sametable.DemocraticGovt", "gov.nih.nci.system.applicationservice.ApplicationException", "java.util.Collection", "java.util.Iterator" ]
import gov.nih.nci.cacoresdk.domain.inheritance.twolevelinheritance.sametable.DemocraticGovt; import gov.nih.nci.system.applicationservice.ApplicationException; import java.util.Collection; import java.util.Iterator;
import gov.nih.nci.cacoresdk.domain.inheritance.twolevelinheritance.sametable.*; import gov.nih.nci.system.applicationservice.*; import java.util.*;
[ "gov.nih.nci", "java.util" ]
gov.nih.nci; java.util;
2,806,474
public void rollbackChannels() { // unsubscribe from all channels DataResult<Map<String, Object>> chs = SystemManager.channelsForServer( this.server); for (Map<String, Object> ch : chs) { SystemManager.unsubscribeServerFromChannel(this.server.getId(), (Long) ch.get("id")); } // subscribe to appropriate channels chs = snapshotChannelList(); for (Map<String, Object> ch : chs) { SystemManager.subscribeServerToChannel(null, this.server, ChannelFactory.lookupById((Long) ch.get("id"))); } }
void function() { DataResult<Map<String, Object>> chs = SystemManager.channelsForServer( this.server); for (Map<String, Object> ch : chs) { SystemManager.unsubscribeServerFromChannel(this.server.getId(), (Long) ch.get("id")); } chs = snapshotChannelList(); for (Map<String, Object> ch : chs) { SystemManager.subscribeServerToChannel(null, this.server, ChannelFactory.lookupById((Long) ch.get("id"))); } }
/** * rollback server channels to snapshot */
rollback server channels to snapshot
rollbackChannels
{ "repo_name": "xkollar/spacewalk", "path": "java/code/src/com/redhat/rhn/domain/server/ServerSnapshot.java", "license": "gpl-2.0", "size": 15405 }
[ "com.redhat.rhn.common.db.datasource.DataResult", "com.redhat.rhn.domain.channel.ChannelFactory", "com.redhat.rhn.manager.system.SystemManager", "java.util.Map" ]
import com.redhat.rhn.common.db.datasource.DataResult; import com.redhat.rhn.domain.channel.ChannelFactory; import com.redhat.rhn.manager.system.SystemManager; import java.util.Map;
import com.redhat.rhn.common.db.datasource.*; import com.redhat.rhn.domain.channel.*; import com.redhat.rhn.manager.system.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
1,338,382
public Collection<Entity> getCommittedInstances() { return committedInstances; } }
Collection<Entity> function() { return committedInstances; } }
/** * Returns the collection of committed entities. */
Returns the collection of committed entities
getCommittedInstances
{ "repo_name": "dimone-kun/cuba", "path": "modules/gui/src/com/haulmont/cuba/gui/model/DataContext.java", "license": "apache-2.0", "size": 8392 }
[ "com.haulmont.cuba.core.entity.Entity", "java.util.Collection" ]
import com.haulmont.cuba.core.entity.Entity; import java.util.Collection;
import com.haulmont.cuba.core.entity.*; import java.util.*;
[ "com.haulmont.cuba", "java.util" ]
com.haulmont.cuba; java.util;
2,771,674
public synchronized boolean addDependingJob(Job dependingJob) { if (this.state == Job.WAITING) { // only allowed to add jobs when // waiting if (this.dependingJobs == null) { this.dependingJobs = new ArrayList<Job>(); } return this.dependingJobs.add(dependingJob); } else { return false; } }
synchronized boolean function(Job dependingJob) { if (this.state == Job.WAITING) { if (this.dependingJobs == null) { this.dependingJobs = new ArrayList<Job>(); } return this.dependingJobs.add(dependingJob); } else { return false; } }
/** * Add a job to this jobs' dependency list. Dependent jobs can only be added * while a Job is waiting to run, not during or afterwards. * * @param dependingJob * Job that this Job depends on. * @return <tt>true</tt> if the Job was added. */
Add a job to this jobs' dependency list. Dependent jobs can only be added while a Job is waiting to run, not during or afterwards
addDependingJob
{ "repo_name": "dongpf/hadoop-0.19.1", "path": "src/mapred/org/apache/hadoop/mapred/jobcontrol/Job.java", "license": "apache-2.0", "size": 12327 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,927,459
static void compareReadings (Reading[] expectedReadings, List<Reading> actualReadings) { Assert.assertEquals (expectedReadings.length, actualReadings.size()); for (int i = 0; i < expectedReadings.length; i++) { if (!expectedReadings[i].equals(actualReadings.get(i))) { String error = ""; error += String.format ("start: %1$20d : %2$20d\n", expectedReadings[i].start, actualReadings.get(i).start); error += String.format ("length: %1$20d : %2$20d\n", expectedReadings[i].length, actualReadings.get(i).length); error += String.format ("text: %1$20s : %2$20s\n", expectedReadings[i].text, actualReadings.get(i).text); Assert.fail("Readings don't match\n" + error); } } }
static void compareReadings (Reading[] expectedReadings, List<Reading> actualReadings) { Assert.assertEquals (expectedReadings.length, actualReadings.size()); for (int i = 0; i < expectedReadings.length; i++) { if (!expectedReadings[i].equals(actualReadings.get(i))) { String error = STRstart: %1$20d : %2$20d\nSTRlength: %1$20d : %2$20d\nSTRtext: %1$20s : %2$20s\nSTRReadings don't match\n" + error); } } }
/** * Compare two arrays of <code>Token</code>s * * @param expectedReadings The expected tokens * @param actualReadings The actual tokens */
Compare two arrays of <code>Token</code>s
compareReadings
{ "repo_name": "hkazuakey/lucene-gosen", "path": "src/test/java/net/java/sen/SenTestUtil.java", "license": "lgpl-2.1", "size": 7335 }
[ "java.util.List", "junit.framework.Assert", "net.java.sen.dictionary.Reading" ]
import java.util.List; import junit.framework.Assert; import net.java.sen.dictionary.Reading;
import java.util.*; import junit.framework.*; import net.java.sen.dictionary.*;
[ "java.util", "junit.framework", "net.java.sen" ]
java.util; junit.framework; net.java.sen;
1,622,983
void startActivity(@Nullable String uri, @Nullable String action, @Nullable String data, @Nullable String mimeType, Collection<String> categories, Map<String, Object> extras, @Nullable String component, int flags);
void startActivity(@Nullable String uri, @Nullable String action, @Nullable String data, @Nullable String mimeType, Collection<String> categories, Map<String, Object> extras, @Nullable String component, int flags);
/** * Start an activity. * * @param uri the URI for the Intent * @param action the action for the Intent * @param data the data URI for the Intent * @param mimeType the mime type for the Intent * @param categories the category names for the Intent * @param extras the extras to add to the Intent * @param component the component of the Intent * @param flags the flags for the Intent */
Start an activity
startActivity
{ "repo_name": "z7z8th/aster", "path": "src/com/android/chimpchat/core/IChimpDevice.java", "license": "apache-2.0", "size": 6899 }
[ "java.util.Collection", "java.util.Map", "javax.annotation.Nullable" ]
import java.util.Collection; import java.util.Map; import javax.annotation.Nullable;
import java.util.*; import javax.annotation.*;
[ "java.util", "javax.annotation" ]
java.util; javax.annotation;
1,327,404
public Adapter createMComponentTypeAdapter() { return null; }
Adapter function() { return null; }
/** * Creates a new adapter for an object of class '{@link es.uah.aut.srg.micobs.mclev.mclevdom.MComponentType <em>MComponent Type</em>}'. * @return the new adapter. * @see es.uah.aut.srg.micobs.mclev.mclevdom.MComponentType * @generated */
Creates a new adapter for an object of class '<code>es.uah.aut.srg.micobs.mclev.mclevdom.MComponentType MComponent Type</code>'
createMComponentTypeAdapter
{ "repo_name": "parraman/micobs", "path": "mclev/es.uah.aut.srg.micobs.mclev/src/es/uah/aut/srg/micobs/mclev/mclevdom/util/mclevdomAdapterFactory.java", "license": "epl-1.0", "size": 27448 }
[ "org.eclipse.emf.common.notify.Adapter" ]
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,474,646
@ApiModelProperty(value = "What features are available in settings (0 = Deny, 1 = Setting, 2 = Overview, 3 = UserSetting, 4 = OverviewPlus, 5 = Upgrade, 6 = Full)") public Integer getUserAccountMode() { return userAccountMode; }
@ApiModelProperty(value = STR) Integer function() { return userAccountMode; }
/** * What features are available in settings (0 &#x3D; Deny, 1 &#x3D; Setting, 2 &#x3D; Overview, 3 &#x3D; UserSetting, 4 &#x3D; OverviewPlus, 5 &#x3D; Upgrade, 6 &#x3D; Full) * @return userAccountMode **/
What features are available in settings (0 &#x3D; Deny, 1 &#x3D; Setting, 2 &#x3D; Overview, 3 &#x3D; UserSetting, 4 &#x3D; OverviewPlus, 5 &#x3D; Upgrade, 6 &#x3D; Full)
getUserAccountMode
{ "repo_name": "iterate-ch/cyberduck", "path": "storegate/src/main/java/ch/cyberduck/core/storegate/io/swagger/client/model/ModelConfiguration.java", "license": "gpl-3.0", "size": 27397 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
1,167,714
public Item getQueuedItem() { return Jenkins.getInstance().getQueue().getItem(owner); }
Item function() { return Jenkins.getInstance().getQueue().getItem(owner); }
/** * Returns the first queue item if the owner is scheduled for execution in the queue. */
Returns the first queue item if the owner is scheduled for execution in the queue
getQueuedItem
{ "repo_name": "vjuranek/jenkins", "path": "core/src/main/java/hudson/widgets/BuildHistoryWidget.java", "license": "mit", "size": 2862 }
[ "hudson.model.Queue" ]
import hudson.model.Queue;
import hudson.model.*;
[ "hudson.model" ]
hudson.model;
1,772,605
private void executeSQLScript(String filename) { /// Delimiter String delimiter = ";"; /// Get file from resources folder and setup scanner Scanner scanner; File file = new File(getClass().getClassLoader().getResource(filename).getFile()); try { scanner = new Scanner(file).useDelimiter(delimiter); } catch (FileNotFoundException e) { System.out.println("SqlScriptLauncher: Scanner Exception - " + e); return; } // Loop through the SQL file statements // TODO: THIS DOES NOT SUPPORT COMMENTS! Connection conn = DatabaseConnection.getConnection(); Statement currentStatement = null; while (scanner.hasNext()) { // Get statement String rawStatement = scanner.next() + delimiter; try { // Execute statement currentStatement = conn.createStatement(); currentStatement.execute(rawStatement); } catch (SQLException e) { System.out.println("SqlScriptLauncher: Execute Exception - " + e); } finally { // Release resources if (currentStatement != null) { try { currentStatement.close(); } catch (SQLException e) { System.out.println("SqlScriptLauncher: Release Exception - " + e); } } currentStatement = null; } } DatabaseConnection.closeConnection(conn); }
void function(String filename) { String delimiter = ";"; Scanner scanner; File file = new File(getClass().getClassLoader().getResource(filename).getFile()); try { scanner = new Scanner(file).useDelimiter(delimiter); } catch (FileNotFoundException e) { System.out.println(STR + e); return; } Connection conn = DatabaseConnection.getConnection(); Statement currentStatement = null; while (scanner.hasNext()) { String rawStatement = scanner.next() + delimiter; try { currentStatement = conn.createStatement(); currentStatement.execute(rawStatement); } catch (SQLException e) { System.out.println(STR + e); } finally { if (currentStatement != null) { try { currentStatement.close(); } catch (SQLException e) { System.out.println(STR + e); } } currentStatement = null; } } DatabaseConnection.closeConnection(conn); }
/** * Parse and execute commands from the sql script specified. * NOTE: Does not handle comments in the sql script * @param filename Name of sql script file to be executed */
Parse and execute commands from the sql script specified
executeSQLScript
{ "repo_name": "VertMusic/vert_backend", "path": "src/main/java/com/project/vert_backend/controller/SqlScriptLauncher.java", "license": "apache-2.0", "size": 3157 }
[ "com.project.vert_backend.database.DatabaseConnection", "java.io.File", "java.io.FileNotFoundException", "java.sql.Connection", "java.sql.SQLException", "java.sql.Statement", "java.util.Scanner" ]
import com.project.vert_backend.database.DatabaseConnection; import java.io.File; import java.io.FileNotFoundException; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner;
import com.project.vert_backend.database.*; import java.io.*; import java.sql.*; import java.util.*;
[ "com.project.vert_backend", "java.io", "java.sql", "java.util" ]
com.project.vert_backend; java.io; java.sql; java.util;
1,415,071
public Map<String, Application> findByIdsIfAuthorized(String fetchContext, String... ids) { List<Application> apps = alienDAO.findByIdsWithContext(Application.class, fetchContext, ids); if (apps == null) { return null; } Map<String, Application> applications = Maps.newHashMap(); Iterator<Application> iterator = apps.iterator(); while (iterator.hasNext()) { Application app = iterator.next(); if (!AuthorizationUtil.hasAuthorizationForApplication(app, ApplicationRole.values())) { iterator.remove(); continue; } applications.put(app.getId(), app); } return applications.isEmpty() ? null : applications; }
Map<String, Application> function(String fetchContext, String... ids) { List<Application> apps = alienDAO.findByIdsWithContext(Application.class, fetchContext, ids); if (apps == null) { return null; } Map<String, Application> applications = Maps.newHashMap(); Iterator<Application> iterator = apps.iterator(); while (iterator.hasNext()) { Application app = iterator.next(); if (!AuthorizationUtil.hasAuthorizationForApplication(app, ApplicationRole.values())) { iterator.remove(); continue; } applications.put(app.getId(), app); } return applications.isEmpty() ? null : applications; }
/** * Retrieve applications given a list of ids, and a specific context * Only retrieves the authorized ones. * * @param fetchContext The fetch context to recover only the required field (Note that this should be simplified to directly use the given field...). * @param ids array of id of the applications to find * @return Map of Applications that has the given ids and for which the user is authorized (key is application Id), or null if no application matching the * request is found. */
Retrieve applications given a list of ids, and a specific context Only retrieves the authorized ones
findByIdsIfAuthorized
{ "repo_name": "OresteVisari/alien4cloud", "path": "alien4cloud-core/src/main/java/alien4cloud/application/ApplicationService.java", "license": "apache-2.0", "size": 8555 }
[ "com.google.common.collect.Maps", "java.util.Iterator", "java.util.List", "java.util.Map" ]
import com.google.common.collect.Maps; import java.util.Iterator; import java.util.List; import java.util.Map;
import com.google.common.collect.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,499,388
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setupActionBar() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // Show the Up button in the action bar. getActionBar().setDisplayHomeAsUpEnabled(true); } }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) void function() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { getActionBar().setDisplayHomeAsUpEnabled(true); } }
/** * Set up the {@link android.app.ActionBar}, if the API is available. */
Set up the <code>android.app.ActionBar</code>, if the API is available
setupActionBar
{ "repo_name": "ReliQ/FirstTipCalc", "path": "src/com/reliqartz/firsttipcalc/gui/SettingsActivity.java", "license": "apache-2.0", "size": 12356 }
[ "android.annotation.TargetApi", "android.os.Build" ]
import android.annotation.TargetApi; import android.os.Build;
import android.annotation.*; import android.os.*;
[ "android.annotation", "android.os" ]
android.annotation; android.os;
2,791,321
return false; } protected MobCapacitiesConfigType getCapacities () { return ModCastleDefenders.config.eMageCapacities; }
return false; } protected MobCapacitiesConfigType getCapacities () { return ModCastleDefenders.config.eMageCapacities; }
/** * Determines if an entity can be despawned, used on idle far away entities */
Determines if an entity can be despawned, used on idle far away entities
canDespawn
{ "repo_name": "GollumTeam/CastleDefenders", "path": "src/main/java/com/gollum/castledefenders/common/entities/EntityEMage.java", "license": "gpl-2.0", "size": 970 }
[ "com.gollum.castledefenders.ModCastleDefenders", "com.gollum.core.common.config.type.MobCapacitiesConfigType" ]
import com.gollum.castledefenders.ModCastleDefenders; import com.gollum.core.common.config.type.MobCapacitiesConfigType;
import com.gollum.castledefenders.*; import com.gollum.core.common.config.type.*;
[ "com.gollum.castledefenders", "com.gollum.core" ]
com.gollum.castledefenders; com.gollum.core;
2,363,514
public void deleteItem(ItemId itemId, DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode, AffectedTaskOccurrence affectedTaskOccurrences) throws Exception { List<ItemId> itemIdArray = new ArrayList<ItemId>(); itemIdArray.add(itemId); EwsUtilities.validateParam(itemId, "itemId"); this.internalDeleteItems(itemIdArray, deleteMode, sendCancellationsMode, affectedTaskOccurrences, ServiceErrorHandling.ThrowOnError); }
void function(ItemId itemId, DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode, AffectedTaskOccurrence affectedTaskOccurrences) throws Exception { List<ItemId> itemIdArray = new ArrayList<ItemId>(); itemIdArray.add(itemId); EwsUtilities.validateParam(itemId, STR); this.internalDeleteItems(itemIdArray, deleteMode, sendCancellationsMode, affectedTaskOccurrences, ServiceErrorHandling.ThrowOnError); }
/** * Deletes an item. Calling this method results in a call to EWS. * * @param itemId the item id * @param deleteMode the delete mode * @param sendCancellationsMode the send cancellations mode * @param affectedTaskOccurrences the affected task occurrences * @throws Exception the exception */
Deletes an item. Calling this method results in a call to EWS
deleteItem
{ "repo_name": "candrews/ews-java-api", "path": "src/main/java/microsoft/exchange/webservices/data/core/ExchangeService.java", "license": "mit", "size": 161711 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,373,973
String printTreeToString(Node node, int maxDepth, Node markNode);
String printTreeToString(Node node, int maxDepth, Node markNode);
/** * Creates a textual AST display, one line per node, with nesting. * * @param node the root node of the display. * @param maxDepth the maximum number of levels to print below the root * @param markNode a node to mark with a textual arrow prefix, if present. * @since 0.8 or earlier */
Creates a textual AST display, one line per node, with nesting
printTreeToString
{ "repo_name": "mlvdv/truffle", "path": "truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/instrument/ASTPrinter.java", "license": "gpl-2.0", "size": 3010 }
[ "com.oracle.truffle.api.nodes.Node" ]
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.*;
[ "com.oracle.truffle" ]
com.oracle.truffle;
803,986
public static boolean removeAccessibilityStateChangeListener(AccessibilityManager manager, AccessibilityStateChangeListenerCompat listener) { return IMPL.removeAccessibilityStateChangeListener(manager, listener); }
static boolean function(AccessibilityManager manager, AccessibilityStateChangeListenerCompat listener) { return IMPL.removeAccessibilityStateChangeListener(manager, listener); }
/** * Unregisters an {@link AccessibilityManager.AccessibilityStateChangeListener}. * * @param manager The accessibility manager. * @param listener The listener. * @return True if successfully unregistered. */
Unregisters an <code>AccessibilityManager.AccessibilityStateChangeListener</code>
removeAccessibilityStateChangeListener
{ "repo_name": "devoxx/mobile-client", "path": "devoxx-android-client/src/android/support/v4/view/accessibility/AccessibilityManagerCompat.java", "license": "apache-2.0", "size": 8206 }
[ "android.view.accessibility.AccessibilityManager" ]
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.*;
[ "android.view" ]
android.view;
2,512,865
public EventDto setCategory(@Nullable String category) { this.category = checkEventCategory(category); return this; }
EventDto function(@Nullable String category) { this.category = checkEventCategory(category); return this; }
/** * The category of an event should not be null, but we must accept null values as the DB column is not nullable */
The category of an event should not be null, but we must accept null values as the DB column is not nullable
setCategory
{ "repo_name": "lbndev/sonarqube", "path": "server/sonar-db-dao/src/main/java/org/sonar/db/event/EventDto.java", "license": "lgpl-3.0", "size": 3541 }
[ "javax.annotation.Nullable", "org.sonar.db.event.EventValidator" ]
import javax.annotation.Nullable; import org.sonar.db.event.EventValidator;
import javax.annotation.*; import org.sonar.db.event.*;
[ "javax.annotation", "org.sonar.db" ]
javax.annotation; org.sonar.db;
981,146
public static String encodeValue(String segment, String[] encoding) { ArrayList<String> params = new ArrayList<String>(); boolean foundParam = false; StringBuilder newSegment = new StringBuilder(); if (savePathParams(segment, newSegment, params)) { foundParam = true; segment = newSegment.toString(); } String result = encodeFromArray(segment, encoding, false); result = encodeNonCodes(result); segment = result; if (foundParam) { segment = pathParamReplacement(segment, params); } return segment; }
static String function(String segment, String[] encoding) { ArrayList<String> params = new ArrayList<String>(); boolean foundParam = false; StringBuilder newSegment = new StringBuilder(); if (savePathParams(segment, newSegment, params)) { foundParam = true; segment = newSegment.toString(); } String result = encodeFromArray(segment, encoding, false); result = encodeNonCodes(result); segment = result; if (foundParam) { segment = pathParamReplacement(segment, params); } return segment; }
/** * Keep encoded values "%..." and template parameters intact i.e. "{x}" * * @param segment * @param encoding * @return */
Keep encoded values "%..." and template parameters intact i.e. "{x}"
encodeValue
{ "repo_name": "thomasdarimont/keycloak", "path": "common/src/main/java/org/keycloak/common/util/Encode.java", "license": "apache-2.0", "size": 17086 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,932,761
public Validator.Builder excludingByPattern(String... patterns) { stream(patterns).map(Pattern::compile).forEach(excludePatterns::add); return this; }
Validator.Builder function(String... patterns) { stream(patterns).map(Pattern::compile).forEach(excludePatterns::add); return this; }
/** * Skip any checks with names matching the given regular expressions. * <p> * <b>Note:</b> Excludes are applied after includes. * * @param patterns * regular expressions matching check class names to be excluded. */
Skip any checks with names matching the given regular expressions. Note: Excludes are applied after includes
excludingByPattern
{ "repo_name": "apache/uima-uimafit", "path": "uimafit-core/src/main/java/org/apache/uima/fit/validation/Validator.java", "license": "apache-2.0", "size": 8471 }
[ "java.util.Arrays", "java.util.regex.Pattern", "java.util.stream.StreamSupport" ]
import java.util.Arrays; import java.util.regex.Pattern; import java.util.stream.StreamSupport;
import java.util.*; import java.util.regex.*; import java.util.stream.*;
[ "java.util" ]
java.util;
22,545
EnumSet<T> enums = EnumSet.allOf(enumClass); return IterableUtils.randomFrom(enums); }
EnumSet<T> enums = EnumSet.allOf(enumClass); return IterableUtils.randomFrom(enums); }
/** * Returns a random element from the given enum class. * * @param enumClass enum class to return random element from * @param <T> the type of the given enum class * @return random element from the given enum class * @throws IllegalArgumentException if the given enumClass has no values */
Returns a random element from the given enum class
random
{ "repo_name": "RKumsher/utils", "path": "src/main/java/com/github/rkumsher/enums/RandomEnumUtils.java", "license": "apache-2.0", "size": 2027 }
[ "com.github.rkumsher.collection.IterableUtils", "java.util.EnumSet" ]
import com.github.rkumsher.collection.IterableUtils; import java.util.EnumSet;
import com.github.rkumsher.collection.*; import java.util.*;
[ "com.github.rkumsher", "java.util" ]
com.github.rkumsher; java.util;
2,811,212
private void closeChunk() throws IOException { if(chunkRemaining > 0) { // just skip the rest and the CRC input.skip(chunkRemaining+4); } else { readFully(buffer, 0, 4); int expectedCrc = readInt(buffer, 0); int computedCrc = (int)crc.getValue(); if(computedCrc != expectedCrc) { throw new IOException("Invalid CRC"); } } chunkRemaining = 0; chunkLength = 0; chunkType = 0; }
void function() throws IOException { if(chunkRemaining > 0) { input.skip(chunkRemaining+4); } else { readFully(buffer, 0, 4); int expectedCrc = readInt(buffer, 0); int computedCrc = (int)crc.getValue(); if(computedCrc != expectedCrc) { throw new IOException(STR); } } chunkRemaining = 0; chunkLength = 0; chunkType = 0; }
/** * Close the current chunk, skip the remaining data * * @throws java.io.IOException Indicates a failure to read off redundant data */
Close the current chunk, skip the remaining data
closeChunk
{ "repo_name": "nonvirtualthunk/arx-core", "path": "src/main/java/arx/core/graphics/data/PNGImageData2.java", "license": "bsd-2-clause", "size": 23698 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,974,516
private boolean hasCustomNullabilityRules(SqlKind sqlKind) { switch (sqlKind) { case CAST: case ITEM: return true; default: return false; } }
boolean function(SqlKind sqlKind) { switch (sqlKind) { case CAST: case ITEM: return true; default: return false; } }
/** * Returns {@code true} if specified {@link SqlKind} has custom nullability rules which * depend not only on the nullability of input operands. * * <p>For example, CAST may be used to change the nullability of its operand type, * so it may be nullable, though the argument type was non-nullable. * * @param sqlKind Sql kind to check * @return {@code true} if specified {@link SqlKind} has custom nullability rules */
Returns true if specified <code>SqlKind</code> has custom nullability rules which depend not only on the nullability of input operands. For example, CAST may be used to change the nullability of its operand type, so it may be nullable, though the argument type was non-nullable
hasCustomNullabilityRules
{ "repo_name": "greghogan/flink", "path": "flink-table/flink-table-planner-blink/src/main/java/org/apache/calcite/rex/RexSimplify.java", "license": "apache-2.0", "size": 101484 }
[ "org.apache.calcite.sql.SqlKind" ]
import org.apache.calcite.sql.SqlKind;
import org.apache.calcite.sql.*;
[ "org.apache.calcite" ]
org.apache.calcite;
1,009,226
public void writeChildElements( JRElementGroup elementContainer, String parentName) { List<JRChild> children = elementContainer.getChildren(); if (children != null && children.size() > 0) { for(int i = 0; i < children.size(); i++) { String childName = parentName + "_" + i; apiWriterVisitor.setName(childName); children.get(i).visit(apiWriterVisitor); if(children.get(i) instanceof JRElementGroup && !(children.get(i) instanceof JRElement)) { write( parentName +".addElementGroup(" + childName + ");\n\n"); } else if (!(children.get(i) instanceof JRComponentElement))//FIXME component { write( parentName +".addElement(" + childName + ");\n\n"); } } } }
void function( JRElementGroup elementContainer, String parentName) { List<JRChild> children = elementContainer.getChildren(); if (children != null && children.size() > 0) { for(int i = 0; i < children.size(); i++) { String childName = parentName + "_" + i; apiWriterVisitor.setName(childName); children.get(i).visit(apiWriterVisitor); if(children.get(i) instanceof JRElementGroup && !(children.get(i) instanceof JRElement)) { write( parentName +STR + childName + STR); } else if (!(children.get(i) instanceof JRComponentElement)) { write( parentName +STR + childName + STR); } } } }
/** * Writes the contents (child elements) of an element container. * * @param elementContainer the element container */
Writes the contents (child elements) of an element container
writeChildElements
{ "repo_name": "aleatorio12/ProVentasConnector", "path": "jasperreports-6.2.1-project/jasperreports-6.2.1/src/net/sf/jasperreports/engine/util/JRApiWriter.java", "license": "gpl-3.0", "size": 146427 }
[ "java.util.List", "net.sf.jasperreports.engine.JRChild", "net.sf.jasperreports.engine.JRComponentElement", "net.sf.jasperreports.engine.JRElement", "net.sf.jasperreports.engine.JRElementGroup" ]
import java.util.List; import net.sf.jasperreports.engine.JRChild; import net.sf.jasperreports.engine.JRComponentElement; import net.sf.jasperreports.engine.JRElement; import net.sf.jasperreports.engine.JRElementGroup;
import java.util.*; import net.sf.jasperreports.engine.*;
[ "java.util", "net.sf.jasperreports" ]
java.util; net.sf.jasperreports;
821,912
public List<String> records() { return rrdatas; }
List<String> function() { return rrdatas; }
/** * Returns a list of records stored in this record set. */
Returns a list of records stored in this record set
records
{ "repo_name": "tangiel/google-cloud-java", "path": "google-cloud-dns/src/main/java/com/google/cloud/dns/RecordSet.java", "license": "apache-2.0", "size": 9154 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,303,060
@Override public void write(byte[] buffer, int offset, int length) throws IOException { while ((mByteToSkip > 0 || mByteToCopy > 0 || mState != STATE_JPEG_DATA) && length > 0) { if (mByteToSkip > 0) { int byteToProcess = length > mByteToSkip ? mByteToSkip : length; length -= byteToProcess; mByteToSkip -= byteToProcess; offset += byteToProcess; } if (mByteToCopy > 0) { int byteToProcess = length > mByteToCopy ? mByteToCopy : length; out.write(buffer, offset, byteToProcess); length -= byteToProcess; mByteToCopy -= byteToProcess; offset += byteToProcess; } if (length == 0) { return; } switch (mState) { case STATE_SOI: int byteRead = requestByteToBuffer(2, buffer, offset, length); offset += byteRead; length -= byteRead; if (mBuffer.position() < 2) { return; } mBuffer.rewind(); if (mBuffer.getShort() != JpegHeader.SOI) { throw new IOException("Not a valid jpeg image, cannot write exif"); } out.write(mBuffer.array(), 0, 2); mState = STATE_FRAME_HEADER; mBuffer.rewind(); writeExifData(); break; case STATE_FRAME_HEADER: // We ignore the APP1 segment and copy all other segments // until SOF tag. byteRead = requestByteToBuffer(4, buffer, offset, length); offset += byteRead; length -= byteRead; // Check if this image data doesn't contain SOF. if (mBuffer.position() == 2) { short tag = mBuffer.getShort(); if (tag == JpegHeader.EOI) { out.write(mBuffer.array(), 0, 2); mBuffer.rewind(); } } if (mBuffer.position() < 4) { return; } mBuffer.rewind(); short marker = mBuffer.getShort(); if (marker == JpegHeader.APP1) { mByteToSkip = (mBuffer.getShort() & 0x0000ffff) - 2; mState = STATE_JPEG_DATA; } else if (!JpegHeader.isSofMarker(marker)) { out.write(mBuffer.array(), 0, 4); mByteToCopy = (mBuffer.getShort() & 0x0000ffff) - 2; } else { out.write(mBuffer.array(), 0, 4); mState = STATE_JPEG_DATA; } mBuffer.rewind(); } } if (length > 0) { out.write(buffer, offset, length); } }
void function(byte[] buffer, int offset, int length) throws IOException { while ((mByteToSkip > 0 mByteToCopy > 0 mState != STATE_JPEG_DATA) && length > 0) { if (mByteToSkip > 0) { int byteToProcess = length > mByteToSkip ? mByteToSkip : length; length -= byteToProcess; mByteToSkip -= byteToProcess; offset += byteToProcess; } if (mByteToCopy > 0) { int byteToProcess = length > mByteToCopy ? mByteToCopy : length; out.write(buffer, offset, byteToProcess); length -= byteToProcess; mByteToCopy -= byteToProcess; offset += byteToProcess; } if (length == 0) { return; } switch (mState) { case STATE_SOI: int byteRead = requestByteToBuffer(2, buffer, offset, length); offset += byteRead; length -= byteRead; if (mBuffer.position() < 2) { return; } mBuffer.rewind(); if (mBuffer.getShort() != JpegHeader.SOI) { throw new IOException(STR); } out.write(mBuffer.array(), 0, 2); mState = STATE_FRAME_HEADER; mBuffer.rewind(); writeExifData(); break; case STATE_FRAME_HEADER: byteRead = requestByteToBuffer(4, buffer, offset, length); offset += byteRead; length -= byteRead; if (mBuffer.position() == 2) { short tag = mBuffer.getShort(); if (tag == JpegHeader.EOI) { out.write(mBuffer.array(), 0, 2); mBuffer.rewind(); } } if (mBuffer.position() < 4) { return; } mBuffer.rewind(); short marker = mBuffer.getShort(); if (marker == JpegHeader.APP1) { mByteToSkip = (mBuffer.getShort() & 0x0000ffff) - 2; mState = STATE_JPEG_DATA; } else if (!JpegHeader.isSofMarker(marker)) { out.write(mBuffer.array(), 0, 4); mByteToCopy = (mBuffer.getShort() & 0x0000ffff) - 2; } else { out.write(mBuffer.array(), 0, 4); mState = STATE_JPEG_DATA; } mBuffer.rewind(); } } if (length > 0) { out.write(buffer, offset, length); } }
/** * Writes the image out. The input data should be a valid JPEG format. After * writing, it's Exif header will be replaced by the given header. */
Writes the image out. The input data should be a valid JPEG format. After writing, it's Exif header will be replaced by the given header
write
{ "repo_name": "asm-products/nexus-camera", "path": "src/com/android/camera/exif/ExifOutputStream.java", "license": "agpl-3.0", "size": 20863 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,010,108
public boolean shouldExecute() { if (!super.shouldExecute()) { return false; } else if (!this.theEntity.worldObj.getGameRules().getBoolean("mobGriefing")) { return false; } else { BlockDoor blockdoor = this.doorBlock; return !BlockDoor.isOpen(this.theEntity.worldObj, this.doorPosition); } }
boolean function() { if (!super.shouldExecute()) { return false; } else if (!this.theEntity.worldObj.getGameRules().getBoolean(STR)) { return false; } else { BlockDoor blockdoor = this.doorBlock; return !BlockDoor.isOpen(this.theEntity.worldObj, this.doorPosition); } }
/** * Returns whether the EntityAIBase should begin execution. */
Returns whether the EntityAIBase should begin execution
shouldExecute
{ "repo_name": "TorchPowered/CraftBloom", "path": "src/net/minecraft/entity/ai/EntityAIBreakDoor.java", "license": "mit", "size": 2863 }
[ "net.minecraft.block.BlockDoor" ]
import net.minecraft.block.BlockDoor;
import net.minecraft.block.*;
[ "net.minecraft.block" ]
net.minecraft.block;
1,478,279
private HostId isHostId(String id) { return id.matches("..:..:..:..:..:../.*") ? HostId.hostId(id) : null; }
HostId function(String id) { return id.matches(STR) ? HostId.hostId(id) : null; }
/** * Determines if the id appears to be the id of a host. * Host id format is 00:00:00:00:00:01/-1 * * @param id id string * @return HostId if the id is valid, null otherwise */
Determines if the id appears to be the id of a host. Host id format is 00:00:00:00:00:01/-1
isHostId
{ "repo_name": "harikrushna-Huawei/hackathon", "path": "web/api/src/main/java/org/onosproject/rest/resources/PathsWebResource.java", "license": "apache-2.0", "size": 3530 }
[ "org.onosproject.net.HostId" ]
import org.onosproject.net.HostId;
import org.onosproject.net.*;
[ "org.onosproject.net" ]
org.onosproject.net;
548,915
private Sha256Hash calculateHash() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE); writeHeader(bos); return new Sha256Hash(Utils.reverseBytes(doubleDigest(bos.toByteArray()))); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } }
Sha256Hash function() { try { ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(HEADER_SIZE); writeHeader(bos); return new Sha256Hash(Utils.reverseBytes(doubleDigest(bos.toByteArray()))); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Calculates the block hash by serializing the block and hashing the * resulting bytes. */
Calculates the block hash by serializing the block and hashing the resulting bytes
calculateHash
{ "repo_name": "incredible-hulk/betacoinj", "path": "core/src/main/java/com/google/betacoin/core/Block.java", "license": "apache-2.0", "size": 45308 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException" ]
import java.io.ByteArrayOutputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
74,956
void onVideoInputFormatChanged(Format format);
void onVideoInputFormatChanged(Format format);
/** * Called when the format of the media being consumed by the renderer changes. * * @param format The new format. */
Called when the format of the media being consumed by the renderer changes
onVideoInputFormatChanged
{ "repo_name": "ClubCom/AndroidExoPlayer", "path": "library/src/main/java/com/google/android/exoplayer2/video/VideoRendererEventListener.java", "license": "apache-2.0", "size": 8026 }
[ "com.google.android.exoplayer2.Format" ]
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.*;
[ "com.google.android" ]
com.google.android;
1,177,847
EAttribute getDGraph_Facade2();
EAttribute getDGraph_Facade2();
/** * Returns the meta object for the attribute '{@link org.isoe.diagraph.diagraph.DGraph#getFacade2 <em>Facade2</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Facade2</em>'. * @see org.isoe.diagraph.diagraph.DGraph#getFacade2() * @see #getDGraph() * @generated */
Returns the meta object for the attribute '<code>org.isoe.diagraph.diagraph.DGraph#getFacade2 Facade2</code>'.
getDGraph_Facade2
{ "repo_name": "francoispfister/diagraph", "path": "org.isoe.diagraph.diagraph/src/org/isoe/diagraph/diagraph/DiagraphPackage.java", "license": "epl-1.0", "size": 96197 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,448,131
private void storeBounds() { final Rectangle bounds = new Rectangle(); GeneralPath arc = dataSeries.getArcPath(); if (arc != null) { bounds.setBounds(arc.getBounds()); } Rectangle resultant = null; Line2D res = dataSeries.getResultant(); if (res != null) { resultant = ((Line2D) res).getBounds(); LOGGER.info("Resultant = " + resultant); } if (resultant != null) { if (resultant.x < bounds.x) { bounds.setBounds(resultant.x, bounds.y, bounds.width + (bounds.x - resultant.x), bounds.height); } if (resultant.y < bounds.y) { bounds.setBounds(bounds.x, resultant.y, bounds.width, bounds.height + (bounds.y - resultant.y)); } if (resultant.x + resultant.width > bounds.x + bounds.width) { bounds.setBounds(resultant.x, bounds.y, resultant.x + resultant.width - bounds.x, bounds.height); } if (resultant.y + resultant.height > bounds.y + bounds.height) { bounds.setBounds(resultant.x, bounds.y, bounds.width, resultant.y + resultant.height - bounds.y); } } bounds.setBounds(bounds.x - BOUND_BORDER, bounds.y - BOUND_BORDER, bounds.width + (2 * BOUND_BORDER), bounds.height + (2 * BOUND_BORDER)); LOGGER.info("result bounds = " + bounds); dataSeries.setResultBounds(bounds); }
void function() { final Rectangle bounds = new Rectangle(); GeneralPath arc = dataSeries.getArcPath(); if (arc != null) { bounds.setBounds(arc.getBounds()); } Rectangle resultant = null; Line2D res = dataSeries.getResultant(); if (res != null) { resultant = ((Line2D) res).getBounds(); LOGGER.info(STR + resultant); } if (resultant != null) { if (resultant.x < bounds.x) { bounds.setBounds(resultant.x, bounds.y, bounds.width + (bounds.x - resultant.x), bounds.height); } if (resultant.y < bounds.y) { bounds.setBounds(bounds.x, resultant.y, bounds.width, bounds.height + (bounds.y - resultant.y)); } if (resultant.x + resultant.width > bounds.x + bounds.width) { bounds.setBounds(resultant.x, bounds.y, resultant.x + resultant.width - bounds.x, bounds.height); } if (resultant.y + resultant.height > bounds.y + bounds.height) { bounds.setBounds(resultant.x, bounds.y, bounds.width, resultant.y + resultant.height - bounds.y); } } bounds.setBounds(bounds.x - BOUND_BORDER, bounds.y - BOUND_BORDER, bounds.width + (2 * BOUND_BORDER), bounds.height + (2 * BOUND_BORDER)); LOGGER.info(STR + bounds); dataSeries.setResultBounds(bounds); }
/** * Bounds for the calculation area (to cut the result image later). */
Bounds for the calculation area (to cut the result image later)
storeBounds
{ "repo_name": "gabibau/orthodontic-preview", "path": "ortho-datamodel/src/main/java/com/orthodonticpreview/datamodel/PreviewCalculation.java", "license": "lgpl-3.0", "size": 12732 }
[ "java.awt.Rectangle", "java.awt.geom.GeneralPath", "java.awt.geom.Line2D" ]
import java.awt.Rectangle; import java.awt.geom.GeneralPath; import java.awt.geom.Line2D;
import java.awt.*; import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,691,728
public LocalDateTime getObject(int index) { if (isSet(index) == 0) { return null; } else { final long micros = valueBuffer.getLong((long) index * TYPE_WIDTH); return DateUtility.getLocalDateTimeFromEpochMicro(micros); } }
LocalDateTime function(int index) { if (isSet(index) == 0) { return null; } else { final long micros = valueBuffer.getLong((long) index * TYPE_WIDTH); return DateUtility.getLocalDateTimeFromEpochMicro(micros); } }
/** * Same as {@link #get(int)}. * * @param index position of element * @return element at given index */
Same as <code>#get(int)</code>
getObject
{ "repo_name": "cpcloud/arrow", "path": "java/vector/src/main/java/org/apache/arrow/vector/TimeStampMicroVector.java", "license": "apache-2.0", "size": 8150 }
[ "java.time.LocalDateTime", "org.apache.arrow.vector.util.DateUtility" ]
import java.time.LocalDateTime; import org.apache.arrow.vector.util.DateUtility;
import java.time.*; import org.apache.arrow.vector.util.*;
[ "java.time", "org.apache.arrow" ]
java.time; org.apache.arrow;
1,217,842
public void validate() { if (name() == null) { throw LOGGER .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); } if (tier() == null) { throw LOGGER .logExceptionAsError(new IllegalArgumentException("Missing required property tier in model Sku")); } } private static final ClientLogger LOGGER = new ClientLogger(Sku.class);
void function() { if (name() == null) { throw LOGGER .logExceptionAsError(new IllegalArgumentException(STR)); } if (tier() == null) { throw LOGGER .logExceptionAsError(new IllegalArgumentException(STR)); } } private static final ClientLogger LOGGER = new ClientLogger(Sku.class);
/** * Validates the instance. * * @throws IllegalArgumentException thrown if the instance is not valid. */
Validates the instance
validate
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mysqlflexibleserver/azure-resourcemanager-mysqlflexibleserver/src/main/java/com/azure/resourcemanager/mysqlflexibleserver/models/Sku.java", "license": "mit", "size": 2294 }
[ "com.azure.core.util.logging.ClientLogger" ]
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.logging.*;
[ "com.azure.core" ]
com.azure.core;
1,424,526
public void findStronglyConnected(OperatorMeta om, ValidationContext ctx) { om.nindex = ctx.nodeIndex; om.lowlink = ctx.nodeIndex; ctx.nodeIndex++; ctx.stack.push(om); ctx.path.push(om); // depth first successors traversal for (StreamMeta downStream: om.outputStreams.values()) { for (InputPortMeta sink: downStream.sinks) { OperatorMeta successor = sink.getOperatorWrapper(); if (successor == null) { continue; } // check for self referencing node if (om == successor) { ctx.invalidCycles.add(Collections.singleton(om)); } if (successor.nindex == null) { // not visited yet findStronglyConnected(successor, ctx); om.lowlink = Math.min(om.lowlink, successor.lowlink); } else if (ctx.stack.contains(successor)) { om.lowlink = Math.min(om.lowlink, successor.nindex); boolean isDelayLoop = false; for (int i = ctx.stack.size(); i > 0; i--) { OperatorMeta om2 = ctx.stack.get(i - 1); if (om2.getOperator() instanceof Operator.DelayOperator) { isDelayLoop = true; } if (om2 == successor) { break; } } if (!isDelayLoop) { ctx.invalidLoopAt = successor; } } } } // pop stack for all root operators if (om.lowlink.equals(om.nindex)) { Set<OperatorMeta> connectedSet = new LinkedHashSet<>(ctx.stack.size()); while (!ctx.stack.isEmpty()) { OperatorMeta n2 = ctx.stack.pop(); connectedSet.add(n2); if (n2 == om) { break; // collected all connected operators } } // strongly connected (cycle) if more than one node in stack if (connectedSet.size() > 1) { ctx.stronglyConnected.add(connectedSet); if (connectedSet.contains(ctx.invalidLoopAt)) { ctx.invalidCycles.add(connectedSet); } } } ctx.path.pop(); }
void function(OperatorMeta om, ValidationContext ctx) { om.nindex = ctx.nodeIndex; om.lowlink = ctx.nodeIndex; ctx.nodeIndex++; ctx.stack.push(om); ctx.path.push(om); for (StreamMeta downStream: om.outputStreams.values()) { for (InputPortMeta sink: downStream.sinks) { OperatorMeta successor = sink.getOperatorWrapper(); if (successor == null) { continue; } if (om == successor) { ctx.invalidCycles.add(Collections.singleton(om)); } if (successor.nindex == null) { findStronglyConnected(successor, ctx); om.lowlink = Math.min(om.lowlink, successor.lowlink); } else if (ctx.stack.contains(successor)) { om.lowlink = Math.min(om.lowlink, successor.nindex); boolean isDelayLoop = false; for (int i = ctx.stack.size(); i > 0; i--) { OperatorMeta om2 = ctx.stack.get(i - 1); if (om2.getOperator() instanceof Operator.DelayOperator) { isDelayLoop = true; } if (om2 == successor) { break; } } if (!isDelayLoop) { ctx.invalidLoopAt = successor; } } } } if (om.lowlink.equals(om.nindex)) { Set<OperatorMeta> connectedSet = new LinkedHashSet<>(ctx.stack.size()); while (!ctx.stack.isEmpty()) { OperatorMeta n2 = ctx.stack.pop(); connectedSet.add(n2); if (n2 == om) { break; } } if (connectedSet.size() > 1) { ctx.stronglyConnected.add(connectedSet); if (connectedSet.contains(ctx.invalidLoopAt)) { ctx.invalidCycles.add(connectedSet); } } } ctx.path.pop(); }
/** * Check for cycles in the graph reachable from start node n. This is done by * attempting to find strongly connected components. * * @see <a href="http://en.wikipedia.org/wiki/Tarjan%E2%80%99s_strongly_connected_components_algorithm">http://en.wikipedia.org/wiki/Tarjan%E2%80%99s_strongly_connected_components_algorithm</a> * * @param om * @param ctx */
Check for cycles in the graph reachable from start node n. This is done by attempting to find strongly connected components
findStronglyConnected
{ "repo_name": "tweise/incubator-apex-core", "path": "engine/src/main/java/com/datatorrent/stram/plan/logical/LogicalPlan.java", "license": "apache-2.0", "size": 87362 }
[ "com.datatorrent.api.Operator", "java.util.Collections", "java.util.LinkedHashSet", "java.util.Set" ]
import com.datatorrent.api.Operator; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set;
import com.datatorrent.api.*; import java.util.*;
[ "com.datatorrent.api", "java.util" ]
com.datatorrent.api; java.util;
924,794
@Override public void start(final BundleContext context) throws Exception { super.start(context); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); // avoid deadlock with JDT by starting JDT's classpath resolution job JavaCore.initializeAfterLoad(new NullProgressMonitor()); // traverse all Xpans projects in workspace and analyze their MMs in // classpath for (final IProject p : workspace.getRoot().getProjects()) { if (Activator.getExtXptModelManager().findProject(p) != null) { final ProjectAnalyzer pa = getProjectAnalyzer(p); if (pa != null) { if (pa.getState() != Job.WAITING) { pa.schedule(); } } } } // add listener for contents of files which contain metamodels workspace.addResourceChangeListener(resourceListener); // add listener for changes in a project's classpath JavaCore.addElementChangedListener(classpathListener); }
void function(final BundleContext context) throws Exception { super.start(context); final IWorkspace workspace = ResourcesPlugin.getWorkspace(); JavaCore.initializeAfterLoad(new NullProgressMonitor()); for (final IProject p : workspace.getRoot().getProjects()) { if (Activator.getExtXptModelManager().findProject(p) != null) { final ProjectAnalyzer pa = getProjectAnalyzer(p); if (pa != null) { if (pa.getState() != Job.WAITING) { pa.schedule(); } } } } workspace.addResourceChangeListener(resourceListener); JavaCore.addElementChangedListener(classpathListener); }
/** * This method is called upon plug-in activation */
This method is called upon plug-in activation
start
{ "repo_name": "markus1978/clickwatch", "path": "external/org.eclipse.xtend.typesystem.emf.ui/src/org/eclipse/xtend/typesystem/emf/ui/EmfToolsPlugin.java", "license": "apache-2.0", "size": 11748 }
[ "org.eclipse.core.resources.IProject", "org.eclipse.core.resources.IWorkspace", "org.eclipse.core.resources.ResourcesPlugin", "org.eclipse.core.runtime.NullProgressMonitor", "org.eclipse.core.runtime.jobs.Job", "org.eclipse.jdt.core.JavaCore", "org.eclipse.xtend.shared.ui.Activator", "org.osgi.framework.BundleContext" ]
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jdt.core.JavaCore; import org.eclipse.xtend.shared.ui.Activator; import org.osgi.framework.BundleContext;
import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.*; import org.eclipse.jdt.core.*; import org.eclipse.xtend.shared.ui.*; import org.osgi.framework.*;
[ "org.eclipse.core", "org.eclipse.jdt", "org.eclipse.xtend", "org.osgi.framework" ]
org.eclipse.core; org.eclipse.jdt; org.eclipse.xtend; org.osgi.framework;
2,481,328
// NOTE(nicksantos): The official ES4 grammar forces optional and rest // arguments to come after the required arguments. Our parser does not // enforce this. Instead we allow them anywhere in the function at parse-time, // and then warn about them during type resolution. // // In theory, it might be mathematically nicer to do the order-checking here. // But in practice, the order-checking for structural functions is exactly // the same as the order-checking for @param annotations. And the latter // has to happen during type resolution. Rather than duplicate the // order-checking in two places, we just do all of it in type resolution. private Node parseParametersType(JsDocToken token) { Node paramsType = newNode(Token.PARAM_LIST); boolean isVarArgs = false; Node paramType = null; if (token != JsDocToken.RP) { do { if (paramType != null) { // skip past the comma next(); skipEOLs(); token = next(); } if (token == JsDocToken.ELLIPSIS) { // In the latest ES4 proposal, there are no type constraints allowed // on variable arguments. We support the old syntax for backwards // compatibility, but we should gradually tear it out. skipEOLs(); if (match(JsDocToken.RP)) { paramType = newNode(Token.ELLIPSIS); } else { skipEOLs(); if (!match(JsDocToken.LB)) { return reportTypeSyntaxWarning("msg.jsdoc.missing.lb"); } next(); skipEOLs(); paramType = wrapNode(Token.ELLIPSIS, parseTypeExpression(next())); skipEOLs(); if (!match(JsDocToken.RB)) { return reportTypeSyntaxWarning("msg.jsdoc.missing.rb"); } skipEOLs(); next(); } isVarArgs = true; } else { paramType = parseTypeExpression(token); if (match(JsDocToken.EQUALS)) { skipEOLs(); next(); paramType = wrapNode(Token.EQUALS, paramType); } } if (paramType == null) { return null; } paramsType.addChildToBack(paramType); if (isVarArgs) { break; } } while (match(JsDocToken.COMMA)); } if (isVarArgs && match(JsDocToken.COMMA)) { return reportTypeSyntaxWarning("msg.jsdoc.function.varargs"); } // The right paren will be checked by parseFunctionType return paramsType; }
Node function(JsDocToken token) { Node paramsType = newNode(Token.PARAM_LIST); boolean isVarArgs = false; Node paramType = null; if (token != JsDocToken.RP) { do { if (paramType != null) { next(); skipEOLs(); token = next(); } if (token == JsDocToken.ELLIPSIS) { skipEOLs(); if (match(JsDocToken.RP)) { paramType = newNode(Token.ELLIPSIS); } else { skipEOLs(); if (!match(JsDocToken.LB)) { return reportTypeSyntaxWarning(STR); } next(); skipEOLs(); paramType = wrapNode(Token.ELLIPSIS, parseTypeExpression(next())); skipEOLs(); if (!match(JsDocToken.RB)) { return reportTypeSyntaxWarning(STR); } skipEOLs(); next(); } isVarArgs = true; } else { paramType = parseTypeExpression(token); if (match(JsDocToken.EQUALS)) { skipEOLs(); next(); paramType = wrapNode(Token.EQUALS, paramType); } } if (paramType == null) { return null; } paramsType.addChildToBack(paramType); if (isVarArgs) { break; } } while (match(JsDocToken.COMMA)); } if (isVarArgs && match(JsDocToken.COMMA)) { return reportTypeSyntaxWarning(STR); } return paramsType; }
/** * ParametersType := RestParameterType | NonRestParametersType * | NonRestParametersType ',' RestParameterType * RestParameterType := '...' Identifier * NonRestParametersType := ParameterType ',' NonRestParametersType * | ParameterType * | OptionalParametersType * OptionalParametersType := OptionalParameterType * | OptionalParameterType, OptionalParametersType * OptionalParameterType := ParameterType= * ParameterType := TypeExpression | Identifier ':' TypeExpression */
ParametersType := RestParameterType | NonRestParametersType | NonRestParametersType ',' RestParameterType RestParameterType := '...' Identifier NonRestParametersType := ParameterType ',' NonRestParametersType | ParameterType | OptionalParametersType OptionalParametersType := OptionalParameterType | OptionalParameterType, OptionalParametersType OptionalParameterType := ParameterType= ParameterType := TypeExpression | Identifier ':' TypeExpression
parseParametersType
{ "repo_name": "nicks/closure-compiler-old", "path": "src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java", "license": "apache-2.0", "size": 81943 }
[ "com.google.javascript.rhino.Node", "com.google.javascript.rhino.Token" ]
import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
56,632
@Test public void testHasLocalDependenciesInheritedServersideProvider() throws QuickFixException { String parentContent = String.format(baseTag, "extensible='true' provider='java://org.auraframework.impl.java.provider.TestProviderAbstractBasic'", ""); DefDescriptor<ComponentDef> parent = addSourceAutoCleanup(getDefClass(), parentContent); DefDescriptor<ComponentDef> child = addSourceAutoCleanup(getDefClass(), String.format(baseTag, "extends='" + parent.getDescriptorName() + "'", "")); assertFalse( "When a component's parent has serverside provider dependency, the component should not be marked as server dependent.", definitionService.getDefinition(child).hasLocalDependencies()); }
void function() throws QuickFixException { String parentContent = String.format(baseTag, STRSTRextends='STR'STRSTRWhen a component's parent has serverside provider dependency, the component should not be marked as server dependent.", definitionService.getDefinition(child).hasLocalDependencies()); }
/** * hasLocalDependencies is false if super has local provider dependency. Test method for * {@link BaseComponentDef#hasLocalDependencies()}. */
hasLocalDependencies is false if super has local provider dependency. Test method for <code>BaseComponentDef#hasLocalDependencies()</code>
testHasLocalDependenciesInheritedServersideProvider
{ "repo_name": "forcedotcom/aura", "path": "aura-integration-test/src/test/java/org/auraframework/integration/test/def/ComponentDefTest.java", "license": "apache-2.0", "size": 26338 }
[ "org.auraframework.throwable.quickfix.QuickFixException" ]
import org.auraframework.throwable.quickfix.QuickFixException;
import org.auraframework.throwable.quickfix.*;
[ "org.auraframework.throwable" ]
org.auraframework.throwable;
2,012,537
private Key buildKey(String prefix, ConnectPoint cPoint, VlanId vlanId) { String keyString = new StringBuilder() .append(prefix) .append("-") .append(cPoint.deviceId()) .append("-") .append(cPoint.port()) .append("-") .append(vlanId) .toString(); return Key.of(keyString, appId); }
Key function(String prefix, ConnectPoint cPoint, VlanId vlanId) { String keyString = new StringBuilder() .append(prefix) .append("-") .append(cPoint.deviceId()) .append("-") .append(cPoint.port()) .append("-") .append(vlanId) .toString(); return Key.of(keyString, appId); }
/** * Builds an intent Key for either for a Single Point to Multi Point or * Multi Point to Single Point intent, based on a prefix that defines * the type of intent, the single connection point representing the source * or the destination and the vlan id representing the network. * * @param cPoint the source or destination connect point * @param vlanId the network vlan id * @param prefix prefix string * @return */
Builds an intent Key for either for a Single Point to Multi Point or Multi Point to Single Point intent, based on a prefix that defines the type of intent, the single connection point representing the source or the destination and the vlan id representing the network
buildKey
{ "repo_name": "wuwenbin2/onos_bgp_evpn", "path": "apps/vpls/src/main/java/org/onosproject/vpls/IntentInstaller.java", "license": "apache-2.0", "size": 9589 }
[ "org.onlab.packet.VlanId", "org.onosproject.net.ConnectPoint", "org.onosproject.net.intent.Key" ]
import org.onlab.packet.VlanId; import org.onosproject.net.ConnectPoint; import org.onosproject.net.intent.Key;
import org.onlab.packet.*; import org.onosproject.net.*; import org.onosproject.net.intent.*;
[ "org.onlab.packet", "org.onosproject.net" ]
org.onlab.packet; org.onosproject.net;
1,221,369
@Test public void shouldReturnCoarseHeadingUndefined() throws JsonProcessingException, IOException{ ObjectMapper mapper = new ObjectMapper(); BigDecimal expectedValue = null; JsonNode testHeading = mapper.readTree("240"); BigDecimal actualValue = HeadingBuilder.genericCoarseHeading(testHeading); assertEquals(expectedValue, actualValue); }
void function() throws JsonProcessingException, IOException{ ObjectMapper mapper = new ObjectMapper(); BigDecimal expectedValue = null; JsonNode testHeading = mapper.readTree("240"); BigDecimal actualValue = HeadingBuilder.genericCoarseHeading(testHeading); assertEquals(expectedValue, actualValue); }
/** * Test that undefined coarse heading flag (240) returns (null) */
Test that undefined coarse heading flag (240) returns (null)
shouldReturnCoarseHeadingUndefined
{ "repo_name": "hmusavi/jpo-ode", "path": "jpo-ode-plugins/src/test/java/us/dot/its/jpo/ode/plugin/j2735/builders/HeadingBuilderTest.java", "license": "apache-2.0", "size": 3984 }
[ "com.fasterxml.jackson.core.JsonProcessingException", "com.fasterxml.jackson.databind.JsonNode", "com.fasterxml.jackson.databind.ObjectMapper", "java.io.IOException", "java.math.BigDecimal", "org.junit.Assert" ]
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.math.BigDecimal; import org.junit.Assert;
import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import java.io.*; import java.math.*; import org.junit.*;
[ "com.fasterxml.jackson", "java.io", "java.math", "org.junit" ]
com.fasterxml.jackson; java.io; java.math; org.junit;
1,583,748
public float getRenderPartialTicks() { return renderPartialTicks; } @Cancelable public static class Pre extends DrawScreenEvent { public Pre(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks) { super(gui, mouseX, mouseY, renderPartialTicks); } } public static class Post extends DrawScreenEvent { public Post(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks) { super(gui, mouseX, mouseY, renderPartialTicks); } } } public static class BackgroundDrawnEvent extends GuiScreenEvent { private final int mouseX; private final int mouseY; public BackgroundDrawnEvent(GuiScreen gui) { super(gui); final ScaledResolution scaledresolution = new ScaledResolution(gui.mc); final int scaledWidth = scaledresolution.getScaledWidth(); final int scaledHeight = scaledresolution.getScaledHeight(); this.mouseX = Mouse.getX() * scaledWidth / gui.mc.displayWidth; this.mouseY = scaledHeight - Mouse.getY() * scaledHeight / gui.mc.displayHeight - 1; }
float function() { return renderPartialTicks; } public static class Pre extends DrawScreenEvent { public Pre(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks) { super(gui, mouseX, mouseY, renderPartialTicks); } } public static class Post extends DrawScreenEvent { public Post(GuiScreen gui, int mouseX, int mouseY, float renderPartialTicks) { super(gui, mouseX, mouseY, renderPartialTicks); } } } public static class BackgroundDrawnEvent extends GuiScreenEvent { private final int mouseX; private final int mouseY; public BackgroundDrawnEvent(GuiScreen gui) { super(gui); final ScaledResolution scaledresolution = new ScaledResolution(gui.mc); final int scaledWidth = scaledresolution.getScaledWidth(); final int scaledHeight = scaledresolution.getScaledHeight(); this.mouseX = Mouse.getX() * scaledWidth / gui.mc.displayWidth; this.mouseY = scaledHeight - Mouse.getY() * scaledHeight / gui.mc.displayHeight - 1; }
/** * Partial render ticks elapsed. */
Partial render ticks elapsed
getRenderPartialTicks
{ "repo_name": "jdpadrnos/MinecraftForge", "path": "src/main/java/net/minecraftforge/client/event/GuiScreenEvent.java", "license": "lgpl-2.1", "size": 10764 }
[ "net.minecraft.client.gui.GuiScreen", "net.minecraft.client.gui.ScaledResolution", "org.lwjgl.input.Mouse" ]
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.*; import org.lwjgl.input.*;
[ "net.minecraft.client", "org.lwjgl.input" ]
net.minecraft.client; org.lwjgl.input;
9,875
public void changeGhostNote(TGMeasure measure,long start,int string){ TGNote note = getNote(measure,start,string); if(note != null){ note.getEffect().setGhostNote(!note.getEffect().isGhostNote()); } }
void function(TGMeasure measure,long start,int string){ TGNote note = getNote(measure,start,string); if(note != null){ note.getEffect().setGhostNote(!note.getEffect().isGhostNote()); } }
/** * Agrega un GhostNote */
Agrega un GhostNote
changeGhostNote
{ "repo_name": "m-wichmann/tg2ly", "path": "src/org/herac/tuxguitar/song/managers/TGMeasureManager.java", "license": "lgpl-2.1", "size": 73407 }
[ "org.herac.tuxguitar.song.models.TGMeasure", "org.herac.tuxguitar.song.models.TGNote" ]
import org.herac.tuxguitar.song.models.TGMeasure; import org.herac.tuxguitar.song.models.TGNote;
import org.herac.tuxguitar.song.models.*;
[ "org.herac.tuxguitar" ]
org.herac.tuxguitar;
2,511,169
@Test public void testMissingActivities() { ServiceResult activities = service.getActivitiesByIDs(Arrays.asList(999L)); assertEquals(0, activities.getRecords().size()); }
void function() { ServiceResult activities = service.getActivitiesByIDs(Arrays.asList(999L)); assertEquals(0, activities.getRecords().size()); }
/** * Tests retrieving of missing activities. */
Tests retrieving of missing activities
testMissingActivities
{ "repo_name": "SirmaITT/conservation-space-1.7.0", "path": "docker/sirma-platform/platform/seip-parent/platform/seip-audit/seip-audit-impl/src/test/java/com/sirma/itt/emf/audit/db/AuditDaoTest.java", "license": "lgpl-3.0", "size": 5142 }
[ "com.sirma.itt.emf.audit.solr.query.ServiceResult", "java.util.Arrays", "org.junit.Assert" ]
import com.sirma.itt.emf.audit.solr.query.ServiceResult; import java.util.Arrays; import org.junit.Assert;
import com.sirma.itt.emf.audit.solr.query.*; import java.util.*; import org.junit.*;
[ "com.sirma.itt", "java.util", "org.junit" ]
com.sirma.itt; java.util; org.junit;
2,127,453
void shutdown(String reason) { LOG.info("Shutting down"); if (isShutdown) { return; } LOG.info("Shutdown called", new Exception("shutdown Leader! reason: " + reason)); if (cnxAcceptor != null) { cnxAcceptor.halt(); } // NIO should not accept conenctions self.cnxnFactory.setZooKeeperServer(null); try { ss.close(); } catch (IOException e) { LOG.warn("Ignoring unexpected exception during close",e); } // clear all the connections self.cnxnFactory.closeAll(); // shutdown the previous zk if (zk != null) { zk.shutdown(); } synchronized (learners) { for (Iterator<LearnerHandler> it = learners.iterator(); it .hasNext();) { LearnerHandler f = it.next(); it.remove(); f.shutdown(); } } isShutdown = true; }
void shutdown(String reason) { LOG.info(STR); if (isShutdown) { return; } LOG.info(STR, new Exception(STR + reason)); if (cnxAcceptor != null) { cnxAcceptor.halt(); } self.cnxnFactory.setZooKeeperServer(null); try { ss.close(); } catch (IOException e) { LOG.warn(STR,e); } self.cnxnFactory.closeAll(); if (zk != null) { zk.shutdown(); } synchronized (learners) { for (Iterator<LearnerHandler> it = learners.iterator(); it .hasNext();) { LearnerHandler f = it.next(); it.remove(); f.shutdown(); } } isShutdown = true; }
/** * Close down all the LearnerHandlers */
Close down all the LearnerHandlers
shutdown
{ "repo_name": "fzsens/zookeeper", "path": "src/java/main/org/apache/zookeeper/server/quorum/Leader.java", "license": "apache-2.0", "size": 36214 }
[ "java.io.IOException", "java.util.Iterator" ]
import java.io.IOException; import java.util.Iterator;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
33,824
public List<Channel> getChannels() { return channels; }
List<Channel> function() { return channels; }
/** * Get control's channels * * @return channels */
Get control's channels
getChannels
{ "repo_name": "paulianttila/openhab2", "path": "bundles/org.openhab.binding.loxone/src/main/java/org/openhab/binding/loxone/internal/controls/LxControl.java", "license": "epl-1.0", "size": 24971 }
[ "java.util.List", "org.openhab.core.thing.Channel" ]
import java.util.List; import org.openhab.core.thing.Channel;
import java.util.*; import org.openhab.core.thing.*;
[ "java.util", "org.openhab.core" ]
java.util; org.openhab.core;
1,841,639
private void checkSegmentOnStart() throws IgniteCheckedException { assert hasRslvrs; if (log.isDebugEnabled()) log.debug("Starting network segment check."); while (true) { if (ctx.segmentation().isValidSegment()) break; if (ctx.config().isWaitForSegmentOnStart()) { LT.warn(log, null, "Failed to check network segment (retrying every 2000 ms)."); // Wait and check again. U.sleep(2000); } else throw new IgniteCheckedException("Failed to check network segment."); } if (log.isDebugEnabled()) log.debug("Finished network segment check successfully."); }
void function() throws IgniteCheckedException { assert hasRslvrs; if (log.isDebugEnabled()) log.debug(STR); while (true) { if (ctx.segmentation().isValidSegment()) break; if (ctx.config().isWaitForSegmentOnStart()) { LT.warn(log, null, STR); U.sleep(2000); } else throw new IgniteCheckedException(STR); } if (log.isDebugEnabled()) log.debug(STR); }
/** * Checks segment on start waiting for correct segment if necessary. * * @throws IgniteCheckedException If check failed. */
Checks segment on start waiting for correct segment if necessary
checkSegmentOnStart
{ "repo_name": "murador/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java", "license": "apache-2.0", "size": 105398 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.util.typedef.internal.LT", "org.apache.ignite.internal.util.typedef.internal.U" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.util.typedef.internal.LT; import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.internal.*;
[ "org.apache.ignite" ]
org.apache.ignite;
507,759
public void createAsyncScenario36a() throws Exception { // create subscription setDateFactory("2013-03-28 10:15:00"); VOServiceDetails serviceDetails = serviceSetup .createPublishAndActivateMarketableService( basicSetup.getSupplierAdminKey(), "SCENARIO_36a", TestService.EXAMPLE_ASYNC, TestPriceModel.EXAMPLE_PERUNIT_MONTH_ROLES_1, technicalServiceAsync, supplierMarketplace); setCutOffDay(basicSetup.getSupplierAdminKey(), 1); // create own customer String customerAdminId = "SCENARIO_36aCustomer"; orgSetup.registerCustomer("SCENARIO_36aCustomerOrg", TestOrganizationSetup.ORGANIZATION_DOMICILE_DE, customerAdminId, supplierMarketplace.getMarketplaceId(), basicSetup.getSupplierOrgID()); VOUser customerAdmin = orgSetup.getUser(customerAdminId, true); VORoleDefinition role = VOServiceFactory.getRole(serviceDetails, "ADMIN"); container.login(customerAdmin.getKey(), ROLE_ORGANIZATION_ADMIN); VOSubscriptionDetails subDetails = subscrSetup.subscribeToService( "SCENARIO_36a", serviceDetails, basicSetup.getCustomerUser1(), role); // ASYNC setDateFactory("2013-03-28 10:20:00"); subDetails = subscrSetup.completeAsyncSubscription( basicSetup.getSupplierAdminKey(), customerAdmin, subDetails); // upgrade to pro_rata of charge VOServiceDetails serviceDetails2 = serviceSetup .createPublishAndActivateMarketableService( basicSetup.getSupplierAdminKey(), "SCENARIO_36a_2", TestService.EXAMPLE_ASYNC, TestPriceModel.EXAMPLE_PRORATA_MONTH_ROLES_2, technicalServiceAsync, supplierMarketplace); serviceSetup.registerCompatibleServices( basicSetup.getSupplierAdminKey(), serviceDetails, serviceDetails2); setDateFactory("2013-03-30 10:20:00"); container.login(customerAdmin.getKey(), ROLE_ORGANIZATION_ADMIN); VOSubscriptionDetails upgradedSubDetails = subscrSetup .upgradeSubscription(subDetails, serviceDetails2); // delete the customer's billing contact -> subscription is suspended setDateFactory("2013-03-30 20:20:00"); upgradedSubDetails = deleteBillingContactsAndUpdateSub( customerAdmin.getKey(), upgradedSubDetails); // ASYNC setDateFactory("2013-04-10 10:20:00"); upgradedSubDetails = subscrSetup.completeAsyncUpgradeSubscription( basicSetup.getSupplierAdminKey(), customerAdmin, upgradedSubDetails); // Resume the subscription by creating a new billing contact for the // customer and assigning this billing contact to the subscription setDateFactory("2013-04-15 10:20:00"); upgradedSubDetails = restoreBillingContactForSubscription( customerAdmin.getKey(), upgradedSubDetails); // terminate Sub container.login(customerAdmin.getKey(), ROLE_ORGANIZATION_ADMIN); setDateFactory("2013-04-30 10:20:00"); subscrSetup.unsubscribeToService(subDetails.getSubscriptionId()); resetCutOffDay(basicSetup.getSupplierAdminKey()); BillingIntegrationTestBase.updateSubscriptionListForTests( "SCENARIO_36a", subDetails); BillingIntegrationTestBase.updateSubscriptionListForTests( "SCENARIO_36a", upgradedSubDetails); }
void function() throws Exception { setDateFactory(STR); VOServiceDetails serviceDetails = serviceSetup .createPublishAndActivateMarketableService( basicSetup.getSupplierAdminKey(), STR, TestService.EXAMPLE_ASYNC, TestPriceModel.EXAMPLE_PERUNIT_MONTH_ROLES_1, technicalServiceAsync, supplierMarketplace); setCutOffDay(basicSetup.getSupplierAdminKey(), 1); String customerAdminId = STR; orgSetup.registerCustomer(STR, TestOrganizationSetup.ORGANIZATION_DOMICILE_DE, customerAdminId, supplierMarketplace.getMarketplaceId(), basicSetup.getSupplierOrgID()); VOUser customerAdmin = orgSetup.getUser(customerAdminId, true); VORoleDefinition role = VOServiceFactory.getRole(serviceDetails, "ADMIN"); container.login(customerAdmin.getKey(), ROLE_ORGANIZATION_ADMIN); VOSubscriptionDetails subDetails = subscrSetup.subscribeToService( STR, serviceDetails, basicSetup.getCustomerUser1(), role); setDateFactory(STR); subDetails = subscrSetup.completeAsyncSubscription( basicSetup.getSupplierAdminKey(), customerAdmin, subDetails); VOServiceDetails serviceDetails2 = serviceSetup .createPublishAndActivateMarketableService( basicSetup.getSupplierAdminKey(), STR, TestService.EXAMPLE_ASYNC, TestPriceModel.EXAMPLE_PRORATA_MONTH_ROLES_2, technicalServiceAsync, supplierMarketplace); serviceSetup.registerCompatibleServices( basicSetup.getSupplierAdminKey(), serviceDetails, serviceDetails2); setDateFactory(STR); container.login(customerAdmin.getKey(), ROLE_ORGANIZATION_ADMIN); VOSubscriptionDetails upgradedSubDetails = subscrSetup .upgradeSubscription(subDetails, serviceDetails2); setDateFactory(STR); upgradedSubDetails = deleteBillingContactsAndUpdateSub( customerAdmin.getKey(), upgradedSubDetails); setDateFactory(STR); upgradedSubDetails = subscrSetup.completeAsyncUpgradeSubscription( basicSetup.getSupplierAdminKey(), customerAdmin, upgradedSubDetails); setDateFactory(STR); upgradedSubDetails = restoreBillingContactForSubscription( customerAdmin.getKey(), upgradedSubDetails); container.login(customerAdmin.getKey(), ROLE_ORGANIZATION_ADMIN); setDateFactory(STR); subscrSetup.unsubscribeToService(subDetails.getSubscriptionId()); resetCutOffDay(basicSetup.getSupplierAdminKey()); BillingIntegrationTestBase.updateSubscriptionListForTests( STR, subDetails); BillingIntegrationTestBase.updateSubscriptionListForTests( STR, upgradedSubDetails); }
/** * Suspend a subscription by deleting the customer's billing contact while * an asynchronous upgrade is running. After the async. upgrade is finished, * resume the subscription by creating a new billing contact and assigning * it to the subscription. */
Suspend a subscription by deleting the customer's billing contact while an asynchronous upgrade is running. After the async. upgrade is finished, resume the subscription by creating a new billing contact and assigning it to the subscription
createAsyncScenario36a
{ "repo_name": "opetrovski/development", "path": "oscm-billing-unittests/javasrc-it/org/oscm/billingservice/business/calculation/revenue/setup/AsyncSetup3.java", "license": "apache-2.0", "size": 85892 }
[ "org.oscm.billingservice.setup.BillingIntegrationTestBase", "org.oscm.billingservice.setup.TestOrganizationSetup", "org.oscm.billingservice.setup.VOPriceModelFactory", "org.oscm.billingservice.setup.VOServiceFactory", "org.oscm.internal.vo.VORoleDefinition", "org.oscm.internal.vo.VOServiceDetails", "org.oscm.internal.vo.VOSubscriptionDetails", "org.oscm.internal.vo.VOUser" ]
import org.oscm.billingservice.setup.BillingIntegrationTestBase; import org.oscm.billingservice.setup.TestOrganizationSetup; import org.oscm.billingservice.setup.VOPriceModelFactory; import org.oscm.billingservice.setup.VOServiceFactory; import org.oscm.internal.vo.VORoleDefinition; import org.oscm.internal.vo.VOServiceDetails; import org.oscm.internal.vo.VOSubscriptionDetails; import org.oscm.internal.vo.VOUser;
import org.oscm.billingservice.setup.*; import org.oscm.internal.vo.*;
[ "org.oscm.billingservice", "org.oscm.internal" ]
org.oscm.billingservice; org.oscm.internal;
360,123
public void custom(StringTokenizer tkn, Scanner scan){ //Try to create the object try{ //Grab the name of the object to be created String obj = tkn.nextToken(); //Find the object that is to be manipulated switch(objectType.valueOf(obj.toUpperCase())){ //If creating the crust case CRUST: crust = new Crust(); //array to hold all of the trait names String[] traits = {"firstName","middleName", "lastName", "warmth", "reasoning", "emotionalStability", "dominance", "liveliness", "ruleConsciousness", "socialBoldness", "sensitivity", "vigilance", "abstractedness", "privateness", "apprehensivness", "opennessToChange", "selfReliance", "perfectionism", "tension" }; //other variable declarations String input = ""; //Input string for storing the user's given value boolean prompted = false;//boolean for displaying second prompt only once //Print instructions System.out.println("Start by naming your Crust,"); System.out.println("or type 'cancel' at anytime to exit crust creation."); for(int i = 0; i <= 18; i++){ //Print necessary prompts if(i == 3 && !prompted){ System.out.println("Now set you Crust's personality traits."); System.out.println("Traits should be an integer between -100 and 100."); prompted = true; } System.out.print("$:"); System.out.print(" " + traits[i].toUpperCase() + ": "); //Scan for input input = scan.nextLine(); //See if custom creation was cancelled, if so set crust = null and return if(input.equals("cancel")){ crust = null; return; } //otherwise try to set the trait, recalling this iteration if bad input given try{ crust.set(traits[i], input); }catch(Exception e){ System.out.println("Traits must be an integer between -100 and 100"); i--; } } break; //Otherwise object is not meant to be created default: System.out.println("Invalid command, given object can not be created. Type 'help create'"); break; } //Object not in list or invalid command }catch(Exception e){ System.out.println("Invalid command.\nUsage: create [object]"); } }
void function(StringTokenizer tkn, Scanner scan){ try{ String obj = tkn.nextToken(); switch(objectType.valueOf(obj.toUpperCase())){ case CRUST: crust = new Crust(); String[] traits = {STR,STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR }; String input = STRStart by naming your Crust,STRor type 'cancel' at anytime to exit crust creation.STRNow set you Crust's personality traits.STRTraits should be an integer between -100 and 100.STR$:STR STR: STRcancelSTRTraits must be an integer between -100 and 100STRInvalid command, given object can not be created. Type 'help create'STRInvalid command.\nUsage: create [object]"); } }
/*************************************** * Creates a new object and asks user for further input to determine its values * @param tkn - A string tokenizer containing the rest of the custom command * @param scan - A Scanner which needs to be passed in from the Commandline calling custom * @author Anthony ***************************************/
Creates a new object and asks user for further input to determine its values
custom
{ "repo_name": "msjackso/DesperateHousePi", "path": "DesperateHousePi/desperatehousepi/Commands.java", "license": "unlicense", "size": 15974 }
[ "java.util.Scanner", "java.util.StringTokenizer" ]
import java.util.Scanner; import java.util.StringTokenizer;
import java.util.*;
[ "java.util" ]
java.util;
114,733
public ScoreDoc[] searchTop(Query query, int topX);
ScoreDoc[] function(Query query, int topX);
/** * This method performs a lucene <code>query</code> * and retrieves the <code>topX</code> results as an array of <code>ScoreDoc</code> * @param query * @param int - topX * @return */
This method performs a lucene <code>query</code> and retrieves the <code>topX</code> results as an array of <code>ScoreDoc</code>
searchTop
{ "repo_name": "MacHundt/BostonCase", "path": "src/interfaces/ILuceneQuerySearcher.java", "license": "apache-2.0", "size": 1031 }
[ "org.apache.lucene.search.Query", "org.apache.lucene.search.ScoreDoc" ]
import org.apache.lucene.search.Query; import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.*;
[ "org.apache.lucene" ]
org.apache.lucene;
2,877,582
private DatatypeStreamingValidator streamingValidatorFor(String uri, String localName, Attributes atts) { if (XHTML_URL.equals(uri)) { if ("time".equals(localName) && (atts.getIndex("", "datetime") < 0)) { return TimeDatetime.THE_INSTANCE.createStreamingValidator(null); } if ("script".equals(localName) && atts.getIndex("", "src") >= 0) { return ScriptDocumentation // .THE_INSTANCE.createStreamingValidator(null); } } return null; }
DatatypeStreamingValidator function(String uri, String localName, Attributes atts) { if (XHTML_URL.equals(uri)) { if ("time".equals(localName) && (atts.getIndex(STRdatetimeSTRscript".equals(localName) && atts.getIndex(STRsrc") >= 0) { return ScriptDocumentation } } return null; }
/** * Returns a <code>DatatypeStreamingValidator</code> for the element if it * needs <code>textContent</code> checking or <code>null</code> if it does * not. * * @param uri * the namespace URI of the element * @param localName * the local name of the element * @param atts * the attributes * @return a <code>DatatypeStreamingValidator</code> or <code>null</code> if * checks not necessary */
Returns a <code>DatatypeStreamingValidator</code> for the element if it needs <code>textContent</code> checking or <code>null</code> if it does not
streamingValidatorFor
{ "repo_name": "validator/validator", "path": "src/nu/validator/checker/TextContentChecker.java", "license": "mit", "size": 8646 }
[ "nu.validator.datatype.ScriptDocumentation", "org.relaxng.datatype.DatatypeStreamingValidator", "org.xml.sax.Attributes" ]
import nu.validator.datatype.ScriptDocumentation; import org.relaxng.datatype.DatatypeStreamingValidator; import org.xml.sax.Attributes;
import nu.validator.datatype.*; import org.relaxng.datatype.*; import org.xml.sax.*;
[ "nu.validator.datatype", "org.relaxng.datatype", "org.xml.sax" ]
nu.validator.datatype; org.relaxng.datatype; org.xml.sax;
142,883
private static SarlScript scriptToEMF(String code) throws Exception { final ParseHelper<SarlScript> parser = getParseHelper(); return parser.parse(code); }
static SarlScript function(String code) throws Exception { final ParseHelper<SarlScript> parser = getParseHelper(); return parser.parse(code); }
/** Parse the given SARL code and replies the EMF tree. * * @param code the SARL code to parse and convert to EMF. * @return the EMF tree. * @throws Exception if the code cannot be parsed. */
Parse the given SARL code and replies the EMF tree
scriptToEMF
{ "repo_name": "sarl/sarl", "path": "main/externalmaven/io.sarl.maven.docs.testing/src/main/java/io/sarl/maven/docs/testing/OperatorExtensions.java", "license": "apache-2.0", "size": 31709 }
[ "io.sarl.lang.sarl.SarlScript", "org.eclipse.xtext.testing.util.ParseHelper" ]
import io.sarl.lang.sarl.SarlScript; import org.eclipse.xtext.testing.util.ParseHelper;
import io.sarl.lang.sarl.*; import org.eclipse.xtext.testing.util.*;
[ "io.sarl.lang", "org.eclipse.xtext" ]
io.sarl.lang; org.eclipse.xtext;
2,625,374
public void subscribe(String groupId, TopicFilter topicFilter, int numThreads, MessageConsumer<String, Document> consumer) { subscribe(groupId, topicFilter, numThreads, Serdes.stringDeserializer(), Serdes.document(), consumer); }
void function(String groupId, TopicFilter topicFilter, int numThreads, MessageConsumer<String, Document> consumer) { subscribe(groupId, topicFilter, numThreads, Serdes.stringDeserializer(), Serdes.document(), consumer); }
/** * Subscribe to one or more topics. * * @param groupId the identifier of the consumer's group; may not be null * @param topicFilter the filter for the topics; may not be null * @param numThreads the number of threads on which consumers should be called * @param consumer the consumer, which should be threadsafe if {@code numThreads} is more than 1 */
Subscribe to one or more topics
subscribe
{ "repo_name": "rhauch/debezium-proto", "path": "debezium/src/main/java/org/debezium/driver/DbzNode.java", "license": "apache-2.0", "size": 21353 }
[ "org.debezium.kafka.Serdes", "org.debezium.message.Document" ]
import org.debezium.kafka.Serdes; import org.debezium.message.Document;
import org.debezium.kafka.*; import org.debezium.message.*;
[ "org.debezium.kafka", "org.debezium.message" ]
org.debezium.kafka; org.debezium.message;
843,939
public VirtualHostBuilder sslContext( SessionProtocol protocol, File keyCertChainFile, File keyFile, String keyPassword) throws SSLException { if (requireNonNull(protocol, "protocol") != SessionProtocol.HTTPS) { throw new IllegalArgumentException("unsupported protocol: " + protocol); } sslContext(SslContextBuilder.forServer(keyCertChainFile, keyFile, keyPassword) .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE) .applicationProtocolConfig(HTTPS_ALPN_CFG).build()); return this; }
VirtualHostBuilder function( SessionProtocol protocol, File keyCertChainFile, File keyFile, String keyPassword) throws SSLException { if (requireNonNull(protocol, STR) != SessionProtocol.HTTPS) { throw new IllegalArgumentException(STR + protocol); } sslContext(SslContextBuilder.forServer(keyCertChainFile, keyFile, keyPassword) .ciphers(Http2SecurityUtil.CIPHERS, SupportedCipherSuiteFilter.INSTANCE) .applicationProtocolConfig(HTTPS_ALPN_CFG).build()); return this; }
/** * Sets the {@link SslContext} of this {@link VirtualHost} from the specified {@link SessionProtocol}, * {@code keyCertChainFile}, {@code keyFile} and {@code keyPassword}. */
Sets the <code>SslContext</code> of this <code>VirtualHost</code> from the specified <code>SessionProtocol</code>, keyCertChainFile, keyFile and keyPassword
sslContext
{ "repo_name": "brant-hwang/armeria", "path": "src/main/java/com/linecorp/armeria/server/VirtualHostBuilder.java", "license": "apache-2.0", "size": 5654 }
[ "com.linecorp.armeria.common.SessionProtocol", "io.netty.handler.codec.http2.Http2SecurityUtil", "io.netty.handler.ssl.SslContextBuilder", "io.netty.handler.ssl.SupportedCipherSuiteFilter", "java.io.File", "javax.net.ssl.SSLException" ]
import com.linecorp.armeria.common.SessionProtocol; import io.netty.handler.codec.http2.Http2SecurityUtil; import io.netty.handler.ssl.SslContextBuilder; import io.netty.handler.ssl.SupportedCipherSuiteFilter; import java.io.File; import javax.net.ssl.SSLException;
import com.linecorp.armeria.common.*; import io.netty.handler.codec.http2.*; import io.netty.handler.ssl.*; import java.io.*; import javax.net.ssl.*;
[ "com.linecorp.armeria", "io.netty.handler", "java.io", "javax.net" ]
com.linecorp.armeria; io.netty.handler; java.io; javax.net;
2,832,047
@ApiModelProperty(example = "null", required = true, value = "name string") public String getName() { return name; }
@ApiModelProperty(example = "null", required = true, value = STR) String function() { return name; }
/** * name string * @return name **/
name string
getName
{ "repo_name": "Tmin10/EVE-Security-Service", "path": "server-api/src/main/java/ru/tmin10/EVESecurityService/serverApi/model/GetMarketsGroupsMarketGroupIdOk.java", "license": "gpl-3.0", "size": 5113 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
85,438
default <N extends Number, L extends LambdaStream<N, ? super L>> L min(EntityField<T, N> field) { return aggregate(field, Aggregates.MIN); }
default <N extends Number, L extends LambdaStream<N, ? super L>> L min(EntityField<T, N> field) { return aggregate(field, Aggregates.MIN); }
/** * Create an aggregate expression applying the numerical MIN operation. * * @param field * expression representing input value to MIN operation * * @return {@link org.lightmare.criteria.query.LambdaStream} implementation * for numeric result type */
Create an aggregate expression applying the numerical MIN operation
min
{ "repo_name": "levants/lightmare", "path": "lightmare-criteria/src/main/java/org/lightmare/criteria/query/orm/AggregateFunction.java", "license": "lgpl-2.1", "size": 10181 }
[ "org.lightmare.criteria.functions.EntityField", "org.lightmare.criteria.query.LambdaStream", "org.lightmare.criteria.query.orm.links.Aggregates" ]
import org.lightmare.criteria.functions.EntityField; import org.lightmare.criteria.query.LambdaStream; import org.lightmare.criteria.query.orm.links.Aggregates;
import org.lightmare.criteria.functions.*; import org.lightmare.criteria.query.*; import org.lightmare.criteria.query.orm.links.*;
[ "org.lightmare.criteria" ]
org.lightmare.criteria;
890,991
void initialize(IScopeContext context, IAdaptable element);
void initialize(IScopeContext context, IAdaptable element);
/** * Called after creating the control. * <p> * Implementations should load the preferences values and update the controls accordingly. * </p> * @param context the context from which to load the preference values from * @param element the element to configure, or null if this configures the workspace settings */
Called after creating the control. Implementations should load the preferences values and update the controls accordingly.
initialize
{ "repo_name": "boniatillo-com/PhaserEditor", "path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/javaeditor/saveparticipant/ISaveParticipantPreferenceConfiguration.java", "license": "epl-1.0", "size": 3400 }
[ "org.eclipse.core.runtime.IAdaptable", "org.eclipse.core.runtime.preferences.IScopeContext" ]
import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.preferences.*;
[ "org.eclipse.core" ]
org.eclipse.core;
1,112,135
Optional<Humanoid> customer();
Optional<Humanoid> customer();
/** * Gets the currently trading customer with this merchant. * * @return The currently trading customer if available */
Gets the currently trading customer with this merchant
customer
{ "repo_name": "SpongePowered/SpongeAPI", "path": "src/main/java/org/spongepowered/api/item/merchant/Merchant.java", "license": "mit", "size": 2535 }
[ "java.util.Optional", "org.spongepowered.api.entity.living.Humanoid" ]
import java.util.Optional; import org.spongepowered.api.entity.living.Humanoid;
import java.util.*; import org.spongepowered.api.entity.living.*;
[ "java.util", "org.spongepowered.api" ]
java.util; org.spongepowered.api;
2,698,687
public Map<String, Object> getExtensions(){ return this.extensions; } private class MappingBuilder { private static final int MAX_ENTRY_VALUES = 5; private final StringCharIterator content; private int line = 0; private int previousCol = 0; private int previousSrcId = 0; private int previousSrcLine = 0; private int previousSrcColumn = 0; private int previousNameId = 0; MappingBuilder(String lineMap) { this.content = new StringCharIterator(lineMap); }
Map<String, Object> function(){ return this.extensions; } private class MappingBuilder { private static final int MAX_ENTRY_VALUES = 5; private final StringCharIterator content; private int line = 0; private int previousCol = 0; private int previousSrcId = 0; private int previousSrcLine = 0; private int previousSrcColumn = 0; private int previousNameId = 0; MappingBuilder(String lineMap) { this.content = new StringCharIterator(lineMap); }
/** * Returns all extensions and their values (which can be any json value) * in a Map object. * * @return The extension list */
Returns all extensions and their values (which can be any json value) in a Map object
getExtensions
{ "repo_name": "Yannic/closure-compiler", "path": "src/com/google/debugging/sourcemap/SourceMapConsumerV3.java", "license": "apache-2.0", "size": 21003 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,822,818
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new BindingGroup(); proxySettingsPanel = new JPanel(); jLabel8 = new JLabel(); proxyHostTextBox = new JTextField(); jLabel9 = new JLabel(); proxyPortTextBox = new JFormattedTextField(); useProxyCheckbox = new JCheckBox(); cancelButton = new JToggleButton(); okButton = new JToggleButton(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setTitle(NbBundle.getMessage(UpdateProxyConfigDialog.class, "UpdateProxyConfigDialog.title")); // NOI18N setModal(true); proxySettingsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 0, 11), UIManager.getDefaults().getColor("windowText")), NbBundle.getMessage(UpdateProxyConfigDialog.class, "UpdateProxyConfigDialog.proxySettingsPanel.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Tahoma", 0, 11), UIManager.getDefaults().getColor("textText"))); // NOI18N proxySettingsPanel.setEnabled(false); jLabel8.setText(NbBundle.getMessage(UpdateProxyConfigDialog.class, "UpdateProxyConfigDialog.jLabel8.text")); // NOI18N Binding binding = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, this, ELProperty.create("${properties[\"update.proxy.host\"]}"), proxyHostTextBox, BeanProperty.create("text_ON_ACTION_OR_FOCUS_LOST")); bindingGroup.addBinding(binding); jLabel9.setText(NbBundle.getMessage(UpdateProxyConfigDialog.class, "UpdateProxyConfigDialog.jLabel9.text")); // NOI18N proxyPortTextBox.setFormatterFactory(new IntegerFormatterFactory()); binding = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, this, ELProperty.create("${properties[\"update.proxy.port\"]}"), proxyPortTextBox, BeanProperty.create("value")); bindingGroup.addBinding(binding); GroupLayout proxySettingsPanelLayout = new GroupLayout(proxySettingsPanel); proxySettingsPanel.setLayout(proxySettingsPanelLayout); proxySettingsPanelLayout.setHorizontalGroup( proxySettingsPanelLayout.createParallelGroup(Alignment.LEADING) .addGroup(proxySettingsPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(proxySettingsPanelLayout.createParallelGroup(Alignment.TRAILING) .addComponent(jLabel9) .addComponent(jLabel8)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(proxySettingsPanelLayout.createParallelGroup(Alignment.LEADING) .addComponent(proxyPortTextBox, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE) .addComponent(proxyHostTextBox, GroupLayout.PREFERRED_SIZE, 267, GroupLayout.PREFERRED_SIZE)) .addGap(32, 32, 32)) ); proxySettingsPanelLayout.setVerticalGroup( proxySettingsPanelLayout.createParallelGroup(Alignment.LEADING) .addGroup(proxySettingsPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(proxySettingsPanelLayout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabel8) .addComponent(proxyHostTextBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(proxySettingsPanelLayout.createParallelGroup(Alignment.BASELINE) .addComponent(jLabel9) .addComponent(proxyPortTextBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(24, Short.MAX_VALUE)) ); useProxyCheckbox.setText(NbBundle.getMessage(UpdateProxyConfigDialog.class, "UpdateProxyConfigDialog.useProxyCheckbox.text")); // NOI18N binding = Bindings.createAutoBinding(UpdateStrategy.READ_WRITE, this, ELProperty.create("${properties[\"update.proxy\"]}"), useProxyCheckbox, BeanProperty.create("selected")); bindingGroup.addBinding(binding);
@SuppressWarnings(STR) void function() { bindingGroup = new BindingGroup(); proxySettingsPanel = new JPanel(); jLabel8 = new JLabel(); proxyHostTextBox = new JTextField(); jLabel9 = new JLabel(); proxyPortTextBox = new JFormattedTextField(); useProxyCheckbox = new JCheckBox(); cancelButton = new JToggleButton(); okButton = new JToggleButton(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setTitle(NbBundle.getMessage(UpdateProxyConfigDialog.class, STR)); setModal(true); proxySettingsPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createTitledBorder(null, STRTahomaSTRwindowTextSTRUpdateProxyConfigDialog.proxySettingsPanel.border.titleSTRTahomaSTRtextTextSTRUpdateProxyConfigDialog.jLabel8.textSTR${properties[\STR]}STRtext_ON_ACTION_OR_FOCUS_LOSTSTRUpdateProxyConfigDialog.jLabel9.textSTR${properties[\STR]}STRvalueSTRUpdateProxyConfigDialog.useProxyCheckbox.textSTR${properties[\STR]}STRselected")); bindingGroup.addBinding(binding);
/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */
This method is called from within the constructor to initialize the form. always regenerated by the Form Editor
initComponents
{ "repo_name": "Det-Kongelige-Bibliotek/droid", "path": "droid-swing-ui/src/main/java/uk/gov/nationalarchives/droid/gui/config/UpdateProxyConfigDialog.java", "license": "bsd-3-clause", "size": 13951 }
[ "javax.swing.BorderFactory", "javax.swing.JCheckBox", "javax.swing.JFormattedTextField", "javax.swing.JLabel", "javax.swing.JPanel", "javax.swing.JTextField", "javax.swing.JToggleButton", "javax.swing.WindowConstants", "org.jdesktop.beansbinding.BindingGroup", "org.openide.util.NbBundle" ]
import javax.swing.BorderFactory; import javax.swing.JCheckBox; import javax.swing.JFormattedTextField; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JToggleButton; import javax.swing.WindowConstants; import org.jdesktop.beansbinding.BindingGroup; import org.openide.util.NbBundle;
import javax.swing.*; import org.jdesktop.beansbinding.*; import org.openide.util.*;
[ "javax.swing", "org.jdesktop.beansbinding", "org.openide.util" ]
javax.swing; org.jdesktop.beansbinding; org.openide.util;
2,794,367
private void analyzeOperands(List<RexNode> operands) { assert operands.size() == 2; typeA = operands.get(0).getType(); typeB = operands.get(1).getType(); assert SqlTypeUtil.isExactNumeric(typeA) && SqlTypeUtil.isExactNumeric(typeB); scaleA = typeA.getScale(); scaleB = typeB.getScale(); }
void function(List<RexNode> operands) { assert operands.size() == 2; typeA = operands.get(0).getType(); typeB = operands.get(1).getType(); assert SqlTypeUtil.isExactNumeric(typeA) && SqlTypeUtil.isExactNumeric(typeB); scaleA = typeA.getScale(); scaleB = typeB.getScale(); }
/** * Convenience method for reading characteristics of operands (such as * scale, precision, whole digits) into an ArithmeticExpander. The * operands are restricted by the following contraints: * * <ul> * <li>there are exactly two operands * <li>both are exact numeric types * </ul> */
Convenience method for reading characteristics of operands (such as scale, precision, whole digits) into an ArithmeticExpander. The operands are restricted by the following contraints: there are exactly two operands both are exact numeric types
analyzeOperands
{ "repo_name": "vlsi/calcite", "path": "core/src/main/java/org/apache/calcite/rel/rules/ReduceDecimalsRule.java", "license": "apache-2.0", "size": 44381 }
[ "java.util.List", "org.apache.calcite.rex.RexNode", "org.apache.calcite.sql.type.SqlTypeUtil" ]
import java.util.List; import org.apache.calcite.rex.RexNode; import org.apache.calcite.sql.type.SqlTypeUtil;
import java.util.*; import org.apache.calcite.rex.*; import org.apache.calcite.sql.type.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
1,182,732
@Override public boolean checkParams(Object params) throws ActionException { if (params == null) { return false; } // correct instance received if (!(params instanceof VRRPProtocolEndpoint)) return false; VRRPProtocolEndpoint pE = (VRRPProtocolEndpoint) params; // ProtocolIFtype not set or not correct. if (pE.getProtocolIFType() == null) return false; if (!pE.getProtocolIFType().equals(ProtocolIFType.IPV4) && !pE.getProtocolIFType().equals(ProtocolIFType.IPV6)) return false; List<ProtocolEndpoint> protocolEndpoints = pE.getBindedProtocolEndpoints(); // VRRPProtocolEndpoint has 1 ProtocolEndpoint if (protocolEndpoints.size() != 1) return false; // protocolEndpoint is an instance of IPProtocolEndpoint ProtocolEndpoint protocolEndpoint = protocolEndpoints.get(0); if (!(protocolEndpoint instanceof IPProtocolEndpoint)) return false; // ProtocolEndpoint and VRRPProtocolEndpoint with different protocols. if (protocolEndpoint.getProtocolIFType() == null || !protocolEndpoint.getProtocolIFType().equals(pE.getProtocolIFType())) return false; // protocolEndpoint has 1 LogicalPort List<LogicalPort> logicalPorts = ((IPProtocolEndpoint) protocolEndpoint).getLogicalPorts(); if (logicalPorts.size() != 1) return false; // logicalPort is an instance of NetworkPort LogicalPort logicalPort = logicalPorts.get(0); if (!(logicalPort instanceof NetworkPort)) return false; // service is an instance of VRRPGroup Service service = ((VRRPProtocolEndpoint) params).getService(); if (!(service instanceof VRRPGroup)) return false; // structure correct return true; }
boolean function(Object params) throws ActionException { if (params == null) { return false; } if (!(params instanceof VRRPProtocolEndpoint)) return false; VRRPProtocolEndpoint pE = (VRRPProtocolEndpoint) params; if (pE.getProtocolIFType() == null) return false; if (!pE.getProtocolIFType().equals(ProtocolIFType.IPV4) && !pE.getProtocolIFType().equals(ProtocolIFType.IPV6)) return false; List<ProtocolEndpoint> protocolEndpoints = pE.getBindedProtocolEndpoints(); if (protocolEndpoints.size() != 1) return false; ProtocolEndpoint protocolEndpoint = protocolEndpoints.get(0); if (!(protocolEndpoint instanceof IPProtocolEndpoint)) return false; if (protocolEndpoint.getProtocolIFType() == null !protocolEndpoint.getProtocolIFType().equals(pE.getProtocolIFType())) return false; List<LogicalPort> logicalPorts = ((IPProtocolEndpoint) protocolEndpoint).getLogicalPorts(); if (logicalPorts.size() != 1) return false; LogicalPort logicalPort = logicalPorts.get(0); if (!(logicalPort instanceof NetworkPort)) return false; Service service = ((VRRPProtocolEndpoint) params).getService(); if (!(service instanceof VRRPGroup)) return false; return true; }
/** * Required params: A VRRPProtocolEndpoint with - getService() being a VRRPGroup - getProtocolIFType set to ProtocolIFType.IPV4 or to * ProtocolIFType.IPV6 - getBindedProtocolEndpoints containing a single IPProtocolEndpoint (protocolEndpoint) - protocolEndpoint * getProtocolIFType() set to VRRPProtocolEndpoint.getProtocolIFType() - protocolEndpoint.getLogicalPorts() containing a single NetworkPort */
Required params: A VRRPProtocolEndpoint with - getService() being a VRRPGroup - getProtocolIFType set to ProtocolIFType.IPV4 or to ProtocolIFType.IPV6 - getBindedProtocolEndpoints containing a single IPProtocolEndpoint (protocolEndpoint) - protocolEndpoint getProtocolIFType() set to VRRPProtocolEndpoint.getProtocolIFType() - protocolEndpoint.getLogicalPorts() containing a single NetworkPort
checkParams
{ "repo_name": "dana-i2cat/opennaas-routing-nfv", "path": "extensions/bundles/router.actionsets.junos/src/main/java/org/opennaas/extensions/router/junos/actionssets/actions/vrrp/UpdateVRRPVirtualIPAddressAction.java", "license": "lgpl-3.0", "size": 6888 }
[ "java.util.List", "org.opennaas.core.resources.action.ActionException", "org.opennaas.extensions.router.model.IPProtocolEndpoint", "org.opennaas.extensions.router.model.LogicalPort", "org.opennaas.extensions.router.model.NetworkPort", "org.opennaas.extensions.router.model.ProtocolEndpoint", "org.opennaas.extensions.router.model.Service", "org.opennaas.extensions.router.model.VRRPGroup", "org.opennaas.extensions.router.model.VRRPProtocolEndpoint" ]
import java.util.List; import org.opennaas.core.resources.action.ActionException; import org.opennaas.extensions.router.model.IPProtocolEndpoint; import org.opennaas.extensions.router.model.LogicalPort; import org.opennaas.extensions.router.model.NetworkPort; import org.opennaas.extensions.router.model.ProtocolEndpoint; import org.opennaas.extensions.router.model.Service; import org.opennaas.extensions.router.model.VRRPGroup; import org.opennaas.extensions.router.model.VRRPProtocolEndpoint;
import java.util.*; import org.opennaas.core.resources.action.*; import org.opennaas.extensions.router.model.*;
[ "java.util", "org.opennaas.core", "org.opennaas.extensions" ]
java.util; org.opennaas.core; org.opennaas.extensions;
974,501
public static Object getFromJson(String data, Class clazz) { Object o = null; try { GsonBuilder gsonBuilder = new GsonBuilder(); Gson gson = gsonBuilder.create(); o = gson.fromJson(data, clazz); } catch (Exception e) { System.out.println("Json Error" + e.getMessage()); } return o; }
static Object function(String data, Class clazz) { Object o = null; try { GsonBuilder gsonBuilder = new GsonBuilder(); Gson gson = gsonBuilder.create(); o = gson.fromJson(data, clazz); } catch (Exception e) { System.out.println(STR + e.getMessage()); } return o; }
/** * returns an object serialized from json * * @param data json string to be serialized * @param clazz class to serialize into * @return serialized object */
returns an object serialized from json
getFromJson
{ "repo_name": "ir2pid/MarvelCharacterLibrary", "path": "app/src/main/java/noisyninja/com/marvelcharacterlibrary/utils/NoisyUtils.java", "license": "apache-2.0", "size": 16508 }
[ "com.google.gson.Gson", "com.google.gson.GsonBuilder" ]
import com.google.gson.Gson; import com.google.gson.GsonBuilder;
import com.google.gson.*;
[ "com.google.gson" ]
com.google.gson;
2,386,334
public byte readRawByte() throws IOException { if (bufferPos == bufferSize) { refillBuffer(true); } return buffer[bufferPos++]; }
byte function() throws IOException { if (bufferPos == bufferSize) { refillBuffer(true); } return buffer[bufferPos++]; }
/** * Read one byte from the input. * * @throws ProtobufException * The end of the stream or the current limit was reached. */
Read one byte from the input
readRawByte
{ "repo_name": "Shvid/protostuff", "path": "protostuff-core/src/main/java/io/protostuff/CodedInput.java", "license": "apache-2.0", "size": 40683 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,027,077
private boolean validateIndexes() { CAS localCAS = descriptorCAS.get(); TypePriorities savedMergedTypePriorities = getMergedTypePriorities(); FsIndexCollection savedFsIndexCollection = getMergedFsIndexCollection(); try { setMergedFsIndexCollection(); setMergedTypePriorities(); descriptorCAS.validate(); } catch (Exception ex) { descriptorCAS.set(localCAS); if (!revertToLastValid(Messages.getString("MultiPageEditor.indexDefProblemTitle"), //$NON-NLS-1$ Messages.getString("MultiPageEditor.indexDefProblem") + //$NON-NLS-1$ getMessagesToRootCause(ex))) { // currentIndex = -1; //irrelevent, but not sourceIndex super.setActivePage(indexesIndex); // currentIndex = indexesIndex; return false; } else { getAeDescription().getAnalysisEngineMetaData().setTypePriorities(m_typePrioritiesBackup); setMergedTypePriorities(savedMergedTypePriorities); setMergedFsIndexCollection(savedFsIndexCollection); isRevertingIndex = true; return true; } } return true; }
boolean function() { CAS localCAS = descriptorCAS.get(); TypePriorities savedMergedTypePriorities = getMergedTypePriorities(); FsIndexCollection savedFsIndexCollection = getMergedFsIndexCollection(); try { setMergedFsIndexCollection(); setMergedTypePriorities(); descriptorCAS.validate(); } catch (Exception ex) { descriptorCAS.set(localCAS); if (!revertToLastValid(Messages.getString(STR), Messages.getString(STR) + getMessagesToRootCause(ex))) { super.setActivePage(indexesIndex); return false; } else { getAeDescription().getAnalysisEngineMetaData().setTypePriorities(m_typePrioritiesBackup); setMergedTypePriorities(savedMergedTypePriorities); setMergedFsIndexCollection(savedFsIndexCollection); isRevertingIndex = true; return true; } } return true; }
/** * Called when switching off of the indexes page Goal is to validate indexes by making a CAS - as * a side effect it does index validation. * * We do this without changing the typeSystemDescription * * @return is valid state */
Called when switching off of the indexes page Goal is to validate indexes by making a CAS - as a side effect it does index validation. We do this without changing the typeSystemDescription
validateIndexes
{ "repo_name": "apache/uima-uimaj", "path": "uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java", "license": "apache-2.0", "size": 143007 }
[ "org.apache.uima.resource.metadata.FsIndexCollection", "org.apache.uima.resource.metadata.TypePriorities", "org.apache.uima.taeconfigurator.Messages" ]
import org.apache.uima.resource.metadata.FsIndexCollection; import org.apache.uima.resource.metadata.TypePriorities; import org.apache.uima.taeconfigurator.Messages;
import org.apache.uima.resource.metadata.*; import org.apache.uima.taeconfigurator.*;
[ "org.apache.uima" ]
org.apache.uima;
459,834
public static int getProcessId() throws Exception { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); int pid = Integer.parseInt(runtime.getName().split("@")[0]); return pid; }
static int function() throws Exception { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); int pid = Integer.parseInt(runtime.getName().split("@")[0]); return pid; }
/** * Get the process id of the current running Java process * * @return Process id */
Get the process id of the current running Java process
getProcessId
{ "repo_name": "mohlerm/hotspot_cached_profiles", "path": "test/testlibrary/jdk/test/lib/ProcessTools.java", "license": "gpl-2.0", "size": 9601 }
[ "java.lang.management.ManagementFactory", "java.lang.management.RuntimeMXBean" ]
import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean;
import java.lang.management.*;
[ "java.lang" ]
java.lang;
2,769,880
private QueryExp buildQueryExp(final String pidAttribute, final String[] attributes, final Object[] values) { QueryExp optionalAttributes = buildOptionalQueryExp(attributes, values); QueryExp constraint; if (optionalAttributes != null) { constraint = Query.and(optionalAttributes, Query.eq(Query.attr(pidAttribute), Query.value(pid))); } else { constraint = Query.eq(Query.attr(pidAttribute), Query.value(pid)); } return constraint; }
QueryExp function(final String pidAttribute, final String[] attributes, final Object[] values) { QueryExp optionalAttributes = buildOptionalQueryExp(attributes, values); QueryExp constraint; if (optionalAttributes != null) { constraint = Query.and(optionalAttributes, Query.eq(Query.attr(pidAttribute), Query.value(pid))); } else { constraint = Query.eq(Query.attr(pidAttribute), Query.value(pid)); } return constraint; }
/** * Builds the QueryExp used to identify the target MBean. * * @param pidAttribute the name of the MBean attribute with the process id to compare against * @param attributes the names of additional MBean attributes to compare with expected values * @param values the expected values of the specified MBean attributes * * @return the main QueryExp for matching the target MBean */
Builds the QueryExp used to identify the target MBean
buildQueryExp
{ "repo_name": "smgoller/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/process/MBeanProcessController.java", "license": "apache-2.0", "size": 13720 }
[ "javax.management.Query", "javax.management.QueryExp" ]
import javax.management.Query; import javax.management.QueryExp;
import javax.management.*;
[ "javax.management" ]
javax.management;
1,268,491
@Override public boolean isSharedScopeNameExists(String scopeName, String tenantDomain) throws APIManagementException { if (log.isDebugEnabled()) { log.debug("Checking whether scope name: " + scopeName + " exists as a shared scope in tenant: " + tenantDomain); } int tenantId = APIUtil.getTenantIdFromTenantDomain(tenantDomain); return ApiMgtDAO.getInstance().isSharedScopeExists(scopeName, tenantId); }
boolean function(String scopeName, String tenantDomain) throws APIManagementException { if (log.isDebugEnabled()) { log.debug(STR + scopeName + STR + tenantDomain); } int tenantId = APIUtil.getTenantIdFromTenantDomain(tenantDomain); return ApiMgtDAO.getInstance().isSharedScopeExists(scopeName, tenantId); }
/** * Check whether the given scope name exists as a shared scope in the tenant domain. * * @param scopeName Shared Scope name * @param tenantDomain Tenant Domain * @return Scope availability * @throws APIManagementException if failed to check the availability */
Check whether the given scope name exists as a shared scope in the tenant domain
isSharedScopeNameExists
{ "repo_name": "Rajith90/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIProviderImpl.java", "license": "apache-2.0", "size": 520854 }
[ "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO", "org.wso2.carbon.apimgt.impl.utils.APIUtil" ]
import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO; import org.wso2.carbon.apimgt.impl.utils.APIUtil;
import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.impl.dao.*; import org.wso2.carbon.apimgt.impl.utils.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
707,938
public void testGetInstance03() throws NoSuchAlgorithmException, IllegalArgumentException, InvalidAlgorithmParameterException, CertPathBuilderException { try { CertPathBuilder.getInstance(null, mProv); fail("NullPointerException or NoSuchAlgorithmException must be thrown when algorithm is null"); } catch (NullPointerException e) { } catch (NoSuchAlgorithmException e) { } for (int i = 0; i < invalidValues.length; i++) { try { CertPathBuilder.getInstance(invalidValues[i], mProv); fail("NoSuchAlgorithmException must be thrown (type: ".concat( invalidValues[i]).concat(")")); } catch (NoSuchAlgorithmException e) { } } Provider prov = null; for (int i = 0; i < validValues.length; i++) { try { CertPathBuilder.getInstance(validValues[i], prov); fail("IllegalArgumentException must be thrown when provider is null (type: " .concat(validValues[i]).concat(")")); } catch (IllegalArgumentException e) { } } CertPathBuilder cerPB; for (int i = 0; i < validValues.length; i++) { cerPB = CertPathBuilder.getInstance(validValues[i], mProv); assertEquals("Incorrect type", cerPB.getAlgorithm(), validValues[i]); assertEquals("Incorrect provider", cerPB.getProvider(), mProv); checkResult(cerPB); } }
void function() throws NoSuchAlgorithmException, IllegalArgumentException, InvalidAlgorithmParameterException, CertPathBuilderException { try { CertPathBuilder.getInstance(null, mProv); fail(STR); } catch (NullPointerException e) { } catch (NoSuchAlgorithmException e) { } for (int i = 0; i < invalidValues.length; i++) { try { CertPathBuilder.getInstance(invalidValues[i], mProv); fail(STR.concat( invalidValues[i]).concat(")")); } catch (NoSuchAlgorithmException e) { } } Provider prov = null; for (int i = 0; i < validValues.length; i++) { try { CertPathBuilder.getInstance(validValues[i], prov); fail(STR .concat(validValues[i]).concat(")")); } catch (IllegalArgumentException e) { } } CertPathBuilder cerPB; for (int i = 0; i < validValues.length; i++) { cerPB = CertPathBuilder.getInstance(validValues[i], mProv); assertEquals(STR, cerPB.getAlgorithm(), validValues[i]); assertEquals(STR, cerPB.getProvider(), mProv); checkResult(cerPB); } }
/** * Test for <code>getInstance(String algorithm, Provider provider)</code> * method * Assertions: * throws NullPointerException when algorithm is null * throws NoSuchAlgorithmException when algorithm is not correct * returns CertPathBuilder object */
Test for <code>getInstance(String algorithm, Provider provider)</code> method Assertions: throws NullPointerException when algorithm is null throws NoSuchAlgorithmException when algorithm is not correct returns CertPathBuilder object
testGetInstance03
{ "repo_name": "AdmireTheDistance/android_libcore", "path": "luni/src/test/java/tests/security/cert/CertPathBuilder2Test.java", "license": "gpl-2.0", "size": 9986 }
[ "java.security.InvalidAlgorithmParameterException", "java.security.NoSuchAlgorithmException", "java.security.Provider", "java.security.cert.CertPathBuilder", "java.security.cert.CertPathBuilderException" ]
import java.security.InvalidAlgorithmParameterException; import java.security.NoSuchAlgorithmException; import java.security.Provider; import java.security.cert.CertPathBuilder; import java.security.cert.CertPathBuilderException;
import java.security.*; import java.security.cert.*;
[ "java.security" ]
java.security;
719,459
public Transaction createUnsignedSimpleSend(ECKey fromKey, Collection<TransactionInput> inputs, Address toAddress, CurrencyID currencyID, OmniValue amount) throws InsufficientMoneyException { String txHex = builder.createSimpleSendHex(currencyID, amount); byte[] payload = RawTxBuilder.hexToBinary(txHex); return createUnsignedOmniTransaction(fromKey, inputs, toAddress, payload); }
Transaction function(ECKey fromKey, Collection<TransactionInput> inputs, Address toAddress, CurrencyID currencyID, OmniValue amount) throws InsufficientMoneyException { String txHex = builder.createSimpleSendHex(currencyID, amount); byte[] payload = RawTxBuilder.hexToBinary(txHex); return createUnsignedOmniTransaction(fromKey, inputs, toAddress, payload); }
/** * Create a signed simple send Transaction * * @param fromKey Private key/address to send from * @param inputs unsigned inputs to use for the transaction * @param toAddress The Omni reference address (for the reference output, destination address in this case) * @param currencyID The Omni currency ID * @param amount The currency amount in willetts * @return unsigned transaction * @throws InsufficientMoneyException Not enough bitcoin for fees */
Create a signed simple send Transaction
createUnsignedSimpleSend
{ "repo_name": "OmniLayer/OmniJ", "path": "omnij-core/src/main/java/foundation/omni/tx/OmniTxBuilder.java", "license": "apache-2.0", "size": 12677 }
[ "foundation.omni.CurrencyID", "foundation.omni.OmniValue", "java.util.Collection", "org.bitcoinj.core.Address", "org.bitcoinj.core.ECKey", "org.bitcoinj.core.InsufficientMoneyException", "org.bitcoinj.core.Transaction", "org.bitcoinj.core.TransactionInput" ]
import foundation.omni.CurrencyID; import foundation.omni.OmniValue; import java.util.Collection; import org.bitcoinj.core.Address; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.InsufficientMoneyException; import org.bitcoinj.core.Transaction; import org.bitcoinj.core.TransactionInput;
import foundation.omni.*; import java.util.*; import org.bitcoinj.core.*;
[ "foundation.omni", "java.util", "org.bitcoinj.core" ]
foundation.omni; java.util; org.bitcoinj.core;
1,940,771
ServiceResponse<Void> putDateTimeValid(List<DateTime> arrayBody) throws ErrorException, IOException, IllegalArgumentException;
ServiceResponse<Void> putDateTimeValid(List<DateTime> arrayBody) throws ErrorException, IOException, IllegalArgumentException;
/** * Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']. * * @param arrayBody the List&lt;DateTime&gt; value * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @throws IllegalArgumentException exception thrown from invalid parameters * @return the {@link ServiceResponse} object if successful. */
Set array value ['2000-12-01t00:00:01z', '1980-01-02T00:11:35+01:00', '1492-10-12T10:15:01-08:00']
putDateTimeValid
{ "repo_name": "haocs/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodyarray/Arrays.java", "license": "mit", "size": 72234 }
[ "com.microsoft.rest.ServiceResponse", "java.io.IOException", "java.util.List", "org.joda.time.DateTime" ]
import com.microsoft.rest.ServiceResponse; import java.io.IOException; import java.util.List; import org.joda.time.DateTime;
import com.microsoft.rest.*; import java.io.*; import java.util.*; import org.joda.time.*;
[ "com.microsoft.rest", "java.io", "java.util", "org.joda.time" ]
com.microsoft.rest; java.io; java.util; org.joda.time;
2,501,210
public static List updateOutComings(List<HashMap> oldAndNewId) { List<HashMap> result = new ArrayList<HashMap>(); List<Integer> oldIds = new ArrayList<Integer>(); HashMap<Integer, Integer> updatedIds = new HashMap<Integer, Integer>(); for (HashMap<Integer, Integer> m : oldAndNewId) { Integer oldId = (Integer) m.get("old"); Integer newId = (Integer) m.get("new"); logger.info("now reading old:" + oldId + " and new: " + newId); updatedIds.put(oldId, newId); } Set<Integer> idsToBeUpdated = updatedIds.keySet(); logger.info("ids to be updated:" + idsToBeUpdated.toString()); for (HashMap m : oldAndNewId) { List<Integer> oldOutcomings = (List) m.get("outcomings"); logger.info("old outcomings are:" + oldOutcomings.toString()); Set oldOutcomingsNoDuplicates = new HashSet(); oldOutcomingsNoDuplicates.addAll(oldOutcomings); for (Integer id : idsToBeUpdated) { if (oldOutcomingsNoDuplicates.contains(id)) { logger.info("now removing: " + id); logger.info("replacing it with: " + updatedIds.get(id)); oldOutcomingsNoDuplicates.remove(id); oldOutcomingsNoDuplicates.add((updatedIds.get(id))); } } logger.info("now updated outcomings:" + oldOutcomingsNoDuplicates); m.put("outcomings", new ArrayList(oldOutcomingsNoDuplicates)); result.add(m); } return result; }
static List function(List<HashMap> oldAndNewId) { List<HashMap> result = new ArrayList<HashMap>(); List<Integer> oldIds = new ArrayList<Integer>(); HashMap<Integer, Integer> updatedIds = new HashMap<Integer, Integer>(); for (HashMap<Integer, Integer> m : oldAndNewId) { Integer oldId = (Integer) m.get("old"); Integer newId = (Integer) m.get("new"); logger.info(STR + oldId + STR + newId); updatedIds.put(oldId, newId); } Set<Integer> idsToBeUpdated = updatedIds.keySet(); logger.info(STR + idsToBeUpdated.toString()); for (HashMap m : oldAndNewId) { List<Integer> oldOutcomings = (List) m.get(STR); logger.info(STR + oldOutcomings.toString()); Set oldOutcomingsNoDuplicates = new HashSet(); oldOutcomingsNoDuplicates.addAll(oldOutcomings); for (Integer id : idsToBeUpdated) { if (oldOutcomingsNoDuplicates.contains(id)) { logger.info(STR + id); logger.info(STR + updatedIds.get(id)); oldOutcomingsNoDuplicates.remove(id); oldOutcomingsNoDuplicates.add((updatedIds.get(id))); } } logger.info(STR + oldOutcomingsNoDuplicates); m.put(STR, new ArrayList(oldOutcomingsNoDuplicates)); result.add(m); } return result; }
/** * updates adjacencies of the nodes which are removed from the graph * * @param oldAndNewId * @return */
updates adjacencies of the nodes which are removed from the graph
updateOutComings
{ "repo_name": "danicadamljanovic/freya", "path": "freya/freya-annotate/src/main/java/org/freya/util/GraphUtils.java", "license": "agpl-3.0", "size": 62350 }
[ "java.util.ArrayList", "java.util.HashMap", "java.util.HashSet", "java.util.List", "java.util.Set" ]
import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,810,834
@ServiceMethod(returns = ReturnType.SINGLE) Response<NetworkInterfaceInner> getCloudServiceNetworkInterfaceWithResponse( String resourceGroupName, String cloudServiceName, String roleInstanceName, String networkInterfaceName, String expand, Context context);
@ServiceMethod(returns = ReturnType.SINGLE) Response<NetworkInterfaceInner> getCloudServiceNetworkInterfaceWithResponse( String resourceGroupName, String cloudServiceName, String roleInstanceName, String networkInterfaceName, String expand, Context context);
/** * Get the specified network interface in a cloud service. * * @param resourceGroupName The name of the resource group. * @param cloudServiceName The name of the cloud service. * @param roleInstanceName The name of role instance. * @param networkInterfaceName The name of the network interface. * @param expand Expands referenced resources. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified network interface in a cloud service along with {@link Response}. */
Get the specified network interface in a cloud service
getCloudServiceNetworkInterfaceWithResponse
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/NetworkInterfacesClient.java", "license": "mit", "size": 71039 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.resourcemanager.network.fluent.models.NetworkInterfaceInner" ]
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.network.fluent.models.NetworkInterfaceInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,861,945
private void verifyCollectorNames(List<GCHelper.GcBatch> batches) { for (GCHelper.GcBatch batch : batches) { String name = batch.getName(); Asserts.assertNotNull(name, "garbage_collection.name was null"); boolean isYoung = batch.isYoungCollection(); String expectedName = isYoung ? youngCollector : oldCollector; if (!expectedName.equals(name)) { // Collector names not equal. Check if the collector has been overridden by an expected collector. String overrideKey = expectedName + "." + name; boolean isOverride = GCHelper.collectorOverrides.contains(overrideKey); Asserts.assertTrue(isOverride, String.format("Unexpected event name(%s) for collectors(%s, %s)", name, youngCollector, oldCollector)); } } }
void function(List<GCHelper.GcBatch> batches) { for (GCHelper.GcBatch batch : batches) { String name = batch.getName(); Asserts.assertNotNull(name, STR); boolean isYoung = batch.isYoungCollection(); String expectedName = isYoung ? youngCollector : oldCollector; if (!expectedName.equals(name)) { String overrideKey = expectedName + "." + name; boolean isOverride = GCHelper.collectorOverrides.contains(overrideKey); Asserts.assertTrue(isOverride, String.format(STR, name, youngCollector, oldCollector)); } } }
/** * Verifies that the collector name in initial configuration matches the name in garbage configuration event. * If the names are not equal, then we check if this is an expected collector override. * For example, if old collector in initial config is "G1Old" we allow both event "G1Old" and "SerialOld". */
Verifies that the collector name in initial configuration matches the name in garbage configuration event. If the names are not equal, then we check if this is an expected collector override. For example, if old collector in initial config is "G1Old" we allow both event "G1Old" and "SerialOld"
verifyCollectorNames
{ "repo_name": "md-5/jdk10", "path": "test/jdk/jdk/jfr/event/gc/collection/GCEventAll.java", "license": "gpl-2.0", "size": 21699 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,831,007
public void unbindRequested(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { ctx.sendDownstream(e); }
void function(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { ctx.sendDownstream(e); }
/** * Invoked when {@link Channel#unbind()} was called. */
Invoked when <code>Channel#unbind()</code> was called
unbindRequested
{ "repo_name": "xiexingguang/simple-netty-source", "path": "src/main/java/org/jboss/netty/channel/core/impl/SimpleChannelDownstreamHandler.java", "license": "apache-2.0", "size": 5965 }
[ "org.jboss.netty.channel.core.ChannelHandlerContext", "org.jboss.netty.channel.event.ChannelStateEvent" ]
import org.jboss.netty.channel.core.ChannelHandlerContext; import org.jboss.netty.channel.event.ChannelStateEvent;
import org.jboss.netty.channel.core.*; import org.jboss.netty.channel.event.*;
[ "org.jboss.netty" ]
org.jboss.netty;
1,768,649
public static <T> T wrapCatchedExceptions(Callable<T> callable, String messageFormat, Object... params) { try { return callable.call(); } catch (Exception e) { String formattedMessage = String.format(messageFormat, params); throw new IllegalStateException(formattedMessage, e); } }
static <T> T function(Callable<T> callable, String messageFormat, Object... params) { try { return callable.call(); } catch (Exception e) { String formattedMessage = String.format(messageFormat, params); throw new IllegalStateException(formattedMessage, e); } }
/** * Use this method for exceptiosn that are "never" happen, like missing UTF8 encoding. * This method also will make sure no coverage gets lost for such cases. * <p> * Allows to specify a formatted message with optional parameters. */
Use this method for exceptiosn that are "never" happen, like missing UTF8 encoding. This method also will make sure no coverage gets lost for such cases. Allows to specify a formatted message with optional parameters
wrapCatchedExceptions
{ "repo_name": "crnk-project/crnk-framework", "path": "crnk-core/src/main/java/io/crnk/core/engine/internal/utils/ExceptionUtil.java", "license": "apache-2.0", "size": 1097 }
[ "java.util.concurrent.Callable" ]
import java.util.concurrent.Callable;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,130,821
private static String getAttributeString(final HttpServletRequest request, final String name) { Object resObj = request.getAttribute(name); if ((resObj instanceof String) && ((String) resObj).length() > 0) { return (String) resObj; } // not set or not a non-empty string return null; }
static String function(final HttpServletRequest request, final String name) { Object resObj = request.getAttribute(name); if ((resObj instanceof String) && ((String) resObj).length() > 0) { return (String) resObj; } return null; }
/** * Returns the name request attribute if it is a non-empty string value. * * @param request The request from which to retrieve the attribute * @param name The name of the attribute to return * @return The named request attribute or <code>null</code> if the attribute * is not set or is not a non-empty string value. */
Returns the name request attribute if it is a non-empty string value
getAttributeString
{ "repo_name": "MRivas-XumaK/slingBuild", "path": "bundles/auth/core/src/main/java/org/apache/sling/auth/core/AuthUtil.java", "license": "apache-2.0", "size": 25108 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
79,290
public void testRereplicate1() throws Exception { setupDataNodeCapacity(); List<DatanodeDescriptor> chosenNodes = new ArrayList<DatanodeDescriptor>(); chosenNodes.add(dataNodes[0]); DatanodeDescriptor[] targets; targets = replicator.chooseTarget(filename, 0, dataNodes[0], chosenNodes, BLOCK_SIZE); assertEquals(targets.length, 0); targets = replicator.chooseTarget(filename, 1, dataNodes[0], chosenNodes, BLOCK_SIZE); assertEquals(targets.length, 1); assertFalse(cluster.isOnSameRack(dataNodes[0], targets[0])); targets = replicator.chooseTarget(filename, 2, dataNodes[0], chosenNodes, BLOCK_SIZE); assertEquals(targets.length, 2); assertTrue(cluster.isOnSameRack(dataNodes[0], targets[0])); assertFalse(cluster.isOnSameRack(targets[0], targets[1])); targets = replicator.chooseTarget(filename, 3, dataNodes[0], chosenNodes, BLOCK_SIZE); assertEquals(targets.length, 3); assertTrue(cluster.isOnSameRack(dataNodes[0], targets[0])); assertFalse(cluster.isOnSameNodeGroup(dataNodes[0], targets[0])); assertFalse(cluster.isOnSameRack(targets[0], targets[2])); }
void function() throws Exception { setupDataNodeCapacity(); List<DatanodeDescriptor> chosenNodes = new ArrayList<DatanodeDescriptor>(); chosenNodes.add(dataNodes[0]); DatanodeDescriptor[] targets; targets = replicator.chooseTarget(filename, 0, dataNodes[0], chosenNodes, BLOCK_SIZE); assertEquals(targets.length, 0); targets = replicator.chooseTarget(filename, 1, dataNodes[0], chosenNodes, BLOCK_SIZE); assertEquals(targets.length, 1); assertFalse(cluster.isOnSameRack(dataNodes[0], targets[0])); targets = replicator.chooseTarget(filename, 2, dataNodes[0], chosenNodes, BLOCK_SIZE); assertEquals(targets.length, 2); assertTrue(cluster.isOnSameRack(dataNodes[0], targets[0])); assertFalse(cluster.isOnSameRack(targets[0], targets[1])); targets = replicator.chooseTarget(filename, 3, dataNodes[0], chosenNodes, BLOCK_SIZE); assertEquals(targets.length, 3); assertTrue(cluster.isOnSameRack(dataNodes[0], targets[0])); assertFalse(cluster.isOnSameNodeGroup(dataNodes[0], targets[0])); assertFalse(cluster.isOnSameRack(targets[0], targets[2])); }
/** * This testcase tests re-replication, when dataNodes[0] is already chosen. * So the 1st replica can be placed on random rack. * the 2nd replica should be placed on different node and nodegroup by same rack as * the 1st replica. The 3rd replica can be placed randomly. * @throws Exception */
This testcase tests re-replication, when dataNodes[0] is already chosen. So the 1st replica can be placed on random rack. the 2nd replica should be placed on different node and nodegroup by same rack as the 1st replica. The 3rd replica can be placed randomly
testRereplicate1
{ "repo_name": "ict-carch/hadoop-plus", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestReplicationPolicyWithNodeGroup.java", "license": "apache-2.0", "size": 28187 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
448,455
public java.util.List<fr.lip6.move.pnml.symmetricnet.booleans.hlapi.OrHLAPI> getSubterm_booleans_OrHLAPI(){ java.util.List<fr.lip6.move.pnml.symmetricnet.booleans.hlapi.OrHLAPI> retour = new ArrayList<fr.lip6.move.pnml.symmetricnet.booleans.hlapi.OrHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.symmetricnet.booleans.impl.OrImpl.class)){ retour.add(new fr.lip6.move.pnml.symmetricnet.booleans.hlapi.OrHLAPI( (fr.lip6.move.pnml.symmetricnet.booleans.Or)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.symmetricnet.booleans.hlapi.OrHLAPI> function(){ java.util.List<fr.lip6.move.pnml.symmetricnet.booleans.hlapi.OrHLAPI> retour = new ArrayList<fr.lip6.move.pnml.symmetricnet.booleans.hlapi.OrHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.symmetricnet.booleans.impl.OrImpl.class)){ retour.add(new fr.lip6.move.pnml.symmetricnet.booleans.hlapi.OrHLAPI( (fr.lip6.move.pnml.symmetricnet.booleans.Or)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of OrHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of OrHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_booleans_OrHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-SNNet/src/fr/lip6/move/pnml/symmetricnet/integers/hlapi/ModuloHLAPI.java", "license": "epl-1.0", "size": 89721 }
[ "fr.lip6.move.pnml.symmetricnet.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.symmetricnet.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.symmetricnet.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
1,424,594
public void invoke(Request request, Response response) throws IOException, ServletException { // Perform the request getNext().invoke(request, response); Throwable throwable = (Throwable) request.getAttribute(Globals.EXCEPTION_ATTR); if (response.isCommitted()) { return; } if (throwable != null) { // The response is an error response.setError(); // Reset the response (if possible) try { response.reset(); } catch (IllegalStateException e) { ; } response.sendError (HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } response.setSuspended(false); try { report(request, response, throwable); } catch (Throwable tt) { ; } } // ------------------------------------------------------ Protected Methods
void function(Request request, Response response) throws IOException, ServletException { getNext().invoke(request, response); Throwable throwable = (Throwable) request.getAttribute(Globals.EXCEPTION_ATTR); if (response.isCommitted()) { return; } if (throwable != null) { response.setError(); try { response.reset(); } catch (IllegalStateException e) { ; } response.sendError (HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } response.setSuspended(false); try { report(request, response, throwable); } catch (Throwable tt) { ; } }
/** * Invoke the next Valve in the sequence. When the invoke returns, check * the response state, and output an error report is necessary. * * @param request The servlet request to be processed * @param response The servlet response to be created * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet error occurs */
Invoke the next Valve in the sequence. When the invoke returns, check the response state, and output an error report is necessary
invoke
{ "repo_name": "yuyupapa/OpenSource", "path": "apache-tomcat-6.0.48/java/org/apache/catalina/valves/ErrorReportValve.java", "license": "apache-2.0", "size": 10222 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletResponse", "org.apache.catalina.Globals", "org.apache.catalina.connector.Request", "org.apache.catalina.connector.Response" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; import org.apache.catalina.Globals; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.catalina.*; import org.apache.catalina.connector.*;
[ "java.io", "javax.servlet", "org.apache.catalina" ]
java.io; javax.servlet; org.apache.catalina;
2,806,312
ServiceResponse<Double> getBigDoublePositiveDecimal() throws ErrorException, IOException;
ServiceResponse<Double> getBigDoublePositiveDecimal() throws ErrorException, IOException;
/** * Get big double value 99999999.99. * * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the double object wrapped in {@link ServiceResponse} if successful. */
Get big double value 99999999.99
getBigDoublePositiveDecimal
{ "repo_name": "yaqiyang/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodynumber/Numbers.java", "license": "mit", "size": 20998 }
[ "com.microsoft.rest.ServiceResponse", "java.io.IOException" ]
import com.microsoft.rest.ServiceResponse; import java.io.IOException;
import com.microsoft.rest.*; import java.io.*;
[ "com.microsoft.rest", "java.io" ]
com.microsoft.rest; java.io;
139,046
public static CelestialBody getUranus() throws OrekitException { return getBody(URANUS); }
static CelestialBody function() throws OrekitException { return getBody(URANUS); }
/** Get the Uranus singleton body. * @return Uranus body * @exception OrekitException if the celestial body cannot be built */
Get the Uranus singleton body
getUranus
{ "repo_name": "treeform/orekit", "path": "src/main/java/org/orekit/bodies/CelestialBodyFactory.java", "license": "apache-2.0", "size": 18815 }
[ "org.orekit.errors.OrekitException" ]
import org.orekit.errors.OrekitException;
import org.orekit.errors.*;
[ "org.orekit.errors" ]
org.orekit.errors;
1,852,073
public static void assertEquals(InputStream expectedInputStream, List<BibEntry> actualEntries) throws IOException { Assert.assertNotNull(expectedInputStream); Assert.assertNotNull(actualEntries); Assert.assertEquals(getListFromInputStream(expectedInputStream), actualEntries); }
static void function(InputStream expectedInputStream, List<BibEntry> actualEntries) throws IOException { Assert.assertNotNull(expectedInputStream); Assert.assertNotNull(actualEntries); Assert.assertEquals(getListFromInputStream(expectedInputStream), actualEntries); }
/** * Reads a bibtex database from the given InputStream. The list is compared with the given list. * * @param expectedInputStream the inputStream reading the entry from * @param actualEntries a list containing a single entry to compare with */
Reads a bibtex database from the given InputStream. The list is compared with the given list
assertEquals
{ "repo_name": "Mr-DLib/jabref", "path": "src/test/java/net/sf/jabref/logic/bibtex/BibEntryAssert.java", "license": "mit", "size": 5983 }
[ "java.io.IOException", "java.io.InputStream", "java.util.List", "net.sf.jabref.model.entry.BibEntry", "org.junit.Assert" ]
import java.io.IOException; import java.io.InputStream; import java.util.List; import net.sf.jabref.model.entry.BibEntry; import org.junit.Assert;
import java.io.*; import java.util.*; import net.sf.jabref.model.entry.*; import org.junit.*;
[ "java.io", "java.util", "net.sf.jabref", "org.junit" ]
java.io; java.util; net.sf.jabref; org.junit;
1,884,461
@Override public boolean is(Class<?> type) { return this.getType().equals(type); } /** * Verify if has a next item in {@see Iterator} * @return {@code true} if has a next item on {@see Iterator}
boolean function(Class<?> type) { return this.getType().equals(type); } /** * Verify if has a next item in {@see Iterator} * @return {@code true} if has a next item on {@see Iterator}
/** * Compare if the type of this {@see Element} is equals than the param type * @param type to be verified */
Compare if the type of this Element is equals than the param type
is
{ "repo_name": "agscripter/elastic-format-java", "path": "elastic-format-core/src/main/java/br/com/agneresteves/ef/core/element/DefaultIteratorElement.java", "license": "mit", "size": 2425 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,868,928