method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public WafMetricsResponseSeriesItem withData( List<Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems> data) { this.data = data; return this; }
WafMetricsResponseSeriesItem function( List<Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems> data) { this.data = data; return this; }
/** * Set the data property: The data property. * * @param data the data value to set. * @return the WafMetricsResponseSeriesItem object itself. */
Set the data property: The data property
withData
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cdn/src/main/java/com/azure/resourcemanager/cdn/models/WafMetricsResponseSeriesItem.java", "license": "mit", "size": 3744 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,006,433
public ApiResponse getPaginated( List<String> fields, List<String> sort, int page, int pageSize ) { return getPaginated( toParamList( DEFAULT_METADATA_FILTER ), fields, sort, page, pageSize ); }
ApiResponse function( List<String> fields, List<String> sort, int page, int pageSize ) { return getPaginated( toParamList( DEFAULT_METADATA_FILTER ), fields, sort, page, pageSize ); }
/** * Executes a metadata request using pagination directives. Uses a default * filter expression * * @param fields a List of String, containing the name of the fields to * return * @param sort a List of String, containing the sort expressions * @param page the page to return * @param pageSize the number of elements to return for each page * @return an {@see ApiResponse} object */
Executes a metadata request using pagination directives. Uses a default filter expression
getPaginated
{ "repo_name": "dhis2/dhis2-core", "path": "dhis-2/dhis-e2e-test/src/main/java/org/hisp/dhis/actions/metadata/MetadataPaginationActions.java", "license": "bsd-3-clause", "size": 7887 }
[ "java.util.List", "org.hisp.dhis.dto.ApiResponse" ]
import java.util.List; import org.hisp.dhis.dto.ApiResponse;
import java.util.*; import org.hisp.dhis.dto.*;
[ "java.util", "org.hisp.dhis" ]
java.util; org.hisp.dhis;
2,348,654
private Iterator<Map.Entry<byte[], RowColumnRangeIterator>> partitionByRow( Iterator<Map.Entry<Cell, Value>> rawResults) { PeekingIterator<Map.Entry<Cell, Value>> peekableRawResults = Iterators.peekingIterator(rawResults); return new AbstractIterator<Map.Entry<byte[], RowColumnRangeIterator>>() { byte[] prevRowName;
Iterator<Map.Entry<byte[], RowColumnRangeIterator>> function( Iterator<Map.Entry<Cell, Value>> rawResults) { PeekingIterator<Map.Entry<Cell, Value>> peekableRawResults = Iterators.peekingIterator(rawResults); return new AbstractIterator<Map.Entry<byte[], RowColumnRangeIterator>>() { byte[] prevRowName;
/** * Partitions a {@link RowColumnRangeIterator} into contiguous blocks that share the same row name. {@link * KeyValueService#getRowsColumnRange(TableReference, Iterable, ColumnRangeSelection, int, long)} guarantees that * all columns for a single row are adjacent, so this method will return an {@link Iterator} with exactly one entry * per non-empty row. */
Partitions a <code>RowColumnRangeIterator</code> into contiguous blocks that share the same row name. <code>KeyValueService#getRowsColumnRange(TableReference, Iterable, ColumnRangeSelection, int, long)</code> guarantees that all columns for a single row are adjacent, so this method will return an <code>Iterator</code> with exactly one entry per non-empty row
partitionByRow
{ "repo_name": "palantir/atlasdb", "path": "atlasdb-impl-shared/src/main/java/com/palantir/atlasdb/transaction/impl/SnapshotTransaction.java", "license": "apache-2.0", "size": 132079 }
[ "com.google.common.collect.AbstractIterator", "com.google.common.collect.Iterators", "com.google.common.collect.PeekingIterator", "com.palantir.atlasdb.keyvalue.api.Cell", "com.palantir.atlasdb.keyvalue.api.RowColumnRangeIterator", "com.palantir.atlasdb.keyvalue.api.Value", "java.util.Iterator", "java.util.Map" ]
import com.google.common.collect.AbstractIterator; import com.google.common.collect.Iterators; import com.google.common.collect.PeekingIterator; import com.palantir.atlasdb.keyvalue.api.Cell; import com.palantir.atlasdb.keyvalue.api.RowColumnRangeIterator; import com.palantir.atlasdb.keyvalue.api.Value; import java.util.Iterator; import java.util.Map;
import com.google.common.collect.*; import com.palantir.atlasdb.keyvalue.api.*; import java.util.*;
[ "com.google.common", "com.palantir.atlasdb", "java.util" ]
com.google.common; com.palantir.atlasdb; java.util;
1,318,776
return new ConditionalRejectingErrorHandler(); }
return new ConditionalRejectingErrorHandler(); }
/** * Create default error handler bean. * * @return the default error handler bean */
Create default error handler bean
errorHandler
{ "repo_name": "stormc/hawkbit", "path": "hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/dmf/amqp/DmfApiAutoConfiguration.java", "license": "epl-1.0", "size": 1366 }
[ "org.springframework.amqp.rabbit.listener.ConditionalRejectingErrorHandler" ]
import org.springframework.amqp.rabbit.listener.ConditionalRejectingErrorHandler;
import org.springframework.amqp.rabbit.listener.*;
[ "org.springframework.amqp" ]
org.springframework.amqp;
993,741
@Test public void whenCalledHasNextIfNextIsNotPrimeNumberShouldReturnFalse() { Iterator it = new PrimeIterator(new int[] {6}); boolean result = it.hasNext(); assertThat(result, is(false)); }
void function() { Iterator it = new PrimeIterator(new int[] {6}); boolean result = it.hasNext(); assertThat(result, is(false)); }
/** * Tests method hasNext() when next number is not prime. */
Tests method hasNext() when next number is not prime
whenCalledHasNextIfNextIsNotPrimeNumberShouldReturnFalse
{ "repo_name": "BonDyka/abondarev", "path": "jun/chapter_005pro/src/test/java/ru/job4j/iterators/PrimeIteratorTest.java", "license": "apache-2.0", "size": 1499 }
[ "java.util.Iterator", "org.hamcrest.core.Is", "org.junit.Assert" ]
import java.util.Iterator; import org.hamcrest.core.Is; import org.junit.Assert;
import java.util.*; import org.hamcrest.core.*; import org.junit.*;
[ "java.util", "org.hamcrest.core", "org.junit" ]
java.util; org.hamcrest.core; org.junit;
2,010,833
void setActiveChannels(Map activeChannels) { this.activeChannels = activeChannels; }
void setActiveChannels(Map activeChannels) { this.activeChannels = activeChannels; }
/** * Sets the active channels. * * @param activeChannels The value to set. */
Sets the active channels
setActiveChannels
{ "repo_name": "dominikl/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/measurement/view/MeasurementViewerModel.java", "license": "gpl-2.0", "size": 49600 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,800,273
public void testTautology32() throws Exception { final Element ele = BasicParser.createElement( "<FORALL><VAR id=\"x\"/><EXISTS><VAR id=\"y\"/><IMPL><PREDVAR id=\"A\"><VAR id=\"x\"/></PREDVAR>" + "<PREDVAR id=\"A\"><VAR id=\"y\"/></PREDVAR></IMPL></EXISTS></FORALL>"); // System.out.println(ele.toString()); assertTrue(isTautology(ele)); }
void function() throws Exception { final Element ele = BasicParser.createElement( STRx\STRy\STRA\STRx\STR + STRA\STRy\STR); assertTrue(isTautology(ele)); }
/** * Function: isTautology(Element) * Type: positive * Data: \forall x \exists y (A(x) -> A(y)) * * @throws Exception Test failed. */
Function: isTautology(Element) Type: positive Data: \forall x \exists y (A(x) -> A(y))
testTautology32
{ "repo_name": "m-31/qedeq", "path": "QedeqKernelBoTest/src/org/qedeq/kernel/bo/logic/model/DynamicDirectInterpreterTest.java", "license": "gpl-2.0", "size": 82947 }
[ "org.qedeq.kernel.se.base.list.Element", "org.qedeq.kernel.xml.parser.BasicParser" ]
import org.qedeq.kernel.se.base.list.Element; import org.qedeq.kernel.xml.parser.BasicParser;
import org.qedeq.kernel.se.base.list.*; import org.qedeq.kernel.xml.parser.*;
[ "org.qedeq.kernel" ]
org.qedeq.kernel;
770,801
private static void packFilePositionInfo(FileInfo info, DataBuffer buf) { // Information format :- // ULONG Unknown1 // ULONG Unknown2 buf.putInt(0); buf.putInt(0); }
static void function(FileInfo info, DataBuffer buf) { buf.putInt(0); buf.putInt(0); }
/** * Pack the file position information (level 1014) * * @param info File information * @param buf Buffer to pack data into */
Pack the file position information (level 1014)
packFilePositionInfo
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/alfresco-jlan/source/java/org/alfresco/jlan/smb/server/QueryInfoPacker.java", "license": "lgpl-3.0", "size": 17087 }
[ "org.alfresco.jlan.server.filesys.FileInfo", "org.alfresco.jlan.util.DataBuffer" ]
import org.alfresco.jlan.server.filesys.FileInfo; import org.alfresco.jlan.util.DataBuffer;
import org.alfresco.jlan.server.filesys.*; import org.alfresco.jlan.util.*;
[ "org.alfresco.jlan" ]
org.alfresco.jlan;
814,359
private IndexMetadata getIVCacheIndexMetadata(final BOp op) { final IndexMetadata metadata = new IndexMetadata(UUID.randomUUID()); final int branchingFactor = 256;// TODO Config/tune. final int ratio = 32; // TODO Config/tune. metadata.setBranchingFactor(branchingFactor); metadata.setWriteRetentionQueueCapacity(op.getProperty( IndexAnnotations.WRITE_RETENTION_QUEUE_CAPACITY, IndexAnnotations.DEFAULT_WRITE_RETENTION_QUEUE_CAPACITY)); metadata.setTupleSerializer(new Id2TermTupleSerializer(namespace, valueFactory, new ASCIIKeyBuilderFactory(Bytes.SIZEOF_LONG),// new FrontCodedRabaCoder(ratio), SimpleRabaCoder.INSTANCE)); // a bloom filter should help avoid lookups when IVs do not have cached // values. metadata.setBloomFilterFactory(BloomFilterFactory.DEFAULT); if (true) { // enable raw record support. metadata.setRawRecords(true); metadata.setMaxRecLen(16); } return metadata; }
IndexMetadata function(final BOp op) { final IndexMetadata metadata = new IndexMetadata(UUID.randomUUID()); final int branchingFactor = 256; final int ratio = 32; metadata.setBranchingFactor(branchingFactor); metadata.setWriteRetentionQueueCapacity(op.getProperty( IndexAnnotations.WRITE_RETENTION_QUEUE_CAPACITY, IndexAnnotations.DEFAULT_WRITE_RETENTION_QUEUE_CAPACITY)); metadata.setTupleSerializer(new Id2TermTupleSerializer(namespace, valueFactory, new ASCIIKeyBuilderFactory(Bytes.SIZEOF_LONG), new FrontCodedRabaCoder(ratio), SimpleRabaCoder.INSTANCE)); metadata.setBloomFilterFactory(BloomFilterFactory.DEFAULT); if (true) { metadata.setRawRecords(true); metadata.setMaxRecLen(16); } return metadata; }
/** * Setup the {@link IndexMetadata} for {@link #ivCache}. * <p> * Note: This is basically the same setup as the ID2TERM index. */
Setup the <code>IndexMetadata</code> for <code>#ivCache</code>. Note: This is basically the same setup as the ID2TERM index
getIVCacheIndexMetadata
{ "repo_name": "rac021/blazegraph_1_5_3_cluster_2_nodes", "path": "bigdata-rdf/src/java/com/bigdata/rdf/internal/encoder/IVBindingSetEncoderWithIVCache.java", "license": "gpl-2.0", "size": 17878 }
[ "com.bigdata.bop.BOp", "com.bigdata.bop.IndexAnnotations", "com.bigdata.btree.BloomFilterFactory", "com.bigdata.btree.IndexMetadata", "com.bigdata.btree.keys.ASCIIKeyBuilderFactory", "com.bigdata.btree.raba.codec.FrontCodedRabaCoder", "com.bigdata.btree.raba.codec.SimpleRabaCoder", "com.bigdata.rawstore.Bytes", "com.bigdata.rdf.lexicon.Id2TermTupleSerializer", "java.util.UUID" ]
import com.bigdata.bop.BOp; import com.bigdata.bop.IndexAnnotations; import com.bigdata.btree.BloomFilterFactory; import com.bigdata.btree.IndexMetadata; import com.bigdata.btree.keys.ASCIIKeyBuilderFactory; import com.bigdata.btree.raba.codec.FrontCodedRabaCoder; import com.bigdata.btree.raba.codec.SimpleRabaCoder; import com.bigdata.rawstore.Bytes; import com.bigdata.rdf.lexicon.Id2TermTupleSerializer; import java.util.UUID;
import com.bigdata.bop.*; import com.bigdata.btree.*; import com.bigdata.btree.keys.*; import com.bigdata.btree.raba.codec.*; import com.bigdata.rawstore.*; import com.bigdata.rdf.lexicon.*; import java.util.*;
[ "com.bigdata.bop", "com.bigdata.btree", "com.bigdata.rawstore", "com.bigdata.rdf", "java.util" ]
com.bigdata.bop; com.bigdata.btree; com.bigdata.rawstore; com.bigdata.rdf; java.util;
2,262,475
public Iterator<Action> iterateAction();
Iterator<Action> function();
/** * Iterate through the Action objects * @return an iterator */
Iterate through the Action objects
iterateAction
{ "repo_name": "stephaneperry/Silverpeas-Core", "path": "ejb-core/formtemplate/src/main/java/com/silverpeas/workflow/api/model/Actions.java", "license": "agpl-3.0", "size": 2370 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,264,582
public void connect(Criterion operand1, LogicalOperator logicalOperator, Criterion operand2) throws InapplicableFilterTypeException { this.setOperand1(operand1); this.setLogicalOperator(logicalOperator); this.setOperand2(operand2); }
void function(Criterion operand1, LogicalOperator logicalOperator, Criterion operand2) throws InapplicableFilterTypeException { this.setOperand1(operand1); this.setLogicalOperator(logicalOperator); this.setOperand2(operand2); }
/** * use this method for defining the logical operation to be evaluation for * two operands. * * @param operand1 * @param logicalOperator * @param operand2 * @throws {@link InapplicableFilterTypeException} - when the filter type of * one of the operands don't match with this one */
use this method for defining the logical operation to be evaluation for two operands
connect
{ "repo_name": "utebock/spendenverwaltung", "path": "src/main/java/at/fraubock/spendenverwaltung/interfaces/domain/filter/criterion/ConnectedCriterion.java", "license": "gpl-3.0", "size": 4643 }
[ "at.fraubock.spendenverwaltung.interfaces.domain.filter.InapplicableFilterTypeException", "at.fraubock.spendenverwaltung.util.filter.LogicalOperator" ]
import at.fraubock.spendenverwaltung.interfaces.domain.filter.InapplicableFilterTypeException; import at.fraubock.spendenverwaltung.util.filter.LogicalOperator;
import at.fraubock.spendenverwaltung.interfaces.domain.filter.*; import at.fraubock.spendenverwaltung.util.filter.*;
[ "at.fraubock.spendenverwaltung" ]
at.fraubock.spendenverwaltung;
1,958,256
public static void validateField(Field field, Map<String, Object> conf) { Annotation[] annotations = field.getAnnotations(); if (annotations.length == 0) { LOG.warn("Field {} does not have validator annotation", field); } try { for (Annotation annotation : annotations) { if (annotation.annotationType().equals(Deprecated.class)) { LOG.warn("{} is a deprecated config please see {}.{} for more information.", field.get(null), field.getDeclaringClass(), field.getName()); continue; } String type = annotation.annotationType().getName(); Class<?> validatorClass = null; Class<?>[] classes = ConfigValidationAnnotations.class.getDeclaredClasses(); //check if annotation is one of our for (Class<?> clazz : classes) { if (clazz.getName().equals(type)) { validatorClass = clazz; break; } } if (validatorClass != null) { Object v = validatorClass.cast(annotation); String key = (String) field.get(null); @SuppressWarnings("unchecked") Class<Validator> clazz = (Class<Validator>) validatorClass .getMethod(ConfigValidationAnnotations.ValidatorParams.VALIDATOR_CLASS).invoke(v); Validator o = null; Map<String, Object> params = getParamsFromAnnotation(validatorClass, v); //two constructor signatures used to initialize validators. //One constructor takes input a Map of arguments, the other doesn't take any arguments (default constructor) //If validator has a constructor that takes a Map as an argument call that constructor if (hasConstructor(clazz, Map.class)) { o = clazz.getConstructor(Map.class).newInstance(params); } else { //If not call default constructor o = clazz.newInstance(); } o.validateField(field.getName(), conf.get(key)); } } } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new RuntimeException(e); } }
static void function(Field field, Map<String, Object> conf) { Annotation[] annotations = field.getAnnotations(); if (annotations.length == 0) { LOG.warn(STR, field); } try { for (Annotation annotation : annotations) { if (annotation.annotationType().equals(Deprecated.class)) { LOG.warn(STR, field.get(null), field.getDeclaringClass(), field.getName()); continue; } String type = annotation.annotationType().getName(); Class<?> validatorClass = null; Class<?>[] classes = ConfigValidationAnnotations.class.getDeclaredClasses(); for (Class<?> clazz : classes) { if (clazz.getName().equals(type)) { validatorClass = clazz; break; } } if (validatorClass != null) { Object v = validatorClass.cast(annotation); String key = (String) field.get(null); @SuppressWarnings(STR) Class<Validator> clazz = (Class<Validator>) validatorClass .getMethod(ConfigValidationAnnotations.ValidatorParams.VALIDATOR_CLASS).invoke(v); Validator o = null; Map<String, Object> params = getParamsFromAnnotation(validatorClass, v); if (hasConstructor(clazz, Map.class)) { o = clazz.getConstructor(Map.class).newInstance(params); } else { o = clazz.newInstance(); } o.validateField(field.getName(), conf.get(key)); } } } catch (NoSuchMethodException IllegalAccessException InstantiationException InvocationTargetException e) { throw new RuntimeException(e); } }
/** * Validates a field given field. Calls correct ValidatorField method based on which fields are declared for the corresponding * annotation. * * @param field field that needs to be validated * @param conf map of confs */
Validates a field given field. Calls correct ValidatorField method based on which fields are declared for the corresponding annotation
validateField
{ "repo_name": "kishorvpatil/incubator-storm", "path": "storm-client/src/jvm/org/apache/storm/validation/ConfigValidation.java", "license": "apache-2.0", "size": 43741 }
[ "java.lang.annotation.Annotation", "java.lang.reflect.Field", "java.lang.reflect.InvocationTargetException", "java.util.Map", "org.apache.storm.validation.ConfigValidationAnnotations" ]
import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.util.Map; import org.apache.storm.validation.ConfigValidationAnnotations;
import java.lang.annotation.*; import java.lang.reflect.*; import java.util.*; import org.apache.storm.validation.*;
[ "java.lang", "java.util", "org.apache.storm" ]
java.lang; java.util; org.apache.storm;
862,726
void openFolder(BookmarkId folder);
void openFolder(BookmarkId folder);
/** * Corresponds to any folder named list item in the side drawer. Shows bookmarks under the * folder. * @param folder Parent folder that contains bookmarks to show as its children. */
Corresponds to any folder named list item in the side drawer. Shows bookmarks under the folder
openFolder
{ "repo_name": "Chilledheart/chromium", "path": "chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkDelegate.java", "license": "bsd-3-clause", "size": 4444 }
[ "org.chromium.components.bookmarks.BookmarkId" ]
import org.chromium.components.bookmarks.BookmarkId;
import org.chromium.components.bookmarks.*;
[ "org.chromium.components" ]
org.chromium.components;
2,128,008
List<DirectoryResource> getWebRootDirectories(); /** * At the given path/filename relative to the project Web Root directory: {@link #getWebRootDirectory()} - create a * {@link FileResource} containing the given bytes. * * @return a handle to the {@link FileResource} that was created. * @deprecated use {@link WebResourcesFacet#getWebResource(String)} and call {@link FileResource#setContents(char[])}
List<DirectoryResource> getWebRootDirectories(); /** * At the given path/filename relative to the project Web Root directory: {@link #getWebRootDirectory()} - create a * {@link FileResource} containing the given bytes. * * @return a handle to the {@link FileResource} that was created. * @deprecated use {@link WebResourcesFacet#getWebResource(String)} and call {@link FileResource#setContents(char[])}
/** * Get a list containing all possible Web Root {@link DirectoryResource}s for the current project. */
Get a list containing all possible Web Root <code>DirectoryResource</code>s for the current project
getWebRootDirectories
{ "repo_name": "agoncal/core", "path": "projects/api/src/main/java/org/jboss/forge/addon/projects/facets/WebResourcesFacet.java", "license": "epl-1.0", "size": 2876 }
[ "java.util.List", "org.jboss.forge.addon.resource.DirectoryResource", "org.jboss.forge.addon.resource.FileResource" ]
import java.util.List; import org.jboss.forge.addon.resource.DirectoryResource; import org.jboss.forge.addon.resource.FileResource;
import java.util.*; import org.jboss.forge.addon.resource.*;
[ "java.util", "org.jboss.forge" ]
java.util; org.jboss.forge;
584,713
public static boolean canBePreviewed(OCFile file) { return (file != null && (file.isAudio() || file.isVideo())); } /** * {@inheritDoc}
static boolean function(OCFile file) { return (file != null && (file.isAudio() file.isVideo())); } /** * {@inheritDoc}
/** * Helper method to test if an {@link OCFile} can be passed to a {@link PreviewMediaFragment} to be previewed. * * @param file File to test if can be previewed. * @return 'True' if the file can be handled by the fragment. */
Helper method to test if an <code>OCFile</code> can be passed to a <code>PreviewMediaFragment</code> to be previewed
canBePreviewed
{ "repo_name": "cbulloss/android", "path": "src/com/owncloud/android/ui/preview/PreviewMediaFragment.java", "license": "gpl-2.0", "size": 29560 }
[ "com.owncloud.android.datamodel.OCFile" ]
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.*;
[ "com.owncloud.android" ]
com.owncloud.android;
43,874
public static BitSet xor(BitSet left, BitSet right) { BitSet result = (BitSet) left.clone(); result.xor(right); return result; }
static BitSet function(BitSet left, BitSet right) { BitSet result = (BitSet) left.clone(); result.xor(right); return result; }
/** * Bitwise XOR together two BitSets. Called when the '^' operator is used * between two bit sets. * * @param left a BitSet * @param right another BitSet to bitwise AND * @return the bitwise XOR of both BitSets * @since 1.5.0 */
Bitwise XOR together two BitSets. Called when the '^' operator is used between two bit sets
xor
{ "repo_name": "mv2a/yajsw", "path": "src/groovy-patch/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java", "license": "apache-2.0", "size": 704164 }
[ "java.util.BitSet" ]
import java.util.BitSet;
import java.util.*;
[ "java.util" ]
java.util;
1,565,717
protected Command handlePortStatus(long sw, OFPortStatus ps) { IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw); if (iofSwitch == null) return Command.CONTINUE; if (log.isTraceEnabled()) { log.trace("handlePortStatus: Switch {} port #{} reason {}; " + "config is {} state is {}", new Object[] { iofSwitch.getStringId(), ps.getDesc().getPortNumber(), ps.getReason(), ps.getDesc().getConfig(), ps.getDesc().getState() }); } short port = ps.getDesc().getPortNumber(); NodePortTuple npt = new NodePortTuple(sw, port); boolean linkDeleted = false; boolean linkInfoChanged = false; lock.writeLock().lock(); try { // if ps is a delete, or a modify where the port is down or // configured down if ((byte) OFPortReason.OFPPR_DELETE.ordinal() == ps.getReason() || ((byte) OFPortReason.OFPPR_MODIFY.ordinal() == ps.getReason() && !portEnabled(ps.getDesc()))) { deleteLinksOnPort(npt, "Port Status Changed"); LDUpdate update = new LDUpdate(sw, port, UpdateOperation.PORT_DOWN); updates.add(update); linkDeleted = true; } else if (ps.getReason() == (byte) OFPortReason.OFPPR_MODIFY.ordinal()) { // If ps is a port modification and the port state has changed // that affects links in the topology if (this.portLinks.containsKey(npt)) { for (Link lt : this.portLinks.get(npt)) { LinkInfo linkInfo = links.get(lt); assert (linkInfo != null); Integer updatedSrcPortState = null; Integer updatedDstPortState = null; if (lt.getSrc() == npt.getNodeId() && lt.getSrcPort() == npt.getPortId() && (linkInfo.getSrcPortState() != ps.getDesc() .getState())) { updatedSrcPortState = ps.getDesc().getState(); linkInfo.setSrcPortState(updatedSrcPortState); } if (lt.getDst() == npt.getNodeId() && lt.getDstPort() == npt.getPortId() && (linkInfo.getDstPortState() != ps.getDesc() .getState())) { updatedDstPortState = ps.getDesc().getState(); linkInfo.setDstPortState(updatedDstPortState); } if ((updatedSrcPortState != null) || (updatedDstPortState != null)) { // The link is already known to link discovery // manager and the status has changed, therefore // send an LDUpdate. UpdateOperation operation = getUpdateOperation(linkInfo.getSrcPortState(), linkInfo.getDstPortState()); updates.add(new LDUpdate(lt.getSrc(), lt.getSrcPort(), lt.getDst(), lt.getDstPort(), getLinkType(lt, linkInfo), operation)); writeLinkToStorage(lt, linkInfo); linkInfoChanged = true; } } } UpdateOperation operation = getUpdateOperation(ps.getDesc() .getState()); updates.add(new LDUpdate(sw, port, operation)); } if (!linkDeleted && !linkInfoChanged) { if (log.isTraceEnabled()) { log.trace("handlePortStatus: Switch {} port #{} reason {};" + " no links to update/remove", new Object[] { HexString.toHexString(sw), ps.getDesc().getPortNumber(), ps.getReason() }); } } } finally { lock.writeLock().unlock(); } if (!linkDeleted) { // Send LLDP right away when port state is changed for faster // cluster-merge. If it is a link delete then there is not need // to send the LLDPs right away and instead we wait for the LLDPs // to be sent on the timer as it is normally done // do it outside the write-lock // sendLLDPTask.reschedule(1000, TimeUnit.MILLISECONDS); processNewPort(npt.getNodeId(), npt.getPortId()); } return Command.CONTINUE; }
Command function(long sw, OFPortStatus ps) { IOFSwitch iofSwitch = floodlightProvider.getSwitches().get(sw); if (iofSwitch == null) return Command.CONTINUE; if (log.isTraceEnabled()) { log.trace(STR + STR, new Object[] { iofSwitch.getStringId(), ps.getDesc().getPortNumber(), ps.getReason(), ps.getDesc().getConfig(), ps.getDesc().getState() }); } short port = ps.getDesc().getPortNumber(); NodePortTuple npt = new NodePortTuple(sw, port); boolean linkDeleted = false; boolean linkInfoChanged = false; lock.writeLock().lock(); try { if ((byte) OFPortReason.OFPPR_DELETE.ordinal() == ps.getReason() ((byte) OFPortReason.OFPPR_MODIFY.ordinal() == ps.getReason() && !portEnabled(ps.getDesc()))) { deleteLinksOnPort(npt, STR); LDUpdate update = new LDUpdate(sw, port, UpdateOperation.PORT_DOWN); updates.add(update); linkDeleted = true; } else if (ps.getReason() == (byte) OFPortReason.OFPPR_MODIFY.ordinal()) { if (this.portLinks.containsKey(npt)) { for (Link lt : this.portLinks.get(npt)) { LinkInfo linkInfo = links.get(lt); assert (linkInfo != null); Integer updatedSrcPortState = null; Integer updatedDstPortState = null; if (lt.getSrc() == npt.getNodeId() && lt.getSrcPort() == npt.getPortId() && (linkInfo.getSrcPortState() != ps.getDesc() .getState())) { updatedSrcPortState = ps.getDesc().getState(); linkInfo.setSrcPortState(updatedSrcPortState); } if (lt.getDst() == npt.getNodeId() && lt.getDstPort() == npt.getPortId() && (linkInfo.getDstPortState() != ps.getDesc() .getState())) { updatedDstPortState = ps.getDesc().getState(); linkInfo.setDstPortState(updatedDstPortState); } if ((updatedSrcPortState != null) (updatedDstPortState != null)) { UpdateOperation operation = getUpdateOperation(linkInfo.getSrcPortState(), linkInfo.getDstPortState()); updates.add(new LDUpdate(lt.getSrc(), lt.getSrcPort(), lt.getDst(), lt.getDstPort(), getLinkType(lt, linkInfo), operation)); writeLinkToStorage(lt, linkInfo); linkInfoChanged = true; } } } UpdateOperation operation = getUpdateOperation(ps.getDesc() .getState()); updates.add(new LDUpdate(sw, port, operation)); } if (!linkDeleted && !linkInfoChanged) { if (log.isTraceEnabled()) { log.trace(STR + STR, new Object[] { HexString.toHexString(sw), ps.getDesc().getPortNumber(), ps.getReason() }); } } } finally { lock.writeLock().unlock(); } if (!linkDeleted) { processNewPort(npt.getNodeId(), npt.getPortId()); } return Command.CONTINUE; }
/** * Handles an OFPortStatus message from a switch. We will add or delete * LinkTupes as well re-compute the topology if needed. * * @param sw * The IOFSwitch that sent the port status message * @param ps * The OFPortStatus message * @return The Command to continue or stop after we process this message */
Handles an OFPortStatus message from a switch. We will add or delete LinkTupes as well re-compute the topology if needed
handlePortStatus
{ "repo_name": "yeasy/floodlight-lc", "path": "src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java", "license": "apache-2.0", "size": 93540 }
[ "net.floodlightcontroller.core.IOFSwitch", "net.floodlightcontroller.linkdiscovery.ILinkDiscovery", "net.floodlightcontroller.linkdiscovery.LinkInfo", "net.floodlightcontroller.routing.Link", "net.floodlightcontroller.topology.NodePortTuple", "org.openflow.protocol.OFPortStatus", "org.openflow.util.HexString" ]
import net.floodlightcontroller.core.IOFSwitch; import net.floodlightcontroller.linkdiscovery.ILinkDiscovery; import net.floodlightcontroller.linkdiscovery.LinkInfo; import net.floodlightcontroller.routing.Link; import net.floodlightcontroller.topology.NodePortTuple; import org.openflow.protocol.OFPortStatus; import org.openflow.util.HexString;
import net.floodlightcontroller.core.*; import net.floodlightcontroller.linkdiscovery.*; import net.floodlightcontroller.routing.*; import net.floodlightcontroller.topology.*; import org.openflow.protocol.*; import org.openflow.util.*;
[ "net.floodlightcontroller.core", "net.floodlightcontroller.linkdiscovery", "net.floodlightcontroller.routing", "net.floodlightcontroller.topology", "org.openflow.protocol", "org.openflow.util" ]
net.floodlightcontroller.core; net.floodlightcontroller.linkdiscovery; net.floodlightcontroller.routing; net.floodlightcontroller.topology; org.openflow.protocol; org.openflow.util;
287,110
public final IDTokenValidator getValidator() { return validator; }
final IDTokenValidator function() { return validator; }
/** * Retrieves the OAuth token validator. * * @return The validator */
Retrieves the OAuth token validator
getValidator
{ "repo_name": "FutureGateway/LiferayPlugIns", "path": "portal-security-sso-iam/src/main/java/com/liferay/portal/security/sso/iam/internal/util/IAMEndPoints.java", "license": "apache-2.0", "size": 9085 }
[ "com.nimbusds.openid.connect.sdk.validators.IDTokenValidator" ]
import com.nimbusds.openid.connect.sdk.validators.IDTokenValidator;
import com.nimbusds.openid.connect.sdk.validators.*;
[ "com.nimbusds.openid" ]
com.nimbusds.openid;
221,079
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<PagedResponse<ExpressRouteCircuitInner>> listAllNextSinglePageAsync(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .listAllNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<ExpressRouteCircuitInner>> function(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .listAllNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); }
/** * Get the next page of items. * * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return response for ListExpressRouteCircuit API service call along with {@link PagedResponse} on successful * completion of {@link Mono}. */
Get the next page of items
listAllNextSinglePageAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/ExpressRouteCircuitsClientImpl.java", "license": "mit", "size": 143721 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedResponse", "com.azure.core.http.rest.PagedResponseBase", "com.azure.core.util.Context", "com.azure.resourcemanager.network.fluent.models.ExpressRouteCircuitInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.network.fluent.models.ExpressRouteCircuitInner;
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;
2,427,457
public boolean rowDeleted() throws SQLException { throw SQLError.notImplemented(); }
boolean function() throws SQLException { throw SQLError.notImplemented(); }
/** * JDBC 2.0 Determine if this row has been deleted. A deleted row may leave * a visible "hole" in a result set. This method can be used to detect holes * in a result set. The value returned depends on whether or not the result * set can detect deletions. * * @return true if deleted and deletes are detected * * @exception SQLException * if a database-access error occurs * @throws NotImplemented * DOCUMENT ME! * * @see DatabaseMetaData#deletesAreDetected */
JDBC 2.0 Determine if this row has been deleted. A deleted row may leave a visible "hole" in a result set. This method can be used to detect holes in a result set. The value returned depends on whether or not the result set can detect deletions
rowDeleted
{ "repo_name": "Ytrio/Project-RPG-Story", "path": "mysql-connector-java-5.1.23/mysql-connector-java-5.1.23/src/com/mysql/jdbc/ResultSetImpl.java", "license": "gpl-2.0", "size": 246055 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
437,019
public static String unresolvedHostToNormalizedString(String host) { // Return loopback interface address if host is null // This represents the behavior of {@code InetAddress.getByName } and RFC 3330 if (host == null) { host = InetAddress.getLoopbackAddress().getHostAddress(); } else { host = host.trim().toLowerCase(); } // normalize and valid address if (IPAddressUtil.isIPv6LiteralAddress(host)) { byte[] ipV6Address = IPAddressUtil.textToNumericFormatV6(host); host = getIPv6UrlRepresentation(ipV6Address); } else if (!IPAddressUtil.isIPv4LiteralAddress(host)) { try { // We don't allow these in hostnames Preconditions.checkArgument(!host.startsWith(".")); Preconditions.checkArgument(!host.endsWith(".")); Preconditions.checkArgument(!host.contains(":")); } catch (Exception e) { throw new IllegalConfigurationException("The configured hostname is not valid", e); } } return host; }
static String function(String host) { if (host == null) { host = InetAddress.getLoopbackAddress().getHostAddress(); } else { host = host.trim().toLowerCase(); } if (IPAddressUtil.isIPv6LiteralAddress(host)) { byte[] ipV6Address = IPAddressUtil.textToNumericFormatV6(host); host = getIPv6UrlRepresentation(ipV6Address); } else if (!IPAddressUtil.isIPv4LiteralAddress(host)) { try { Preconditions.checkArgument(!host.startsWith(".")); Preconditions.checkArgument(!host.endsWith(".")); Preconditions.checkArgument(!host.contains(":")); } catch (Exception e) { throw new IllegalConfigurationException(STR, e); } } return host; }
/** * Returns an address in a normalized format for Akka. * When an IPv6 address is specified, it normalizes the IPv6 address to avoid * complications with the exact URL match policy of Akka. * @param host The hostname, IPv4 or IPv6 address * @return host which will be normalized if it is an IPv6 address */
Returns an address in a normalized format for Akka. When an IPv6 address is specified, it normalizes the IPv6 address to avoid complications with the exact URL match policy of Akka
unresolvedHostToNormalizedString
{ "repo_name": "fanzhidongyzby/flink", "path": "flink-core/src/main/java/org/apache/flink/util/NetUtils.java", "license": "apache-2.0", "size": 13113 }
[ "java.net.InetAddress", "org.apache.flink.configuration.IllegalConfigurationException" ]
import java.net.InetAddress; import org.apache.flink.configuration.IllegalConfigurationException;
import java.net.*; import org.apache.flink.configuration.*;
[ "java.net", "org.apache.flink" ]
java.net; org.apache.flink;
443,029
checkNotNull(config); final String strategyParam = config.getString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY); switch (strategyParam.toLowerCase()) { case FULL_RESTART_STRATEGY_NAME: return new RestartAllFailoverStrategy.Factory(); case PIPELINED_REGION_RESTART_STRATEGY_NAME: return new RestartPipelinedRegionFailoverStrategy.Factory(); default: throw new IllegalConfigurationException( "Unknown failover strategy: " + strategyParam); } }
checkNotNull(config); final String strategyParam = config.getString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY); switch (strategyParam.toLowerCase()) { case FULL_RESTART_STRATEGY_NAME: return new RestartAllFailoverStrategy.Factory(); case PIPELINED_REGION_RESTART_STRATEGY_NAME: return new RestartPipelinedRegionFailoverStrategy.Factory(); default: throw new IllegalConfigurationException( STR + strategyParam); } }
/** * Loads a {@link FailoverStrategy.Factory} from the given configuration. * * @param config which specifies the failover strategy factory to load * @return failover strategy factory loaded */
Loads a <code>FailoverStrategy.Factory</code> from the given configuration
loadFailoverStrategyFactory
{ "repo_name": "apache/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/flip1/FailoverStrategyFactoryLoader.java", "license": "apache-2.0", "size": 2537 }
[ "org.apache.flink.configuration.IllegalConfigurationException", "org.apache.flink.configuration.JobManagerOptions" ]
import org.apache.flink.configuration.IllegalConfigurationException; import org.apache.flink.configuration.JobManagerOptions;
import org.apache.flink.configuration.*;
[ "org.apache.flink" ]
org.apache.flink;
712,635
@Test public void pinFile() throws Exception { // Create a file that fills the entire Alluxio store AlluxioURI file = new AlluxioURI("/test1"); FileSystemTestUtils.createByteFile(mFileSystem, file, WriteType.MUST_CACHE, MEM_CAPACITY_BYTES); HeartbeatScheduler.execute(HeartbeatContext.WORKER_BLOCK_SYNC); // Pin the file mFileSystem.setAttribute(file, mSetPinned); HeartbeatScheduler.execute(HeartbeatContext.WORKER_PIN_LIST_SYNC); // Confirm the pin with master Assert.assertTrue(mFileSystem.getStatus(file).isPinned()); // Try to create a file that cannot be stored unless the previous file is evicted, expect an // exception since worker cannot serve the request mThrown.expect(Exception.class); FileSystemTestUtils.createByteFile(mFileSystem, "/test2", WriteType.MUST_CACHE, MEM_CAPACITY_BYTES); }
void function() throws Exception { AlluxioURI file = new AlluxioURI(STR); FileSystemTestUtils.createByteFile(mFileSystem, file, WriteType.MUST_CACHE, MEM_CAPACITY_BYTES); HeartbeatScheduler.execute(HeartbeatContext.WORKER_BLOCK_SYNC); mFileSystem.setAttribute(file, mSetPinned); HeartbeatScheduler.execute(HeartbeatContext.WORKER_PIN_LIST_SYNC); Assert.assertTrue(mFileSystem.getStatus(file).isPinned()); mThrown.expect(Exception.class); FileSystemTestUtils.createByteFile(mFileSystem, STR, WriteType.MUST_CACHE, MEM_CAPACITY_BYTES); }
/** * Tests that pinning a file prevents it from being evicted. */
Tests that pinning a file prevents it from being evicted
pinFile
{ "repo_name": "ShailShah/alluxio", "path": "tests/src/test/java/alluxio/worker/block/meta/TieredStoreIntegrationTest.java", "license": "apache-2.0", "size": 9296 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,966,954
public PayRuns getPayRuns(String accessToken, String xeroTenantId, Integer page, String status) throws IOException { try { TypeReference<PayRuns> typeRef = new TypeReference<PayRuns>() {}; HttpResponse response = getPayRunsForHttpResponse(accessToken, xeroTenantId, page, status); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getPayRuns -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference<PayRuns> errorTypeRef = new TypeReference<PayRuns>() {}; PayRuns object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "PayRuns", object.getProblem()); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; }
PayRuns function(String accessToken, String xeroTenantId, Integer page, String status) throws IOException { try { TypeReference<PayRuns> typeRef = new TypeReference<PayRuns>() {}; HttpResponse response = getPayRunsForHttpResponse(accessToken, xeroTenantId, page, status); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( STR + e.getStatusCode() + STR); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 e.getStatusCode() == 405) { TypeReference<PayRuns> errorTypeRef = new TypeReference<PayRuns>() {}; PayRuns object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), STR, object.getProblem()); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; }
/** * searches pay runs * * <p><b>200</b> - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param page Page number which specifies the set of records to retrieve. By default the number * of the records per set is 100. * @param status By default get payruns will return all the payruns for an organization. You can * add GET https://api.xero.com/payroll.xro/2.0/payRuns?statu&#x3D;{PayRunStatus} to filter * the payruns by status. * @param accessToken Authorization token for user set in header of each request * @return PayRuns * @throws IOException if an error occurs while attempting to invoke the API */
searches pay runs 200 - search results matching criteria
getPayRuns
{ "repo_name": "SidneyAllen/Xero-Java", "path": "src/main/java/com/xero/api/client/PayrollUkApi.java", "license": "mit", "size": 285506 }
[ "com.fasterxml.jackson.core.type.TypeReference", "com.google.api.client.http.HttpResponse", "com.google.api.client.http.HttpResponseException", "com.xero.api.XeroApiExceptionHandler", "com.xero.models.payrolluk.PayRuns", "java.io.IOException" ]
import com.fasterxml.jackson.core.type.TypeReference; import com.google.api.client.http.HttpResponse; import com.google.api.client.http.HttpResponseException; import com.xero.api.XeroApiExceptionHandler; import com.xero.models.payrolluk.PayRuns; import java.io.IOException;
import com.fasterxml.jackson.core.type.*; import com.google.api.client.http.*; import com.xero.api.*; import com.xero.models.payrolluk.*; import java.io.*;
[ "com.fasterxml.jackson", "com.google.api", "com.xero.api", "com.xero.models", "java.io" ]
com.fasterxml.jackson; com.google.api; com.xero.api; com.xero.models; java.io;
1,843,974
private List<EsaResourceImpl> createRandomizedListOfResources(int noOfVanityUrls, int numberOfItemsPerVanityUrl) { final String APPLIES_TO_STEM = "com.ibm.websphere.appserver; productEdition=\"BASE,BASE_ILAN,DEVELOPERS,EXPRESS,ND,zOS\"; productVersion=8.5.5."; final String FEATURE_NAME_STEM = "dummyEsa"; final String VANITY_URL_STEM = "vanityUrl"; System.out.println("START Creating list"); List<EsaResourceImpl> list = new ArrayList<EsaResourceImpl>(); for (int i = 1; i < noOfVanityUrls + 1; i++) { for (int j = 1; j < numberOfItemsPerVanityUrl + 1; j++) { EsaResourceImpl esa = new EsaResourceImpl(repoConnection); String featureName = FEATURE_NAME_STEM + i + "-v" + j; String providesFeature = "Feature" + i; esa.setVisibility(Visibility.PUBLIC); esa.setWebDisplayPolicy(DisplayPolicy.VISIBLE); esa.setProviderName("IBM"); esa.setName(featureName); esa.setAppliesTo(APPLIES_TO_STEM + j); esa.setProvideFeature(providesFeature); esa.setVanityURL(VANITY_URL_STEM + i); esa.setDescription(featureName + " on " + providesFeature); list.add(esa); System.out.println("CREATING v855" + j + ", vanityUrl=" + VANITY_URL_STEM + i + ", feature=" + providesFeature + ", name=" + esa.getName()); } } Collections.shuffle(list); System.out.println("END Creating list"); return list; }
List<EsaResourceImpl> function(int noOfVanityUrls, int numberOfItemsPerVanityUrl) { final String APPLIES_TO_STEM = STRBASE,BASE_ILAN,DEVELOPERS,EXPRESS,ND,zOS\STR; final String FEATURE_NAME_STEM = STR; final String VANITY_URL_STEM = STR; System.out.println(STR); List<EsaResourceImpl> list = new ArrayList<EsaResourceImpl>(); for (int i = 1; i < noOfVanityUrls + 1; i++) { for (int j = 1; j < numberOfItemsPerVanityUrl + 1; j++) { EsaResourceImpl esa = new EsaResourceImpl(repoConnection); String featureName = FEATURE_NAME_STEM + i + "-v" + j; String providesFeature = STR + i; esa.setVisibility(Visibility.PUBLIC); esa.setWebDisplayPolicy(DisplayPolicy.VISIBLE); esa.setProviderName("IBM"); esa.setName(featureName); esa.setAppliesTo(APPLIES_TO_STEM + j); esa.setProvideFeature(providesFeature); esa.setVanityURL(VANITY_URL_STEM + i); esa.setDescription(featureName + STR + providesFeature); list.add(esa); System.out.println(STR + j + STR + VANITY_URL_STEM + i + STR + providesFeature + STR + esa.getName()); } } Collections.shuffle(list); System.out.println(STR); return list; }
/** * Create a list containing a specified number of features in a random order * * @param noOfVanityUrls - the number of different vanityUrl features to create * @param numberOfResourcesPerVanityUrl - how many of each of them * @return */
Create a list containing a specified number of features in a random order
createRandomizedListOfResources
{ "repo_name": "ashleyrobertson/tool.lars", "path": "client-lib-tests/src/fat/java/com/ibm/ws/repository/test/ResourceTest.java", "license": "apache-2.0", "size": 67928 }
[ "com.ibm.ws.repository.common.enums.DisplayPolicy", "com.ibm.ws.repository.common.enums.Visibility", "com.ibm.ws.repository.resources.internal.EsaResourceImpl", "java.util.ArrayList", "java.util.Collections", "java.util.List" ]
import com.ibm.ws.repository.common.enums.DisplayPolicy; import com.ibm.ws.repository.common.enums.Visibility; import com.ibm.ws.repository.resources.internal.EsaResourceImpl; import java.util.ArrayList; import java.util.Collections; import java.util.List;
import com.ibm.ws.repository.common.enums.*; import com.ibm.ws.repository.resources.internal.*; import java.util.*;
[ "com.ibm.ws", "java.util" ]
com.ibm.ws; java.util;
841,108
public ProtectionDomain[] combine(ProtectionDomain[] current, ProtectionDomain[] assigned) { filter(current, m_domains); filter(assigned, m_domains); return ALL_PERMISSION_PD; }
ProtectionDomain[] function(ProtectionDomain[] current, ProtectionDomain[] assigned) { filter(current, m_domains); filter(assigned, m_domains); return ALL_PERMISSION_PD; }
/** * Get all bundle protection domains and add them to the m_domains. Then * return the ALL_PERMISSION_PD. */
Get all bundle protection domains and add them to the m_domains. Then return the ALL_PERMISSION_PD
combine
{ "repo_name": "boneman1231/org.apache.felix", "path": "trunk/framework.security/src/main/java/org/apache/felix/framework/security/condpermadmin/DomainGripper.java", "license": "apache-2.0", "size": 4288 }
[ "java.security.ProtectionDomain" ]
import java.security.ProtectionDomain;
import java.security.*;
[ "java.security" ]
java.security;
2,234,591
public void setupAutoFill(Message msg) { }
public void setupAutoFill(Message msg) { }
/** * Tell the client that the page being viewed is web app capable, * i.e. has specified the fullscreen-web-app-capable meta tag. * @hide */
Tell the client that the page being viewed is web app capable, i.e. has specified the fullscreen-web-app-capable meta tag
setInstallableWebApp
{ "repo_name": "R4md4c/cordova-android-chromium", "path": "cordova-chromium/src/com/swipentap/chromium/ChromiumWebChromeClient.java", "license": "bsd-2-clause", "size": 17071 }
[ "android.os.Message" ]
import android.os.Message;
import android.os.*;
[ "android.os" ]
android.os;
187,006
public void setStatus(gov.nih.nci.calims2.domain.administration.enumeration.ContactInformationStatus status) { this.status = status; } private String URI; @Column(name = "URI", length = EntityWithId.COLUMNLENGTH)
void function(gov.nih.nci.calims2.domain.administration.enumeration.ContactInformationStatus status) { this.status = status; } private String URI; @Column(name = "URI", length = EntityWithId.COLUMNLENGTH)
/** * Sets the value of status attribute. * @param status . **/
Sets the value of status attribute
setStatus
{ "repo_name": "NCIP/calims", "path": "calims2-model/src/java/gov/nih/nci/calims2/domain/administration/ContactInformation.java", "license": "bsd-3-clause", "size": 10840 }
[ "gov.nih.nci.calims2.domain.interfaces.EntityWithId", "javax.persistence.Column" ]
import gov.nih.nci.calims2.domain.interfaces.EntityWithId; import javax.persistence.Column;
import gov.nih.nci.calims2.domain.interfaces.*; import javax.persistence.*;
[ "gov.nih.nci", "javax.persistence" ]
gov.nih.nci; javax.persistence;
1,837,982
public DateTime lastModified() { if (this.lastModified == null) { return null; } return this.lastModified.dateTime(); }
DateTime function() { if (this.lastModified == null) { return null; } return this.lastModified.dateTime(); }
/** * Get the time at which the resource was last modified. * * @return the lastModified value */
Get the time at which the resource was last modified
lastModified
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/batch/microsoft-azure-batch/src/main/java/com/microsoft/azure/batch/protocol/models/JobEnableHeaders.java", "license": "mit", "size": 6204 }
[ "org.joda.time.DateTime" ]
import org.joda.time.DateTime;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
73,369
@FIXVersion(introduced="4.4") public void setPegInstructions() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
@FIXVersion(introduced="4.4") void function() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
/** * Sets the PegInstructions component if used in this message to the proper implementation * class. */
Sets the PegInstructions component if used in this message to the proper implementation class
setPegInstructions
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/CrossOrderModificationRequestMsg.java", "license": "gpl-3.0", "size": 87836 }
[ "net.hades.fix.message.anno.FIXVersion" ]
import net.hades.fix.message.anno.FIXVersion;
import net.hades.fix.message.anno.*;
[ "net.hades.fix" ]
net.hades.fix;
1,869,173
public byte getPosition(int type) { switch (type) { case Collator.PRIMARY: return primary; case Collator.SECONDARY: return secondary; case Collator.TERTIARY: return tertiary; default: return 0; } }
byte function(int type) { switch (type) { case Collator.PRIMARY: return primary; case Collator.SECONDARY: return secondary; case Collator.TERTIARY: return tertiary; default: return 0; } }
/** * Get the position with the given strength. * * @param type The strength, Collator.PRIMARY, SECONDARY etc. * @return The collation position at the given strength. */
Get the position with the given strength
getPosition
{ "repo_name": "balp/mkgmap", "path": "src/uk/me/parabola/imgfmt/app/srt/CodePosition.java", "license": "gpl-2.0", "size": 1528 }
[ "java.text.Collator" ]
import java.text.Collator;
import java.text.*;
[ "java.text" ]
java.text;
2,616,979
private void configure(final URL configUri) throws FileSystemException { InputStream configStream = null; try { // Load up the config // TODO - validate final DocumentBuilder builder = createDocumentBuilder(); configStream = configUri.openStream(); final Element config = builder.parse(configStream).getDocumentElement(); configure(config); } catch (final Exception e) { throw new FileSystemException("vfs.impl/load-config.error", configUri.toString(), e); } finally { if (configStream != null) { try { configStream.close(); } catch (final IOException e) { getLogger().warn(e.getLocalizedMessage(), e); } } } }
void function(final URL configUri) throws FileSystemException { InputStream configStream = null; try { final DocumentBuilder builder = createDocumentBuilder(); configStream = configUri.openStream(); final Element config = builder.parse(configStream).getDocumentElement(); configure(config); } catch (final Exception e) { throw new FileSystemException(STR, configUri.toString(), e); } finally { if (configStream != null) { try { configStream.close(); } catch (final IOException e) { getLogger().warn(e.getLocalizedMessage(), e); } } } }
/** * Configures this manager from an XML configuration file. * * @param configUri The URI of the configuration. * @throws FileSystemException if an error occus. */
Configures this manager from an XML configuration file
configure
{ "repo_name": "distribuitech/datos", "path": "datos-vfs/src/main/java/com/datos/vfs/impl/StandardFileSystemManager.java", "license": "apache-2.0", "size": 16528 }
[ "com.datos.vfs.FileSystemException", "java.io.IOException", "java.io.InputStream", "javax.xml.parsers.DocumentBuilder", "org.w3c.dom.Element" ]
import com.datos.vfs.FileSystemException; import java.io.IOException; import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import org.w3c.dom.Element;
import com.datos.vfs.*; import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*;
[ "com.datos.vfs", "java.io", "javax.xml", "org.w3c.dom" ]
com.datos.vfs; java.io; javax.xml; org.w3c.dom;
2,494,664
public MetaProperty<CurveInterpolator> yInterpolator() { return yInterpolator; }
MetaProperty<CurveInterpolator> function() { return yInterpolator; }
/** * The meta-property for the {@code yInterpolator} property. * @return the meta-property, not null */
The meta-property for the yInterpolator property
yInterpolator
{ "repo_name": "OpenGamma/Strata", "path": "modules/market/src/main/java/com/opengamma/strata/market/surface/interpolator/GridSurfaceInterpolator.java", "license": "apache-2.0", "size": 26939 }
[ "com.opengamma.strata.market.curve.interpolator.CurveInterpolator", "org.joda.beans.MetaProperty" ]
import com.opengamma.strata.market.curve.interpolator.CurveInterpolator; import org.joda.beans.MetaProperty;
import com.opengamma.strata.market.curve.interpolator.*; import org.joda.beans.*;
[ "com.opengamma.strata", "org.joda.beans" ]
com.opengamma.strata; org.joda.beans;
915,456
if (closable != null) { try { closable.close(); } catch (IOException e) { Logger.error(Closer.class, "Error during close() on "+closable, e); } } }
if (closable != null) { try { closable.close(); } catch (IOException e) { Logger.error(Closer.class, STR+closable, e); } } }
/** * Closes the given stream. * * @param closable The output stream to close */
Closes the given stream
close
{ "repo_name": "deepstupid/fred", "path": "src/freenet/support/io/Closer.java", "license": "gpl-2.0", "size": 2697 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,100,474
public OpwUser findUser(String login) { Query q = em.createNamedQuery("OpwUser.findByEmail"); q.setParameter("login", login); return (OpwUser) q.getSingleResult(); }
OpwUser function(String login) { Query q = em.createNamedQuery(STR); q.setParameter("login", login); return (OpwUser) q.getSingleResult(); }
/** * Returns single user instance by given login / E-Mail address. * * @param login E-Mail address to look for. * @return full instance of OpwUser or null if no record was found. * @author Adam Kowalewski * @version 2015.03.15 */
Returns single user instance by given login / E-Mail address
findUser
{ "repo_name": "adamkowalewski/OtwartaPlatformaWyborcza", "path": "opw/src/main/java/com/adamkowalewski/opw/bean/UserBean.java", "license": "mit", "size": 3277 }
[ "com.adamkowalewski.opw.entity.OpwUser", "javax.persistence.Query" ]
import com.adamkowalewski.opw.entity.OpwUser; import javax.persistence.Query;
import com.adamkowalewski.opw.entity.*; import javax.persistence.*;
[ "com.adamkowalewski.opw", "javax.persistence" ]
com.adamkowalewski.opw; javax.persistence;
1,100,211
public default <S2, E2> Traversal.Admin<S2, E2> removeStep(final Step<?, ?> step) throws IllegalStateException { return this.removeStep(TraversalHelper.stepIndex(step, this)); }
default <S2, E2> Traversal.Admin<S2, E2> function(final Step<?, ?> step) throws IllegalStateException { return this.removeStep(TraversalHelper.stepIndex(step, this)); }
/** * Remove a {@link Step} from the traversal. * * @param step the step to remove * @param <S2> the new start type of the traversal (if the removed step was a start step) * @param <E2> the new end type of the traversal (if the removed step was an end step) * @return the newly modulated traversal * @throws IllegalStateException if the {@link TraversalStrategies} have already been applied */
Remove a <code>Step</code> from the traversal
removeStep
{ "repo_name": "RussellSpitzer/incubator-tinkerpop", "path": "gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Traversal.java", "license": "apache-2.0", "size": 18466 }
[ "org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper" ]
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
import org.apache.tinkerpop.gremlin.process.traversal.util.*;
[ "org.apache.tinkerpop" ]
org.apache.tinkerpop;
1,682,353
Mono<Void> writeTo(ClientHttpRequest request, WebClientStrategies strategies); // Static builder methods
Mono<Void> writeTo(ClientHttpRequest request, WebClientStrategies strategies);
/** * Writes this request to the given {@link ClientHttpRequest}. * * @param request the client http request to write to * @param strategies the strategies to use when writing * @return {@code Mono<Void>} to indicate when writing is complete */
Writes this request to the given <code>ClientHttpRequest</code>
writeTo
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/spring-jdk9/src/spring.web/org/springframework/web/client/reactive/ClientRequest.java", "license": "mit", "size": 9994 }
[ "org.springframework.http.client.reactive.ClientHttpRequest" ]
import org.springframework.http.client.reactive.ClientHttpRequest;
import org.springframework.http.client.reactive.*;
[ "org.springframework.http" ]
org.springframework.http;
1,989,595
// ********** for user methods ************* void updateUser(PeerreviewUser peerreviewUser);
void updateUser(PeerreviewUser peerreviewUser);
/** * Create a new user in database. */
Create a new user in database
updateUser
{ "repo_name": "lamsfoundation/lams", "path": "lams_tool_preview/src/java/org/lamsfoundation/lams/tool/peerreview/service/IPeerreviewService.java", "license": "gpl-2.0", "size": 12435 }
[ "org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser" ]
import org.lamsfoundation.lams.tool.peerreview.model.PeerreviewUser;
import org.lamsfoundation.lams.tool.peerreview.model.*;
[ "org.lamsfoundation.lams" ]
org.lamsfoundation.lams;
2,098,920
public String readUntil(char c) throws IOException { if (lookaheadChar == UNDEFINED) { lookaheadChar = super.read(); } line.clear(); // reuse while (lookaheadChar != c && lookaheadChar != END_OF_STREAM) { line.append((char) lookaheadChar); if (lookaheadChar == '\n') { lineCounter++; } lastChar = lookaheadChar; lookaheadChar = super.read(); } return line.toString(); }
String function(char c) throws IOException { if (lookaheadChar == UNDEFINED) { lookaheadChar = super.read(); } line.clear(); while (lookaheadChar != c && lookaheadChar != END_OF_STREAM) { line.append((char) lookaheadChar); if (lookaheadChar == '\n') { lineCounter++; } lastChar = lookaheadChar; lookaheadChar = super.read(); } return line.toString(); }
/** * Reads all characters up to (but not including) the given character. * * @param c the character to read up to * @return the string up to the character <code>c</code> * @throws IOException */
Reads all characters up to (but not including) the given character
readUntil
{ "repo_name": "Sofd/iirkit", "path": "src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java", "license": "gpl-2.0", "size": 8515 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,591,560
return new HashMap<K, V>(); }
return new HashMap<K, V>(); }
/** * DOCUMENT ME! * * @param <K> DOCUMENT ME! * @param <V> DOCUMENT ME! * * @return DOCUMENT ME! */
DOCUMENT ME
newHashMap
{ "repo_name": "cismet/jpresso", "path": "jpresso-core/src/main/java/de/cismet/jpresso/core/utils/TypeSafeCollections.java", "license": "lgpl-3.0", "size": 18545 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
706,573
public int getVersionCodeFromManifest() { File manifestLocation = mDefaultSourceProvider.getManifestFile(); return sManifestParser.getVersionCode(manifestLocation); }
int function() { File manifestLocation = mDefaultSourceProvider.getManifestFile(); return sManifestParser.getVersionCode(manifestLocation); }
/** * Reads the version code from the manifest. */
Reads the version code from the manifest
getVersionCodeFromManifest
{ "repo_name": "consulo/consulo-android", "path": "tools-base/build-system/builder/src/main/java/com/android/builder/core/VariantConfiguration.java", "license": "apache-2.0", "size": 62290 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,058,996
protected MethodJmsListenerEndpoint createMethodJmsListenerEndpoint() { return new MethodJmsListenerEndpoint(); }
MethodJmsListenerEndpoint function() { return new MethodJmsListenerEndpoint(); }
/** * Instantiate an empty {@link MethodJmsListenerEndpoint} for further * configuration with provided parameters in {@link #processJmsListener}. * @return a new {@code MethodJmsListenerEndpoint} or subclass thereof * @since 4.1.9 * @see MethodJmsListenerEndpoint#createMessageListenerInstance() */
Instantiate an empty <code>MethodJmsListenerEndpoint</code> for further configuration with provided parameters in <code>#processJmsListener</code>
createMethodJmsListenerEndpoint
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/spring-jdk9/src/spring.jms/org/springframework/jms/annotation/JmsListenerAnnotationBeanPostProcessor.java", "license": "mit", "size": 13953 }
[ "org.springframework.jms.config.MethodJmsListenerEndpoint" ]
import org.springframework.jms.config.MethodJmsListenerEndpoint;
import org.springframework.jms.config.*;
[ "org.springframework.jms" ]
org.springframework.jms;
2,397,327
Map<String, List<Object>> getPrincipalAttributesFrom(String ticketGrantingTicketId);
Map<String, List<Object>> getPrincipalAttributesFrom(String ticketGrantingTicketId);
/** * Retrieve a valid Principal's map of attributes identified by the provided TGT SSO token. * * @param ticketGrantingTicketId an SSO token identifying the requested authenticated Principal's attributes * @return valid Principal's attributes OR <b>NULL</b> if there is no valid SSO session present identified by the provided TGT id SSO token */
Retrieve a valid Principal's map of attributes identified by the provided TGT SSO token
getPrincipalAttributesFrom
{ "repo_name": "apereo/cas", "path": "api/cas-server-core-api-ticket/src/main/java/org/apereo/cas/ticket/registry/TicketRegistrySupport.java", "license": "apache-2.0", "size": 3109 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,422,961
public DefaultMutableTreeNode addObject(Object child) { DefaultMutableTreeNode parentNode = null; TreePath parentPath = tree.getSelectionPath(); if (parentPath == null) { parentNode = rootNode; } else { parentNode = (DefaultMutableTreeNode) (parentPath .getLastPathComponent()); } return addObject(parentNode, child, true); }
DefaultMutableTreeNode function(Object child) { DefaultMutableTreeNode parentNode = null; TreePath parentPath = tree.getSelectionPath(); if (parentPath == null) { parentNode = rootNode; } else { parentNode = (DefaultMutableTreeNode) (parentPath .getLastPathComponent()); } return addObject(parentNode, child, true); }
/** * Add child to the currently selected node. */
Add child to the currently selected node
addObject
{ "repo_name": "dvorka/mindraider", "path": "mr7/src/main/java/com/mindcognition/mindraider/ui/swing/trash/TrashJPanel.java", "license": "apache-2.0", "size": 24481 }
[ "javax.swing.tree.DefaultMutableTreeNode", "javax.swing.tree.TreePath" ]
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath;
import javax.swing.tree.*;
[ "javax.swing" ]
javax.swing;
1,285,005
public int getResultSetType() throws SQLException { // fredt - omit checkClosed() in order to be able to handle the result of a // SHUTDOWN query // checkClosed(); return rsType; }
int function() throws SQLException { return rsType; }
/** * <!-- start generic documentation --> * Retrieves the result set type for <code>ResultSet</code> objects * generated by this <code>Statement</code> object. <p> * <!-- end generic documentation --> * * <!-- start release-specific documentation --> * <div class="ReleaseSpecificDocumentation"> * <h3>HSQLDB-Specific Information:</h3> <p> * * HSQLDB 1.7.0 and later versions support <code>TYPE_FORWARD_ONLY</code> * and <code>TYPE_SCROLL_INSENSITIVE</code>. * </div> * <!-- end release-specific documentation --> * * @return one of <code>ResultSet.TYPE_FORWARD_ONLY</code>, * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> (not supported) <p> * * <b>Note:</b> Up to and including 1.7.1, HSQLDB never returns * <code>TYPE_SCROLL_SENSITIVE</code> * @exception SQLException if a database access error occurs * @since JDK 1.2 (JDK 1.1.x developers: read the new overview * for jdbcStatement) */
Retrieves the result set type for <code>ResultSet</code> objects generated by this <code>Statement</code> object. HSQLDB-Specific Information: HSQLDB 1.7.0 and later versions support <code>TYPE_FORWARD_ONLY</code> and <code>TYPE_SCROLL_INSENSITIVE</code>.
getResultSetType
{ "repo_name": "ckaestne/LEADT", "path": "workspace/hsqldb/src/org/hsqldb/jdbc/jdbcStatement.java", "license": "gpl-3.0", "size": 65571 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
268,222
@Test public void testPagedParentChildren() throws IOException { final String moreRecordsString = ResourceUtil .loadResourceAsString("org/auscope/portal/core/test/responses/csw/cswRecordResponse_ChildRecord.xml"); final String noMoreRecordsString = ResourceUtil .loadResourceAsString("org/auscope/portal/core/test/responses/csw/cswRecordResponse_ParentRecord.xml"); try (final HttpClientInputStream t1r1 = new HttpClientInputStream(new ByteArrayInputStream(moreRecordsString.getBytes()), null); final HttpClientInputStream t1r2 = new HttpClientInputStream( new ByteArrayInputStream(noMoreRecordsString.getBytes()), null)) { final Sequence t1Sequence = context.sequence("t1Sequence"); final Sequence t2Sequence = context.sequence("t2Sequence"); final Sequence t3Sequence = context.sequence("t3Sequence"); context.checking(new Expectations() { { // Thread 1 will make 2 requests oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 1), null))); inSequence(t1Sequence); will(returnValue(t1r1)); oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 1), null))); inSequence(t1Sequence); will(returnValue(t1r2)); // Thread 2 will just fail exactly(3).of(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 2), null))); inSequence(t2Sequence); will(throwException(new ConnectException())); // Thread 3 will just fail exactly(3).of(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 3), null))); inSequence(t3Sequence); will(throwException(new ConnectException())); } }); // Start our updating and wait for our threads to finish Assert.assertTrue(this.cswCacheService.updateCache(3, 2000)); try { waitForCSWUpdateToComplete(); } catch (InterruptedException e) { Assert.fail("Test sleep interrupted. Test aborted."); } try { threadExecutor.getExecutorService().shutdown(); threadExecutor.getExecutorService().awaitTermination(180, TimeUnit.SECONDS); } catch (Exception ex) { threadExecutor.getExecutorService().shutdownNow(); Assert.fail("Exception whilst waiting for update to finish " + ex.getMessage()); } // Check that we have a 2 records, one of which has a child List<CSWRecord> records = cswCacheService.getRecordCache(); Assert.assertNotNull(records); Assert.assertEquals(2, records.size()); CSWRecord parent = null; CSWRecord child = null; for (CSWRecord rec : records) { if (rec.getFileIdentifier().equals("ANZCW0503900100")) { parent = rec; } if (rec.getFileIdentifier().equals("f634510e-c157-4691-888f-c84c69d2a586")) { child = rec; } } Assert.assertNotNull(parent); Assert.assertNotNull(child); Assert.assertEquals(1, parent.getChildRecords().length); Assert.assertSame(child, parent.getChildRecords()[0]); } }
void function() throws IOException { final String moreRecordsString = ResourceUtil .loadResourceAsString(STR); final String noMoreRecordsString = ResourceUtil .loadResourceAsString(STR); try (final HttpClientInputStream t1r1 = new HttpClientInputStream(new ByteArrayInputStream(moreRecordsString.getBytes()), null); final HttpClientInputStream t1r2 = new HttpClientInputStream( new ByteArrayInputStream(noMoreRecordsString.getBytes()), null)) { final Sequence t1Sequence = context.sequence(STR); final Sequence t2Sequence = context.sequence(STR); final Sequence t3Sequence = context.sequence(STR); context.checking(new Expectations() { { oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 1), null))); inSequence(t1Sequence); will(returnValue(t1r1)); oneOf(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 1), null))); inSequence(t1Sequence); will(returnValue(t1r2)); exactly(3).of(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 2), null))); inSequence(t2Sequence); will(throwException(new ConnectException())); exactly(3).of(httpServiceCaller).getMethodResponseAsStream( with(aHttpMethodBase(HttpMethodType.POST, String.format(serviceUrlFormatString, 3), null))); inSequence(t3Sequence); will(throwException(new ConnectException())); } }); Assert.assertTrue(this.cswCacheService.updateCache(3, 2000)); try { waitForCSWUpdateToComplete(); } catch (InterruptedException e) { Assert.fail(STR); } try { threadExecutor.getExecutorService().shutdown(); threadExecutor.getExecutorService().awaitTermination(180, TimeUnit.SECONDS); } catch (Exception ex) { threadExecutor.getExecutorService().shutdownNow(); Assert.fail(STR + ex.getMessage()); } List<CSWRecord> records = cswCacheService.getRecordCache(); Assert.assertNotNull(records); Assert.assertEquals(2, records.size()); CSWRecord parent = null; CSWRecord child = null; for (CSWRecord rec : records) { if (rec.getFileIdentifier().equals(STR)) { parent = rec; } if (rec.getFileIdentifier().equals(STR)) { child = rec; } } Assert.assertNotNull(parent); Assert.assertNotNull(child); Assert.assertEquals(1, parent.getChildRecords().length); Assert.assertSame(child, parent.getChildRecords()[0]); } }
/** * Tests that getting a parent and child on different CSW pages will still result in the parent/child being preserved * @throws IOException */
Tests that getting a parent and child on different CSW pages will still result in the parent/child being preserved
testPagedParentChildren
{ "repo_name": "squireg/portal-core", "path": "src/test/java/org/auscope/portal/core/services/TestCSWCacheService.java", "license": "lgpl-3.0", "size": 58582 }
[ "java.io.ByteArrayInputStream", "java.io.IOException", "java.net.ConnectException", "java.util.List", "java.util.concurrent.TimeUnit", "org.auscope.portal.core.server.http.HttpClientInputStream", "org.auscope.portal.core.services.responses.csw.CSWRecord", "org.auscope.portal.core.test.jmock.HttpMethodBaseMatcher", "org.auscope.portal.core.util.ResourceUtil", "org.jmock.Expectations", "org.jmock.Sequence", "org.junit.Assert" ]
import java.io.ByteArrayInputStream; import java.io.IOException; import java.net.ConnectException; import java.util.List; import java.util.concurrent.TimeUnit; import org.auscope.portal.core.server.http.HttpClientInputStream; import org.auscope.portal.core.services.responses.csw.CSWRecord; import org.auscope.portal.core.test.jmock.HttpMethodBaseMatcher; import org.auscope.portal.core.util.ResourceUtil; import org.jmock.Expectations; import org.jmock.Sequence; import org.junit.Assert;
import java.io.*; import java.net.*; import java.util.*; import java.util.concurrent.*; import org.auscope.portal.core.server.http.*; import org.auscope.portal.core.services.responses.csw.*; import org.auscope.portal.core.test.jmock.*; import org.auscope.portal.core.util.*; import org.jmock.*; import org.junit.*;
[ "java.io", "java.net", "java.util", "org.auscope.portal", "org.jmock", "org.junit" ]
java.io; java.net; java.util; org.auscope.portal; org.jmock; org.junit;
2,123,824
public static long computeChecksum(ByteBuffer buffer, int start, int size) { return Crc32.crc32(buffer.array(), buffer.arrayOffset() + start, size); }
static long function(ByteBuffer buffer, int start, int size) { return Crc32.crc32(buffer.array(), buffer.arrayOffset() + start, size); }
/** * Compute the checksum of a range of data * @param buffer Buffer containing the data to checksum * @param start Offset in the buffer to read from * @param size The number of bytes to include */
Compute the checksum of a range of data
computeChecksum
{ "repo_name": "lemonJun/TakinMQ", "path": "takinmq-kclient/src/main/java/org/apache/kafka/common/utils/Utils.java", "license": "apache-2.0", "size": 29556 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
2,314,152
public boolean containsAll(Collection<?> c) { // assume yes boolean contained = true; Iterator i = c.iterator(); while (contained && i.hasNext()) { // possibly realize some value is not in structure contained &= contains((E)i.next()); } return contained; }
boolean function(Collection<?> c) { boolean contained = true; Iterator i = c.iterator(); while (contained && i.hasNext()) { contained &= contains((E)i.next()); } return contained; }
/** * Returns true if all of the elements of c are contained within * the subordinate structure. * @pre c is a valid Collection * @post returns true if all elements of c appear in this Structure * @return true if c is a subset of this */
Returns true if all of the elements of c are contained within the subordinate structure
containsAll
{ "repo_name": "echalkpad/t4f-data", "path": "structure/core/src/main/java/io/datalayer/data/structure5/StructCollection.java", "license": "apache-2.0", "size": 9488 }
[ "java.util.Collection", "java.util.Iterator" ]
import java.util.Collection; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
4,057
public boolean areInsnsEqual(AbstractInsnNode a, AbstractInsnNode b) { if (a == b) return true; if (a == null || b == null) return false; if (a.equals(b)) return true; if (a.getOpcode() != b.getOpcode()) return false; switch (a.getType()) { case AbstractInsnNode.VAR_INSN: return areVarInsnsEqual((VarInsnNode) a, (VarInsnNode) b); case AbstractInsnNode.TYPE_INSN: return areTypeInsnsEqual((TypeInsnNode) a, (TypeInsnNode) b); case AbstractInsnNode.FIELD_INSN: return areFieldInsnsEqual((FieldInsnNode) a, (FieldInsnNode) b); case AbstractInsnNode.METHOD_INSN: return areMethodInsnsEqual((MethodInsnNode) a, (MethodInsnNode) b); case AbstractInsnNode.LDC_INSN: return areLdcInsnsEqual((LdcInsnNode) a, (LdcInsnNode) b); case AbstractInsnNode.IINC_INSN: return areIincInsnsEqual((IincInsnNode) a, (IincInsnNode) b); case AbstractInsnNode.INT_INSN: return areIntInsnsEqual((IntInsnNode) a, (IntInsnNode) b); default: return true; } }
boolean function(AbstractInsnNode a, AbstractInsnNode b) { if (a == b) return true; if (a == null b == null) return false; if (a.equals(b)) return true; if (a.getOpcode() != b.getOpcode()) return false; switch (a.getType()) { case AbstractInsnNode.VAR_INSN: return areVarInsnsEqual((VarInsnNode) a, (VarInsnNode) b); case AbstractInsnNode.TYPE_INSN: return areTypeInsnsEqual((TypeInsnNode) a, (TypeInsnNode) b); case AbstractInsnNode.FIELD_INSN: return areFieldInsnsEqual((FieldInsnNode) a, (FieldInsnNode) b); case AbstractInsnNode.METHOD_INSN: return areMethodInsnsEqual((MethodInsnNode) a, (MethodInsnNode) b); case AbstractInsnNode.LDC_INSN: return areLdcInsnsEqual((LdcInsnNode) a, (LdcInsnNode) b); case AbstractInsnNode.IINC_INSN: return areIincInsnsEqual((IincInsnNode) a, (IincInsnNode) b); case AbstractInsnNode.INT_INSN: return areIntInsnsEqual((IntInsnNode) a, (IntInsnNode) b); default: return true; } }
/** * Respects {@link #INT_WILDCARD} and {@link #WILDCARD} instruction properties. * Always returns true if {@code a} and {@code b} are label, line number, or frame instructions. * * @return Whether or not the given instructions are equivalent. */
Respects <code>#INT_WILDCARD</code> and <code>#WILDCARD</code> instruction properties. Always returns true if a and b are label, line number, or frame instructions
areInsnsEqual
{ "repo_name": "HostileNetworks/ReignAdditionals", "path": "src/com/cosmicdan/reignadditionals/asmhelper/InsnComparator.java", "license": "agpl-3.0", "size": 3729 }
[ "org.objectweb.asm.tree.AbstractInsnNode", "org.objectweb.asm.tree.FieldInsnNode", "org.objectweb.asm.tree.IincInsnNode", "org.objectweb.asm.tree.IntInsnNode", "org.objectweb.asm.tree.LdcInsnNode", "org.objectweb.asm.tree.MethodInsnNode", "org.objectweb.asm.tree.TypeInsnNode", "org.objectweb.asm.tree.VarInsnNode" ]
import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.FieldInsnNode; import org.objectweb.asm.tree.IincInsnNode; import org.objectweb.asm.tree.IntInsnNode; import org.objectweb.asm.tree.LdcInsnNode; import org.objectweb.asm.tree.MethodInsnNode; import org.objectweb.asm.tree.TypeInsnNode; import org.objectweb.asm.tree.VarInsnNode;
import org.objectweb.asm.tree.*;
[ "org.objectweb.asm" ]
org.objectweb.asm;
245,768
public SELF isCloseTo(String otherAsString, TemporalOffset<? super TEMPORAL> offset) { requireNonNull(otherAsString, "The String representing of the temporal object to compare actual with should not be null"); return isCloseTo(parse(otherAsString), offset); }
SELF function(String otherAsString, TemporalOffset<? super TEMPORAL> offset) { requireNonNull(otherAsString, STR); return isCloseTo(parse(otherAsString), offset); }
/** * Same assertion as {@link #isCloseTo(Temporal, TemporalOffset)} but the {@code TEMPORAL} is built from a given String that * follows predefined ISO date format <a href= * "http://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html" * >Predefined Formatters</a> to allow calling {@link #parse(String)})} method. * <p> * Example : * <pre><code class='java'> assertThat(LocalTime.parse("07:10:30")).isCloseTo("07:12:11", within(5, ChronoUnit.MINUTES));</code></pre> * @param otherAsString String representing a {@code TEMPORAL}. * @param offset the offset used for comparison * @return this assertion object. * @throws AssertionError if the actual {@code Temporal} is {@code null}. * @throws NullPointerException if temporal string representation or {@code TemporalOffset} parameter is {@code null}. * @throws AssertionError if the actual {@code Temporal} is {@code null}. * @throws AssertionError if the actual {@code Temporal} is not close to the given for a provided offset. */
Same assertion as <code>#isCloseTo(Temporal, TemporalOffset)</code> but the TEMPORAL is built from a given String that follows predefined ISO date format Predefined Formatters to allow calling <code>#parse(String)</code>)} method. Example : <code> assertThat(LocalTime.parse("07:10:30")).isCloseTo("07:12:11", within(5, ChronoUnit.MINUTES));</code></code>
isCloseTo
{ "repo_name": "joel-costigliola/assertj-core", "path": "src/main/java/org/assertj/core/api/AbstractTemporalAssert.java", "license": "apache-2.0", "size": 6122 }
[ "java.util.Objects", "org.assertj.core.data.TemporalOffset" ]
import java.util.Objects; import org.assertj.core.data.TemporalOffset;
import java.util.*; import org.assertj.core.data.*;
[ "java.util", "org.assertj.core" ]
java.util; org.assertj.core;
698,630
public static Path getStoreArchivePath(Configuration conf, RegionInfo region, byte[] family) throws IOException { Path rootDir = FSUtils.getRootDir(conf); Path tableArchiveDir = getTableArchivePath(rootDir, region.getTable()); return HStore.getStoreHomedir(tableArchiveDir, region, family); }
static Path function(Configuration conf, RegionInfo region, byte[] family) throws IOException { Path rootDir = FSUtils.getRootDir(conf); Path tableArchiveDir = getTableArchivePath(rootDir, region.getTable()); return HStore.getStoreHomedir(tableArchiveDir, region, family); }
/** * Gets the directory to archive a store directory. * @param conf {@link Configuration} to read for the archive directory name. * @param region parent region information under which the store currently lives * @param family name of the family in the store * @return {@link Path} to the directory to archive the given store or <tt>null</tt> if it should * not be archived */
Gets the directory to archive a store directory
getStoreArchivePath
{ "repo_name": "vincentpoon/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/HFileArchiveUtil.java", "license": "apache-2.0", "size": 8128 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.client.RegionInfo", "org.apache.hadoop.hbase.regionserver.HStore" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.regionserver.HStore;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.regionserver.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,852,098
private void killAllNoWait() { if ( steps == null ) { return; } for ( int i = 0; i < steps.size(); i++ ) { StepMetaDataCombi sid = steps.get( i ); StepInterface step = sid.step; if ( log.isDebug() ) { log.logDebug( BaseMessages.getString( PKG, "Trans.Log.LookingAtStep" ) + step.getStepname() ); } step.stopAll(); try { Thread.sleep( 20 ); } catch ( Exception e ) { log.logError( BaseMessages.getString( PKG, "Trans.Log.TransformationErrors" ) + e.toString() ); return; } } }
void function() { if ( steps == null ) { return; } for ( int i = 0; i < steps.size(); i++ ) { StepMetaDataCombi sid = steps.get( i ); StepInterface step = sid.step; if ( log.isDebug() ) { log.logDebug( BaseMessages.getString( PKG, STR ) + step.getStepname() ); } step.stopAll(); try { Thread.sleep( 20 ); } catch ( Exception e ) { log.logError( BaseMessages.getString( PKG, STR ) + e.toString() ); return; } } }
/** * Asks all steps to stop but doesn't wait around for it to happen. This is a special method for use with mappings. */
Asks all steps to stop but doesn't wait around for it to happen. This is a special method for use with mappings
killAllNoWait
{ "repo_name": "rfellows/pentaho-kettle", "path": "engine/src/org/pentaho/di/trans/Trans.java", "license": "apache-2.0", "size": 189048 }
[ "org.pentaho.di.i18n.BaseMessages", "org.pentaho.di.trans.step.StepInterface", "org.pentaho.di.trans.step.StepMetaDataCombi" ]
import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.trans.step.StepInterface; import org.pentaho.di.trans.step.StepMetaDataCombi;
import org.pentaho.di.i18n.*; import org.pentaho.di.trans.step.*;
[ "org.pentaho.di" ]
org.pentaho.di;
1,614,196
@Test public void fromNumber() { assertThat(BookCardType.fromNumber(num), is(type)); assertThat(BookCardType.fromNumber(num + 1), not(type)); }
void function() { assertThat(BookCardType.fromNumber(num), is(type)); assertThat(BookCardType.fromNumber(num + 1), not(type)); }
/** * Tests that {@link BookCardType#fromNumber(int)} works correctly. */
Tests that <code>BookCardType#fromNumber(int)</code> works correctly
fromNumber
{ "repo_name": "bkromhout/Minerva", "path": "app/src/test/java/com/bkromhout/minerva/enums/BookCardTypeTest.java", "license": "apache-2.0", "size": 2667 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers;
import org.hamcrest.*;
[ "org.hamcrest" ]
org.hamcrest;
2,187,776
public void migrateBackEnd(BackEndType bet) { Migrator migrator; switch (bet) { case YAML: migrator = new Migrate2YAML(config); break; case MySQL: migrator = new Migrate2MySQL(config, debug); break; default: throw new UnsupportedOperationException("bet = " + bet.name()); } debug.log("migrate backend: loading all groups and users"); List<Group> groups = backEnd.loadGroups(); debug.log("migrate backend: loaded groups"); List<User> users = backEnd.loadUsers(); debug.log("migrate backend: loaded users"); Map<UUID, String> uuidplayer = new HashMap(); if (config.isUseUUIDs()) uuidplayer = UUIDPlayerDB.getAll(); migrator.migrate(groups, users, uuidplayer, permsversion); backEnd.load(); }
void function(BackEndType bet) { Migrator migrator; switch (bet) { case YAML: migrator = new Migrate2YAML(config); break; case MySQL: migrator = new Migrate2MySQL(config, debug); break; default: throw new UnsupportedOperationException(STR + bet.name()); } debug.log(STR); List<Group> groups = backEnd.loadGroups(); debug.log(STR); List<User> users = backEnd.loadUsers(); debug.log(STR); Map<UUID, String> uuidplayer = new HashMap(); if (config.isUseUUIDs()) uuidplayer = UUIDPlayerDB.getAll(); migrator.migrate(groups, users, uuidplayer, permsversion); backEnd.load(); }
/** * Migrates the permissions to the given backnd type. * * @param bet the backEnd type to migrate to */
Migrates the permissions to the given backnd type
migrateBackEnd
{ "repo_name": "weaondara/BungeePerms", "path": "src/main/java/net/alpenblock/bungeeperms/PermissionsManager.java", "license": "mit", "size": 64671 }
[ "java.util.HashMap", "java.util.List", "java.util.Map", "net.alpenblock.bungeeperms.io.BackEndType", "net.alpenblock.bungeeperms.io.UUIDPlayerDB", "net.alpenblock.bungeeperms.io.migrate.Migrate2MySQL", "net.alpenblock.bungeeperms.io.migrate.Migrate2YAML", "net.alpenblock.bungeeperms.io.migrate.Migrator" ]
import java.util.HashMap; import java.util.List; import java.util.Map; import net.alpenblock.bungeeperms.io.BackEndType; import net.alpenblock.bungeeperms.io.UUIDPlayerDB; import net.alpenblock.bungeeperms.io.migrate.Migrate2MySQL; import net.alpenblock.bungeeperms.io.migrate.Migrate2YAML; import net.alpenblock.bungeeperms.io.migrate.Migrator;
import java.util.*; import net.alpenblock.bungeeperms.io.*; import net.alpenblock.bungeeperms.io.migrate.*;
[ "java.util", "net.alpenblock.bungeeperms" ]
java.util; net.alpenblock.bungeeperms;
2,777,973
public List<ApplicationGatewayRequestRoutingRule> requestRoutingRules() { return this.requestRoutingRules; }
List<ApplicationGatewayRequestRoutingRule> function() { return this.requestRoutingRules; }
/** * Get request routing rules of the application gateway resource. * * @return the requestRoutingRules value */
Get request routing rules of the application gateway resource
requestRoutingRules
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_04_01/src/main/java/com/microsoft/azure/management/network/v2019_04_01/implementation/ApplicationGatewayInner.java", "license": "mit", "size": 31499 }
[ "com.microsoft.azure.management.network.v2019_04_01.ApplicationGatewayRequestRoutingRule", "java.util.List" ]
import com.microsoft.azure.management.network.v2019_04_01.ApplicationGatewayRequestRoutingRule; import java.util.List;
import com.microsoft.azure.management.network.v2019_04_01.*; import java.util.*;
[ "com.microsoft.azure", "java.util" ]
com.microsoft.azure; java.util;
777,219
@Test public void removeReferenceBeforePut() { ConcurrentServiceReferenceSetMap<String, String> map = new ConcurrentServiceReferenceSetMap<String, String>("refName"); assertFalse("remove should return false since nothing was removed", map.removeReference("key", mockServiceReference1)); }
void function() { ConcurrentServiceReferenceSetMap<String, String> map = new ConcurrentServiceReferenceSetMap<String, String>(STR); assertFalse(STR, map.removeReference("key", mockServiceReference1)); }
/** * Test method for {@link com.ibm.wsspi.kernel.service.utils.ConcurrentServiceReferenceSetMap#removeReference(org.osgi.framework.ServiceReference)}. */
Test method for <code>com.ibm.wsspi.kernel.service.utils.ConcurrentServiceReferenceSetMap#removeReference(org.osgi.framework.ServiceReference)</code>
removeReferenceBeforePut
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.kernel.service/test/com/ibm/wsspi/kernel/service/utils/ConcurrentServiceReferenceSetMapTest.java", "license": "epl-1.0", "size": 16540 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,586,710
@LayoutRes int provideErrorLayout();
@LayoutRes int provideErrorLayout();
/** * Provide the layout resource for the ERROR state * * @return layout resource for the ERROR state */
Provide the layout resource for the ERROR state
provideErrorLayout
{ "repo_name": "JamieCruwys/StatefulView", "path": "statefulview/src/main/java/uk/co/jamiecruwys/contracts/ViewStateLayouts.java", "license": "apache-2.0", "size": 798 }
[ "android.support.annotation.LayoutRes" ]
import android.support.annotation.LayoutRes;
import android.support.annotation.*;
[ "android.support" ]
android.support;
2,536,743
public void addFeatures(SimpleFeature... features) { if ((features == null) || (features.length == 0)) { throw new IllegalArgumentException("Provided features are empty"); } synchronized (entries) { for (SimpleFeature feature : features) { addFeatureInternal(feature); } } }
void function(SimpleFeature... features) { if ((features == null) (features.length == 0)) { throw new IllegalArgumentException(STR); } synchronized (entries) { for (SimpleFeature feature : features) { addFeatureInternal(feature); } } }
/** * Configures MemoryDataStore with feature array. * * @param features Array of features to add * @throws IllegalArgumentException If provided feature array is empty */
Configures MemoryDataStore with feature array
addFeatures
{ "repo_name": "geotools/geotools", "path": "modules/library/main/src/main/java/org/geotools/data/memory/MemoryDataStore.java", "license": "lgpl-2.1", "size": 12225 }
[ "org.opengis.feature.simple.SimpleFeature" ]
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.*;
[ "org.opengis.feature" ]
org.opengis.feature;
698,183
private Point getComparisonPoint(WorldArea other) { int x, y; if (other.x <= this.x) { x = this.x; } else if (other.x >= this.x + this.width - 1) { x = this.x + this.width - 1; } else { x = other.x; } if (other.y <= this.y) { y = this.y; } else if (other.y >= this.y + this.height - 1) { y = this.y + this.height - 1; } else { y = other.y; } return new Point(x, y); }
Point function(WorldArea other) { int x, y; if (other.x <= this.x) { x = this.x; } else if (other.x >= this.x + this.width - 1) { x = this.x + this.width - 1; } else { x = other.x; } if (other.y <= this.y) { y = this.y; } else if (other.y >= this.y + this.height - 1) { y = this.y + this.height - 1; } else { y = other.y; } return new Point(x, y); }
/** * Gets the point within this area that is closest to another. * * @param other the other area * @return the closest point to the passed area */
Gets the point within this area that is closest to another
getComparisonPoint
{ "repo_name": "runelite/runelite", "path": "runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java", "license": "bsd-2-clause", "size": 19925 }
[ "net.runelite.api.Point" ]
import net.runelite.api.Point;
import net.runelite.api.*;
[ "net.runelite.api" ]
net.runelite.api;
271,344
public void clickTwitterLink() { try { drone.find(twitterLinkLocator).click(); } catch (NoSuchElementException ex) { logger.error("Exceeded time to find the Twitter link element", ex); throw new PageException("Unable to find Twitter link"); } }
void function() { try { drone.find(twitterLinkLocator).click(); } catch (NoSuchElementException ex) { logger.error(STR, ex); throw new PageException(STR); } }
/** * Click Twitter Link present on Share Link page. */
Click Twitter Link present on Share Link page
clickTwitterLink
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/share-po/src/main/java/org/alfresco/po/share/site/document/ShareLinkPage.java", "license": "lgpl-3.0", "size": 8212 }
[ "org.alfresco.webdrone.exception.PageException", "org.openqa.selenium.NoSuchElementException" ]
import org.alfresco.webdrone.exception.PageException; import org.openqa.selenium.NoSuchElementException;
import org.alfresco.webdrone.exception.*; import org.openqa.selenium.*;
[ "org.alfresco.webdrone", "org.openqa.selenium" ]
org.alfresco.webdrone; org.openqa.selenium;
1,172,430
val writer = new StringWriter(); constructJackson().writeValue(writer, obj); return writer.toString(); }
val writer = new StringWriter(); constructJackson().writeValue(writer, obj); return writer.toString(); }
/** * <code>toJSON</code> method will extract the OBJ passed as a parameter and return the JSON String * representation. * * NOTE: Written for performance thus NULL checks are not performed. * * @param obj an <code>Object</code> value * @return a <code>String</code> value * @exception IOException if an error occurs */
<code>toJSON</code> method will extract the OBJ passed as a parameter and return the JSON String representation
toJSON
{ "repo_name": "Bjond/bjond-utilities", "path": "src/main/java/com/bjond/utilities/JSONUtils.java", "license": "apache-2.0", "size": 6944 }
[ "java.io.StringWriter" ]
import java.io.StringWriter;
import java.io.*;
[ "java.io" ]
java.io;
1,917,725
AmqpErrorContext getErrorContext();
AmqpErrorContext getErrorContext();
/** * Gets the context for this AMQP send link. */
Gets the context for this AMQP send link
getErrorContext
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/AmqpSendLink.java", "license": "mit", "size": 1679 }
[ "com.azure.core.amqp.exception.AmqpErrorContext" ]
import com.azure.core.amqp.exception.AmqpErrorContext;
import com.azure.core.amqp.exception.*;
[ "com.azure.core" ]
com.azure.core;
1,947,039
@Test public void testDismissCallback() { PropertyModel shownDialogModel = mModalDialogManager.getShownDialogModel(); Assert.assertNotNull(shownDialogModel); Assert.assertEquals(0, mDialogCallback.getCallCount()); Assert.assertEquals(0, mIntentCallback.getCallCount()); shownDialogModel.get(ModalDialogProperties.CONTROLLER) .onClick(shownDialogModel, ModalDialogProperties.ButtonType.NEGATIVE); Assert.assertEquals(1, mDialogCallback.getCallCount()); Assert.assertEquals(0, mIntentCallback.getCallCount()); }
void function() { PropertyModel shownDialogModel = mModalDialogManager.getShownDialogModel(); Assert.assertNotNull(shownDialogModel); Assert.assertEquals(0, mDialogCallback.getCallCount()); Assert.assertEquals(0, mIntentCallback.getCallCount()); shownDialogModel.get(ModalDialogProperties.CONTROLLER) .onClick(shownDialogModel, ModalDialogProperties.ButtonType.NEGATIVE); Assert.assertEquals(1, mDialogCallback.getCallCount()); Assert.assertEquals(0, mIntentCallback.getCallCount()); }
/** * Tests whether callback for dismissal functions correctly. */
Tests whether callback for dismissal functions correctly
testDismissCallback
{ "repo_name": "scheib/chromium", "path": "components/permissions/android/junit/src/org/chromium/components/permissions/nfc/NfcSystemLevelPromptTest.java", "license": "bsd-3-clause", "size": 5474 }
[ "org.chromium.ui.modaldialog.ModalDialogProperties", "org.chromium.ui.modelutil.PropertyModel", "org.junit.Assert" ]
import org.chromium.ui.modaldialog.ModalDialogProperties; import org.chromium.ui.modelutil.PropertyModel; import org.junit.Assert;
import org.chromium.ui.modaldialog.*; import org.chromium.ui.modelutil.*; import org.junit.*;
[ "org.chromium.ui", "org.junit" ]
org.chromium.ui; org.junit;
472,939
private RestResponse createRestResponseFromFile(final String filename, final int httpCode) { try { return new RestResponse( TestHelper.readFile("mockResponses/" + filename), httpCode ); } catch (final IOException exception) { throw new RuntimeException(exception); } }
RestResponse function(final String filename, final int httpCode) { try { return new RestResponse( TestHelper.readFile(STR + filename), httpCode ); } catch (final IOException exception) { throw new RuntimeException(exception); } }
/** * Helper method to generate a RestResponse as loaded from a mockResponse resource file. * @param filename file containing the mock response. * @param httpCode Http response code to mock. * @return RestResponse instance. */
Helper method to generate a RestResponse as loaded from a mockResponse resource file
createRestResponseFromFile
{ "repo_name": "Crim/pardot-java-client", "path": "src/test/java/com/darksci/pardot/api/PardotClient_UsernameAndPasswordAuthTest.java", "license": "mit", "size": 16401 }
[ "com.darksci.pardot.api.rest.RestResponse", "java.io.IOException" ]
import com.darksci.pardot.api.rest.RestResponse; import java.io.IOException;
import com.darksci.pardot.api.rest.*; import java.io.*;
[ "com.darksci.pardot", "java.io" ]
com.darksci.pardot; java.io;
543,747
boolean caseWhenCoercion(SqlCallBinding binding);
boolean caseWhenCoercion(SqlCallBinding binding);
/** * Coerce CASE WHEN statement branches to one common type. * * <p>Rules: Find common type for all the then operands and else operands, * then try to coerce the then/else operands to the type if needed. */
Coerce CASE WHEN statement branches to one common type. Rules: Find common type for all the then operands and else operands, then try to coerce the then/else operands to the type if needed
caseWhenCoercion
{ "repo_name": "xhoong/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercion.java", "license": "apache-2.0", "size": 7570 }
[ "org.apache.calcite.sql.SqlCallBinding" ]
import org.apache.calcite.sql.SqlCallBinding;
import org.apache.calcite.sql.*;
[ "org.apache.calcite" ]
org.apache.calcite;
1,711,565
public void startElement(String elementName) throws XmlException { try { if (elementName.equals("barGraph")) { // Override the base class to ignore things irrelevant // to histograms... String widthSpec = (String) _attributes.get("width"); String offsetSpec = (String) _attributes.get("offset"); // NOTE: If only one of these is given, then the other // is ignored. if ((widthSpec != null) && (offsetSpec != null)) { double width = (Double.valueOf(widthSpec)).doubleValue(); double offset = (Double.valueOf(offsetSpec)).doubleValue(); ((Histogram) _plot).setBars(width, offset); } } else if (elementName.equals("bin")) { // Ignore if plot is not an instance of Histogram. if (_plot instanceof Histogram) { Histogram histogram = (Histogram) _plot; String widthSpec = (String) _attributes.get("width"); String offsetSpec = (String) _attributes.get("offset"); // NOTE: If only one of these is given, then the other // is ignored. if ((widthSpec != null) && (offsetSpec != null)) { double width = (Double.valueOf(widthSpec)).doubleValue(); histogram.setBinWidth(width); double offset = (Double.valueOf(offsetSpec)) .doubleValue(); histogram.setBinOffset(offset); } } } else if (elementName.equals("dataset")) { // Override the base class to ignore things irrelevant // to histograms... _currentDataset++; _currentPointCount = 0.0; String name = (String) _attributes.get("name"); if (name != null) { _plot.addLegend(_currentDataset, name); } } else if (elementName.equals("default")) { // Override the base class to ignore things irrelevant // to histograms... } else { super.startElement(elementName); } } catch (Exception ex) { if (ex instanceof XmlException) { throw (XmlException) ex; } else { String msg = "XML element \"" + elementName + "\" triggers exception:\n " + ex.toString(); throw new XmlException(msg, _currentExternalEntity(), _parser.getLineNumber(), _parser.getColumnNumber()); } } // NOTE: if super is called, this gets done three times... // Any way to avoid it? _attributes.clear(); } /////////////////////////////////////////////////////////////////// //// protected methods ////
void function(String elementName) throws XmlException { try { if (elementName.equals(STR)) { String widthSpec = (String) _attributes.get("width"); String offsetSpec = (String) _attributes.get(STR); if ((widthSpec != null) && (offsetSpec != null)) { double width = (Double.valueOf(widthSpec)).doubleValue(); double offset = (Double.valueOf(offsetSpec)).doubleValue(); ((Histogram) _plot).setBars(width, offset); } } else if (elementName.equals("bin")) { if (_plot instanceof Histogram) { Histogram histogram = (Histogram) _plot; String widthSpec = (String) _attributes.get("width"); String offsetSpec = (String) _attributes.get(STR); if ((widthSpec != null) && (offsetSpec != null)) { double width = (Double.valueOf(widthSpec)).doubleValue(); histogram.setBinWidth(width); double offset = (Double.valueOf(offsetSpec)) .doubleValue(); histogram.setBinOffset(offset); } } } else if (elementName.equals(STR)) { _currentDataset++; _currentPointCount = 0.0; String name = (String) _attributes.get("name"); if (name != null) { _plot.addLegend(_currentDataset, name); } } else if (elementName.equals(STR)) { } else { super.startElement(elementName); } } catch (Exception ex) { if (ex instanceof XmlException) { throw (XmlException) ex; } else { String msg = STRSTR\STR + ex.toString(); throw new XmlException(msg, _currentExternalEntity(), _parser.getLineNumber(), _parser.getColumnNumber()); } } _attributes.clear(); }
/** Start an element. * This is called at the beginning of each XML * element. By the time it is called, all of the attributes * for the element will already have been reported using the * attribute() method. Unrecognized elements are ignored. * @param elementName The element type name. * @exception XmlException If the element produces an error * in constructing the model. */
Start an element. This is called at the beginning of each XML element. By the time it is called, all of the attributes for the element will already have been reported using the attribute() method. Unrecognized elements are ignored
startElement
{ "repo_name": "mrmaxent/Maxent", "path": "ptolemy/plot/plotml/HistogramMLParser.java", "license": "mit", "size": 7196 }
[ "com.microstar.xml.XmlException" ]
import com.microstar.xml.XmlException;
import com.microstar.xml.*;
[ "com.microstar.xml" ]
com.microstar.xml;
2,692,090
public static Read<GenericRecord> readGenericRecords(String schema) { return readGenericRecords(new Schema.Parser().parse(schema)); }
static Read<GenericRecord> function(String schema) { return readGenericRecords(new Schema.Parser().parse(schema)); }
/** * Reads Avro file(s) containing records of the specified schema. The schema is specified as a * JSON-encoded string. */
Reads Avro file(s) containing records of the specified schema. The schema is specified as a JSON-encoded string
readGenericRecords
{ "repo_name": "tgroh/incubator-beam", "path": "sdks/java/core/src/main/java/org/apache/beam/sdk/io/AvroIO.java", "license": "apache-2.0", "size": 61636 }
[ "org.apache.avro.Schema", "org.apache.avro.generic.GenericRecord" ]
import org.apache.avro.Schema; import org.apache.avro.generic.GenericRecord;
import org.apache.avro.*; import org.apache.avro.generic.*;
[ "org.apache.avro" ]
org.apache.avro;
88,670
public String getKey() { return StringUtils.checkNotNull(key); }
String function() { return StringUtils.checkNotNull(key); }
/** * Method used to get the key String. * * @return String representation of key */
Method used to get the key String
getKey
{ "repo_name": "Dominic-Pace/AutoCoreCommons", "path": "src/main/java/org/autocore/java/rest/uri/KeyValue.java", "license": "gpl-3.0", "size": 1595 }
[ "org.autocore.java.commons.utils.StringUtils" ]
import org.autocore.java.commons.utils.StringUtils;
import org.autocore.java.commons.utils.*;
[ "org.autocore.java" ]
org.autocore.java;
890,741
public AppRole2JobPosPersistence getAppRole2JobPosPersistence() { return appRole2JobPosPersistence; }
AppRole2JobPosPersistence function() { return appRole2JobPosPersistence; }
/** * Returns the app role2 job pos persistence. * * @return the app role2 job pos persistence */
Returns the app role2 job pos persistence
getAppRole2JobPosPersistence
{ "repo_name": "openegovplatform/OEPv2", "path": "oep-core-ssomgt-portlet/docroot/WEB-INF/src/org/oep/core/ssomgt/service/base/AppRoleServiceBaseImpl.java", "license": "apache-2.0", "size": 19673 }
[ "org.oep.core.ssomgt.service.persistence.AppRole2JobPosPersistence" ]
import org.oep.core.ssomgt.service.persistence.AppRole2JobPosPersistence;
import org.oep.core.ssomgt.service.persistence.*;
[ "org.oep.core" ]
org.oep.core;
540,081
@Test public void whenInvokeActionThenPrintActionString() { StringJoiner sj = new StringJoiner(System.lineSeparator()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); System.setOut(new PrintStream(baos)); MenuController controller = new MenuController(); String item1 = "item1"; String item2 = "item2"; int[] paragraph2 = new int[]{1}; int[] actionParagraph1 = new int[]{1}; int[] actionParagraph2 = new int[]{1, 1}; controller.addMenuItem(item1); controller.addMenuItem(item2, paragraph2); controller.action(actionParagraph1); controller.action(actionParagraph2); sj.add("item1: action."); sj.add("item2: action."); sj.add(""); String result = baos.toString(); String expected = sj.toString(); assertThat(result, is(expected)); }
void function() { StringJoiner sj = new StringJoiner(System.lineSeparator()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); System.setOut(new PrintStream(baos)); MenuController controller = new MenuController(); String item1 = "item1"; String item2 = "item2"; int[] paragraph2 = new int[]{1}; int[] actionParagraph1 = new int[]{1}; int[] actionParagraph2 = new int[]{1, 1}; controller.addMenuItem(item1); controller.addMenuItem(item2, paragraph2); controller.action(actionParagraph1); controller.action(actionParagraph2); sj.add(STR); sj.add(STR); sj.add(""); String result = baos.toString(); String expected = sj.toString(); assertThat(result, is(expected)); }
/** * Test action() method. */
Test action() method
whenInvokeActionThenPrintActionString
{ "repo_name": "MironovVadim/vmironov", "path": "chapter_004/src/test/java/ru/job4j/menu/MenuControllerTest.java", "license": "apache-2.0", "size": 3147 }
[ "java.io.ByteArrayOutputStream", "java.io.PrintStream", "java.util.StringJoiner", "org.hamcrest.core.Is", "org.junit.Assert" ]
import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.StringJoiner; import org.hamcrest.core.Is; import org.junit.Assert;
import java.io.*; import java.util.*; import org.hamcrest.core.*; import org.junit.*;
[ "java.io", "java.util", "org.hamcrest.core", "org.junit" ]
java.io; java.util; org.hamcrest.core; org.junit;
2,283,240
private void setExpectedLease(Lease l) { expected = l; expectedReceived = false; }
void function(Lease l) { expected = l; expectedReceived = false; }
/** * Set the lease we should expect in the next event */
Set the lease we should expect in the next event
setExpectedLease
{ "repo_name": "pfirmstone/JGDMS", "path": "qa/src/org/apache/river/test/impl/norm/ExpiredLeaseTest.java", "license": "apache-2.0", "size": 8944 }
[ "net.jini.core.lease.Lease" ]
import net.jini.core.lease.Lease;
import net.jini.core.lease.*;
[ "net.jini.core" ]
net.jini.core;
687,729
private void closeAnimate(View view, int position) { if (isOpen(position)) { animateReveal(view, true, false, new ListItem(position)); } }
void function(View view, int position) { if (isOpen(position)) { animateReveal(view, true, false, new ListItem(position)); } }
/** * Close item * * @param view affected view * @param position Position of list */
Close item
closeAnimate
{ "repo_name": "adamaviner/SwipeList", "path": "java/com/fortysevendeg/android/swipelistview/SwipeListViewTouchListener.java", "license": "apache-2.0", "size": 21170 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
174,046
interface WithSubnet { WithCreate withSubnet(SubnetInner subnet); } interface WithCreate extends Creatable<PrivateEndpoint>, Resource.DefinitionWithTags<WithCreate>, DefinitionStages.WithManualPrivateLinkServiceConnections, DefinitionStages.WithPrivateLinkServiceConnections, DefinitionStages.WithSubnet { } } interface Update extends Appliable<PrivateEndpoint>, Resource.UpdateWithTags<Update>, UpdateStages.WithManualPrivateLinkServiceConnections, UpdateStages.WithPrivateLinkServiceConnections, UpdateStages.WithSubnet { }
interface WithSubnet { WithCreate withSubnet(SubnetInner subnet); } interface WithCreate extends Creatable<PrivateEndpoint>, Resource.DefinitionWithTags<WithCreate>, DefinitionStages.WithManualPrivateLinkServiceConnections, DefinitionStages.WithPrivateLinkServiceConnections, DefinitionStages.WithSubnet { } } interface Update extends Appliable<PrivateEndpoint>, Resource.UpdateWithTags<Update>, UpdateStages.WithManualPrivateLinkServiceConnections, UpdateStages.WithPrivateLinkServiceConnections, UpdateStages.WithSubnet { }
/** * Specifies subnet. * @param subnet The ID of the subnet from which the private IP will be allocated * @return the next definition stage */
Specifies subnet
withSubnet
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/PrivateEndpoint.java", "license": "mit", "size": 7089 }
[ "com.microsoft.azure.arm.model.Appliable", "com.microsoft.azure.arm.model.Creatable", "com.microsoft.azure.arm.resources.models.Resource", "com.microsoft.azure.management.network.v2019_11_01.implementation.SubnetInner" ]
import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.Resource; import com.microsoft.azure.management.network.v2019_11_01.implementation.SubnetInner;
import com.microsoft.azure.arm.model.*; import com.microsoft.azure.arm.resources.models.*; import com.microsoft.azure.management.network.v2019_11_01.implementation.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,296,985
public OAuth2ClientMutator principalName(String principalName) { Assert.notNull(principalName, "principalName cannot be null"); this.principalName = principalName; return this; } /** * Use this {@link OAuth2AccessToken} * @param accessToken the {@link OAuth2AccessToken} to use * @return the * {@link SecurityMockMvcRequestPostProcessors.OAuth2ClientRequestPostProcessor}
OAuth2ClientMutator function(String principalName) { Assert.notNull(principalName, STR); this.principalName = principalName; return this; } /** * Use this {@link OAuth2AccessToken} * @param accessToken the {@link OAuth2AccessToken} to use * @return the * {@link SecurityMockMvcRequestPostProcessors.OAuth2ClientRequestPostProcessor}
/** * Use this as the resource owner's principal name * @param principalName the resource owner's principal name * @return the {@link OAuth2ClientMutator} for further configuration */
Use this as the resource owner's principal name
principalName
{ "repo_name": "djechelon/spring-security", "path": "test/src/main/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurers.java", "license": "apache-2.0", "size": 48530 }
[ "org.springframework.security.oauth2.core.OAuth2AccessToken", "org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors", "org.springframework.util.Assert" ]
import org.springframework.security.oauth2.core.OAuth2AccessToken; import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors; import org.springframework.util.Assert;
import org.springframework.security.oauth2.core.*; import org.springframework.security.test.web.servlet.request.*; import org.springframework.util.*;
[ "org.springframework.security", "org.springframework.util" ]
org.springframework.security; org.springframework.util;
971,148
public void importSystem(InputStream importStream) { SystemInfo systemInfo = SystemInfo.createSystemInfo(importStream); // apply patch info for (PatchInfo patchInfo : systemInfo.patches) { AppliedPatch patch = new AppliedPatch(); patch.setId(patchInfo.id); patch.setAppliedOnDate(patchInfo.appliedOnDate); patch.setAppliedToSchema(patchInfo.appliedToSchema); patch.setAppliedToServer(patchInfo.appliedToServer); patch.setDescription(patchInfo.description); patch.setFixesFromSchema(patchInfo.fixesFromSchema); patch.setFixesToSchema(patchInfo.fixesToSchema); patch.setReport(patchInfo.report); patch.setSucceeded(patchInfo.succeeded); patch.setTargetSchema(patchInfo.targetSchema); patch.setWasExecuted(patchInfo.wasExecuted); appliedPatchDAO.createAppliedPatch(patch); } }
void function(InputStream importStream) { SystemInfo systemInfo = SystemInfo.createSystemInfo(importStream); for (PatchInfo patchInfo : systemInfo.patches) { AppliedPatch patch = new AppliedPatch(); patch.setId(patchInfo.id); patch.setAppliedOnDate(patchInfo.appliedOnDate); patch.setAppliedToSchema(patchInfo.appliedToSchema); patch.setAppliedToServer(patchInfo.appliedToServer); patch.setDescription(patchInfo.description); patch.setFixesFromSchema(patchInfo.fixesFromSchema); patch.setFixesToSchema(patchInfo.fixesToSchema); patch.setReport(patchInfo.report); patch.setSucceeded(patchInfo.succeeded); patch.setTargetSchema(patchInfo.targetSchema); patch.setWasExecuted(patchInfo.wasExecuted); appliedPatchDAO.createAppliedPatch(patch); } }
/** * Import Repository System Information * * @param importStream input stream to import from */
Import Repository System Information
importSystem
{ "repo_name": "Alfresco/alfresco-repository", "path": "src/main/java/org/alfresco/repo/importer/system/SystemExporterImporter.java", "license": "lgpl-3.0", "size": 4247 }
[ "java.io.InputStream", "org.alfresco.repo.admin.patch.AppliedPatch" ]
import java.io.InputStream; import org.alfresco.repo.admin.patch.AppliedPatch;
import java.io.*; import org.alfresco.repo.admin.patch.*;
[ "java.io", "org.alfresco.repo" ]
java.io; org.alfresco.repo;
263,299
public boolean disconnectIfNotMatching(final ComponentName componentName, final int userId) { if (matches(componentName, userId)) { return false; } disconnect(); return true; }
boolean function(final ComponentName componentName, final int userId) { if (matches(componentName, userId)) { return false; } disconnect(); return true; }
/** * Asynchronously unbind from the application service if the bound service component and user * does not match the given signature. * * @param componentName the component that must match. * @param userId the user ID that must match. * @return {@code true} if not matching. */
Asynchronously unbind from the application service if the bound service component and user does not match the given signature
disconnectIfNotMatching
{ "repo_name": "xorware/android_frameworks_base", "path": "services/core/java/com/android/server/utils/ManagedApplicationService.java", "license": "apache-2.0", "size": 9695 }
[ "android.content.ComponentName" ]
import android.content.ComponentName;
import android.content.*;
[ "android.content" ]
android.content;
2,547,170
@Override public void setup(int imageFormat, int imageWidth, int imageHeight) throws IllegalStateException { if (mState != CLOSED) throw new IllegalStateException("StillSequenceCamera2.setup() can only be called in the CLOSED state"); try { mImageCapture.setup(mCameraId, imageFormat, imageWidth, imageHeight); mFocusManager.setup(mCameraId); if (mPreview!=null) mPreview.setup(mCameraId); } catch (NullPointerException e) { // Currently an NPE is thrown when the Camera2API is used but not supported on the // device this code runs. Log.e(TAG, "Camera2 API is not supported"); throw new UnsupportedOperationException("Camera2 API is not supported"); } mState = STOPPED; }
void function(int imageFormat, int imageWidth, int imageHeight) throws IllegalStateException { if (mState != CLOSED) throw new IllegalStateException(STR); try { mImageCapture.setup(mCameraId, imageFormat, imageWidth, imageHeight); mFocusManager.setup(mCameraId); if (mPreview!=null) mPreview.setup(mCameraId); } catch (NullPointerException e) { Log.e(TAG, STR); throw new UnsupportedOperationException(STR); } mState = STOPPED; }
/** * Chooses a back-facing camera satisfying the requirements from the constructor (i.e. format * and resolution). * * * @param imageFormat The preferred format to capture images in * (see #ImageFormat for values) * * @throws IllegalStateException if the StillSequenceCamera2 is in any but the CLOSED state. */
Chooses a back-facing camera satisfying the requirements from the constructor (i.e. format and resolution)
setup
{ "repo_name": "tschaumburg/FastBarcodeScanner", "path": "still-sequence-camera/src/main/java/dk/schaumburgit/stillsequencecamera/camera2/StillSequenceCamera2.java", "license": "apache-2.0", "size": 18242 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
2,494,434
protected SpringApplication getSpringApplication() { return new SpringApplication(); }
SpringApplication function() { return new SpringApplication(); }
/** * Builds new {@link org.springframework.boot.SpringApplication} instance. You can * override this method to add custom behavior * @return {@link org.springframework.boot.SpringApplication} instance */
Builds new <code>org.springframework.boot.SpringApplication</code> instance. You can override this method to add custom behavior
getSpringApplication
{ "repo_name": "nisuhw/spring-boot", "path": "spring-boot/src/main/java/org/springframework/boot/test/SpringApplicationContextLoader.java", "license": "apache-2.0", "size": 12349 }
[ "org.springframework.boot.SpringApplication" ]
import org.springframework.boot.SpringApplication;
import org.springframework.boot.*;
[ "org.springframework.boot" ]
org.springframework.boot;
2,766,044
default AtomixValueEndpointBuilder atomixValue(String path) { class AtomixValueEndpointBuilderImpl extends AbstractEndpointBuilder implements AtomixValueEndpointBuilder, AdvancedAtomixValueEndpointBuilder { public AtomixValueEndpointBuilderImpl(String path) { super("atomix-value", path); } } return new AtomixValueEndpointBuilderImpl(path); }
default AtomixValueEndpointBuilder atomixValue(String path) { class AtomixValueEndpointBuilderImpl extends AbstractEndpointBuilder implements AtomixValueEndpointBuilder, AdvancedAtomixValueEndpointBuilder { public AtomixValueEndpointBuilderImpl(String path) { super(STR, path); } } return new AtomixValueEndpointBuilderImpl(path); }
/** * Atomix Value (camel-atomix) * The atomix-value component is used to access Atomix's distributed value. * * Category: clustering * Since: 2.20 * Maven coordinates: org.apache.camel:camel-atomix * * Syntax: <code>atomix-value:resourceName</code> * * Path parameter: resourceName (required) * The distributed resource name */
Atomix Value (camel-atomix) The atomix-value component is used to access Atomix's distributed value. Category: clustering Since: 2.20 Maven coordinates: org.apache.camel:camel-atomix Syntax: <code>atomix-value:resourceName</code> Path parameter: resourceName (required) The distributed resource name
atomixValue
{ "repo_name": "objectiser/camel", "path": "core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/AtomixValueEndpointBuilderFactory.java", "license": "apache-2.0", "size": 46410 }
[ "org.apache.camel.builder.endpoint.AbstractEndpointBuilder" ]
import org.apache.camel.builder.endpoint.AbstractEndpointBuilder;
import org.apache.camel.builder.endpoint.*;
[ "org.apache.camel" ]
org.apache.camel;
2,646,343
@Override public boolean onInterceptTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: currentY = ev.getY(); break; } return super.onInterceptTouchEvent(ev); }
boolean function(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: currentY = ev.getY(); break; } return super.onInterceptTouchEvent(ev); }
/** * Set up first touch to later calculations. * * @see android.widget.AbsListView#onInterceptTouchEvent(android.view.MotionEvent ) */
Set up first touch to later calculations
onInterceptTouchEvent
{ "repo_name": "thoinv/kaorisan", "path": "trunk/C_Source_Code/refreshlistview_library/src/com/github/jeremiemartinez/refreshlistview/RefreshListView.java", "license": "gpl-3.0", "size": 12891 }
[ "android.view.MotionEvent" ]
import android.view.MotionEvent;
import android.view.*;
[ "android.view" ]
android.view;
204,095
ShardRouting routingEntry();
ShardRouting routingEntry();
/** * Returns the latest cluster routing entry received with this shard. */
Returns the latest cluster routing entry received with this shard
routingEntry
{ "repo_name": "sneivandt/elasticsearch", "path": "core/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java", "license": "apache-2.0", "size": 45761 }
[ "org.elasticsearch.cluster.routing.ShardRouting" ]
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.*;
[ "org.elasticsearch.cluster" ]
org.elasticsearch.cluster;
201,052
public void testGetEncodedValue003() { try { PagedResultsControl prc=new PagedResultsControl(0,null,true); assertEquals("30 05 02 01 00 04 00",toHexString(prc.getEncodedValue())); } catch (IOException e) { fail("Failed with:"+e); } }
void function() { try { PagedResultsControl prc=new PagedResultsControl(0,null,true); assertEquals(STR,toHexString(prc.getEncodedValue())); } catch (IOException e) { fail(STR+e); } }
/** * <p>Test method for 'javax.naming.ldap.BasicControl.getEncodedValue()'</p> * <p>Here we are testing if this method returns retrieves the control's ASN.1 BER encoded value.</p> * <p>The expected result is a byte array representing the control's ASN.1 BER encoded value.</p> */
Test method for 'javax.naming.ldap.BasicControl.getEncodedValue()' Here we are testing if this method returns retrieves the control's ASN.1 BER encoded value. The expected result is a byte array representing the control's ASN.1 BER encoded value
testGetEncodedValue003
{ "repo_name": "freeVM/freeVM", "path": "enhanced/archive/classlib/java6/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsControls.java", "license": "apache-2.0", "size": 10422 }
[ "java.io.IOException", "javax.naming.ldap.PagedResultsControl" ]
import java.io.IOException; import javax.naming.ldap.PagedResultsControl;
import java.io.*; import javax.naming.ldap.*;
[ "java.io", "javax.naming" ]
java.io; javax.naming;
845,675
synchronized final void deleteNewFiles(Collection<String> files) throws IOException { deleter.deleteNewFiles(files); }
synchronized final void deleteNewFiles(Collection<String> files) throws IOException { deleter.deleteNewFiles(files); }
/** * Tries to delete the given files if unreferenced * @param files the files to delete * @throws IOException if an {@link IOException} occurs * @see IndexFileDeleter#deleteNewFiles(Collection) */
Tries to delete the given files if unreferenced
deleteNewFiles
{ "repo_name": "williamchengit/TestRepo", "path": "solr-4.9.0/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java", "license": "apache-2.0", "size": 176183 }
[ "java.io.IOException", "java.util.Collection" ]
import java.io.IOException; import java.util.Collection;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,943,964
private static void assertCreateTableEquals(GridSqlCreateTable exp, GridSqlCreateTable actual) { assertEqualsIgnoreCase(exp.schemaName(), actual.schemaName()); assertEqualsIgnoreCase(exp.tableName(), actual.tableName()); assertEquals(exp.templateName(), actual.templateName()); assertEquals(exp.primaryKeyColumns(), actual.primaryKeyColumns()); assertEquals(new ArrayList<>(exp.columns().keySet()), new ArrayList<>(actual.columns().keySet())); for (Map.Entry<String, GridSqlColumn> col : exp.columns().entrySet()) { GridSqlColumn val = actual.columns().get(col.getKey()); assertNotNull(val); assertEquals(col.getValue().columnName(), val.columnName()); assertEquals(col.getValue().column().getType(), val.column().getType()); } assertEquals(exp.ifNotExists(), actual.ifNotExists()); }
static void function(GridSqlCreateTable exp, GridSqlCreateTable actual) { assertEqualsIgnoreCase(exp.schemaName(), actual.schemaName()); assertEqualsIgnoreCase(exp.tableName(), actual.tableName()); assertEquals(exp.templateName(), actual.templateName()); assertEquals(exp.primaryKeyColumns(), actual.primaryKeyColumns()); assertEquals(new ArrayList<>(exp.columns().keySet()), new ArrayList<>(actual.columns().keySet())); for (Map.Entry<String, GridSqlColumn> col : exp.columns().entrySet()) { GridSqlColumn val = actual.columns().get(col.getKey()); assertNotNull(val); assertEquals(col.getValue().columnName(), val.columnName()); assertEquals(col.getValue().column().getType(), val.column().getType()); } assertEquals(exp.ifNotExists(), actual.ifNotExists()); }
/** * Test two instances of {@link GridSqlDropTable} for equality. */
Test two instances of <code>GridSqlDropTable</code> for equality
assertCreateTableEquals
{ "repo_name": "samaitra/ignite", "path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java", "license": "apache-2.0", "size": 48802 }
[ "java.util.ArrayList", "java.util.Map" ]
import java.util.ArrayList; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
911,888
public static Point getCanvasSpriteLocation(Client client, Graphics2D graphics, LocalPoint localLocation, SpritePixels sprite, int zOffset) { int plane = client.getPlane(); Point p = Perspective.worldToCanvas(client, localLocation.getX(), localLocation.getY(), plane, zOffset); if (p == null) { return null; } int xOffset = p.getX() - sprite.getWidth() / 2; int yOffset = p.getY() - sprite.getHeight() / 2; return new Point(xOffset, yOffset); } /** * You don't want this. Use {@link TileObject#getClickbox()} instead * * Get the on-screen clickable area of {@code model} as though it's for the object on the tile at * ({@code tileX}, {@code tileY}) and rotated to angle {@code orientation}
static Point function(Client client, Graphics2D graphics, LocalPoint localLocation, SpritePixels sprite, int zOffset) { int plane = client.getPlane(); Point p = Perspective.worldToCanvas(client, localLocation.getX(), localLocation.getY(), plane, zOffset); if (p == null) { return null; } int xOffset = p.getX() - sprite.getWidth() / 2; int yOffset = p.getY() - sprite.getHeight() / 2; return new Point(xOffset, yOffset); } /** * You don't want this. Use {@link TileObject#getClickbox()} instead * * Get the on-screen clickable area of {@code model} as though it's for the object on the tile at * ({@code tileX}, {@code tileY}) and rotated to angle {@code orientation}
/** * Calculates sprite position and centers depending on sprite size. * * @param client * @param graphics * @param localLocation local location of the tile * @param sprite SpritePixel for size measurement * @param zOffset offset from ground plane * @return a {@link Point} on screen corresponding to the given * localLocation. */
Calculates sprite position and centers depending on sprite size
getCanvasSpriteLocation
{ "repo_name": "UniquePassive/runelite", "path": "runelite-api/src/main/java/net/runelite/api/Perspective.java", "license": "bsd-2-clause", "size": 20638 }
[ "java.awt.Graphics2D", "net.runelite.api.coords.LocalPoint" ]
import java.awt.Graphics2D; import net.runelite.api.coords.LocalPoint;
import java.awt.*; import net.runelite.api.coords.*;
[ "java.awt", "net.runelite.api" ]
java.awt; net.runelite.api;
2,585,113
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<String>> supportedVpnDevicesWithResponseAsync( String resourceGroupName, String virtualNetworkGatewayName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (virtualNetworkGatewayName == null) { return Mono .error( new IllegalArgumentException( "Parameter virtualNetworkGatewayName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } final String apiVersion = "2020-05-01"; context = this.client.mergeContext(context); return service .supportedVpnDevices( this.client.getEndpoint(), resourceGroupName, virtualNetworkGatewayName, apiVersion, this.client.getSubscriptionId(), context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<String>> function( String resourceGroupName, String virtualNetworkGatewayName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (virtualNetworkGatewayName == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String apiVersion = STR; context = this.client.mergeContext(context); return service .supportedVpnDevices( this.client.getEndpoint(), resourceGroupName, virtualNetworkGatewayName, apiVersion, this.client.getSubscriptionId(), context); }
/** * Gets a xml format representation for supported vpn devices. * * @param resourceGroupName The name of the resource group. * @param virtualNetworkGatewayName The name of the virtual network gateway. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a xml format representation for supported vpn devices. */
Gets a xml format representation for supported vpn devices
supportedVpnDevicesWithResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/VirtualNetworkGatewaysClientImpl.java", "license": "mit", "size": 322151 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context" ]
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.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
2,797,360
public List<T> findAll() { EntityManager em = getManager(); EntityTransaction xact = startTransaction(em); List<T> found = null; try { CriteriaQuery<T> query = em.getCriteriaBuilder() .createQuery(entityType); query.from(entityType); found = em.createQuery(query).getResultList(); } catch (PersistenceException pe) { baseLog.error("Couldn't find all entities!", pe); endTransaction(xact, true); throw new FieldScanDaoException(pe); } endTransaction(xact); return found; }
List<T> function() { EntityManager em = getManager(); EntityTransaction xact = startTransaction(em); List<T> found = null; try { CriteriaQuery<T> query = em.getCriteriaBuilder() .createQuery(entityType); query.from(entityType); found = em.createQuery(query).getResultList(); } catch (PersistenceException pe) { baseLog.error(STR, pe); endTransaction(xact, true); throw new FieldScanDaoException(pe); } endTransaction(xact); return found; }
/** * Simple query to get all of a particular type. This is * not recommended for general use, unless the type is a static * definition or very small. Better to write or use a key-based * query. * * @return a {@link List} of all type-safe entities available. */
Simple query to get all of a particular type. This is not recommended for general use, unless the type is a static definition or very small. Better to write or use a key-based query
findAll
{ "repo_name": "ProgrammerDan/fieldscan", "path": "src/main/java/com/programmerdan/fieldscan/dao/impl/BaseDaoImpl.java", "license": "gpl-2.0", "size": 6079 }
[ "com.programmerdan.fieldscan.dao.FieldScanDaoException", "java.util.List", "javax.persistence.EntityManager", "javax.persistence.EntityTransaction", "javax.persistence.PersistenceException", "javax.persistence.criteria.CriteriaQuery" ]
import com.programmerdan.fieldscan.dao.FieldScanDaoException; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityTransaction; import javax.persistence.PersistenceException; import javax.persistence.criteria.CriteriaQuery;
import com.programmerdan.fieldscan.dao.*; import java.util.*; import javax.persistence.*; import javax.persistence.criteria.*;
[ "com.programmerdan.fieldscan", "java.util", "javax.persistence" ]
com.programmerdan.fieldscan; java.util; javax.persistence;
1,006,615
protected Component buildPage() { GridBagConstraints constraints = new GridBagConstraints(); PropertyValueModel loggingTypeHolder = buildLoggingTypeSelectionHolder(); // Create the container JPanel panel = new JPanel(new GridBagLayout()); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // No Logging //JRadioButton noLoggingRadioButton = buildRadioButton //( //"DATABASE_SESSION_LOGGING_TYPE_NO_LOGGING", //new RadioButtonModelAdapter(loggingTypeHolder, LOGGING_TYPE_NO_LOGGING_CHOICE) //); //addHelpTopicId(noLoggingRadioButton, "session.logging.noLogging"); // Server Logging JRadioButton serverLoggingRadioButton = buildRadioButton ( "DATABASE_SESSION_LOGGING_TYPE_SERVER", new RadioButtonModelAdapter(loggingTypeHolder, LOGGING_TYPE_SERVER_CHOICE) ); addHelpTopicId(serverLoggingRadioButton, "session.logging.server"); // Java Logging JRadioButton javaLoggingRadioButton = buildRadioButton ( "DATABASE_SESSION_LOGGING_TYPE_JAVA", new RadioButtonModelAdapter(loggingTypeHolder, LOGGING_TYPE_JAVA_CHOICE) ); addHelpTopicId(javaLoggingRadioButton, "session.logging.java"); // Standard Logging JRadioButton standardLoggingRadioButton = buildRadioButton ( "DATABASE_SESSION_LOGGING_TYPE_STANDARD", new RadioButtonModelAdapter(loggingTypeHolder, LOGGING_TYPE_STANDARD_CHOICE) ); addHelpTopicId(standardLoggingRadioButton, "session.logging.standard"); StandardPane standardPane = new StandardPane(buildStandardLogHolder()); addPaneForAlignment(standardPane); new ComponentEnabler(buildStandardPaneEnableStateHolder(), standardPane.getComponents()); addHelpTopicId(standardPane, "session.logging.standard"); // Add the widgets to the container GroupBox groupBox = new GroupBox ( new AbstractButton[] { //noLoggingRadioButton, serverLoggingRadioButton, javaLoggingRadioButton, standardLoggingRadioButton }, standardPane ); constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 1; constraints.weighty = 0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(0, 0, 0, 0); panel.add(groupBox, constraints); // Logging Options pane JCheckBox optionsCheckBox = buildCheckBox ( "LOGGING_OPTIONS_CHECK_BOX", buildOptionsCheckBoxModelAdapter() ); LoggingOptionsPane loggingOptionsPane = new LoggingOptionsPane ( buildLogAdapterHolder(), getApplicationContext() ); groupBox = new GroupBox ( optionsCheckBox, loggingOptionsPane ); constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 1; constraints.weighty = 1; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.PAGE_START; constraints.insets = new Insets(5, 0, 0, 0); panel.add(groupBox, constraints); new ComponentEnabler(buildLoggingOptionsCheckBoxEnablerHolder(), optionsCheckBox); new ComponentEnabler(buildLoggingOptionsPaneEnablerHolder(), loggingOptionsPane.getComponents()); addHelpTopicId(groupBox, "session.logging.options"); addHelpTopicId(this, "session.logging"); return panel; }
Component function() { GridBagConstraints constraints = new GridBagConstraints(); PropertyValueModel loggingTypeHolder = buildLoggingTypeSelectionHolder(); JPanel panel = new JPanel(new GridBagLayout()); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JRadioButton serverLoggingRadioButton = buildRadioButton ( STR, new RadioButtonModelAdapter(loggingTypeHolder, LOGGING_TYPE_SERVER_CHOICE) ); addHelpTopicId(serverLoggingRadioButton, STR); JRadioButton javaLoggingRadioButton = buildRadioButton ( STR, new RadioButtonModelAdapter(loggingTypeHolder, LOGGING_TYPE_JAVA_CHOICE) ); addHelpTopicId(javaLoggingRadioButton, STR); JRadioButton standardLoggingRadioButton = buildRadioButton ( STR, new RadioButtonModelAdapter(loggingTypeHolder, LOGGING_TYPE_STANDARD_CHOICE) ); addHelpTopicId(standardLoggingRadioButton, STR); StandardPane standardPane = new StandardPane(buildStandardLogHolder()); addPaneForAlignment(standardPane); new ComponentEnabler(buildStandardPaneEnableStateHolder(), standardPane.getComponents()); addHelpTopicId(standardPane, STR); GroupBox groupBox = new GroupBox ( new AbstractButton[] { serverLoggingRadioButton, javaLoggingRadioButton, standardLoggingRadioButton }, standardPane ); constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 1; constraints.weighty = 0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.CENTER; constraints.insets = new Insets(0, 0, 0, 0); panel.add(groupBox, constraints); JCheckBox optionsCheckBox = buildCheckBox ( STR, buildOptionsCheckBoxModelAdapter() ); LoggingOptionsPane loggingOptionsPane = new LoggingOptionsPane ( buildLogAdapterHolder(), getApplicationContext() ); groupBox = new GroupBox ( optionsCheckBox, loggingOptionsPane ); constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 1; constraints.weighty = 1; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.PAGE_START; constraints.insets = new Insets(5, 0, 0, 0); panel.add(groupBox, constraints); new ComponentEnabler(buildLoggingOptionsCheckBoxEnablerHolder(), optionsCheckBox); new ComponentEnabler(buildLoggingOptionsPaneEnablerHolder(), loggingOptionsPane.getComponents()); addHelpTopicId(groupBox, STR); addHelpTopicId(this, STR); return panel; }
/** * Initializes the layout of this pane. * * @return The container with all its widgets */
Initializes the layout of this pane
buildPage
{ "repo_name": "RallySoftware/eclipselink.runtime", "path": "utils/eclipselink.utils.workbench/scplugin/source/org/eclipse/persistence/tools/workbench/scplugin/ui/session/basic/SessionLoggingPropertiesPage.java", "license": "epl-1.0", "size": 37467 }
[ "java.awt.Component", "java.awt.GridBagConstraints", "java.awt.GridBagLayout", "java.awt.Insets", "javax.swing.AbstractButton", "javax.swing.BorderFactory", "javax.swing.JCheckBox", "javax.swing.JPanel", "javax.swing.JRadioButton", "org.eclipse.persistence.tools.workbench.framework.uitools.GroupBox", "org.eclipse.persistence.tools.workbench.uitools.ComponentEnabler", "org.eclipse.persistence.tools.workbench.uitools.app.PropertyValueModel", "org.eclipse.persistence.tools.workbench.uitools.app.swing.RadioButtonModelAdapter" ]
import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.JCheckBox; import javax.swing.JPanel; import javax.swing.JRadioButton; import org.eclipse.persistence.tools.workbench.framework.uitools.GroupBox; import org.eclipse.persistence.tools.workbench.uitools.ComponentEnabler; import org.eclipse.persistence.tools.workbench.uitools.app.PropertyValueModel; import org.eclipse.persistence.tools.workbench.uitools.app.swing.RadioButtonModelAdapter;
import java.awt.*; import javax.swing.*; import org.eclipse.persistence.tools.workbench.framework.uitools.*; import org.eclipse.persistence.tools.workbench.uitools.*; import org.eclipse.persistence.tools.workbench.uitools.app.*; import org.eclipse.persistence.tools.workbench.uitools.app.swing.*;
[ "java.awt", "javax.swing", "org.eclipse.persistence" ]
java.awt; javax.swing; org.eclipse.persistence;
2,659,241
EList<TreeNode> getNode();
EList<TreeNode> getNode();
/** * Returns the value of the '<em><b>Node</b></em>' containment reference list. * The list contents are of type {@link org.wso2.developerstudio.datamapper.TreeNode}. * It is bidirectional and its opposite is '{@link org.wso2.developerstudio.datamapper.TreeNode#getFieldParent <em>Field Parent</em>}'. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Node</em>' reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Node</em>' containment reference list. * @see org.wso2.developerstudio.datamapper.DataMapperPackage#getTreeNode_Node() * @see org.wso2.developerstudio.datamapper.TreeNode#getFieldParent * @model opposite="fieldParent" containment="true" * @generated */
Returns the value of the 'Node' containment reference list. The list contents are of type <code>org.wso2.developerstudio.datamapper.TreeNode</code>. It is bidirectional and its opposite is '<code>org.wso2.developerstudio.datamapper.TreeNode#getFieldParent Field Parent</code>'. If the meaning of the 'Node' reference list isn't clear, there really should be more of a description here...
getNode
{ "repo_name": "knadikari/developer-studio", "path": "data-mapper/org.wso2.developerstudio.visualdatamapper/src/org/wso2/developerstudio/datamapper/TreeNode.java", "license": "apache-2.0", "size": 10152 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,387,826
@Test public void testAutoSaveWithSubSubnodeConfig() throws ConfigurationException { final String newValue = "I am autosaved"; conf.setFile(testSaveConf); conf.setAutoSave(true); SubnodeConfiguration sub1 = conf.configurationAt("element2"); SubnodeConfiguration sub2 = sub1.configurationAt("subelement"); sub2.setProperty("subsubelement", newValue); assertEquals("Change not visible to parent", newValue, conf.getString("element2.subelement.subsubelement")); XMLConfiguration conf2 = new XMLConfiguration(testSaveConf); assertEquals("Change was not saved", newValue, conf2.getString("element2.subelement.subsubelement")); }
void function() throws ConfigurationException { final String newValue = STR; conf.setFile(testSaveConf); conf.setAutoSave(true); SubnodeConfiguration sub1 = conf.configurationAt(STR); SubnodeConfiguration sub2 = sub1.configurationAt(STR); sub2.setProperty(STR, newValue); assertEquals(STR, newValue, conf.getString(STR)); XMLConfiguration conf2 = new XMLConfiguration(testSaveConf); assertEquals(STR, newValue, conf2.getString(STR)); }
/** * Tests whether a subnode configuration created from another subnode * configuration of a XMLConfiguration can trigger the auto save mechanism. */
Tests whether a subnode configuration created from another subnode configuration of a XMLConfiguration can trigger the auto save mechanism
testAutoSaveWithSubSubnodeConfig
{ "repo_name": "XClouded/t4f-core", "path": "devops/java/src/test/java/io/datalayer/conf/XmlConfigurationTest.java", "license": "apache-2.0", "size": 66459 }
[ "org.apache.commons.configuration.ConfigurationException", "org.apache.commons.configuration.SubnodeConfiguration", "org.apache.commons.configuration.XMLConfiguration", "org.junit.Assert" ]
import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.SubnodeConfiguration; import org.apache.commons.configuration.XMLConfiguration; import org.junit.Assert;
import org.apache.commons.configuration.*; import org.junit.*;
[ "org.apache.commons", "org.junit" ]
org.apache.commons; org.junit;
1,574,388
protected VmAllocationPolicy getVmAllocationPolicy( String vmAllocationPolicyName, String vmSelectionPolicyName, String parameterName) { VmAllocationPolicy vmAllocationPolicy = null; PowerVmSelectionPolicy vmSelectionPolicy = null; if (!vmSelectionPolicyName.isEmpty()) { vmSelectionPolicy = getVmSelectionPolicy(vmSelectionPolicyName); } double parameter = 0; if (!parameterName.isEmpty()) { parameter = Double.valueOf(parameterName); } if (vmAllocationPolicyName.equals("iqr")) { PowerVmAllocationPolicyMigrationAbstract fallbackVmSelectionPolicy = new PowerVmAllocationPolicyMigrationStaticThreshold( hostList, vmSelectionPolicy, 0.7); vmAllocationPolicy = new PowerVmAllocationPolicyMigrationInterQuartileRange( hostList, vmSelectionPolicy, parameter, fallbackVmSelectionPolicy); } else if (vmAllocationPolicyName.equals("mad")) { PowerVmAllocationPolicyMigrationAbstract fallbackVmSelectionPolicy = new PowerVmAllocationPolicyMigrationStaticThreshold( hostList, vmSelectionPolicy, 0.7); vmAllocationPolicy = new PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation( hostList, vmSelectionPolicy, parameter, fallbackVmSelectionPolicy); } else if (vmAllocationPolicyName.equals("lr")) { PowerVmAllocationPolicyMigrationAbstract fallbackVmSelectionPolicy = new PowerVmAllocationPolicyMigrationStaticThreshold( hostList, vmSelectionPolicy, 0.7); vmAllocationPolicy = new PowerVmAllocationPolicyMigrationLocalRegression( hostList, vmSelectionPolicy, parameter, Constants.SCHEDULING_INTERVAL, fallbackVmSelectionPolicy); } else if (vmAllocationPolicyName.equals("lrr")) { PowerVmAllocationPolicyMigrationAbstract fallbackVmSelectionPolicy = new PowerVmAllocationPolicyMigrationStaticThreshold( hostList, vmSelectionPolicy, 0.7); vmAllocationPolicy = new PowerVmAllocationPolicyMigrationLocalRegressionRobust( hostList, vmSelectionPolicy, parameter, Constants.SCHEDULING_INTERVAL, fallbackVmSelectionPolicy); } else if (vmAllocationPolicyName.equals("thr")) { vmAllocationPolicy = new PowerVmAllocationPolicyMigrationStaticThreshold( hostList, vmSelectionPolicy, parameter); } else if (vmAllocationPolicyName.equals("openstack")) { vmAllocationPolicy = new PowerVmAllocationPolicySimple(hostList); } else { System.out.println("Unknown VM allocation policy: " + vmAllocationPolicyName); System.exit(0); } return vmAllocationPolicy; }
VmAllocationPolicy function( String vmAllocationPolicyName, String vmSelectionPolicyName, String parameterName) { VmAllocationPolicy vmAllocationPolicy = null; PowerVmSelectionPolicy vmSelectionPolicy = null; if (!vmSelectionPolicyName.isEmpty()) { vmSelectionPolicy = getVmSelectionPolicy(vmSelectionPolicyName); } double parameter = 0; if (!parameterName.isEmpty()) { parameter = Double.valueOf(parameterName); } if (vmAllocationPolicyName.equals("iqr")) { PowerVmAllocationPolicyMigrationAbstract fallbackVmSelectionPolicy = new PowerVmAllocationPolicyMigrationStaticThreshold( hostList, vmSelectionPolicy, 0.7); vmAllocationPolicy = new PowerVmAllocationPolicyMigrationInterQuartileRange( hostList, vmSelectionPolicy, parameter, fallbackVmSelectionPolicy); } else if (vmAllocationPolicyName.equals("mad")) { PowerVmAllocationPolicyMigrationAbstract fallbackVmSelectionPolicy = new PowerVmAllocationPolicyMigrationStaticThreshold( hostList, vmSelectionPolicy, 0.7); vmAllocationPolicy = new PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation( hostList, vmSelectionPolicy, parameter, fallbackVmSelectionPolicy); } else if (vmAllocationPolicyName.equals("lr")) { PowerVmAllocationPolicyMigrationAbstract fallbackVmSelectionPolicy = new PowerVmAllocationPolicyMigrationStaticThreshold( hostList, vmSelectionPolicy, 0.7); vmAllocationPolicy = new PowerVmAllocationPolicyMigrationLocalRegression( hostList, vmSelectionPolicy, parameter, Constants.SCHEDULING_INTERVAL, fallbackVmSelectionPolicy); } else if (vmAllocationPolicyName.equals("lrr")) { PowerVmAllocationPolicyMigrationAbstract fallbackVmSelectionPolicy = new PowerVmAllocationPolicyMigrationStaticThreshold( hostList, vmSelectionPolicy, 0.7); vmAllocationPolicy = new PowerVmAllocationPolicyMigrationLocalRegressionRobust( hostList, vmSelectionPolicy, parameter, Constants.SCHEDULING_INTERVAL, fallbackVmSelectionPolicy); } else if (vmAllocationPolicyName.equals("thr")) { vmAllocationPolicy = new PowerVmAllocationPolicyMigrationStaticThreshold( hostList, vmSelectionPolicy, parameter); } else if (vmAllocationPolicyName.equals(STR)) { vmAllocationPolicy = new PowerVmAllocationPolicySimple(hostList); } else { System.out.println(STR + vmAllocationPolicyName); System.exit(0); } return vmAllocationPolicy; }
/** * Gets the vm allocation policy. * * @param vmAllocationPolicyName the vm allocation policy name * @param vmSelectionPolicyName the vm selection policy name * @param parameterName the parameter name * @return the vm allocation policy */
Gets the vm allocation policy
getVmAllocationPolicy
{ "repo_name": "Sukoon-Sharma/OpenSim", "path": "src/org/opensim/storage/RunnerAbstract.java", "license": "lgpl-3.0", "size": 11097 }
[ "org.cloudbus.cloudsim.VmAllocationPolicy", "org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationAbstract", "org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationInterQuartileRange", "org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression", "org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust", "org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation", "org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationStaticThreshold", "org.cloudbus.cloudsim.power.PowerVmAllocationPolicySimple", "org.cloudbus.cloudsim.power.PowerVmSelectionPolicy" ]
import org.cloudbus.cloudsim.VmAllocationPolicy; import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationAbstract; import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationInterQuartileRange; import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression; import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust; import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation; import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationStaticThreshold; import org.cloudbus.cloudsim.power.PowerVmAllocationPolicySimple; import org.cloudbus.cloudsim.power.PowerVmSelectionPolicy;
import org.cloudbus.cloudsim.*; import org.cloudbus.cloudsim.power.*;
[ "org.cloudbus.cloudsim" ]
org.cloudbus.cloudsim;
777,701
public void deleteRosterItem(String username, String itemJID) throws UserNotFoundException, SharedGroupException { getUser(username); Roster r = rosterManager.getRoster(username); JID j = new JID(itemJID); // No roster item is found. Uncomment the following line to throw // UserNotFoundException. // r.getRosterItem(j); r.deleteRosterItem(j, true); }
void function(String username, String itemJID) throws UserNotFoundException, SharedGroupException { getUser(username); Roster r = rosterManager.getRoster(username); JID j = new JID(itemJID); r.deleteRosterItem(j, true); }
/** * Delete roster item for specified user. No error returns if nothing to * delete. * * @param username * the username of the local user to add roster item to. * @param itemJID * the JID of the roster item to be deleted. * @throws UserNotFoundException * if the user does not exist in the local server. * @throws SharedGroupException * if roster item cannot be deleted from a shared group. */
Delete roster item for specified user. No error returns if nothing to delete
deleteRosterItem
{ "repo_name": "zhouluoyang/openfire", "path": "src/plugins/userservice/src/java/org/jivesoftware/openfire/plugin/UserServicePlugin.java", "license": "apache-2.0", "size": 16509 }
[ "org.jivesoftware.openfire.SharedGroupException", "org.jivesoftware.openfire.roster.Roster", "org.jivesoftware.openfire.user.UserNotFoundException" ]
import org.jivesoftware.openfire.SharedGroupException; import org.jivesoftware.openfire.roster.Roster; import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.openfire.*; import org.jivesoftware.openfire.roster.*; import org.jivesoftware.openfire.user.*;
[ "org.jivesoftware.openfire" ]
org.jivesoftware.openfire;
1,527,999
ObjectCreationExpr withType(QualifiedType type);
ObjectCreationExpr withType(QualifiedType type);
/** * Replaces the type of this object creation expression. * * @param type the replacement for the type of this object creation expression. * @return the resulting mutated object creation expression. */
Replaces the type of this object creation expression
withType
{ "repo_name": "ptitjes/jlato", "path": "src/main/java/org/jlato/tree/expr/ObjectCreationExpr.java", "license": "lgpl-3.0", "size": 5690 }
[ "org.jlato.tree.type.QualifiedType" ]
import org.jlato.tree.type.QualifiedType;
import org.jlato.tree.type.*;
[ "org.jlato.tree" ]
org.jlato.tree;
193,105
public List calculateLevelTotal(List<BudgetConstructionMonthSummary> bcmsList, Collection<BudgetConstructionMonthSummary> monthSummaryList) { List returnList = new ArrayList(); Integer levelAccountLineAnnualBalanceAmount = new Integer(0); Integer levelMonth1LineAmount = new Integer(0); Integer levelMonth2LineAmount = new Integer(0); Integer levelMonth3LineAmount = new Integer(0); Integer levelMonth4LineAmount = new Integer(0); Integer levelMonth5LineAmount = new Integer(0); Integer levelMonth6LineAmount = new Integer(0); Integer levelMonth7LineAmount = new Integer(0); Integer levelMonth8LineAmount = new Integer(0); Integer levelMonth9LineAmount = new Integer(0); Integer levelMonth10LineAmount = new Integer(0); Integer levelMonth11LineAmount = new Integer(0); Integer levelMonth12LineAmount = new Integer(0); List<BudgetConstructionMonthSummary> listForCalculateLevel = BudgetConstructionReportHelper.deleteDuplicated((List) monthSummaryList, fieldsForLevel()); for (BudgetConstructionMonthSummary levelEntry : listForCalculateLevel) { BudgetConstructionOrgMonthSummaryReportTotal bcMonthTotal = new BudgetConstructionOrgMonthSummaryReportTotal(); for (BudgetConstructionMonthSummary bcmsListEntry : bcmsList) { if (BudgetConstructionReportHelper.isSameEntry(levelEntry, bcmsListEntry, fieldsForLevel())) { levelAccountLineAnnualBalanceAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getAccountLineAnnualBalanceAmount()); levelMonth1LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth1LineAmount()); levelMonth2LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth2LineAmount()); levelMonth3LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth3LineAmount()); levelMonth4LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth4LineAmount()); levelMonth5LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth5LineAmount()); levelMonth6LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth6LineAmount()); levelMonth7LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth7LineAmount()); levelMonth8LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth8LineAmount()); levelMonth9LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth9LineAmount()); levelMonth10LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth10LineAmount()); levelMonth11LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth11LineAmount()); levelMonth12LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth12LineAmount()); } } bcMonthTotal.setBudgetConstructionMonthSummary(levelEntry); bcMonthTotal.setLevelAccountLineAnnualBalanceAmount(levelAccountLineAnnualBalanceAmount); bcMonthTotal.setLevelMonth1LineAmount(levelMonth1LineAmount); bcMonthTotal.setLevelMonth2LineAmount(levelMonth2LineAmount); bcMonthTotal.setLevelMonth3LineAmount(levelMonth3LineAmount); bcMonthTotal.setLevelMonth4LineAmount(levelMonth4LineAmount); bcMonthTotal.setLevelMonth5LineAmount(levelMonth5LineAmount); bcMonthTotal.setLevelMonth6LineAmount(levelMonth6LineAmount); bcMonthTotal.setLevelMonth7LineAmount(levelMonth7LineAmount); bcMonthTotal.setLevelMonth8LineAmount(levelMonth8LineAmount); bcMonthTotal.setLevelMonth9LineAmount(levelMonth9LineAmount); bcMonthTotal.setLevelMonth10LineAmount(levelMonth10LineAmount); bcMonthTotal.setLevelMonth11LineAmount(levelMonth11LineAmount); bcMonthTotal.setLevelMonth12LineAmount(levelMonth12LineAmount); returnList.add(bcMonthTotal); levelAccountLineAnnualBalanceAmount = new Integer(0); levelMonth1LineAmount = new Integer(0); levelMonth2LineAmount = new Integer(0); levelMonth3LineAmount = new Integer(0); levelMonth4LineAmount = new Integer(0); levelMonth5LineAmount = new Integer(0); levelMonth6LineAmount = new Integer(0); levelMonth7LineAmount = new Integer(0); levelMonth8LineAmount = new Integer(0); levelMonth9LineAmount = new Integer(0); levelMonth10LineAmount = new Integer(0); levelMonth11LineAmount = new Integer(0); levelMonth12LineAmount = new Integer(0); } return returnList; }
List function(List<BudgetConstructionMonthSummary> bcmsList, Collection<BudgetConstructionMonthSummary> monthSummaryList) { List returnList = new ArrayList(); Integer levelAccountLineAnnualBalanceAmount = new Integer(0); Integer levelMonth1LineAmount = new Integer(0); Integer levelMonth2LineAmount = new Integer(0); Integer levelMonth3LineAmount = new Integer(0); Integer levelMonth4LineAmount = new Integer(0); Integer levelMonth5LineAmount = new Integer(0); Integer levelMonth6LineAmount = new Integer(0); Integer levelMonth7LineAmount = new Integer(0); Integer levelMonth8LineAmount = new Integer(0); Integer levelMonth9LineAmount = new Integer(0); Integer levelMonth10LineAmount = new Integer(0); Integer levelMonth11LineAmount = new Integer(0); Integer levelMonth12LineAmount = new Integer(0); List<BudgetConstructionMonthSummary> listForCalculateLevel = BudgetConstructionReportHelper.deleteDuplicated((List) monthSummaryList, fieldsForLevel()); for (BudgetConstructionMonthSummary levelEntry : listForCalculateLevel) { BudgetConstructionOrgMonthSummaryReportTotal bcMonthTotal = new BudgetConstructionOrgMonthSummaryReportTotal(); for (BudgetConstructionMonthSummary bcmsListEntry : bcmsList) { if (BudgetConstructionReportHelper.isSameEntry(levelEntry, bcmsListEntry, fieldsForLevel())) { levelAccountLineAnnualBalanceAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getAccountLineAnnualBalanceAmount()); levelMonth1LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth1LineAmount()); levelMonth2LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth2LineAmount()); levelMonth3LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth3LineAmount()); levelMonth4LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth4LineAmount()); levelMonth5LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth5LineAmount()); levelMonth6LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth6LineAmount()); levelMonth7LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth7LineAmount()); levelMonth8LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth8LineAmount()); levelMonth9LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth9LineAmount()); levelMonth10LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth10LineAmount()); levelMonth11LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth11LineAmount()); levelMonth12LineAmount += BudgetConstructionReportHelper.convertKualiInteger(bcmsListEntry.getFinancialDocumentMonth12LineAmount()); } } bcMonthTotal.setBudgetConstructionMonthSummary(levelEntry); bcMonthTotal.setLevelAccountLineAnnualBalanceAmount(levelAccountLineAnnualBalanceAmount); bcMonthTotal.setLevelMonth1LineAmount(levelMonth1LineAmount); bcMonthTotal.setLevelMonth2LineAmount(levelMonth2LineAmount); bcMonthTotal.setLevelMonth3LineAmount(levelMonth3LineAmount); bcMonthTotal.setLevelMonth4LineAmount(levelMonth4LineAmount); bcMonthTotal.setLevelMonth5LineAmount(levelMonth5LineAmount); bcMonthTotal.setLevelMonth6LineAmount(levelMonth6LineAmount); bcMonthTotal.setLevelMonth7LineAmount(levelMonth7LineAmount); bcMonthTotal.setLevelMonth8LineAmount(levelMonth8LineAmount); bcMonthTotal.setLevelMonth9LineAmount(levelMonth9LineAmount); bcMonthTotal.setLevelMonth10LineAmount(levelMonth10LineAmount); bcMonthTotal.setLevelMonth11LineAmount(levelMonth11LineAmount); bcMonthTotal.setLevelMonth12LineAmount(levelMonth12LineAmount); returnList.add(bcMonthTotal); levelAccountLineAnnualBalanceAmount = new Integer(0); levelMonth1LineAmount = new Integer(0); levelMonth2LineAmount = new Integer(0); levelMonth3LineAmount = new Integer(0); levelMonth4LineAmount = new Integer(0); levelMonth5LineAmount = new Integer(0); levelMonth6LineAmount = new Integer(0); levelMonth7LineAmount = new Integer(0); levelMonth8LineAmount = new Integer(0); levelMonth9LineAmount = new Integer(0); levelMonth10LineAmount = new Integer(0); levelMonth11LineAmount = new Integer(0); levelMonth12LineAmount = new Integer(0); } return returnList; }
/** * calculates total part of level * * @param bcmsList * @param monthSummaryList * @return */
calculates total part of level
calculateLevelTotal
{ "repo_name": "ua-eas/kfs-devops-automation-fork", "path": "kfs-bc/src/main/java/org/kuali/kfs/module/bc/document/service/impl/BudgetConstructionMonthSummaryReportServiceImpl.java", "license": "agpl-3.0", "size": 54445 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.List", "org.kuali.kfs.module.bc.businessobject.BudgetConstructionMonthSummary", "org.kuali.kfs.module.bc.businessobject.BudgetConstructionOrgMonthSummaryReportTotal", "org.kuali.kfs.module.bc.report.BudgetConstructionReportHelper" ]
import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.kuali.kfs.module.bc.businessobject.BudgetConstructionMonthSummary; import org.kuali.kfs.module.bc.businessobject.BudgetConstructionOrgMonthSummaryReportTotal; import org.kuali.kfs.module.bc.report.BudgetConstructionReportHelper;
import java.util.*; import org.kuali.kfs.module.bc.businessobject.*; import org.kuali.kfs.module.bc.report.*;
[ "java.util", "org.kuali.kfs" ]
java.util; org.kuali.kfs;
2,911,419
public Notification createNotification(int icon, CharSequence title, CharSequence message) { return new NotificationCompat.Builder(mContext, NOTIFICATION_CHANNEL_ID) .setSmallIcon(icon) .setContentTitle(title) .setContentText(message) .setContentIntent(mContentIntent) .setOnlyAlertOnce(true) .build(); }
Notification function(int icon, CharSequence title, CharSequence message) { return new NotificationCompat.Builder(mContext, NOTIFICATION_CHANNEL_ID) .setSmallIcon(icon) .setContentTitle(title) .setContentText(message) .setContentIntent(mContentIntent) .setOnlyAlertOnce(true) .build(); }
/** * Create new foreground service notification instance. * @param icon Notification small icon ID. * @param title Title character sequence. * @param message Message character sequence. * @return New Android foreground service notification instance. */
Create new foreground service notification instance
createNotification
{ "repo_name": "heremaps/here-android-sdk-examples", "path": "positioning-on-background/app/src/main/java/com/here/android/example/backgroundpositioningexample/NotificationUtils.java", "license": "apache-2.0", "size": 4514 }
[ "android.app.Notification", "androidx.core.app.NotificationCompat" ]
import android.app.Notification; import androidx.core.app.NotificationCompat;
import android.app.*; import androidx.core.app.*;
[ "android.app", "androidx.core" ]
android.app; androidx.core;
2,660,405
public synchronized String startNode(Settings.Builder settings) { return startNode(settings.build()); }
synchronized String function(Settings.Builder settings) { return startNode(settings.build()); }
/** * Starts a node with the given settings builder and returns it's name. */
Starts a node with the given settings builder and returns it's name
startNode
{ "repo_name": "danielmitterdorfer/elasticsearch", "path": "test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java", "license": "apache-2.0", "size": 87129 }
[ "org.elasticsearch.common.settings.Settings" ]
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
1,576,634
@Pure SarlInterface getSarlInterface();
SarlInterface getSarlInterface();
/** Replies the generated SarlInterface. */
Replies the generated SarlInterface
getSarlInterface
{ "repo_name": "sarl/sarl", "path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/ISarlInterfaceBuilder.java", "license": "apache-2.0", "size": 4892 }
[ "io.sarl.lang.sarl.SarlInterface" ]
import io.sarl.lang.sarl.SarlInterface;
import io.sarl.lang.sarl.*;
[ "io.sarl.lang" ]
io.sarl.lang;
1,767,690
public List<Item> getAllMembers() { Set<Item> allMembers = new HashSet<>(); collectMembers(allMembers, members); return new ArrayList<>(allMembers); }
List<Item> function() { Set<Item> allMembers = new HashSet<>(); collectMembers(allMembers, members); return new ArrayList<>(allMembers); }
/** * Returns the direct members of this {@link GroupItem} and recursively all * members of the potentially contained {@link GroupItem}s as well. The * {@link GroupItem}s itself aren't contained. The returned items are unique. * * @return all members of this and all contained {@link GroupItem}s */
Returns the direct members of this <code>GroupItem</code> and recursively all members of the potentially contained <code>GroupItem</code>s as well. The <code>GroupItem</code>s itself aren't contained. The returned items are unique
getAllMembers
{ "repo_name": "computergeek1507/openhab", "path": "bundles/api/org.openhab.core1/src/main/java/org/openhab/core/items/GroupItem.java", "license": "epl-1.0", "size": 7633 }
[ "java.util.ArrayList", "java.util.HashSet", "java.util.List", "java.util.Set" ]
import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,310,196
@Test public void testCanBeSubsumed() throws Exception { // Forced checkpoints cannot be subsumed CheckpointProperties forced = new CheckpointProperties(true, CheckpointType.SAVEPOINT, false, false, false, false, false); PendingCheckpoint pending = createPendingCheckpoint(forced); assertFalse(pending.canBeSubsumed()); try { pending.abort(CheckpointFailureReason.CHECKPOINT_SUBSUMED); fail("Did not throw expected Exception"); } catch (IllegalStateException ignored) { // Expected } // Non-forced checkpoints can be subsumed CheckpointProperties subsumed = new CheckpointProperties(false, CheckpointType.SAVEPOINT, false, false, false, false, false); pending = createPendingCheckpoint(subsumed); assertTrue(pending.canBeSubsumed()); }
void function() throws Exception { CheckpointProperties forced = new CheckpointProperties(true, CheckpointType.SAVEPOINT, false, false, false, false, false); PendingCheckpoint pending = createPendingCheckpoint(forced); assertFalse(pending.canBeSubsumed()); try { pending.abort(CheckpointFailureReason.CHECKPOINT_SUBSUMED); fail(STR); } catch (IllegalStateException ignored) { } CheckpointProperties subsumed = new CheckpointProperties(false, CheckpointType.SAVEPOINT, false, false, false, false, false); pending = createPendingCheckpoint(subsumed); assertTrue(pending.canBeSubsumed()); }
/** * Tests that pending checkpoints can be subsumed iff they are forced. */
Tests that pending checkpoints can be subsumed iff they are forced
testCanBeSubsumed
{ "repo_name": "fhueske/flink", "path": "flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/PendingCheckpointTest.java", "license": "apache-2.0", "size": 14179 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,144,769
@Generated @StructureField(order = 2, isGetter = false) public native void setFirstSubtable(int value);
@StructureField(order = 2, isGetter = false) native void function(int value);
/** * first subtable starts here */
first subtable starts here
setFirstSubtable
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/coretext/struct/KerxTableHeader.java", "license": "apache-2.0", "size": 2380 }
[ "org.moe.natj.c.ann.StructureField" ]
import org.moe.natj.c.ann.StructureField;
import org.moe.natj.c.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
262,653