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
void addArtifactToJavaTargetAttribute(JavaTargetAttributes.Builder builder, Artifact srcArtifact);
void addArtifactToJavaTargetAttribute(JavaTargetAttributes.Builder builder, Artifact srcArtifact);
/** * Add a source artifact to a {@link JavaTargetAttributes.Builder}. It is called when a source * artifact is processed but is not matched by default patterns in the {@link * JavaTargetAttributes.Builder#addSourceArtifacts(Iterable)} method. The semantics can then * detect its custom artifact types and add it to the builder. */
Add a source artifact to a <code>JavaTargetAttributes.Builder</code>. It is called when a source artifact is processed but is not matched by default patterns in the <code>JavaTargetAttributes.Builder#addSourceArtifacts(Iterable)</code> method. The semantics can then detect its custom artifact types and add it to the builder
addArtifactToJavaTargetAttribute
{ "repo_name": "cushon/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/java/JavaSemantics.java", "license": "apache-2.0", "size": 23276 }
[ "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.analysis.Runfiles" ]
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.analysis.*;
[ "com.google.devtools" ]
com.google.devtools;
669,645
public MeshPrimitiveBuilder setIntIndicesAsShort(IntBuffer indices) { return setIndicesInternal( GltfConstants.GL_UNSIGNED_SHORT, "SCALAR", Buffers.castToShortByteBuffer(indices)); }
MeshPrimitiveBuilder function(IntBuffer indices) { return setIndicesInternal( GltfConstants.GL_UNSIGNED_SHORT, STR, Buffers.castToShortByteBuffer(indices)); }
/** * Set the given indices as the indices for the mesh primitive. * The indices will be of the type "unsigned short", and be * created by casting the elements of the given buffer to * "short" * * @param indices The indices * @return This builder */
Set the given indices as the indices for the mesh primitive. The indices will be of the type "unsigned short", and be created by casting the elements of the given buffer to "short"
setIntIndicesAsShort
{ "repo_name": "javagl/JglTF", "path": "jgltf-model-builder/src/main/java/de/javagl/jgltf/model/creation/MeshPrimitiveBuilder.java", "license": "mit", "size": 13128 }
[ "de.javagl.jgltf.model.GltfConstants", "de.javagl.jgltf.model.io.Buffers", "java.nio.IntBuffer" ]
import de.javagl.jgltf.model.GltfConstants; import de.javagl.jgltf.model.io.Buffers; import java.nio.IntBuffer;
import de.javagl.jgltf.model.*; import de.javagl.jgltf.model.io.*; import java.nio.*;
[ "de.javagl.jgltf", "java.nio" ]
de.javagl.jgltf; java.nio;
1,240,017
logic = new FilterFieldStringData(CommonFilterConstants.LOGIC_FILTER_VAR, CommonFilterConstants.LOGIC_FILTER_VAR_DESC); filterVars.clear(); filterVars.add(logic); }
logic = new FilterFieldStringData(CommonFilterConstants.LOGIC_FILTER_VAR, CommonFilterConstants.LOGIC_FILTER_VAR_DESC); filterVars.clear(); filterVars.add(logic); }
/** * Reset all of the Field Variables to their default values. */
Reset all of the Field Variables to their default values
resetAllValues
{ "repo_name": "pressgang-ccms/PressGangCCMSQuery", "path": "src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFieldFilter.java", "license": "gpl-3.0", "size": 5558 }
[ "org.jboss.pressgang.ccms.filter.structures.FilterFieldStringData", "org.jboss.pressgang.ccms.utils.constants.CommonFilterConstants" ]
import org.jboss.pressgang.ccms.filter.structures.FilterFieldStringData; import org.jboss.pressgang.ccms.utils.constants.CommonFilterConstants;
import org.jboss.pressgang.ccms.filter.structures.*; import org.jboss.pressgang.ccms.utils.constants.*;
[ "org.jboss.pressgang" ]
org.jboss.pressgang;
573,953
public void setMaxPages(int maxPages) { this.maxPages = maxPages; } private int maxPages = 3; List<List<T>> pages = new ArrayList<>(); private int pageIndex = -10; private final int pageSize; protected LazyList(CountProvider countProvider, int pageSize) { this.countProvider = countProvider; this.pageSize = pageSize; } public LazyList(EntityProvider<T> dataProvider) { this(dataProvider, DEFAULT_PAGE_SIZE); } public LazyList(EntityProvider<T> dataProvider, int pageSize) { this.pageProvider = dataProvider; this.countProvider = dataProvider; this.pageSize = pageSize; } public LazyList(PagingProvider<T> pageProvider, CountProvider countProvider) { this(pageProvider, countProvider, DEFAULT_PAGE_SIZE); } public LazyList(PagingProvider<T> pageProvider, CountProvider countProvider, int pageSize) { this.pageProvider = pageProvider; this.countProvider = countProvider; this.pageSize = pageSize; }
void function(int maxPages) { this.maxPages = maxPages; } private int maxPages = 3; List<List<T>> pages = new ArrayList<>(); private int pageIndex = -10; private final int pageSize; protected LazyList(CountProvider countProvider, int pageSize) { this.countProvider = countProvider; this.pageSize = pageSize; } public LazyList(EntityProvider<T> dataProvider) { this(dataProvider, DEFAULT_PAGE_SIZE); } public LazyList(EntityProvider<T> dataProvider, int pageSize) { this.pageProvider = dataProvider; this.countProvider = dataProvider; this.pageSize = pageSize; } public LazyList(PagingProvider<T> pageProvider, CountProvider countProvider) { this(pageProvider, countProvider, DEFAULT_PAGE_SIZE); } public LazyList(PagingProvider<T> pageProvider, CountProvider countProvider, int pageSize) { this.pageProvider = pageProvider; this.countProvider = countProvider; this.pageSize = pageSize; }
/** * Sets the maximum of pages that are held in memory. By default 3, but it * is adjusted automatically based on requests that are made to the list, * like subList method calls. Most often this shouldn't be called by end * user. * * @param maxPages the number of pages to be held in memory */
Sets the maximum of pages that are held in memory. By default 3, but it is adjusted automatically based on requests that are made to the list, like subList method calls. Most often this shouldn't be called by end user
setMaxPages
{ "repo_name": "pbaris/viritin", "path": "viritin/src/main/java/org/vaadin/viritin/LazyList.java", "license": "apache-2.0", "size": 10803 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,544,641
public Decision<T> ref(String ref) { childNode.attribute("ref", ref); return this; }
Decision<T> function(String ref) { childNode.attribute("ref", ref); return this; }
/** * Sets the <code>ref</code> attribute * @param ref the value for the attribute <code>ref</code> * @return the current instance of <code>Decision<T></code> */
Sets the <code>ref</code> attribute
ref
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/jobXML10/DecisionImpl.java", "license": "epl-1.0", "size": 12564 }
[ "org.jboss.shrinkwrap.descriptor.api.jobXML10.Decision" ]
import org.jboss.shrinkwrap.descriptor.api.jobXML10.Decision;
import org.jboss.shrinkwrap.descriptor.api.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
1,973,249
@Test public void testFailedAppendBlockRejection() throws Exception { Configuration conf = new HdfsConfiguration(); conf.set("dfs.client.block.write.replace-datanode-on-failure.enable", "false"); File builderBaseDir = new File(GenericTestUtils.getRandomizedTempPath()); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf, builderBaseDir) .numDataNodes(3).build(); DistributedFileSystem fs = null; try { fs = cluster.getFileSystem(); Path path = new Path("/test"); FSDataOutputStream out = fs.create(path); out.writeBytes("hello\n"); out.close(); // stop one datanode DataNodeProperties dnProp = cluster.stopDataNode(0); String dnAddress = dnProp.datanode.getXferAddress().toString(); if (dnAddress.startsWith("/")) { dnAddress = dnAddress.substring(1); } // append again to bump genstamps for (int i = 0; i < 2; i++) { out = fs.append(path); out.writeBytes("helloagain\n"); out.close(); } // re-open and make the block state as underconstruction out = fs.append(path); cluster.restartDataNode(dnProp, true); // wait till the block report comes Thread.sleep(2000); // check the block locations, this should not contain restarted datanode BlockLocation[] locations = fs.getFileBlockLocations(path, 0, Long.MAX_VALUE); String[] names = locations[0].getNames(); for (String node : names) { if (node.equals(dnAddress)) { fail("Failed append should not be present in latest block locations."); } } out.close(); } finally { IOUtils.closeStream(fs); cluster.shutdown(); } }
void function() throws Exception { Configuration conf = new HdfsConfiguration(); conf.set(STR, "false"); File builderBaseDir = new File(GenericTestUtils.getRandomizedTempPath()); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf, builderBaseDir) .numDataNodes(3).build(); DistributedFileSystem fs = null; try { fs = cluster.getFileSystem(); Path path = new Path("/test"); FSDataOutputStream out = fs.create(path); out.writeBytes(STR); out.close(); DataNodeProperties dnProp = cluster.stopDataNode(0); String dnAddress = dnProp.datanode.getXferAddress().toString(); if (dnAddress.startsWith("/")) { dnAddress = dnAddress.substring(1); } for (int i = 0; i < 2; i++) { out = fs.append(path); out.writeBytes(STR); out.close(); } out = fs.append(path); cluster.restartDataNode(dnProp, true); Thread.sleep(2000); BlockLocation[] locations = fs.getFileBlockLocations(path, 0, Long.MAX_VALUE); String[] names = locations[0].getNames(); for (String node : names) { if (node.equals(dnAddress)) { fail(STR); } } out.close(); } finally { IOUtils.closeStream(fs); cluster.shutdown(); } }
/** * Old replica of the block should not be accepted as valid for append/read */
Old replica of the block should not be accepted as valid for append/read
testFailedAppendBlockRejection
{ "repo_name": "apurtell/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestFileAppend.java", "license": "apache-2.0", "size": 27756 }
[ "java.io.File", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.BlockLocation", "org.apache.hadoop.fs.FSDataOutputStream", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hdfs.MiniDFSCluster", "org.apache.hadoop.io.IOUtils", "org.apache.hadoop.test.GenericTestUtils", "org.junit.Assert" ]
import java.io.File; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.BlockLocation; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.test.GenericTestUtils; import org.junit.Assert;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.io.*; import org.apache.hadoop.test.*; import org.junit.*;
[ "java.io", "org.apache.hadoop", "org.junit" ]
java.io; org.apache.hadoop; org.junit;
2,119,708
@Override public void store(PrintWriter aWriter, int indent, Object aElement) throws Exception { StoreDescription elementDesc = getRegistry().findDescription( aElement.getClass()); if (elementDesc != null) { if (log.isDebugEnabled()) log.debug(sm.getString("factory.storeTag", elementDesc.getTag(), aElement)); getStoreAppender().printIndent(aWriter, indent + 2); if (!elementDesc.isChildren()) { getStoreAppender().printTag(aWriter, indent, aElement, elementDesc); } else { getStoreAppender().printOpenTag(aWriter, indent + 2, aElement, elementDesc); storeChildren(aWriter, indent + 2, aElement, elementDesc); getStoreAppender().printIndent(aWriter, indent + 2); getStoreAppender().printCloseTag(aWriter, elementDesc); } } else log.warn(sm.getString("factory.storeNoDescriptor", aElement .getClass())); }
void function(PrintWriter aWriter, int indent, Object aElement) throws Exception { StoreDescription elementDesc = getRegistry().findDescription( aElement.getClass()); if (elementDesc != null) { if (log.isDebugEnabled()) log.debug(sm.getString(STR, elementDesc.getTag(), aElement)); getStoreAppender().printIndent(aWriter, indent + 2); if (!elementDesc.isChildren()) { getStoreAppender().printTag(aWriter, indent, aElement, elementDesc); } else { getStoreAppender().printOpenTag(aWriter, indent + 2, aElement, elementDesc); storeChildren(aWriter, indent + 2, aElement, elementDesc); getStoreAppender().printIndent(aWriter, indent + 2); getStoreAppender().printCloseTag(aWriter, elementDesc); } } else log.warn(sm.getString(STR, aElement .getClass())); }
/** * Store a server.xml element with attributes and children * * @see org.apache.catalina.storeconfig.IStoreFactory#store(java.io.PrintWriter, * int, java.lang.Object) */
Store a server.xml element with attributes and children
store
{ "repo_name": "IAMTJW/Tomcat-8.5.20", "path": "tomcat-8.5.20/java/org/apache/catalina/storeconfig/StoreFactoryBase.java", "license": "apache-2.0", "size": 6857 }
[ "java.io.PrintWriter" ]
import java.io.PrintWriter;
import java.io.*;
[ "java.io" ]
java.io;
2,297,422
public static Date parseRFC822(String sDate) { int utIndex = sDate.indexOf(" UT"); //$NON-NLS-1$ if (utIndex > -1) { String pre = sDate.substring(0, utIndex); String post = sDate.substring(utIndex + 3); sDate = pre + " GMT" + post; //$NON-NLS-1$ } return parseUsingMask(RFC822_MASKS, sDate); }
static Date function(String sDate) { int utIndex = sDate.indexOf(STR); if (utIndex > -1) { String pre = sDate.substring(0, utIndex); String post = sDate.substring(utIndex + 3); sDate = pre + STR + post; } return parseUsingMask(RFC822_MASKS, sDate); }
/** * Parses a Date out of a String with a date in RFC822 format. * <p/> * It parsers the following formats: * <ul> * <li>"EEE, dd MMM yyyy HH:mm:ss z"</li> * <li>"EEE, dd MMM yyyy HH:mm z"</li> * <li>"EEE, dd MMM yy HH:mm:ss z"</li> * <li>"EEE, dd MMM yy HH:mm z"</li> * <li>"dd MMM yyyy HH:mm:ss z"</li> * <li>"dd MMM yyyy HH:mm z"</li> * <li>"dd MMM yy HH:mm:ss z"</li> * <li>"dd MMM yy HH:mm z"</li> * </ul> * <p/> * Refer to the java.text.SimpleDateFormat javadocs for details on the format of each element. * <p/> * @param sDate string to parse for a date. * @return the Date represented by the given RFC822 string. * It returns <b>null</b> if it was not possible to parse the given string into a Date. * */
Parses a Date out of a String with a date in RFC822 format. It parsers the following formats: Refer to the java.text.SimpleDateFormat javadocs for details on the format of each element.
parseRFC822
{ "repo_name": "davletd/SimpleNewsWidget", "path": "src/nsb/widget/news/utils/feed/parse/DateParser.java", "license": "gpl-3.0", "size": 10242 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
329,056
public List<Filter> getFilters() { if (filters == null) { filters = new ArrayList<Filter>(); } return filters; }
List<Filter> function() { if (filters == null) { filters = new ArrayList<Filter>(); } return filters; }
/** * Filter specification bean. */
Filter specification bean
getFilters
{ "repo_name": "pnikolakeas/mojo", "path": "mojo-dao/src/main/java/mojo/dao/core/spec/Select.java", "license": "gpl-3.0", "size": 3186 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,108,544
public static Props fromHierarchicalMap(final Map<String, Object> propsMap) { if (propsMap == null) { return null; } final String source = (String) propsMap.get("source"); final Map<String, String> propsParams = (Map<String, String>) propsMap.get("props"); final Map<String, Object> parent = (Map<String, Object>) propsMap.get("parent"); final Props parentProps = fromHierarchicalMap(parent); final Props props = new Props(parentProps, propsParams); props.setSource(source); return props; }
static Props function(final Map<String, Object> propsMap) { if (propsMap == null) { return null; } final String source = (String) propsMap.get(STR); final Map<String, String> propsParams = (Map<String, String>) propsMap.get("props"); final Map<String, Object> parent = (Map<String, Object>) propsMap.get(STR); final Props parentProps = fromHierarchicalMap(parent); final Props props = new Props(parentProps, propsParams); props.setSource(source); return props; }
/** * Convert a hierarchical Map to Prop Object * * @param propsMap a hierarchical Map * @return a new constructed Props Object */
Convert a hierarchical Map to Prop Object
fromHierarchicalMap
{ "repo_name": "HappyRay/azkaban", "path": "az-core/src/main/java/azkaban/utils/PropsUtils.java", "license": "apache-2.0", "size": 16017 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
747,211
protected Shell getShell() { if (addButton == null) { return null; } return addButton.getShell(); }
Shell function() { if (addButton == null) { return null; } return addButton.getShell(); }
/** * Returns this field editor's shell. * <p> * This method is internal to the framework; subclassers should not call * this method. * </p> * * @return the shell */
Returns this field editor's shell. This method is internal to the framework; subclassers should not call this method.
getShell
{ "repo_name": "Delca/CucumberStepsGenerator", "path": "src/cucumberstepswizard/preferences/DefaultStepsEditor.java", "license": "gpl-2.0", "size": 15030 }
[ "org.eclipse.swt.widgets.Shell" ]
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
1,294,629
protected final void disableAllocation(String... indices) { client().admin().indices().prepareUpdateSettings(indices).setSettings(Settings.builder().put( EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none" )).get(); }
final void function(String... indices) { client().admin().indices().prepareUpdateSettings(indices).setSettings(Settings.builder().put( EnableAllocationDecider.INDEX_ROUTING_ALLOCATION_ENABLE_SETTING.getKey(), "none" )).get(); }
/** * Syntactic sugar for disabling allocation for <code>indices</code> */
Syntactic sugar for disabling allocation for <code>indices</code>
disableAllocation
{ "repo_name": "strahanjen/strahanjen.github.io", "path": "elasticsearch-master/test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java", "license": "bsd-3-clause", "size": 100875 }
[ "org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider", "org.elasticsearch.common.settings.Settings" ]
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.cluster.routing.allocation.decider.*; import org.elasticsearch.common.settings.*;
[ "org.elasticsearch.cluster", "org.elasticsearch.common" ]
org.elasticsearch.cluster; org.elasticsearch.common;
1,692,485
@Generated @Selector("setButtonMaskRequired:") public native void setButtonMaskRequired(@NInt long value);
@Selector(STR) native void function(@NInt long value);
/** * Default is UIEventButtonMaskPrimary and cannot be 0. This property is only evaluated on indirect input devices and is the mask of pressed buttons to required to match. */
Default is UIEventButtonMaskPrimary and cannot be 0. This property is only evaluated on indirect input devices and is the mask of pressed buttons to required to match
setButtonMaskRequired
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UITapGestureRecognizer.java", "license": "apache-2.0", "size": 6884 }
[ "org.moe.natj.general.ann.NInt", "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.general.ann.NInt; import org.moe.natj.objc.ann.Selector;
import org.moe.natj.general.ann.*; import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
586,302
protected List<D> mapListOfSourceEntitiesToDestinationEntities(List<S> sourceEntities) { return sourceEntities.stream() .map(this::mapSourceEntityToDestinationEntity) .collect(Collectors.toList()); }
List<D> function(List<S> sourceEntities) { return sourceEntities.stream() .map(this::mapSourceEntityToDestinationEntity) .collect(Collectors.toList()); }
/** * Method maps a list of source entities to destination entities * * @param sourceEntities list of source entities * @return list of destination entities */
Method maps a list of source entities to destination entities
mapListOfSourceEntitiesToDestinationEntities
{ "repo_name": "luisgtz/the-app", "path": "monolithic/service/common/src/main/java/io/github/zutherb/appstash/common/service/AbstractServiceImpl.java", "license": "apache-2.0", "size": 2229 }
[ "java.util.List", "java.util.stream.Collectors" ]
import java.util.List; import java.util.stream.Collectors;
import java.util.*; import java.util.stream.*;
[ "java.util" ]
java.util;
1,116,911
static void fireChannelRead(ChannelHandlerContext ctx, CodecOutputList msgs, int numElements) { for (int i = 0; i < numElements; i ++) { ctx.fireChannelRead(msgs.getUnsafe(i)); } }
static void fireChannelRead(ChannelHandlerContext ctx, CodecOutputList msgs, int numElements) { for (int i = 0; i < numElements; i ++) { ctx.fireChannelRead(msgs.getUnsafe(i)); } }
/** * Get {@code numElements} out of the {@link CodecOutputList} and forward these through the pipeline. */
Get numElements out of the <code>CodecOutputList</code> and forward these through the pipeline
fireChannelRead
{ "repo_name": "netty/netty", "path": "codec/src/main/java/io/netty/handler/codec/ByteToMessageDecoder.java", "license": "apache-2.0", "size": 23604 }
[ "io.netty.channel.ChannelHandlerContext" ]
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.*;
[ "io.netty.channel" ]
io.netty.channel;
2,767,812
@Override public List<String> getComments() { return new ArrayList<>(); }
List<String> function() { return new ArrayList<>(); }
/** * Returns the comments. * * @return always empty */
Returns the comments
getComments
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-weka/src/main/java/adams/ml/data/InstancesView.java", "license": "gpl-3.0", "size": 33044 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,285,011
public FeatureDao getFeatureDao(String tableName);
FeatureDao function(String tableName);
/** * Get a Feature DAO from a table name * * @param tableName * @return */
Get a Feature DAO from a table name
getFeatureDao
{ "repo_name": "boundlessgeo/geopackage-java", "path": "src/main/java/mil/nga/geopackage/GeoPackage.java", "license": "mit", "size": 1264 }
[ "mil.nga.geopackage.features.user.FeatureDao" ]
import mil.nga.geopackage.features.user.FeatureDao;
import mil.nga.geopackage.features.user.*;
[ "mil.nga.geopackage" ]
mil.nga.geopackage;
2,397,161
@SuppressWarnings({"deprecation"}) protected RepoPath calculateRepoPath(String requestPath) throws UnsupportedEncodingException { String repoKey = PathUtils.getFirstPathElement(requestPath); // index where the path to the file or directory starts (i.e., the request path after the repository key) int pathStartIndex; if (NamingUtils.isMetadata(repoKey)) { //Support repository-level metadata requests repoKey = NamingUtils.stripMetadataFromPath(repoKey); pathStartIndex = repoKey.length() + NamingUtils.METADATA_PREFIX.length(); } else if (LIST_BROWSING_PATH.equals(repoKey)) { int repoKeyStartIndex = requestPath.indexOf(LIST_BROWSING_PATH) + LIST_BROWSING_PATH.length() + 1; if (repoKeyStartIndex > requestPath.length()) { repoKeyStartIndex--; // request doesn't end with '/', no repo key } repoKey = PathUtils.getFirstPathElement(requestPath.substring(repoKeyStartIndex)); pathStartIndex = repoKeyStartIndex + repoKey.length() + 1; } else if (ArtifactoryRequest.SIMPLE_BROWSING_PATH.equals(repoKey)) { int repoKeyStartIndex = requestPath.indexOf(SIMPLE_BROWSING_PATH) + SIMPLE_BROWSING_PATH.length() + 1; if (repoKeyStartIndex > requestPath.length()) { repoKeyStartIndex--; // request doesn't end with '/', no repo key } repoKey = PathUtils.getFirstPathElement(requestPath.substring(repoKeyStartIndex)); pathStartIndex = repoKeyStartIndex + repoKey.length() + 1; } else { pathStartIndex = requestPath.startsWith("/") ? repoKey.length() + 2 : repoKey.length() + 1; } //REPO HANDLING //Calculate matrix params on the repo repoKey = processMatrixParamsIfExist(repoKey); repoKey = URLDecoder.decode(repoKey, "UTF-8"); //Test if we need to substitute the targetRepo due to system prop existence String substTargetRepo = ArtifactoryHome.get().getArtifactoryProperties().getSubstituteRepoKeys().get(repoKey); if (substTargetRepo != null) { repoKey = substTargetRepo; } //PATH HANDLING //Strip any trailing '/' boolean endsWithSlash = requestPath.endsWith("/"); int pathEndIndex = endsWithSlash ? requestPath.length() - 1 : requestPath.length(); String path = pathStartIndex < pathEndIndex ? requestPath.substring(pathStartIndex, pathEndIndex) : ""; //Calculate matrix params on the path and return path without matrix params path = processMatrixParamsIfExist(path); path = URLDecoder.decode(path.replace("+", "%2B"), "UTF-8").replace("%2B", "+"); // calculate zip resource path and return path without the zip resource path path = processZipResourcePathIfExist(path); return InfoFactoryHolder.get().createRepoPath(repoKey, path, endsWithSlash); }
@SuppressWarnings({STR}) RepoPath function(String requestPath) throws UnsupportedEncodingException { String repoKey = PathUtils.getFirstPathElement(requestPath); int pathStartIndex; if (NamingUtils.isMetadata(repoKey)) { repoKey = NamingUtils.stripMetadataFromPath(repoKey); pathStartIndex = repoKey.length() + NamingUtils.METADATA_PREFIX.length(); } else if (LIST_BROWSING_PATH.equals(repoKey)) { int repoKeyStartIndex = requestPath.indexOf(LIST_BROWSING_PATH) + LIST_BROWSING_PATH.length() + 1; if (repoKeyStartIndex > requestPath.length()) { repoKeyStartIndex--; } repoKey = PathUtils.getFirstPathElement(requestPath.substring(repoKeyStartIndex)); pathStartIndex = repoKeyStartIndex + repoKey.length() + 1; } else if (ArtifactoryRequest.SIMPLE_BROWSING_PATH.equals(repoKey)) { int repoKeyStartIndex = requestPath.indexOf(SIMPLE_BROWSING_PATH) + SIMPLE_BROWSING_PATH.length() + 1; if (repoKeyStartIndex > requestPath.length()) { repoKeyStartIndex--; } repoKey = PathUtils.getFirstPathElement(requestPath.substring(repoKeyStartIndex)); pathStartIndex = repoKeyStartIndex + repoKey.length() + 1; } else { pathStartIndex = requestPath.startsWith("/") ? repoKey.length() + 2 : repoKey.length() + 1; } repoKey = processMatrixParamsIfExist(repoKey); repoKey = URLDecoder.decode(repoKey, "UTF-8"); String substTargetRepo = ArtifactoryHome.get().getArtifactoryProperties().getSubstituteRepoKeys().get(repoKey); if (substTargetRepo != null) { repoKey = substTargetRepo; } boolean endsWithSlash = requestPath.endsWith("/"); int pathEndIndex = endsWithSlash ? requestPath.length() - 1 : requestPath.length(); String path = pathStartIndex < pathEndIndex ? requestPath.substring(pathStartIndex, pathEndIndex) : STR+STR%2BSTRUTF-8STR%2BSTR+"); path = processZipResourcePathIfExist(path); return InfoFactoryHolder.get().createRepoPath(repoKey, path, endsWithSlash); }
/** * Decodes and calculates a repoPath based on the given servlet path (path after the context root, including the * repo prefix). */
Decodes and calculates a repoPath based on the given servlet path (path after the context root, including the repo prefix)
calculateRepoPath
{ "repo_name": "alancnet/artifactory", "path": "base/api/src/main/java/org/artifactory/api/request/ArtifactoryRequestBase.java", "license": "apache-2.0", "size": 12886 }
[ "java.io.UnsupportedEncodingException", "java.net.URLDecoder", "org.artifactory.common.ArtifactoryHome", "org.artifactory.factory.InfoFactoryHolder", "org.artifactory.mime.NamingUtils", "org.artifactory.repo.RepoPath", "org.artifactory.request.ArtifactoryRequest", "org.artifactory.util.PathUtils" ]
import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import org.artifactory.common.ArtifactoryHome; import org.artifactory.factory.InfoFactoryHolder; import org.artifactory.mime.NamingUtils; import org.artifactory.repo.RepoPath; import org.artifactory.request.ArtifactoryRequest; import org.artifactory.util.PathUtils;
import java.io.*; import java.net.*; import org.artifactory.common.*; import org.artifactory.factory.*; import org.artifactory.mime.*; import org.artifactory.repo.*; import org.artifactory.request.*; import org.artifactory.util.*;
[ "java.io", "java.net", "org.artifactory.common", "org.artifactory.factory", "org.artifactory.mime", "org.artifactory.repo", "org.artifactory.request", "org.artifactory.util" ]
java.io; java.net; org.artifactory.common; org.artifactory.factory; org.artifactory.mime; org.artifactory.repo; org.artifactory.request; org.artifactory.util;
2,557,480
public String prepareAndGetMetadata( Collection<String> patterns, String offset, OptionsProvider options) throws AbruptExitException, InterruptedException { return buildDriver.meta(ImmutableList.of(getUniverseKey(patterns, offset)), options); }
String function( Collection<String> patterns, String offset, OptionsProvider options) throws AbruptExitException, InterruptedException { return buildDriver.meta(ImmutableList.of(getUniverseKey(patterns, offset)), options); }
/** * Get metadata related to the prepareAndGet() lookup. Resulting data is specific to the * underlying evaluation implementation. */
Get metadata related to the prepareAndGet() lookup. Resulting data is specific to the underlying evaluation implementation
prepareAndGetMetadata
{ "repo_name": "werkt/bazel", "path": "src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java", "license": "apache-2.0", "size": 135591 }
[ "com.google.common.collect.ImmutableList", "com.google.devtools.build.lib.util.AbruptExitException", "com.google.devtools.common.options.OptionsProvider", "java.util.Collection" ]
import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.util.AbruptExitException; import com.google.devtools.common.options.OptionsProvider; import java.util.Collection;
import com.google.common.collect.*; import com.google.devtools.build.lib.util.*; import com.google.devtools.common.options.*; import java.util.*;
[ "com.google.common", "com.google.devtools", "java.util" ]
com.google.common; com.google.devtools; java.util;
571,994
@Test public void testSetArrayList() throws Exception { beanUtilsBean.setProperty(bean, "arrayList", newList); final Object value = bean.getArrayList(); assertEquals("Type is different", newList.getClass(), value.getClass()); final List<?> list = (List<?>)value; assertEquals("List size is different", newList.size(), list.size()); for (int i = 0; i < list.size(); i++) { assertEquals("Element " + i + " is different", newList.get(i), list.get(i)); } }
void function() throws Exception { beanUtilsBean.setProperty(bean, STR, newList); final Object value = bean.getArrayList(); assertEquals(STR, newList.getClass(), value.getClass()); final List<?> list = (List<?>)value; assertEquals(STR, newList.size(), list.size()); for (int i = 0; i < list.size(); i++) { assertEquals(STR + i + STR, newList.get(i), list.get(i)); } }
/** * Test setting an ArrayList property */
Test setting an ArrayList property
testSetArrayList
{ "repo_name": "apache/commons-beanutils", "path": "src/test/java/org/apache/commons/beanutils2/IndexedPropertyTestCase.java", "license": "apache-2.0", "size": 15948 }
[ "java.util.List", "org.junit.Assert" ]
import java.util.List; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
739,331
public static void startTenantFlow(String tenantDomain) { String tenantDomainParam = tenantDomain; int tenantId = MultitenantConstants.SUPER_TENANT_ID; if (tenantDomainParam != null && !tenantDomainParam.trim().isEmpty()) { try { tenantId = FrameworkServiceComponent.getRealmService().getTenantManager() .getTenantId(tenantDomain); } catch (UserStoreException e) { log.error("Error while getting tenantId from tenantDomain query param", e); } } else { tenantDomainParam = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext .getThreadLocalCarbonContext(); carbonContext.setTenantId(tenantId); carbonContext.setTenantDomain(tenantDomainParam); }
static void function(String tenantDomain) { String tenantDomainParam = tenantDomain; int tenantId = MultitenantConstants.SUPER_TENANT_ID; if (tenantDomainParam != null && !tenantDomainParam.trim().isEmpty()) { try { tenantId = FrameworkServiceComponent.getRealmService().getTenantManager() .getTenantId(tenantDomain); } catch (UserStoreException e) { log.error(STR, e); } } else { tenantDomainParam = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext .getThreadLocalCarbonContext(); carbonContext.setTenantId(tenantId); carbonContext.setTenantDomain(tenantDomainParam); }
/** * Starts the tenant flow for the given tenant domain * * @param tenantDomain tenant domain */
Starts the tenant flow for the given tenant domain
startTenantFlow
{ "repo_name": "dharshanaw/carbon-identity-framework", "path": "components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java", "license": "apache-2.0", "size": 55252 }
[ "org.wso2.carbon.context.PrivilegedCarbonContext", "org.wso2.carbon.identity.application.authentication.framework.internal.FrameworkServiceComponent", "org.wso2.carbon.user.api.UserStoreException", "org.wso2.carbon.utils.multitenancy.MultitenantConstants" ]
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.application.authentication.framework.internal.FrameworkServiceComponent; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import org.wso2.carbon.context.*; import org.wso2.carbon.identity.application.authentication.framework.internal.*; import org.wso2.carbon.user.api.*; import org.wso2.carbon.utils.multitenancy.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,545,993
File f = new File(s); addFile(f); }
File f = new File(s); addFile(f); }
/** * Adds the file represented by the given String to the classpath. * * @param s * - a file, represented as a String * @throws IOException * if there are any problems injecting. */
Adds the file represented by the given String to the classpath
addFile
{ "repo_name": "TechShroom/EmergencyLanding", "path": "src/main/java/com/techshroom/emergencylanding/library/util/ClassPathHack.java", "license": "mit", "size": 3150 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
806,602
public void setValue(Object value) { if (value instanceof Number) { super.setValue(NumberUtils.convertNumberToTargetClass((Number) value, this.numberClass)); } else { super.setValue(value); } }
void function(Object value) { if (value instanceof Number) { super.setValue(NumberUtils.convertNumberToTargetClass((Number) value, this.numberClass)); } else { super.setValue(value); } }
/** * Coerce a Number value into the required target class, if necessary. */
Coerce a Number value into the required target class, if necessary
setValue
{ "repo_name": "mattxia/spring-2.5-analysis", "path": "src/org/springframework/beans/propertyeditors/CustomNumberEditor.java", "license": "apache-2.0", "size": 5257 }
[ "org.springframework.util.NumberUtils" ]
import org.springframework.util.NumberUtils;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
2,757,307
protected float transformWidth(float width) { Matrix ctm = getGraphicsState().getCurrentTransformationMatrix(); float x = ctm.getScaleX() + ctm.getShearX(); float y = ctm.getScaleY() + ctm.getShearY(); return width * (float) Math.sqrt((x * x + y * y) * 0.5); }
float function(float width) { Matrix ctm = getGraphicsState().getCurrentTransformationMatrix(); float x = ctm.getScaleX() + ctm.getShearX(); float y = ctm.getScaleY() + ctm.getShearY(); return width * (float) Math.sqrt((x * x + y * y) * 0.5); }
/** * Transforms a width using the CTM. */
Transforms a width using the CTM
transformWidth
{ "repo_name": "gavanx/pdflearn", "path": "pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java", "license": "apache-2.0", "size": 32281 }
[ "org.apache.pdfbox.util.Matrix" ]
import org.apache.pdfbox.util.Matrix;
import org.apache.pdfbox.util.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
1,436,954
@Generated @IsOptional @Selector("locationManagerShouldDisplayHeadingCalibration:") default boolean locationManagerShouldDisplayHeadingCalibration(CLLocationManager manager) { throw new java.lang.UnsupportedOperationException(); }
@Selector(STR) default boolean locationManagerShouldDisplayHeadingCalibration(CLLocationManager manager) { throw new java.lang.UnsupportedOperationException(); }
/** * locationManagerShouldDisplayHeadingCalibration: * <p> * Discussion: * Invoked when a new heading is available. Return YES to display heading calibration info. The display * will remain until heading is calibrated, unless dismissed early via dismissHeadingCalibrationDisplay. */
locationManagerShouldDisplayHeadingCalibration: Discussion: Invoked when a new heading is available. Return YES to display heading calibration info. The display will remain until heading is calibrated, unless dismissed early via dismissHeadingCalibrationDisplay
locationManagerShouldDisplayHeadingCalibration
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/corelocation/protocol/CLLocationManagerDelegate.java", "license": "apache-2.0", "size": 11807 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
466,031
public Stream<ConfigKey> allKeysRecursively() { Stream<ConfigKey> str = Stream.empty(); if (this.value != null) { str = Stream.of(ConfigKey.EMPTY); } str = Stream.concat(str, this.children.entrySet() .stream() .flatMap((kv) -> { ConfigKey key = kv.getKey(); Object value = kv.getValue(); if (value instanceof ConfigNode) { return ((ConfigNode) value).allKeysRecursively() .map(childKey -> key.append(childKey)); } return Stream.empty(); })); return str; }
Stream<ConfigKey> function() { Stream<ConfigKey> str = Stream.empty(); if (this.value != null) { str = Stream.of(ConfigKey.EMPTY); } str = Stream.concat(str, this.children.entrySet() .stream() .flatMap((kv) -> { ConfigKey key = kv.getKey(); Object value = kv.getValue(); if (value instanceof ConfigNode) { return ((ConfigNode) value).allKeysRecursively() .map(childKey -> key.append(childKey)); } return Stream.empty(); })); return str; }
/** * Retrieve all descendent keys. * * @return A stream of all descendent keys. */
Retrieve all descendent keys
allKeysRecursively
{ "repo_name": "heiko-braun/wildfly-swarm-1", "path": "core/container/src/main/java/org/wildfly/swarm/container/config/ConfigNode.java", "license": "apache-2.0", "size": 6447 }
[ "java.util.stream.Stream", "org.wildfly.swarm.spi.api.config.ConfigKey" ]
import java.util.stream.Stream; import org.wildfly.swarm.spi.api.config.ConfigKey;
import java.util.stream.*; import org.wildfly.swarm.spi.api.config.*;
[ "java.util", "org.wildfly.swarm" ]
java.util; org.wildfly.swarm;
1,888,726
public String getName(); public String getVersion(); public void write(File f, SROutput data) throws SRWriterException; public void write(File f, SROutput data, Object options) throws SRWriterException;
String getName(); public String getVersion(); public void function(File f, SROutput data) throws SRWriterException; void function(File f, SROutput data, Object options) throws SRWriterException;
/** * Writes the content of a search result. * * @throws SRWriterException such an exception is reported when an error * occurred while writing a data object in a file. */
Writes the content of a search result
write
{ "repo_name": "pgdurand/Bioinformatics-Core-API", "path": "src/bzh/plealog/bioinfo/api/data/searchresult/io/SRWriter.java", "license": "agpl-3.0", "size": 1669 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
786,410
public OneResponse shutdown() { return shutdown(false); }
OneResponse function() { return shutdown(false); }
/** * Gracefully shuts down the already deployed VM. * @return If an error occurs the error message contains the reason. */
Gracefully shuts down the already deployed VM
shutdown
{ "repo_name": "Terradue/one", "path": "src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java", "license": "apache-2.0", "size": 38638 }
[ "org.opennebula.client.OneResponse" ]
import org.opennebula.client.OneResponse;
import org.opennebula.client.*;
[ "org.opennebula.client" ]
org.opennebula.client;
2,424,488
@Test public void javabeanTesterDownloadLog() { JavaBeanTester.builder(DownloadLogController.class) .skip("applicationContext", "supportedMethods").test(); }
void function() { JavaBeanTester.builder(DownloadLogController.class) .skip(STR, STR).test(); }
/** * Javabean tester download log. */
Javabean tester download log
javabeanTesterDownloadLog
{ "repo_name": "dougwm/psi-probe", "path": "core/src/test/java/psiprobe/controllers/logs/LogHandlerControllerTest.java", "license": "gpl-2.0", "size": 1738 }
[ "com.codebox.bean.JavaBeanTester" ]
import com.codebox.bean.JavaBeanTester;
import com.codebox.bean.*;
[ "com.codebox.bean" ]
com.codebox.bean;
534,859
public Builder setDetectorUpdates(List<DetectorUpdate> detectorUpdates) { this.detectorUpdates = detectorUpdates; return this; } /** * Enables/disables the model plot config setting through {@link ModelPlotConfig#enabled}
Builder function(List<DetectorUpdate> detectorUpdates) { this.detectorUpdates = detectorUpdates; return this; } /** * Enables/disables the model plot config setting through {@link ModelPlotConfig#enabled}
/** * The detector updates to apply to the job * * Updates the {@link AnalysisConfig#detectors} setting * * @param detectorUpdates list of {@link JobUpdate.DetectorUpdate} objects */
The detector updates to apply to the job Updates the <code>AnalysisConfig#detectors</code> setting
setDetectorUpdates
{ "repo_name": "robin13/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/ml/job/config/JobUpdate.java", "license": "apache-2.0", "size": 21506 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,450,190
protected Stream<TypeInfo> getProvides(Class<?> clazz) { Stream<TypeInfo> assignableTypes = new TypeInfo(clazz).getAssignableTypes(); if (clazz.isAnnotationPresent(Component.class)) { Component component = clazz.getAnnotation(Component.class); Set<Class> services = ImmutableSet.copyOf(component.service()); if (!services.isEmpty()) { assignableTypes = assignableTypes.filter(t -> services.contains(t.getRawClass())); } } return assignableTypes; }
Stream<TypeInfo> function(Class<?> clazz) { Stream<TypeInfo> assignableTypes = new TypeInfo(clazz).getAssignableTypes(); if (clazz.isAnnotationPresent(Component.class)) { Component component = clazz.getAnnotation(Component.class); Set<Class> services = ImmutableSet.copyOf(component.service()); if (!services.isEmpty()) { assignableTypes = assignableTypes.filter(t -> services.contains(t.getRawClass())); } } return assignableTypes; }
/** * Determine the list of services provided by the class. * * @param clazz class to evaluate * @return stream of services provided */
Determine the list of services provided by the class
getProvides
{ "repo_name": "mjameson-se/foundation", "path": "org.f8n.inject/src/org/f8n/inject/Injector.java", "license": "unlicense", "size": 15812 }
[ "com.google.common.collect.ImmutableSet", "java.util.Set", "java.util.stream.Stream", "org.f8n.inject.annotate.Component", "org.f8n.reflect.TypeInfo" ]
import com.google.common.collect.ImmutableSet; import java.util.Set; import java.util.stream.Stream; import org.f8n.inject.annotate.Component; import org.f8n.reflect.TypeInfo;
import com.google.common.collect.*; import java.util.*; import java.util.stream.*; import org.f8n.inject.annotate.*; import org.f8n.reflect.*;
[ "com.google.common", "java.util", "org.f8n.inject", "org.f8n.reflect" ]
com.google.common; java.util; org.f8n.inject; org.f8n.reflect;
2,536,523
@Override public int compare(LayoutElement file1, LayoutElement file2) { if (dirsOnTop == 0) { if (isDirectory(file1) && !isDirectory(file2)) { return -1; } else if (isDirectory(file2) && !isDirectory(file1)) { return 1; } } else if (dirsOnTop == 1) { if (isDirectory(file1) && !isDirectory(file2)) { return 1; } else if (isDirectory(file2) && !isDirectory(file1)) { return -1; } } if (sort == 0) { // sort by name return asc * file1.getTitle().compareToIgnoreCase(file2.getTitle()); } else if (sort == 1) { // sort by last modified return asc * Long.valueOf(file1.getDate1()).compareTo(file2.getDate1()); } else if (sort == 2) { // sort by size if (!file1.isDirectory() && !file2.isDirectory()) { return asc * Long.valueOf(file1.getlongSize()).compareTo(file2.getlongSize()); } else { return file1.getTitle().compareToIgnoreCase(file2.getTitle()); } } else if(sort ==3) { // sort by type if(!file1.isDirectory() && !file2.isDirectory()) { final String ext_a = getExtension(file1.getTitle()); final String ext_b = getExtension(file2.getTitle()); final int res = asc*ext_a.compareTo(ext_b); if (res == 0) { return asc * file1.getTitle().compareToIgnoreCase(file2.getTitle()); } return res; } else { return file1.getTitle().compareToIgnoreCase(file2.getTitle()); } } return 0; }
int function(LayoutElement file1, LayoutElement file2) { if (dirsOnTop == 0) { if (isDirectory(file1) && !isDirectory(file2)) { return -1; } else if (isDirectory(file2) && !isDirectory(file1)) { return 1; } } else if (dirsOnTop == 1) { if (isDirectory(file1) && !isDirectory(file2)) { return 1; } else if (isDirectory(file2) && !isDirectory(file1)) { return -1; } } if (sort == 0) { return asc * file1.getTitle().compareToIgnoreCase(file2.getTitle()); } else if (sort == 1) { return asc * Long.valueOf(file1.getDate1()).compareTo(file2.getDate1()); } else if (sort == 2) { if (!file1.isDirectory() && !file2.isDirectory()) { return asc * Long.valueOf(file1.getlongSize()).compareTo(file2.getlongSize()); } else { return file1.getTitle().compareToIgnoreCase(file2.getTitle()); } } else if(sort ==3) { if(!file1.isDirectory() && !file2.isDirectory()) { final String ext_a = getExtension(file1.getTitle()); final String ext_b = getExtension(file2.getTitle()); final int res = asc*ext_a.compareTo(ext_b); if (res == 0) { return asc * file1.getTitle().compareToIgnoreCase(file2.getTitle()); } return res; } else { return file1.getTitle().compareToIgnoreCase(file2.getTitle()); } } return 0; }
/** * Compares two elements and return negative, zero and positive integer if first argument is * less than, equal to or greater than second * @param file1 * @param file2 * @return */
Compares two elements and return negative, zero and positive integer if first argument is less than, equal to or greater than second
compare
{ "repo_name": "martincz/AmazeFileManager", "path": "src/main/java/com/amaze/filemanager/utils/files/FileListSorter.java", "license": "gpl-3.0", "size": 3826 }
[ "com.amaze.filemanager.ui.LayoutElement" ]
import com.amaze.filemanager.ui.LayoutElement;
import com.amaze.filemanager.ui.*;
[ "com.amaze.filemanager" ]
com.amaze.filemanager;
2,597,096
@Test public void testFoundNonStdLicIds() throws IOException, InvalidSPDXAnalysisException { SpdxDocument doc1 = SPDXDocumentFactory.createSpdxDocument(TEST_RDF_FILE_PATH); SpdxDocument doc3 = SPDXDocumentFactory.createSpdxDocument(TEST_RDF_FILE_PATH3); ExtractedLicenseInfo[] subNonStdLics = doc3.getExtractedLicenseInfos(); SpdxLicenseMapper mapper = new SpdxLicenseMapper(); ExtractedLicenseInfo clonedNonStdLic = (ExtractedLicenseInfo) subNonStdLics[0].clone(); mapper.mappingNewNonStdLic(doc1, doc3, clonedNonStdLic); Map<AnyLicenseInfo, AnyLicenseInfo> interalMap = mapper.foundInterMap(doc3); Map<AnyLicenseInfo,AnyLicenseInfo> expected = Maps.newHashMap(); String NewNonStdLicId = doc1.getDocumentContainer().getNextLicenseRef(); clonedNonStdLic.setLicenseId(NewNonStdLicId); expected.put(subNonStdLics[0], clonedNonStdLic); assertEquals(interalMap,expected); }
void function() throws IOException, InvalidSPDXAnalysisException { SpdxDocument doc1 = SPDXDocumentFactory.createSpdxDocument(TEST_RDF_FILE_PATH); SpdxDocument doc3 = SPDXDocumentFactory.createSpdxDocument(TEST_RDF_FILE_PATH3); ExtractedLicenseInfo[] subNonStdLics = doc3.getExtractedLicenseInfos(); SpdxLicenseMapper mapper = new SpdxLicenseMapper(); ExtractedLicenseInfo clonedNonStdLic = (ExtractedLicenseInfo) subNonStdLics[0].clone(); mapper.mappingNewNonStdLic(doc1, doc3, clonedNonStdLic); Map<AnyLicenseInfo, AnyLicenseInfo> interalMap = mapper.foundInterMap(doc3); Map<AnyLicenseInfo,AnyLicenseInfo> expected = Maps.newHashMap(); String NewNonStdLicId = doc1.getDocumentContainer().getNextLicenseRef(); clonedNonStdLic.setLicenseId(NewNonStdLicId); expected.put(subNonStdLics[0], clonedNonStdLic); assertEquals(interalMap,expected); }
/** * Test method for {@link org.spdx.merge.SpdxLicenseMapper#foundNonStdLicIds(org.spdx.rdfparser.SpdxDocument)}. * @throws InvalidSPDXAnalysisException * @throws IOException */
Test method for <code>org.spdx.merge.SpdxLicenseMapper#foundNonStdLicIds(org.spdx.rdfparser.SpdxDocument)</code>
testFoundNonStdLicIds
{ "repo_name": "rtgdk/tools", "path": "Test/org/spdx/merge/SpdxLicenseMapperTest.java", "license": "apache-2.0", "size": 12285 }
[ "com.google.common.collect.Maps", "java.io.IOException", "java.util.Map", "org.junit.Assert", "org.spdx.rdfparser.InvalidSPDXAnalysisException", "org.spdx.rdfparser.SPDXDocumentFactory", "org.spdx.rdfparser.license.AnyLicenseInfo", "org.spdx.rdfparser.license.ExtractedLicenseInfo", "org.spdx.rdfparser.model.SpdxDocument" ]
import com.google.common.collect.Maps; import java.io.IOException; import java.util.Map; import org.junit.Assert; import org.spdx.rdfparser.InvalidSPDXAnalysisException; import org.spdx.rdfparser.SPDXDocumentFactory; import org.spdx.rdfparser.license.AnyLicenseInfo; import org.spdx.rdfparser.license.ExtractedLicenseInfo; import org.spdx.rdfparser.model.SpdxDocument;
import com.google.common.collect.*; import java.io.*; import java.util.*; import org.junit.*; import org.spdx.rdfparser.*; import org.spdx.rdfparser.license.*; import org.spdx.rdfparser.model.*;
[ "com.google.common", "java.io", "java.util", "org.junit", "org.spdx.rdfparser" ]
com.google.common; java.io; java.util; org.junit; org.spdx.rdfparser;
853,845
public static GeneralDiamondResult checkGdiam(TransitionSystem ts, String a, String b) { for (State s : ts.getNodes()) { InterrupterRegistry.throwIfInterruptRequestedForCurrentThread(); Set<Pair<State, Boolean>> s1Set = getGenerallyReachable(s, a); Set<Pair<State, Boolean>> s2Set = getGenerallyReachable(s, b); for (Pair<State, Boolean> p1 : s1Set) { for (Pair<State, Boolean> p2 : s2Set) { Set<State> s1SetPrime = getReachableWithDirection( p1.getFirst(), b, p2.getSecond() ); Set<State> s2SetPrime = getReachableWithDirection( p2.getFirst(), a, p1.getSecond() ); if (Collections.disjoint(s1SetPrime, s2SetPrime)) { return new GeneralDiamondResult( s, a, b, p1.getSecond(), p2.getSecond() ); } } } } return new GeneralDiamondResult(); }
static GeneralDiamondResult function(TransitionSystem ts, String a, String b) { for (State s : ts.getNodes()) { InterrupterRegistry.throwIfInterruptRequestedForCurrentThread(); Set<Pair<State, Boolean>> s1Set = getGenerallyReachable(s, a); Set<Pair<State, Boolean>> s2Set = getGenerallyReachable(s, b); for (Pair<State, Boolean> p1 : s1Set) { for (Pair<State, Boolean> p2 : s2Set) { Set<State> s1SetPrime = getReachableWithDirection( p1.getFirst(), b, p2.getSecond() ); Set<State> s2SetPrime = getReachableWithDirection( p2.getFirst(), a, p1.getSecond() ); if (Collections.disjoint(s1SetPrime, s2SetPrime)) { return new GeneralDiamondResult( s, a, b, p1.getSecond(), p2.getSecond() ); } } } } return new GeneralDiamondResult(); }
/** * Checks if for the given LTS and labels a and b the general diamond * property holds. * * @param ts * the TS to check * @param a * the first label * @param b * the second label * @return a an object containing the result and a counter-example if * the LTS is not a T'-gdiam */
Checks if for the given LTS and labels a and b the general diamond property holds
checkGdiam
{ "repo_name": "CvO-Theory/apt", "path": "src/module/uniol/apt/analysis/factorization/GeneralDiamond.java", "license": "gpl-2.0", "size": 5783 }
[ "java.util.Collections", "java.util.Set" ]
import java.util.Collections; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
85,285
public void testEquals() { TextAnnotation a1 = new CategoryTextAnnotation("Test", "Category", 1.0); TextAnnotation a2 = new CategoryTextAnnotation("Test", "Category", 1.0); assertTrue(a1.equals(a2)); // text a1.setText("Text"); assertFalse(a1.equals(a2)); a2.setText("Text"); assertTrue(a1.equals(a2)); // font a1.setFont(new Font("Serif", Font.BOLD, 18)); assertFalse(a1.equals(a2)); a2.setFont(new Font("Serif", Font.BOLD, 18)); assertTrue(a1.equals(a2)); // paint a1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.pink)); assertFalse(a1.equals(a2)); a2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.pink)); assertTrue(a1.equals(a2)); // textAnchor a1.setTextAnchor(TextAnchor.BOTTOM_LEFT); assertFalse(a1.equals(a2)); a2.setTextAnchor(TextAnchor.BOTTOM_LEFT); assertTrue(a1.equals(a2)); // rotationAnchor a1.setRotationAnchor(TextAnchor.BOTTOM_LEFT); assertFalse(a1.equals(a2)); a2.setRotationAnchor(TextAnchor.BOTTOM_LEFT); assertTrue(a1.equals(a2)); // rotationAngle a1.setRotationAngle(Math.PI); assertFalse(a1.equals(a2)); a2.setRotationAngle(Math.PI); assertTrue(a1.equals(a2)); }
void function() { TextAnnotation a1 = new CategoryTextAnnotation("Test", STR, 1.0); TextAnnotation a2 = new CategoryTextAnnotation("Test", STR, 1.0); assertTrue(a1.equals(a2)); a1.setText("Text"); assertFalse(a1.equals(a2)); a2.setText("Text"); assertTrue(a1.equals(a2)); a1.setFont(new Font("Serif", Font.BOLD, 18)); assertFalse(a1.equals(a2)); a2.setFont(new Font("Serif", Font.BOLD, 18)); assertTrue(a1.equals(a2)); a1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.pink)); assertFalse(a1.equals(a2)); a2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.pink)); assertTrue(a1.equals(a2)); a1.setTextAnchor(TextAnchor.BOTTOM_LEFT); assertFalse(a1.equals(a2)); a2.setTextAnchor(TextAnchor.BOTTOM_LEFT); assertTrue(a1.equals(a2)); a1.setRotationAnchor(TextAnchor.BOTTOM_LEFT); assertFalse(a1.equals(a2)); a2.setRotationAnchor(TextAnchor.BOTTOM_LEFT); assertTrue(a1.equals(a2)); a1.setRotationAngle(Math.PI); assertFalse(a1.equals(a2)); a2.setRotationAngle(Math.PI); assertTrue(a1.equals(a2)); }
/** * Confirm that the equals method can distinguish all the required fields. */
Confirm that the equals method can distinguish all the required fields
testEquals
{ "repo_name": "raedle/univis", "path": "lib/jfreechart-1.0.1/src/org/jfree/chart/annotations/junit/TextAnnotationTests.java", "license": "lgpl-2.1", "size": 4493 }
[ "java.awt.Color", "java.awt.Font", "java.awt.GradientPaint", "junit.framework.Test", "org.jfree.chart.annotations.CategoryTextAnnotation", "org.jfree.chart.annotations.TextAnnotation", "org.jfree.ui.TextAnchor" ]
import java.awt.Color; import java.awt.Font; import java.awt.GradientPaint; import junit.framework.Test; import org.jfree.chart.annotations.CategoryTextAnnotation; import org.jfree.chart.annotations.TextAnnotation; import org.jfree.ui.TextAnchor;
import java.awt.*; import junit.framework.*; import org.jfree.chart.annotations.*; import org.jfree.ui.*;
[ "java.awt", "junit.framework", "org.jfree.chart", "org.jfree.ui" ]
java.awt; junit.framework; org.jfree.chart; org.jfree.ui;
742,643
void update(Object feature) throws LayerException { SimpleFeatureSource source = getFeatureSource(); if (source instanceof SimpleFeatureStore) { SimpleFeatureStore store = (SimpleFeatureStore) source; String featureId = getFeatureModel().getId(feature); Filter filter = filterService.createFidFilter(new String[] { featureId }); transactionSynchronization.synchTransaction(store); List<Name> names = new ArrayList<Name>(); Map<String, Attribute> attrMap = getFeatureModel().getAttributes(feature); List<Object> values = new ArrayList<Object>(); for (Map.Entry<String, Attribute> entry : attrMap.entrySet()) { String name = entry.getKey(); names.add(store.getSchema().getDescriptor(name).getName()); values.add(entry.getValue().getValue()); } try { store.modifyFeatures(names.toArray(new Name[names.size()]), values.toArray(), filter); store.modifyFeatures(store.getSchema().getGeometryDescriptor().getName(), getFeatureModel() .getGeometry(feature), filter); log.debug("Updated feature {} in {}", featureId, getFeatureSourceName()); } catch (IOException ioe) { featureModelUsable = false; throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION); } } else { log.error("Don't know how to create or update " + getFeatureSourceName() + ", class " + source.getClass().getName() + " does not implement SimpleFeatureStore"); throw new LayerException(ExceptionCode.CREATE_OR_UPDATE_NOT_IMPLEMENTED, getFeatureSourceName(), source .getClass().getName()); } }
void update(Object feature) throws LayerException { SimpleFeatureSource source = getFeatureSource(); if (source instanceof SimpleFeatureStore) { SimpleFeatureStore store = (SimpleFeatureStore) source; String featureId = getFeatureModel().getId(feature); Filter filter = filterService.createFidFilter(new String[] { featureId }); transactionSynchronization.synchTransaction(store); List<Name> names = new ArrayList<Name>(); Map<String, Attribute> attrMap = getFeatureModel().getAttributes(feature); List<Object> values = new ArrayList<Object>(); for (Map.Entry<String, Attribute> entry : attrMap.entrySet()) { String name = entry.getKey(); names.add(store.getSchema().getDescriptor(name).getName()); values.add(entry.getValue().getValue()); } try { store.modifyFeatures(names.toArray(new Name[names.size()]), values.toArray(), filter); store.modifyFeatures(store.getSchema().getGeometryDescriptor().getName(), getFeatureModel() .getGeometry(feature), filter); log.debug(STR, featureId, getFeatureSourceName()); } catch (IOException ioe) { featureModelUsable = false; throw new LayerException(ioe, ExceptionCode.LAYER_MODEL_IO_EXCEPTION); } } else { log.error(STR + getFeatureSourceName() + STR + source.getClass().getName() + STR); throw new LayerException(ExceptionCode.CREATE_OR_UPDATE_NOT_IMPLEMENTED, getFeatureSourceName(), source .getClass().getName()); } }
/** * Update an existing feature. Made package private for testing purposes. * * @param feature feature to update * @throws LayerException oops */
Update an existing feature. Made package private for testing purposes
update
{ "repo_name": "olivermay/geomajas", "path": "plugin/geomajas-layer-geotools/geotools/src/main/java/org/geomajas/layer/geotools/GeoToolsLayer.java", "license": "agpl-3.0", "size": 16457 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "java.util.Map", "org.geomajas.global.ExceptionCode", "org.geomajas.layer.LayerException", "org.geomajas.layer.feature.Attribute", "org.geotools.data.simple.SimpleFeatureSource", "org.geotools.data.simple.SimpleFeatureStore", "org.opengis.feature.type.Name", "org.opengis.filter.Filter" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.geomajas.global.ExceptionCode; import org.geomajas.layer.LayerException; import org.geomajas.layer.feature.Attribute; import org.geotools.data.simple.SimpleFeatureSource; import org.geotools.data.simple.SimpleFeatureStore; import org.opengis.feature.type.Name; import org.opengis.filter.Filter;
import java.io.*; import java.util.*; import org.geomajas.global.*; import org.geomajas.layer.*; import org.geomajas.layer.feature.*; import org.geotools.data.simple.*; import org.opengis.feature.type.*; import org.opengis.filter.*;
[ "java.io", "java.util", "org.geomajas.global", "org.geomajas.layer", "org.geotools.data", "org.opengis.feature", "org.opengis.filter" ]
java.io; java.util; org.geomajas.global; org.geomajas.layer; org.geotools.data; org.opengis.feature; org.opengis.filter;
1,648,806
public void forEach(@NonNull Consumer<Entry> consumer) { iterator().forEachRemaining(consumer); }
void function(@NonNull Consumer<Entry> consumer) { iterator().forEachRemaining(consumer); }
/** * Performs the given action for each element in the NDArray. * * @param consumer the consumer to use for processing the NDArray entries */
Performs the given action for each element in the NDArray
forEach
{ "repo_name": "dbracewell/apollo", "path": "src/main/java/com/davidbracewell/apollo/linear/NDArray.java", "license": "apache-2.0", "size": 68768 }
[ "java.util.function.Consumer" ]
import java.util.function.Consumer;
import java.util.function.*;
[ "java.util" ]
java.util;
926,303
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP * <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>POST</code> method
doPost
{ "repo_name": "aadityabagga/bugtrackingportal", "path": "src/java/Consumer/SubmitFeedback.java", "license": "bsd-2-clause", "size": 5945 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
2,636,594
public User getUser() { return Privilege.getInstance().getUser(token); }
User function() { return Privilege.getInstance().getUser(token); }
/** * Returns the authenticated user. Or <tt>null</tt> if the user is not authenticated. */
Returns the authenticated user. Or null if the user is not authenticated
getUser
{ "repo_name": "dhosa/yamcs", "path": "yamcs-core/src/main/java/org/yamcs/web/rest/RestRequest.java", "license": "agpl-3.0", "size": 16813 }
[ "org.yamcs.security.Privilege", "org.yamcs.security.User" ]
import org.yamcs.security.Privilege; import org.yamcs.security.User;
import org.yamcs.security.*;
[ "org.yamcs.security" ]
org.yamcs.security;
2,127,367
@SuppressWarnings({"ConstantConditions", "unchecked"}) protected void checkDataState(IgniteEx srv, boolean afterRebuild) throws IgniteCheckedException { IgniteInternalCache icache = srv.cachex(CACHE_NAME); IgniteCache cache = srv.cache(CACHE_NAME); assertNotNull(icache); for (IgniteCacheOffheapManager.CacheDataStore store : icache.context().offheap().cacheDataStores()) { GridCursor<? extends CacheDataRow> cur = store.cursor(); while (cur.next()) { CacheDataRow row = cur.get(); int key = row.key().value(icache.context().cacheObjectContext(), false); if (!afterRebuild || key <= AMOUNT / 2) assertEquals(key, cache.get(key)); else assertEquals(-1, cache.get(key)); } } }
@SuppressWarnings({STR, STR}) void function(IgniteEx srv, boolean afterRebuild) throws IgniteCheckedException { IgniteInternalCache icache = srv.cachex(CACHE_NAME); IgniteCache cache = srv.cache(CACHE_NAME); assertNotNull(icache); for (IgniteCacheOffheapManager.CacheDataStore store : icache.context().offheap().cacheDataStores()) { GridCursor<? extends CacheDataRow> cur = store.cursor(); while (cur.next()) { CacheDataRow row = cur.get(); int key = row.key().value(icache.context().cacheObjectContext(), false); if (!afterRebuild key <= AMOUNT / 2) assertEquals(key, cache.get(key)); else assertEquals(-1, cache.get(key)); } } }
/** * Check versions presence in index tree. * * @param srv Node. * @param afterRebuild Whether index rebuild has occurred. * @throws IgniteCheckedException if failed. */
Check versions presence in index tree
checkDataState
{ "repo_name": "ascherbakoff/ignite", "path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexRebuildSelfTest.java", "license": "apache-2.0", "size": 14280 }
[ "org.apache.ignite.IgniteCache", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.IgniteEx", "org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager", "org.apache.ignite.internal.processors.cache.IgniteInternalCache", "org.apache.ignite.internal.processors.cache.persistence.CacheDataRow", "org.apache.ignite.internal.util.lang.GridCursor" ]
import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager; import org.apache.ignite.internal.processors.cache.IgniteInternalCache; import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; import org.apache.ignite.internal.util.lang.GridCursor;
import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.persistence.*; import org.apache.ignite.internal.util.lang.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,070,885
@Test public void testOnMinRankChange() { Platform.runLater(() -> { // CHECKSTYLE.OFF: MagicNumber Rectangle view = (Rectangle) minimap.getChildren().get(1); // CHECKSTYLE.ON: MagicNumber assertNotNull(view); // CHECKSTYLE.OFF: MagicNumber strain.minRankProperty().set(4); strain.maxRankProperty().set(6); assertEquals(4, strain.minRankProperty().get()); assertEquals(6, strain.maxRankProperty().get()); // CHECKSTYLE.ON: MagicNumber }); }
void function() { Platform.runLater(() -> { Rectangle view = (Rectangle) minimap.getChildren().get(1); assertNotNull(view); strain.minRankProperty().set(4); strain.maxRankProperty().set(6); assertEquals(4, strain.minRankProperty().get()); assertEquals(6, strain.maxRankProperty().get()); }); }
/** * Test that the x coordinate changes when the min rank property has changed. */
Test that the x coordinate changes when the min rank property has changed
testOnMinRankChange
{ "repo_name": "AbeelLab/dnainator", "path": "dnainator-javafx/src/test/java/nl/tudelft/dnainator/javafx/widgets/MinimapTest.java", "license": "bsd-3-clause", "size": 2230 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,974,532
return new JdbcTemplate(IdentityDatabaseUtil.getDataSource()); }
return new JdbcTemplate(IdentityDatabaseUtil.getDataSource()); }
/** * Get a new Jdbc Template. * * @return a new Jdbc Template. */
Get a new Jdbc Template
getNewTemplate
{ "repo_name": "omindu/carbon-identity-framework", "path": "components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/src/main/java/org/wso2/carbon/identity/configuration/mgt/core/util/JdbcUtils.java", "license": "apache-2.0", "size": 5576 }
[ "org.wso2.carbon.database.utils.jdbc.JdbcTemplate", "org.wso2.carbon.identity.core.util.IdentityDatabaseUtil" ]
import org.wso2.carbon.database.utils.jdbc.JdbcTemplate; import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil;
import org.wso2.carbon.database.utils.jdbc.*; import org.wso2.carbon.identity.core.util.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
525,556
public synchronized MyTempoEvent getTempoEventAt(long tick) { if (dirty) reco(); SortedMap<Long, MyTempoEvent> head = treeSet.headMap(tick + 1); MyTempoEvent ev = (head.get(head.lastKey())); return ev; }
synchronized MyTempoEvent function(long tick) { if (dirty) reco(); SortedMap<Long, MyTempoEvent> head = treeSet.headMap(tick + 1); MyTempoEvent ev = (head.get(head.lastKey())); return ev; }
/** * * get tempo event before tick. * * @param tick * @return */
get tempo event before tick
getTempoEventAt
{ "repo_name": "hajdam/frinthesia", "path": "modules/frinika-sequencer/src/main/java/com/frinika/sequencer/model/tempo/TempoList.java", "license": "gpl-2.0", "size": 8047 }
[ "java.util.SortedMap" ]
import java.util.SortedMap;
import java.util.*;
[ "java.util" ]
java.util;
379,329
public List<String> getParamsAllowableValuesTags() { return this.paramsAllowableValuesTags; }
List<String> function() { return this.paramsAllowableValuesTags; }
/** * This gets the paramsAllowableValuesTags * @return the paramsAllowableValuesTags */
This gets the paramsAllowableValuesTags
getParamsAllowableValuesTags
{ "repo_name": "rodney757/swagger-doclet", "path": "swagger-doclet/src/main/java/com/tenxerconsulting/swagger/doclet/DocletOptions.java", "license": "apache-2.0", "size": 59779 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,193,720
private float ptkDeltaFunction(TreeNode Nx, TreeNode Nz) { float sum = 0; if (deltaMatrix.get(Nx.getId(), Nz.getId()) != DeltaMatrix.NO_RESPONSE) return deltaMatrix.get(Nx.getId(), Nz.getId()); // already there if (!Nx.getContent().getTextFromData() .equals(Nz.getContent().getTextFromData())) { deltaMatrix.add(Nx.getId(), Nz.getId(), 0); return 0; } else if (Nx.getNoOfChildren() == 0 || Nz.getNoOfChildren() == 0) { deltaMatrix.add(Nx.getId(), Nz.getId(), mu * lambda2 * terminalFactor); return mu * lambda2 * terminalFactor; } else { float delta_sk = stringKernelDeltaFunction(Nx.getChildren(), Nz.getChildren()); sum = mu * (lambda2 + delta_sk); deltaMatrix.add(Nx.getId(), Nz.getId(), sum); return sum; } }
float function(TreeNode Nx, TreeNode Nz) { float sum = 0; if (deltaMatrix.get(Nx.getId(), Nz.getId()) != DeltaMatrix.NO_RESPONSE) return deltaMatrix.get(Nx.getId(), Nz.getId()); if (!Nx.getContent().getTextFromData() .equals(Nz.getContent().getTextFromData())) { deltaMatrix.add(Nx.getId(), Nz.getId(), 0); return 0; } else if (Nx.getNoOfChildren() == 0 Nz.getNoOfChildren() == 0) { deltaMatrix.add(Nx.getId(), Nz.getId(), mu * lambda2 * terminalFactor); return mu * lambda2 * terminalFactor; } else { float delta_sk = stringKernelDeltaFunction(Nx.getChildren(), Nz.getChildren()); sum = mu * (lambda2 + delta_sk); deltaMatrix.add(Nx.getId(), Nz.getId(), sum); return sum; } }
/** * Partial Tree Kernel Delta Function * * @param Nx * root of the first tree * @param Nz * root of the second tree * @return */
Partial Tree Kernel Delta Function
ptkDeltaFunction
{ "repo_name": "SAG-KeLP/kelp-additional-kernels", "path": "src/main/java/it/uniroma2/sag/kelp/kernel/tree/PartialTreeKernel.java", "license": "apache-2.0", "size": 12750 }
[ "it.uniroma2.sag.kelp.data.representation.tree.node.TreeNode", "it.uniroma2.sag.kelp.kernel.tree.deltamatrix.DeltaMatrix" ]
import it.uniroma2.sag.kelp.data.representation.tree.node.TreeNode; import it.uniroma2.sag.kelp.kernel.tree.deltamatrix.DeltaMatrix;
import it.uniroma2.sag.kelp.data.representation.tree.node.*; import it.uniroma2.sag.kelp.kernel.tree.deltamatrix.*;
[ "it.uniroma2.sag" ]
it.uniroma2.sag;
1,631,943
public VerticalDropLocation getDropLocation() { String detail = (String) getData("detail"); if (detail == null) { return null; } return VerticalDropLocation.valueOf(detail); } } public static class VerticalLocationIs extends TargetDetailIs { public static VerticalLocationIs TOP = new VerticalLocationIs( VerticalDropLocation.TOP); public static VerticalLocationIs BOTTOM = new VerticalLocationIs( VerticalDropLocation.BOTTOM); public static VerticalLocationIs MIDDLE = new VerticalLocationIs( VerticalDropLocation.MIDDLE); private VerticalLocationIs(VerticalDropLocation l) { super("detail", l.name()); } } public interface ItemDescriptionGenerator extends Serializable {
VerticalDropLocation function() { String detail = (String) getData(STR); if (detail == null) { return null; } return VerticalDropLocation.valueOf(detail); } } public static class VerticalLocationIs extends TargetDetailIs { public static VerticalLocationIs TOP = new VerticalLocationIs( VerticalDropLocation.TOP); public static VerticalLocationIs BOTTOM = new VerticalLocationIs( VerticalDropLocation.BOTTOM); public static VerticalLocationIs MIDDLE = new VerticalLocationIs( VerticalDropLocation.MIDDLE); private VerticalLocationIs(VerticalDropLocation l) { super(STR, l.name()); } } public interface ItemDescriptionGenerator extends Serializable {
/** * Returns a detailed vertical location where the drop happened on Item. */
Returns a detailed vertical location where the drop happened on Item
getDropLocation
{ "repo_name": "jdahlstrom/vaadin.react", "path": "server/src/main/java/com/vaadin/ui/AbstractSelect.java", "license": "apache-2.0", "size": 76957 }
[ "com.vaadin.event.dd.acceptcriteria.TargetDetailIs", "com.vaadin.shared.ui.dd.VerticalDropLocation", "java.io.Serializable" ]
import com.vaadin.event.dd.acceptcriteria.TargetDetailIs; import com.vaadin.shared.ui.dd.VerticalDropLocation; import java.io.Serializable;
import com.vaadin.event.dd.acceptcriteria.*; import com.vaadin.shared.ui.dd.*; import java.io.*;
[ "com.vaadin.event", "com.vaadin.shared", "java.io" ]
com.vaadin.event; com.vaadin.shared; java.io;
295,548
public void addMandatoryConfOption(Configuration conf, String key) throws BadConfigException { if (!addConfOption(conf, key)) { throw new BadConfigException("Missing configuration option: " + key); } }
void function(Configuration conf, String key) throws BadConfigException { if (!addConfOption(conf, key)) { throw new BadConfigException(STR + key); } }
/** * Add a mandatory config option * @param conf configuration * @param key key * @throws BadConfigException if the key is missing */
Add a mandatory config option
addMandatoryConfOption
{ "repo_name": "GeLiXin/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/JavaCommandLineBuilder.java", "license": "apache-2.0", "size": 5293 }
[ "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.yarn.service.exceptions.BadConfigException" ]
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.service.exceptions.BadConfigException;
import org.apache.hadoop.conf.*; import org.apache.hadoop.yarn.service.exceptions.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,178,184
public Date getCreated() { return created; }
Date function() { return created; }
/** * Gets the date that identifies when this content was created. * * @return the created */
Gets the date that identifies when this content was created
getCreated
{ "repo_name": "ibmecod/cognitive-devoxx-videosearch", "path": "src/main/java/com/ibm/watson/developer_cloud/personality_insights/v2/model/ContentItem.java", "license": "apache-2.0", "size": 10049 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
559,836
@Override public void close() throws IOException { writer.close(); }
void function() throws IOException { writer.close(); }
/** * Closes the stream and releases any system resources associated with it. * * @throws IOException if an I/O error occurs */
Closes the stream and releases any system resources associated with it
close
{ "repo_name": "semantic-dependency-parsing/toolkit", "path": "src/main/java/se/liu/ida/nlp/sdp/toolkit/io/GraphWriter2014.java", "license": "isc", "size": 3378 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,177,411
public boolean getRequireReauthentication() { return requireReauthentication; } /** * Sets whether each request needs to be reauthenticated (by an * Authenticator downstream in the pipeline) to the security * <code>Realm</code>, or if this Valve can itself bind security info * to the request, based on the presence of a valid SSO entry, without * rechecking with the <code>Realm</code>. * <p> * If this property is <code>false</code> (the default), this * <code>Valve</code> will bind a UserPrincipal and AuthType to the request * if a valid SSO entry is associated with the request. It will not notify * the security <code>Realm</code> of the incoming request. * <p> * This property should be set to <code>true</code> if the overall server * configuration requires that the <code>Realm</code> reauthenticate each * request thread. An example of such a configuration would be one where * the <code>Realm</code> implementation provides security for both a * web tier and an associated EJB tier, and needs to set security * credentials on each request thread in order to support EJB access. * <p> * If this property is set to <code>true</code>, this Valve will set flags * on the request notifying the downstream Authenticator that the request * is associated with an SSO session. The Authenticator will then call its * {@link AuthenticatorBase#reauthenticateFromSSO reauthenticateFromSSO}
boolean function() { return requireReauthentication; } /** * Sets whether each request needs to be reauthenticated (by an * Authenticator downstream in the pipeline) to the security * <code>Realm</code>, or if this Valve can itself bind security info * to the request, based on the presence of a valid SSO entry, without * rechecking with the <code>Realm</code>. * <p> * If this property is <code>false</code> (the default), this * <code>Valve</code> will bind a UserPrincipal and AuthType to the request * if a valid SSO entry is associated with the request. It will not notify * the security <code>Realm</code> of the incoming request. * <p> * This property should be set to <code>true</code> if the overall server * configuration requires that the <code>Realm</code> reauthenticate each * request thread. An example of such a configuration would be one where * the <code>Realm</code> implementation provides security for both a * web tier and an associated EJB tier, and needs to set security * credentials on each request thread in order to support EJB access. * <p> * If this property is set to <code>true</code>, this Valve will set flags * on the request notifying the downstream Authenticator that the request * is associated with an SSO session. The Authenticator will then call its * {@link AuthenticatorBase#reauthenticateFromSSO reauthenticateFromSSO}
/** * Gets whether each request needs to be reauthenticated (by an * Authenticator downstream in the pipeline) to the security * <code>Realm</code>, or if this Valve can itself bind security info * to the request based on the presence of a valid SSO entry without * rechecking with the <code>Realm</code>. * * @return <code>true</code> if it is required that a downstream * Authenticator reauthenticate each request before calls to * <code>HttpServletRequest.setUserPrincipal()</code> * and <code>HttpServletRequest.setAuthType()</code> are made; * <code>false</code> if the <code>Valve</code> can itself make * those calls relying on the presence of a valid SingleSignOn * entry associated with the request. * * @see #setRequireReauthentication */
Gets whether each request needs to be reauthenticated (by an Authenticator downstream in the pipeline) to the security <code>Realm</code>, or if this Valve can itself bind security info to the request based on the presence of a valid SSO entry without rechecking with the <code>Realm</code>
getRequireReauthentication
{ "repo_name": "Nickname0806/Test_Q4", "path": "java/org/apache/catalina/authenticator/SingleSignOn.java", "license": "apache-2.0", "size": 24356 }
[ "org.apache.catalina.Realm" ]
import org.apache.catalina.Realm;
import org.apache.catalina.*;
[ "org.apache.catalina" ]
org.apache.catalina;
749,382
public IpNetwork getAddress() { return address; } // ActionVerifier /** * {@inheritDoc}
IpNetwork function() { return address; } /** * {@inheritDoc}
/** * Return the destination IP address to be set. * * @return The destination IP address to be set. */
Return the destination IP address to be set
getAddress
{ "repo_name": "opendaylight/vtn", "path": "manager/it/util/src/main/java/org/opendaylight/vtn/manager/it/util/action/SetInet4DstVerifier.java", "license": "epl-1.0", "size": 2729 }
[ "org.opendaylight.vtn.manager.util.IpNetwork" ]
import org.opendaylight.vtn.manager.util.IpNetwork;
import org.opendaylight.vtn.manager.util.*;
[ "org.opendaylight.vtn" ]
org.opendaylight.vtn;
2,759,531
@Test public void testPropertyCRUD() { // CREATE final EntityType type = new EntityType(); type.setName(DATA_TYPE_NAME); type.setDescription(DATA_TYPE_DESC); final Property property = new Property(type, DATA_PROPERTY_NAME, DATA_PROPERTY_DESC); DAO.save(type); DAO.save(property); // List final Collection<Property> properties = Jenabean.instance().reader() .load(Property.class); Assert.assertTrue(properties.contains(property)); // QUERY final List<Property> properties2 = DAO.PROPERTY.query("", 0, 100); Assert.assertTrue(properties2.contains(property)); // FIND final Property property2 = DAO.PROPERTY.findByEntityTypeAndName( type.getName(), property.getName()); Assert.assertNotNull(property2); Assert.assertEquals(property, property2); // COUNT final int count = DAO.PROPERTY.count(""); Assert.assertEquals(1, count); // DELETE DAO.delete(type); DAO.delete(property); // LIST AGAIN final Collection<Property> properties3 = Jenabean.instance().reader() .load(Property.class); Assert.assertFalse(properties3.contains(property)); // QUERY AGAIN final List<Property> properties4 = DAO.PROPERTY.query("", 0, 100); Assert.assertFalse(properties4.contains(property)); // FIND AGAIN final Property property3 = DAO.PROPERTY.findByEntityTypeAndName( type.getName(), property.getName()); Assert.assertNull(property3); // COUNT AGAIN final int count2 = DAO.PROPERTY.count(""); Assert.assertEquals(0, count2); }
void function() { final EntityType type = new EntityType(); type.setName(DATA_TYPE_NAME); type.setDescription(DATA_TYPE_DESC); final Property property = new Property(type, DATA_PROPERTY_NAME, DATA_PROPERTY_DESC); DAO.save(type); DAO.save(property); final Collection<Property> properties = Jenabean.instance().reader() .load(Property.class); Assert.assertTrue(properties.contains(property)); final List<Property> properties2 = DAO.PROPERTY.query(STRSTRSTR"); Assert.assertEquals(0, count2); }
/** * Test Property CRUD operations. */
Test Property CRUD operations
testPropertyCRUD
{ "repo_name": "openpreserve/scout", "path": "model/src/test/java/eu/scape_project/watch/model/KBTest.java", "license": "apache-2.0", "size": 46603 }
[ "eu.scape_project.watch.dao.DAO", "eu.scape_project.watch.domain.EntityType", "eu.scape_project.watch.domain.Property", "java.util.Collection", "java.util.List", "junit.framework.Assert" ]
import eu.scape_project.watch.dao.DAO; import eu.scape_project.watch.domain.EntityType; import eu.scape_project.watch.domain.Property; import java.util.Collection; import java.util.List; import junit.framework.Assert;
import eu.scape_project.watch.dao.*; import eu.scape_project.watch.domain.*; import java.util.*; import junit.framework.*;
[ "eu.scape_project.watch", "java.util", "junit.framework" ]
eu.scape_project.watch; java.util; junit.framework;
2,894,130
Length getMaximumHeight();
Length getMaximumHeight();
/** * This method gets the maximum height of this object. * * @return the maximum height or <code>null</code> if undefined (NOT set). */
This method gets the maximum height of this object
getMaximumHeight
{ "repo_name": "m-m-m/client", "path": "ui/core/api/src/main/java/net/sf/mmm/client/ui/api/attribute/AttributeReadMaximumSize.java", "license": "apache-2.0", "size": 800 }
[ "net.sf.mmm.client.ui.api.common.Length" ]
import net.sf.mmm.client.ui.api.common.Length;
import net.sf.mmm.client.ui.api.common.*;
[ "net.sf.mmm" ]
net.sf.mmm;
687,798
public void testClassExpressionInVar() { test("var C = class { }", " var C = function() {}"); test("var C = class { foo() {} }", Joiner.on('\n').join( " var C = function() {}", "", "C.prototype.foo = function() {}" )); test("var C = class C { }", " var C = function() {}"); test("var C = class C { foo() {} }", Joiner.on('\n').join( " var C = function() {}", "", "C.prototype.foo = function() {};" )); }
void function() { test(STR, STR); test(STR, Joiner.on('\n').join( STR, STRC.prototype.foo = function() {}STRvar C = class C { }", STR); test("var C = class C { foo() {} }", Joiner.on('\n').join( STR, STRC.prototype.foo = function() {};" )); }
/** * Class expressions that are the RHS of a 'var' statement. */
Class expressions that are the RHS of a 'var' statement
testClassExpressionInVar
{ "repo_name": "zombiezen/cardcpx", "path": "third_party/closure-compiler/test/com/google/javascript/jscomp/Es6ToEs3ConverterTest.java", "license": "apache-2.0", "size": 24800 }
[ "com.google.common.base.Joiner" ]
import com.google.common.base.Joiner;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
2,015,370
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); int offset = Math.max(85 - modsMissing.missingMods.size() * 10, 10); this.drawCenteredString(this.fontRendererObj, "Forge Mod Loader has found a problem with your minecraft installation", this.width / 2, offset, 0xFFFFFF); offset+=10; this.drawCenteredString(this.fontRendererObj, "The mods and versions listed below could not be found", this.width / 2, offset, 0xFFFFFF); offset+=5; for (ArtifactVersion v : modsMissing.missingMods) { offset+=10; if (v instanceof DefaultArtifactVersion) { DefaultArtifactVersion dav = (DefaultArtifactVersion)v; if (dav.getRange() != null && dav.getRange().isUnboundedAbove()) { this.drawCenteredString(this.fontRendererObj, String.format("%s : minimum version required is %s", v.getLabel(), dav.getRange().getLowerBoundString()), this.width / 2, offset, 0xEEEEEE); continue; } } this.drawCenteredString(this.fontRendererObj, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.width / 2, offset, 0xEEEEEE); } offset+=20; this.drawCenteredString(this.fontRendererObj, "The file 'logs/fml-client-latest.log' contains more information", this.width / 2, offset, 0xFFFFFF); }
void function(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); int offset = Math.max(85 - modsMissing.missingMods.size() * 10, 10); this.drawCenteredString(this.fontRendererObj, STR, this.width / 2, offset, 0xFFFFFF); offset+=10; this.drawCenteredString(this.fontRendererObj, STR, this.width / 2, offset, 0xFFFFFF); offset+=5; for (ArtifactVersion v : modsMissing.missingMods) { offset+=10; if (v instanceof DefaultArtifactVersion) { DefaultArtifactVersion dav = (DefaultArtifactVersion)v; if (dav.getRange() != null && dav.getRange().isUnboundedAbove()) { this.drawCenteredString(this.fontRendererObj, String.format(STR, v.getLabel(), dav.getRange().getLowerBoundString()), this.width / 2, offset, 0xEEEEEE); continue; } } this.drawCenteredString(this.fontRendererObj, String.format(STR, v.getLabel(), v.getRangeString()), this.width / 2, offset, 0xEEEEEE); } offset+=20; this.drawCenteredString(this.fontRendererObj, STR, this.width / 2, offset, 0xFFFFFF); }
/** * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks */
Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
drawScreen
{ "repo_name": "dogjaw2233/tiu-s-mod", "path": "build/tmp/recompileMc/sources/net/minecraftforge/fml/client/GuiModsMissing.java", "license": "lgpl-2.1", "size": 2810 }
[ "net.minecraftforge.fml.common.versioning.ArtifactVersion", "net.minecraftforge.fml.common.versioning.DefaultArtifactVersion" ]
import net.minecraftforge.fml.common.versioning.ArtifactVersion; import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion;
import net.minecraftforge.fml.common.versioning.*;
[ "net.minecraftforge.fml" ]
net.minecraftforge.fml;
2,220,082
//----------------------------------------------------------------------- public Chronology getChronology() { return iChronology; }
Chronology function() { return iChronology; }
/** * Gets the chronology of this interval. * * @return the chronology */
Gets the chronology of this interval
getChronology
{ "repo_name": "0359xiaodong/joda-time-android", "path": "library/src/org/joda/time/base/BaseInterval.java", "license": "apache-2.0", "size": 9995 }
[ "org.joda.time.Chronology" ]
import org.joda.time.Chronology;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
2,414,693
private void validateAttributes(AllDataType result) throws Exception { validateAttribute(result,"booleanPrimitiveValue",result.getBooleanPrimitiveValue()); validateAttribute(result,"booleanValue",result.getBooleanValue()); validateAttribute(result,"characterPrimitiveValue",result.getCharacterPrimitiveValue()); validateAttribute(result,"characterValue",result.getCharacterValue()); validateAttribute(result,"clobValue",result.getClobValue()); // System.out.println("datePrimitiveValue: " + result.getDatePrimitiveValue()); // System.out.println("datePrimitiveValue.toGMTString: " + result.getDatePrimitiveValue().toGMTString()); // System.out.println("datePrimitiveValue.toLocaleString: " + result.getDatePrimitiveValue().toLocaleString()); validateDateAttribute(result,"datePrimitiveValue",result.getDatePrimitiveValue()); validateDateAttribute(result,"dateValue",result.getDateValue()); validateAttribute(result,"doublePrimitiveValue",result.getDoublePrimitiveValue()); validateAttribute(result,"doubleValue",result.getDoubleValue()); validateAttribute(result,"floatPrimitiveValue",result.getFloatPrimitiveValue()); validateAttribute(result,"floatValue",result.getFloatValue()); validateAttribute(result,"id",result.getId()); validateAttribute(result,"intValue",result.getIntValue()); validateAttribute(result,"intPrimitiveValue",result.getIntPrimitiveValue()); validateAttribute(result,"longPrimitiveValue",result.getLongPrimitiveValue()); validateAttribute(result,"longValue",result.getLongValue()); validateAttribute(result,"stringPrimitiveValue",result.getStringPrimitiveValue()); validateAttribute(result,"stringValue",result.getStringValue()); }
void function(AllDataType result) throws Exception { validateAttribute(result,STR,result.getBooleanPrimitiveValue()); validateAttribute(result,STR,result.getBooleanValue()); validateAttribute(result,STR,result.getCharacterPrimitiveValue()); validateAttribute(result,STR,result.getCharacterValue()); validateAttribute(result,STR,result.getClobValue()); validateDateAttribute(result,STR,result.getDatePrimitiveValue()); validateDateAttribute(result,STR,result.getDateValue()); validateAttribute(result,STR,result.getDoublePrimitiveValue()); validateAttribute(result,STR,result.getDoubleValue()); validateAttribute(result,STR,result.getFloatPrimitiveValue()); validateAttribute(result,STR,result.getFloatValue()); validateAttribute(result,"id",result.getId()); validateAttribute(result,STR,result.getIntValue()); validateAttribute(result,STR,result.getIntPrimitiveValue()); validateAttribute(result,STR,result.getLongPrimitiveValue()); validateAttribute(result,STR,result.getLongValue()); validateAttribute(result,STR,result.getStringPrimitiveValue()); validateAttribute(result,STR,result.getStringValue()); }
/** * Verifies that all the values in the object are present * @param result */
Verifies that all the values in the object are present
validateAttributes
{ "repo_name": "NCIP/cacore-sdk", "path": "sdk-toolkit/example-project/junit/src/test/xml/data/AllDataTypeXMLDataTest.java", "license": "bsd-3-clause", "size": 4782 }
[ "gov.nih.nci.cacoresdk.domain.other.datatype.AllDataType" ]
import gov.nih.nci.cacoresdk.domain.other.datatype.AllDataType;
import gov.nih.nci.cacoresdk.domain.other.datatype.*;
[ "gov.nih.nci" ]
gov.nih.nci;
2,157,527
public void updatePlayState(final boolean isPlaying) { if(null == this.notification || null == this.notificationManager){ return; } if(null != this.notificationTemplate){ this.notificationTemplate.setImageViewResource(R.id.notification_toggle_play_pause, isPlaying ? R.drawable.ic_media_pause : R.drawable.ic_media_play); } if(16 <= Build.VERSION.SDK_INT && null != this.expandedView){ this.expandedView.setImageViewResource(R.id.notification_expanded_toggle_play_pause, isPlaying ? R.drawable.ic_media_pause : R.drawable.ic_media_play); } this.notificationManager.notify(NotificationHelper.NOTIFICATION_ID, this.notification); }
void function(final boolean isPlaying) { if(null == this.notification null == this.notificationManager){ return; } if(null != this.notificationTemplate){ this.notificationTemplate.setImageViewResource(R.id.notification_toggle_play_pause, isPlaying ? R.drawable.ic_media_pause : R.drawable.ic_media_play); } if(16 <= Build.VERSION.SDK_INT && null != this.expandedView){ this.expandedView.setImageViewResource(R.id.notification_expanded_toggle_play_pause, isPlaying ? R.drawable.ic_media_pause : R.drawable.ic_media_play); } this.notificationManager.notify(NotificationHelper.NOTIFICATION_ID, this.notification); }
/** * Changes the playback controls in and out of a paused state * * @param isPlaying True if music is playing, false otherwise */
Changes the playback controls in and out of a paused state
updatePlayState
{ "repo_name": "nstCactus/Hadra-Trance-Festival", "path": "Application/src/main/java/com/zion/music/NotificationHelper.java", "license": "gpl-2.0", "size": 8833 }
[ "android.os.Build" ]
import android.os.Build;
import android.os.*;
[ "android.os" ]
android.os;
2,518,590
public static final String replace(String source, String[] patterns, String[] replacements) { if (source == null) return null; StringBuffer buf = new StringBuffer(); for(int i=0; i < patterns.length; ++i) { if (i != 0) buf.append("|"); buf.append("(").append(patterns[i]).append(")"); } String regexString = buf.toString(); Pattern regex = Pattern.compile(regexString); Matcher m = regex.matcher(source); if (m.groupCount() != replacements.length) throw new IllegalArgumentException("Mismatch between pattern and replacements array"); StringBuffer result = null; int idx = 0; while(m.find()) { if (result == null) result = new StringBuffer(source.length()+32); result.append(source.substring(idx,m.start())); for(int i=0; i < replacements.length; ++i) { // the 0th group is the entire expression if (m.group(i+1) != null) { result.append(replacements[i]); idx = m.end(); break; } } } if (result == null) return source; result.append(source.substring(idx)); return result.toString(); }
static final String function(String source, String[] patterns, String[] replacements) { if (source == null) return null; StringBuffer buf = new StringBuffer(); for(int i=0; i < patterns.length; ++i) { if (i != 0) buf.append(" "); buf.append("(").append(patterns[i]).append(")"); } String regexString = buf.toString(); Pattern regex = Pattern.compile(regexString); Matcher m = regex.matcher(source); if (m.groupCount() != replacements.length) throw new IllegalArgumentException(STR); StringBuffer result = null; int idx = 0; while(m.find()) { if (result == null) result = new StringBuffer(source.length()+32); result.append(source.substring(idx,m.start())); for(int i=0; i < replacements.length; ++i) { if (m.group(i+1) != null) { result.append(replacements[i]); idx = m.end(); break; } } } if (result == null) return source; result.append(source.substring(idx)); return result.toString(); }
/** * Search source for instances of patterns from patterns[]. If found, replace * with the corresponding replacement in replacements[] (i.e., pattern[n] is replaced by * replacement[n]) * * @param patterns an array of regexes of what to find and what will be replaced. Note, that since they are * regexes, you must be sure to escape special regex tokens. */
Search source for instances of patterns from patterns[]. If found, replace with the corresponding replacement in replacements[] (i.e., pattern[n] is replaced by replacement[n])
replace
{ "repo_name": "vitkin/sfdc-email-to-case-agent", "path": "src/main/java/com/sforce/util/TextUtil.java", "license": "bsd-3-clause", "size": 9946 }
[ "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,372,118
@LogMessageDoc(level="ERROR", message="Error {error type} {error code} from {switch} " + "in state {state}", explanation="The switch responded with an unexpected error" + "to an OpenFlow message from the controller", recommendation="This could indicate improper network operation. " + "If the problem persists restarting the switch and " + "controller may help." ) protected void logError(OFErrorMsg error) { log.error("{} from switch {} in state {}", new Object[] { error.toString(), getSwitchInfoString(), this.toString()}); }
@LogMessageDoc(level="ERROR", message=STR + STR, explanation=STR + STR, recommendation=STR + STR + STR ) void function(OFErrorMsg error) { log.error(STR, new Object[] { error.toString(), getSwitchInfoString(), this.toString()}); }
/** * Log an OpenFlow error message from a switch * @param error The error message */
Log an OpenFlow error message from a switch
logError
{ "repo_name": "netgroup/floodlight", "path": "src/main/java/net/floodlightcontroller/core/internal/OFSwitchHandshakeHandler.java", "license": "apache-2.0", "size": 62338 }
[ "net.floodlightcontroller.core.annotations.LogMessageDoc", "org.projectfloodlight.openflow.protocol.OFErrorMsg" ]
import net.floodlightcontroller.core.annotations.LogMessageDoc; import org.projectfloodlight.openflow.protocol.OFErrorMsg;
import net.floodlightcontroller.core.annotations.*; import org.projectfloodlight.openflow.protocol.*;
[ "net.floodlightcontroller.core", "org.projectfloodlight.openflow" ]
net.floodlightcontroller.core; org.projectfloodlight.openflow;
384,580
public OType fieldType(final String iFieldName) { return _fieldTypes != null ? _fieldTypes.get(iFieldName) : null; }
OType function(final String iFieldName) { return _fieldTypes != null ? _fieldTypes.get(iFieldName) : null; }
/** * Returns the forced field type if any. * * @param iFieldName */
Returns the forced field type if any
fieldType
{ "repo_name": "nengxu/OrientDB", "path": "core/src/main/java/com/orientechnologies/orient/core/record/impl/ODocument.java", "license": "apache-2.0", "size": 50521 }
[ "com.orientechnologies.orient.core.metadata.schema.OType" ]
import com.orientechnologies.orient.core.metadata.schema.OType;
import com.orientechnologies.orient.core.metadata.schema.*;
[ "com.orientechnologies.orient" ]
com.orientechnologies.orient;
1,002,914
public static boolean checkUrl(String urlAsString){ if (urlAsString==null){ logger.error("can not check null URL"); return false; } URL url; try { url = new URL(urlAsString); } catch (MalformedURLException e) { logger.error(urlAsString+" is not a valid url, can not check."); return false; } int responseCode; String responseMessage = "NO RESPONSE MESSAGE"; Object content = "NO CONTENT"; HttpURLConnection huc; try { huc = (HttpURLConnection) url.openConnection(); huc.setRequestMethod("HEAD"); responseCode = huc.getResponseCode(); content = huc.getContent(); responseMessage = huc.getResponseMessage(); } catch (ProtocolException e) { logger.error("can not check url "+e.getMessage(),e); return false; } catch (IOException e) { logger.error("can not check url "+e.getMessage(),e); return false; } if (responseCode == 200 || (responseCode >300 && responseCode < 400)) { logger.info("URL "+urlAsString+ " exists"); return true; } else { logger.error(urlAsString+" return a "+responseCode+" : "+content+"/"+responseMessage); return false; } }
static boolean function(String urlAsString){ if (urlAsString==null){ logger.error(STR); return false; } URL url; try { url = new URL(urlAsString); } catch (MalformedURLException e) { logger.error(urlAsString+STR); return false; } int responseCode; String responseMessage = STR; Object content = STR; HttpURLConnection huc; try { huc = (HttpURLConnection) url.openConnection(); huc.setRequestMethod("HEAD"); responseCode = huc.getResponseCode(); content = huc.getContent(); responseMessage = huc.getResponseMessage(); } catch (ProtocolException e) { logger.error(STR+e.getMessage(),e); return false; } catch (IOException e) { logger.error(STR+e.getMessage(),e); return false; } if (responseCode == 200 (responseCode >300 && responseCode < 400)) { logger.info(STR+urlAsString+ STR); return true; } else { logger.error(urlAsString+STR+responseCode+STR+content+"/"+responseMessage); return false; } }
/** * check if an url doesn't return 200 or 3XX code * @param urlAsString the url to check * @return true if the url exists and is valid */
check if an url doesn't return 200 or 3XX code
checkUrl
{ "repo_name": "delphiprogramming/gisgraphy", "path": "src/main/java/com/gisgraphy/importer/ImporterHelper.java", "license": "lgpl-3.0", "size": 19593 }
[ "java.io.IOException", "java.net.HttpURLConnection", "java.net.MalformedURLException", "java.net.ProtocolException" ]
import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
2,653,230
public void setParameterReader(Parameter.Reader parameterReader) { mParameterReader = parameterReader; mAvailableParameters = createAvailableParameters(); }
void function(Parameter.Reader parameterReader) { mParameterReader = parameterReader; mAvailableParameters = createAvailableParameters(); }
/** * Setter method for {@link Parameter.Reader}. * * @param parameterReader the {@link Parameter.Reader} to set. */
Setter method for <code>Parameter.Reader</code>
setParameterReader
{ "repo_name": "Chilledheart/chromium", "path": "chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestBase.java", "license": "bsd-3-clause", "size": 11027 }
[ "org.chromium.base.test.util.parameter.Parameter" ]
import org.chromium.base.test.util.parameter.Parameter;
import org.chromium.base.test.util.parameter.*;
[ "org.chromium.base" ]
org.chromium.base;
2,046,339
protected void useReducedData(ResultItem item) { Instances reduced; MemoryContainer cont; reduced = generateReducedData(item); if (reduced == null) return; cont = new MemoryContainer(reduced); SwingUtilities.invokeLater(() -> { m_Owner.getData().add(cont); m_Owner.logMessage("Added reduced data: " + reduced.relationName()); m_Owner.fireDataChange(new WekaInvestigatorDataEvent(m_Owner.getOwner(), WekaInvestigatorDataEvent.ROWS_ADDED, m_Owner.getData().size() - 1)); }); }
void function(ResultItem item) { Instances reduced; MemoryContainer cont; reduced = generateReducedData(item); if (reduced == null) return; cont = new MemoryContainer(reduced); SwingUtilities.invokeLater(() -> { m_Owner.getData().add(cont); m_Owner.logMessage(STR + reduced.relationName()); m_Owner.fireDataChange(new WekaInvestigatorDataEvent(m_Owner.getOwner(), WekaInvestigatorDataEvent.ROWS_ADDED, m_Owner.getData().size() - 1)); }); }
/** * Makes the reduced data available as data container. * * @param item the result item to use */
Makes the reduced data available as data container
useReducedData
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-weka/src/main/java/adams/gui/tools/wekainvestigator/tab/AttributeSelectionTab.java", "license": "gpl-3.0", "size": 36377 }
[ "javax.swing.SwingUtilities" ]
import javax.swing.SwingUtilities;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
498,184
@Deprecated HistoricProcessInstanceQuery startDateBy(Date date);
HistoricProcessInstanceQuery startDateBy(Date date);
/** Only select historic process instances that were started as of the provided * date. (Date will be adjusted to reflect midnight) * @deprecated use {@link #startedAfter(Date)} and {@link #startedBefore(Date)} instead */
Only select historic process instances that were started as of the provided date. (Date will be adjusted to reflect midnight)
startDateBy
{ "repo_name": "AlexMinsk/camunda-bpm-platform", "path": "engine/src/main/java/org/camunda/bpm/engine/history/HistoricProcessInstanceQuery.java", "license": "apache-2.0", "size": 14417 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,949,905
public long send(Address dest, byte[] msg, boolean reEstablishCon, Object[] userPayload, Priority priority) throws ExtSocketException { Connection conn = null; long bytesSent = 0; if (dest == null) { getCacheLog().Error("msg is null or message's destination is null"); return bytesSent; } // 1. Try to obtain correct Connection (or create one if not yet existent) try { conn = GetConnection(dest, reEstablishCon); //getConnection(dest, reEstablishCon,useDualConnection); if (conn == null) { if (useDedicatedSender) { DedicatedMessageSendManager dmSenderMgr = (DedicatedMessageSendManager) ((dedicatedSenders.get(dest) instanceof DedicatedMessageSendManager) ? dedicatedSenders.get(dest) : null); if (dmSenderMgr != null) { int queueCount = dmSenderMgr.QueueMessage(msg, userPayload, priority); return bytesSent; } } return bytesSent; } } catch (SocketException se) { if (getCacheLog().getIsErrorEnabled()) { getCacheLog().Error("ConnectionTable.GetConnection", se.toString() +" at " +dest.toString()); } for (Object conn_listener : conn_listeners) { ((ConnectionTable.ConnectionListener) conn_listener).couldnotConnectTo(dest); } } catch (Exception ex) { if (getCacheLog().getIsErrorEnabled()) { getCacheLog().Error("ConnectionTable.GetConnection", "connection to " + dest + " could not be established: " + ex); } throw new ExtSocketException(ex.toString()); } // 2. Send the message using that connection try { if (useDedicatedSender) { DedicatedMessageSendManager dmSenderMgr = (DedicatedMessageSendManager) ((dedicatedSenders.get(dest) instanceof DedicatedMessageSendManager) ? dedicatedSenders.get(dest) : null); if (dmSenderMgr != null) { int queueCount = dmSenderMgr.QueueMessage(msg, userPayload, priority); return bytesSent; } } bytesSent = conn.send(msg, userPayload); } catch (Exception ex) { if (conn.getNeedReconnect()) { if (getCacheLog().getIsInfoEnabled()) { getCacheLog().Info("ConnectionTable.send", local_addr + " re-establishing connection with " + dest); } conn = this.ReEstablishConnection(dest); if (conn != null) { if (getCacheLog().getIsInfoEnabled()) { getCacheLog().Info("ConnectionTable.send", local_addr + " re-established connection successfully with " + dest); } try { bytesSent = conn.send(msg, userPayload); return bytesSent; } catch (Exception e) { getCacheLog().Error("ConnectionTable.send", "send failed after reconnect " + e.toString()); } } else { getCacheLog().Error("ConnectionTable.send", local_addr + " failed to re-establish connection with " + dest); } } else { if (getCacheLog().getIsInfoEnabled()) { getCacheLog().Info("ConnectionTable.send", local_addr + " need not to re-establish connection with " + dest); } } if (getCacheLog().getIsInfoEnabled()) { getCacheLog().Info("Ct.send", "sending message to " + dest + " failed (ex=" + ex.getClass().getName() + "); removing from connection table"); } throw new ExtSocketException(ex.toString()); } return bytesSent; }
long function(Address dest, byte[] msg, boolean reEstablishCon, Object[] userPayload, Priority priority) throws ExtSocketException { Connection conn = null; long bytesSent = 0; if (dest == null) { getCacheLog().Error(STR); return bytesSent; } try { conn = GetConnection(dest, reEstablishCon); if (conn == null) { if (useDedicatedSender) { DedicatedMessageSendManager dmSenderMgr = (DedicatedMessageSendManager) ((dedicatedSenders.get(dest) instanceof DedicatedMessageSendManager) ? dedicatedSenders.get(dest) : null); if (dmSenderMgr != null) { int queueCount = dmSenderMgr.QueueMessage(msg, userPayload, priority); return bytesSent; } } return bytesSent; } } catch (SocketException se) { if (getCacheLog().getIsErrorEnabled()) { getCacheLog().Error(STR, se.toString() +STR +dest.toString()); } for (Object conn_listener : conn_listeners) { ((ConnectionTable.ConnectionListener) conn_listener).couldnotConnectTo(dest); } } catch (Exception ex) { if (getCacheLog().getIsErrorEnabled()) { getCacheLog().Error(STR, STR + dest + STR + ex); } throw new ExtSocketException(ex.toString()); } try { if (useDedicatedSender) { DedicatedMessageSendManager dmSenderMgr = (DedicatedMessageSendManager) ((dedicatedSenders.get(dest) instanceof DedicatedMessageSendManager) ? dedicatedSenders.get(dest) : null); if (dmSenderMgr != null) { int queueCount = dmSenderMgr.QueueMessage(msg, userPayload, priority); return bytesSent; } } bytesSent = conn.send(msg, userPayload); } catch (Exception ex) { if (conn.getNeedReconnect()) { if (getCacheLog().getIsInfoEnabled()) { getCacheLog().Info(STR, local_addr + STR + dest); } conn = this.ReEstablishConnection(dest); if (conn != null) { if (getCacheLog().getIsInfoEnabled()) { getCacheLog().Info(STR, local_addr + STR + dest); } try { bytesSent = conn.send(msg, userPayload); return bytesSent; } catch (Exception e) { getCacheLog().Error(STR, STR + e.toString()); } } else { getCacheLog().Error(STR, local_addr + STR + dest); } } else { if (getCacheLog().getIsInfoEnabled()) { getCacheLog().Info(STR, local_addr + STR + dest); } } if (getCacheLog().getIsInfoEnabled()) { getCacheLog().Info(STR, STR + dest + STR + ex.getClass().getName() + STR); } throw new ExtSocketException(ex.toString()); } return bytesSent; }
/** * Sends a message to a unicast destination. The destination has to be set * * @param msg The message to send * * <throws> SocketException Thrown if connection cannot be established * </throws> * @param reEstablishCon indicate that if connection is not found in * connectin table then re-establish the connection or not. * */
Sends a message to a unicast destination. The destination has to be set
send
{ "repo_name": "Alachisoft/TayzGrid", "path": "src/tgcluster/src/com/alachisoft/tayzgrid/cluster/blocks/ConnectionTable.java", "license": "apache-2.0", "size": 123762 }
[ "com.alachisoft.tayzgrid.common.enums.Priority", "com.alachisoft.tayzgrid.common.net.Address", "java.net.SocketException" ]
import com.alachisoft.tayzgrid.common.enums.Priority; import com.alachisoft.tayzgrid.common.net.Address; import java.net.SocketException;
import com.alachisoft.tayzgrid.common.enums.*; import com.alachisoft.tayzgrid.common.net.*; import java.net.*;
[ "com.alachisoft.tayzgrid", "java.net" ]
com.alachisoft.tayzgrid; java.net;
63,425
public Object internalPut( String key, Object value ) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream( baos ); out.writeObject( value ); String data = baos.toString(); out.close(); baos.close(); Statement s = conn.createStatement(); s.executeUpdate( "DELETE FROM contextstore WHERE k = '" + key + "'" ); s.executeUpdate( "INSERT INTO contextstore (k,val) values ('"+key+"','" + data + "')" ); s.close(); } catch(Exception e) { System.out.println("internalGet() : " + e ); } return null; }
Object function( String key, Object value ) { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream( baos ); out.writeObject( value ); String data = baos.toString(); out.close(); baos.close(); Statement s = conn.createStatement(); s.executeUpdate( STR + key + "'" ); s.executeUpdate( STR+key+"','" + data + "')" ); s.close(); } catch(Exception e) { System.out.println(STR + e ); } return null; }
/** * Serializes and stores an object in the database. * This is really a hokey way to do it, and will * cause problems. The right way is to use a * prepared statement... */
Serializes and stores an object in the database. This is really a hokey way to do it, and will cause problems. The right way is to use a prepared statement..
internalPut
{ "repo_name": "VISTALL/apache.velocity-engine", "path": "velocity-engine-examples/src/main/java/org/apache/velocity/example/DBContext.java", "license": "apache-2.0", "size": 4963 }
[ "java.io.ByteArrayOutputStream", "java.io.ObjectOutputStream", "java.sql.Statement" ]
import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import java.sql.Statement;
import java.io.*; import java.sql.*;
[ "java.io", "java.sql" ]
java.io; java.sql;
1,035,833
public Order generateOrder() { System.out.println("...generating order: " + counter); Order order = new Order(); order.setId(counter++); order.setItem(counter + " " + ran.nextInt(100)); order.setAmount(ran.nextInt(100) + 1); order.setDescription(counter % 2 == 0 ? "...Camel in Action" : "...ActiveMQ in Action"); return order; }
Order function() { System.out.println(STR + counter); Order order = new Order(); order.setId(counter++); order.setItem(counter + " " + ran.nextInt(100)); order.setAmount(ran.nextInt(100) + 1); order.setDescription(counter % 2 == 0 ? STR : STR); return order; }
/** * Generates a new order */
Generates a new order
generateOrder
{ "repo_name": "victzero/karaf-quickstart", "path": "department_server/src/main/java/me/ezjs/exam/department/service2/DepartmentServiceImpl.java", "license": "apache-2.0", "size": 2219 }
[ "me.ezjs.exam.department.model.Order" ]
import me.ezjs.exam.department.model.Order;
import me.ezjs.exam.department.model.*;
[ "me.ezjs.exam" ]
me.ezjs.exam;
223,809
private void updateMovieTrailerDetails(ArrayList<Bundle> result) { if ((result != null) && !result.isEmpty() && (m_TrailerAdapter != null)) { m_TrailerAdapter.setData(result); m_TrailerLayoutView.setVisibility(View.VISIBLE); // Share the First Trailer if available Bundle trailerItem = m_TrailerAdapter.GetDataItem(0); String sUrl = trailerItem.getString(BundleKeys.TRAILER_KEY); sUrl = YOUTUBE_BROWSER + sUrl; Intent intent = createShareIntentForTrailer(sUrl); setShareIntent(intent); } else { m_TrailerLayoutView.setVisibility(View.GONE); // Locate MenuItem with ShareActionProvider setShareIntent(new Intent()); } }
void function(ArrayList<Bundle> result) { if ((result != null) && !result.isEmpty() && (m_TrailerAdapter != null)) { m_TrailerAdapter.setData(result); m_TrailerLayoutView.setVisibility(View.VISIBLE); Bundle trailerItem = m_TrailerAdapter.GetDataItem(0); String sUrl = trailerItem.getString(BundleKeys.TRAILER_KEY); sUrl = YOUTUBE_BROWSER + sUrl; Intent intent = createShareIntentForTrailer(sUrl); setShareIntent(intent); } else { m_TrailerLayoutView.setVisibility(View.GONE); setShareIntent(new Intent()); } }
/** * Update movie trailer details */
Update movie trailer details
updateMovieTrailerDetails
{ "repo_name": "sanjnair/projects", "path": "android/popular_movies/app/src/main/java/com/example/xmatrix/popularmovies/DetailFragment.java", "license": "mit", "size": 18368 }
[ "android.content.Intent", "android.os.Bundle", "android.view.View", "java.util.ArrayList" ]
import android.content.Intent; import android.os.Bundle; import android.view.View; import java.util.ArrayList;
import android.content.*; import android.os.*; import android.view.*; import java.util.*;
[ "android.content", "android.os", "android.view", "java.util" ]
android.content; android.os; android.view; java.util;
1,192,840
@Override public void addOneOf( Iterator<? extends Resource> individuals ) { while( individuals.hasNext() ) { addOneOf( individuals.next() ); } }
void function( Iterator<? extends Resource> individuals ) { while( individuals.hasNext() ) { addOneOf( individuals.next() ); } }
/** * <p>Add each individual from the given iteration to the * enumeration that defines the class extension of this class.</p> * @param individuals An iterator over individuals * @exception ProfileException If the {@link Profile#ONE_OF()} property is not supported in the current language profile. */
Add each individual from the given iteration to the enumeration that defines the class extension of this class
addOneOf
{ "repo_name": "CesarPantoja/jena", "path": "jena-core/src/main/java/org/apache/jena/ontology/impl/EnumeratedClassImpl.java", "license": "apache-2.0", "size": 6857 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
957,600
private void perform1to1CreationSimple() throws Exception { PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { // Persist 2 1-1 relations using both concrete subclass types tx.begin(); AbstractSimpleClassHolder holder1 = new AbstractSimpleClassHolder(1); ConcreteSimpleSub1 sub1 = new ConcreteSimpleSub1(1); sub1.setBaseField("Base1"); sub1.setSub1Field("Sub1"); holder1.setAbstract1(sub1); pm.makePersistent(holder1); AbstractSimpleClassHolder holder2 = new AbstractSimpleClassHolder(2); ConcreteSimpleSub2 sub2 = new ConcreteSimpleSub2(2); sub2.setBaseField("Base2"); sub2.setSub2Field("Sub2"); holder2.setAbstract1(sub2); pm.makePersistent(holder2); tx.commit(); assertTrue("Id of Abstract object ConcreteSimpleSub1 was null!", pm.getObjectId(sub1) != null); assertTrue("Id of Abstract object ConcreteSimpleSub2 was null!", pm.getObjectId(sub1) != null); assertTrue("Id of holder1 was null!", pm.getObjectId(holder1) != null); assertTrue("Id of holder2 was null!", pm.getObjectId(holder2) != null); } catch (Exception e) { LOG.error("Exception thrown persisting objects with abstract superclass", e); e.printStackTrace(); fail("Exception thrown during persistence : " + e.getMessage()); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } }
void function() throws Exception { PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); try { tx.begin(); AbstractSimpleClassHolder holder1 = new AbstractSimpleClassHolder(1); ConcreteSimpleSub1 sub1 = new ConcreteSimpleSub1(1); sub1.setBaseField("Base1"); sub1.setSub1Field("Sub1"); holder1.setAbstract1(sub1); pm.makePersistent(holder1); AbstractSimpleClassHolder holder2 = new AbstractSimpleClassHolder(2); ConcreteSimpleSub2 sub2 = new ConcreteSimpleSub2(2); sub2.setBaseField("Base2"); sub2.setSub2Field("Sub2"); holder2.setAbstract1(sub2); pm.makePersistent(holder2); tx.commit(); assertTrue(STR, pm.getObjectId(sub1) != null); assertTrue(STR, pm.getObjectId(sub1) != null); assertTrue(STR, pm.getObjectId(holder1) != null); assertTrue(STR, pm.getObjectId(holder2) != null); } catch (Exception e) { LOG.error(STR, e); e.printStackTrace(); fail(STR + e.getMessage()); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } }
/** * Convenience method to create 2 holders with ConcreteSimpleSub1, ConcreteSimpleSub2 related objects. */
Convenience method to create 2 holders with ConcreteSimpleSub1, ConcreteSimpleSub2 related objects
perform1to1CreationSimple
{ "repo_name": "hopecee/texsts", "path": "jdo/identity/src/test/org/datanucleus/tests/AbstractClassesTest.java", "license": "apache-2.0", "size": 29195 }
[ "javax.jdo.PersistenceManager", "javax.jdo.Transaction", "org.jpox.samples.abstractclasses.AbstractSimpleClassHolder", "org.jpox.samples.abstractclasses.ConcreteSimpleSub1", "org.jpox.samples.abstractclasses.ConcreteSimpleSub2" ]
import javax.jdo.PersistenceManager; import javax.jdo.Transaction; import org.jpox.samples.abstractclasses.AbstractSimpleClassHolder; import org.jpox.samples.abstractclasses.ConcreteSimpleSub1; import org.jpox.samples.abstractclasses.ConcreteSimpleSub2;
import javax.jdo.*; import org.jpox.samples.abstractclasses.*;
[ "javax.jdo", "org.jpox.samples" ]
javax.jdo; org.jpox.samples;
958,348
public void testHead() { CompleteIndex index; long[] values = {60, 80, 40, 50, 0, 20, 10, 70, 30, 90}; int[] ids = {7, 80, 81, 200, 235, 490, 601, 698, 888, 965}; index = fillIndex(values, ids); for (long size = 0, i = 0; i < 100; i += 10, size++) { Assert.assertEquals(size + 1, index.head(Bytes.toBytes(i), true).size()); Assert.assertEquals(size, index.head(Bytes.toBytes(i), false).size()); } for (long size = 0, i = -5; i < 110; i += 10, size++) { Assert.assertEquals(Math.min(size, 10), index.head(Bytes.toBytes(i), true).size()); Assert.assertEquals(Math.min(size, 10), index.head(Bytes.toBytes(i), false).size()); } // check explicit value setting Assert.assertEquals(index.head(Bytes.toBytes(50L), true), makeSet(81, 200, 235, 490, 601, 888)); Assert.assertEquals(index.head(Bytes.toBytes(50L), false), makeSet(81, 235, 490, 601, 888)); Assert.assertEquals(index.head(Bytes.toBytes(45L), true), makeSet(81, 235, 490, 601, 888)); Assert.assertEquals(index.head(Bytes.toBytes(45L), false), makeSet(81, 235, 490, 601, 888)); values = new long[]{100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; index = fillIndex(values, ids); Assert.assertEquals(10, index.head(Bytes.toBytes(100L), true).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(100L), false).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(99L), false).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(99L), true).size()); Assert.assertEquals(10, index.head(Bytes.toBytes(101L), false).size()); Assert.assertEquals(10, index.head(Bytes.toBytes(101L), true).size()); values = new long[]{100, 99, 50, 99, 100, 50, 100, 100, 99, 99}; index = fillIndex(values, ids); Assert.assertEquals(10, index.head(Bytes.toBytes(101L), true).size()); Assert.assertEquals(10, index.head(Bytes.toBytes(101L), false).size()); Assert.assertEquals(10, index.head(Bytes.toBytes(100L), true).size()); Assert.assertEquals(6, index.head(Bytes.toBytes(100L), false).size()); Assert.assertEquals(6, index.head(Bytes.toBytes(99L), true).size()); Assert.assertEquals(2, index.head(Bytes.toBytes(99L), false).size()); Assert.assertEquals(2, index.head(Bytes.toBytes(98L), true).size()); Assert.assertEquals(2, index.head(Bytes.toBytes(98L), false).size()); Assert.assertEquals(2, index.head(Bytes.toBytes(50L), true).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(50L), false).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(49L), true).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(49L), false).size()); }
void function() { CompleteIndex index; long[] values = {60, 80, 40, 50, 0, 20, 10, 70, 30, 90}; int[] ids = {7, 80, 81, 200, 235, 490, 601, 698, 888, 965}; index = fillIndex(values, ids); for (long size = 0, i = 0; i < 100; i += 10, size++) { Assert.assertEquals(size + 1, index.head(Bytes.toBytes(i), true).size()); Assert.assertEquals(size, index.head(Bytes.toBytes(i), false).size()); } for (long size = 0, i = -5; i < 110; i += 10, size++) { Assert.assertEquals(Math.min(size, 10), index.head(Bytes.toBytes(i), true).size()); Assert.assertEquals(Math.min(size, 10), index.head(Bytes.toBytes(i), false).size()); } Assert.assertEquals(index.head(Bytes.toBytes(50L), true), makeSet(81, 200, 235, 490, 601, 888)); Assert.assertEquals(index.head(Bytes.toBytes(50L), false), makeSet(81, 235, 490, 601, 888)); Assert.assertEquals(index.head(Bytes.toBytes(45L), true), makeSet(81, 235, 490, 601, 888)); Assert.assertEquals(index.head(Bytes.toBytes(45L), false), makeSet(81, 235, 490, 601, 888)); values = new long[]{100, 100, 100, 100, 100, 100, 100, 100, 100, 100}; index = fillIndex(values, ids); Assert.assertEquals(10, index.head(Bytes.toBytes(100L), true).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(100L), false).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(99L), false).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(99L), true).size()); Assert.assertEquals(10, index.head(Bytes.toBytes(101L), false).size()); Assert.assertEquals(10, index.head(Bytes.toBytes(101L), true).size()); values = new long[]{100, 99, 50, 99, 100, 50, 100, 100, 99, 99}; index = fillIndex(values, ids); Assert.assertEquals(10, index.head(Bytes.toBytes(101L), true).size()); Assert.assertEquals(10, index.head(Bytes.toBytes(101L), false).size()); Assert.assertEquals(10, index.head(Bytes.toBytes(100L), true).size()); Assert.assertEquals(6, index.head(Bytes.toBytes(100L), false).size()); Assert.assertEquals(6, index.head(Bytes.toBytes(99L), true).size()); Assert.assertEquals(2, index.head(Bytes.toBytes(99L), false).size()); Assert.assertEquals(2, index.head(Bytes.toBytes(98L), true).size()); Assert.assertEquals(2, index.head(Bytes.toBytes(98L), false).size()); Assert.assertEquals(2, index.head(Bytes.toBytes(50L), true).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(50L), false).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(49L), true).size()); Assert.assertEquals(0, index.head(Bytes.toBytes(49L), false).size()); }
/** * Tests that the lookup method returns correct results. */
Tests that the lookup method returns correct results
testHead
{ "repo_name": "ykulbak/ihbase", "path": "src/test/java/org/apache/hadoop/hbase/regionserver/TestCompleteIndex.java", "license": "apache-2.0", "size": 15424 }
[ "junit.framework.Assert", "org.apache.hadoop.hbase.util.Bytes" ]
import junit.framework.Assert; import org.apache.hadoop.hbase.util.Bytes;
import junit.framework.*; import org.apache.hadoop.hbase.util.*;
[ "junit.framework", "org.apache.hadoop" ]
junit.framework; org.apache.hadoop;
2,843,330
public int quantityDropped(Random random) { return 1; }
int function(Random random) { return 1; }
/** * Returns the quantity of items to drop on block destruction. */
Returns the quantity of items to drop on block destruction
quantityDropped
{ "repo_name": "aebert1/BigTransport", "path": "build/tmp/recompileMc/sources/net/minecraft/block/Block.java", "license": "gpl-3.0", "size": 115325 }
[ "java.util.Random" ]
import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
1,530,810
private void initialize() { // Image this.rf = ResourceFinder.resources(); ImageIcon topbar = this.rf.getResourceAsImage("jurpe-topbar.jpg"); this.jLabelPicture.setBounds(new Rectangle(64, 15, 348, 59)); this.jLabelPicture.setIcon(topbar); StyledDocument doc = this.jTextAreaGPL.getStyledDocument(); SimpleAttributeSet center = new SimpleAttributeSet(); StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER); doc.setParagraphAttributes(0, doc.getLength(), center, false); // License text this.jTextAreaGPL.setFont(new Font("Courier", Font.PLAIN, 10)); // this.setSize(483, 329); this.setBackground(SystemColor.control); this.setResizable(false); this.setTitle("Jurpe - About"); }
void function() { this.rf = ResourceFinder.resources(); ImageIcon topbar = this.rf.getResourceAsImage(STR); this.jLabelPicture.setBounds(new Rectangle(64, 15, 348, 59)); this.jLabelPicture.setIcon(topbar); StyledDocument doc = this.jTextAreaGPL.getStyledDocument(); SimpleAttributeSet center = new SimpleAttributeSet(); StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER); doc.setParagraphAttributes(0, doc.getLength(), center, false); this.jTextAreaGPL.setFont(new Font(STR, Font.PLAIN, 10)); this.setBackground(SystemColor.control); this.setResizable(false); this.setTitle(STR); }
/** * This method initializes this * * @return void */
This method initializes this
initialize
{ "repo_name": "guildenstern70/jurpe", "path": "jurpedemo/src/main/java/net/littlelite/jurpedemo/frames/JDialogAbout.java", "license": "gpl-2.0", "size": 8929 }
[ "java.awt.Font", "java.awt.Rectangle", "java.awt.SystemColor", "javax.swing.ImageIcon", "javax.swing.text.SimpleAttributeSet", "javax.swing.text.StyleConstants", "javax.swing.text.StyledDocument", "net.littlelite.jurpe.system.resources.ResourceFinder" ]
import java.awt.Font; import java.awt.Rectangle; import java.awt.SystemColor; import javax.swing.ImageIcon; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; import net.littlelite.jurpe.system.resources.ResourceFinder;
import java.awt.*; import javax.swing.*; import javax.swing.text.*; import net.littlelite.jurpe.system.resources.*;
[ "java.awt", "javax.swing", "net.littlelite.jurpe" ]
java.awt; javax.swing; net.littlelite.jurpe;
1,397,268
public void copyFrom(UnsafeRow row) { // copyFrom is only available for UnsafeRow created from byte array. assert (baseObject instanceof byte[]) && baseOffset == Platform.BYTE_ARRAY_OFFSET; if (row.sizeInBytes > this.sizeInBytes) { // resize the underlying byte[] if it's not large enough. this.baseObject = new byte[row.sizeInBytes]; } Platform.copyMemory( row.baseObject, row.baseOffset, this.baseObject, this.baseOffset, row.sizeInBytes); // update the sizeInBytes. this.sizeInBytes = row.sizeInBytes; }
void function(UnsafeRow row) { assert (baseObject instanceof byte[]) && baseOffset == Platform.BYTE_ARRAY_OFFSET; if (row.sizeInBytes > this.sizeInBytes) { this.baseObject = new byte[row.sizeInBytes]; } Platform.copyMemory( row.baseObject, row.baseOffset, this.baseObject, this.baseOffset, row.sizeInBytes); this.sizeInBytes = row.sizeInBytes; }
/** * Copies the input UnsafeRow to this UnsafeRow, and resize the underlying byte[] when the * input row is larger than this row. */
Copies the input UnsafeRow to this UnsafeRow, and resize the underlying byte[] when the input row is larger than this row
copyFrom
{ "repo_name": "skeght/Mycat-Server", "path": "src/main/java/io/mycat/memory/unsafe/row/UnsafeRow.java", "license": "gpl-2.0", "size": 16390 }
[ "io.mycat.memory.unsafe.Platform" ]
import io.mycat.memory.unsafe.Platform;
import io.mycat.memory.unsafe.*;
[ "io.mycat.memory" ]
io.mycat.memory;
572,289
public static void handleError(HttpResponse response) throws SocialHttpClientException { if (response.getStatusLine().getStatusCode() != 200) { throw new SocialHttpClientException(response.getStatusLine().toString()); } }
static void function(HttpResponse response) throws SocialHttpClientException { if (response.getStatusLine().getStatusCode() != 200) { throw new SocialHttpClientException(response.getStatusLine().toString()); } }
/** * Handles the error code which contains in HttpResponse. * @param response HttpResponse * @throws SocialHttpClientException */
Handles the error code which contains in HttpResponse
handleError
{ "repo_name": "hoatle/exo.social.client", "path": "src/main/java/org/exoplatform/social/client/core/util/SocialHttpClientSupport.java", "license": "agpl-3.0", "size": 14341 }
[ "org.apache.http.HttpResponse", "org.exoplatform.social.client.api.net.SocialHttpClientException" ]
import org.apache.http.HttpResponse; import org.exoplatform.social.client.api.net.SocialHttpClientException;
import org.apache.http.*; import org.exoplatform.social.client.api.net.*;
[ "org.apache.http", "org.exoplatform.social" ]
org.apache.http; org.exoplatform.social;
1,514,002
private Point parsePoint(String point) { int comma = point.indexOf(','); if (comma == -1) return null; float lat = Float.valueOf(point.substring(0, comma)); float lng = Float.valueOf(point.substring(comma + 1)); return spatialctx.makePoint(lng, lat); }
Point function(String point) { int comma = point.indexOf(','); if (comma == -1) return null; float lat = Float.valueOf(point.substring(0, comma)); float lng = Float.valueOf(point.substring(comma + 1)); return spatialctx.makePoint(lng, lat); }
/** * Parses coordinates into a Spatial4j point shape. */
Parses coordinates into a Spatial4j point shape
parsePoint
{ "repo_name": "enricopal/STEM", "path": "lib/Duke/duke-lucene/src/main/java/no/priv/garshol/duke/databases/GeoProperty.java", "license": "apache-2.0", "size": 2570 }
[ "com.spatial4j.core.shape.Point" ]
import com.spatial4j.core.shape.Point;
import com.spatial4j.core.shape.*;
[ "com.spatial4j.core" ]
com.spatial4j.core;
1,256,201
String os = System.getProperty(SYSPROP_OS_NAME).toLowerCase(); return Optional.ofNullable(os.contains(OS_WIN) ? System.getenv(ENV_WIN_APPDATA) : System.getProperty(SYSPROP_USER_HOME) + (os.contains(OS_MAC) ? DATAPATH_MAC : DATAPATH_NIX)); }
String os = System.getProperty(SYSPROP_OS_NAME).toLowerCase(); return Optional.ofNullable(os.contains(OS_WIN) ? System.getenv(ENV_WIN_APPDATA) : System.getProperty(SYSPROP_USER_HOME) + (os.contains(OS_MAC) ? DATAPATH_MAC : DATAPATH_NIX)); }
/** * get the application data directory for the different os systems. * * @return data directory if it can be determined. may be null when in windows environment is not set */
get the application data directory for the different os systems
getApplicationDataDirectory
{ "repo_name": "sothawo/trakxmap", "path": "src/main/java/com/sothawo/trakxmap/util/PathTools.java", "license": "apache-2.0", "size": 3435 }
[ "java.util.Optional" ]
import java.util.Optional;
import java.util.*;
[ "java.util" ]
java.util;
393,759
EAttribute getGenericNode_Icon();
EAttribute getGenericNode_Icon();
/** * Returns the meta object for the attribute '{@link org.nasdanika.amur.it.js.foundation.GenericNode#getIcon <em>Icon</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Icon</em>'. * @see org.nasdanika.amur.it.js.foundation.GenericNode#getIcon() * @see #getGenericNode() * @generated */
Returns the meta object for the attribute '<code>org.nasdanika.amur.it.js.foundation.GenericNode#getIcon Icon</code>'.
getGenericNode_Icon
{ "repo_name": "Nasdanika/amur-it-js", "path": "org.nasdanika.amur.it.js.foundation/src/org/nasdanika/amur/it/js/foundation/FoundationPackage.java", "license": "epl-1.0", "size": 134053 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,457,235
protected void succeeded(Description description) { }
void function(Description description) { }
/** * Invoked when a test succeeds */
Invoked when a test succeeds
succeeded
{ "repo_name": "Activiti/Activiti", "path": "activiti-core/activiti-engine/src/main/java/org/activiti/engine/test/ActivitiRule.java", "license": "apache-2.0", "size": 10291 }
[ "org.junit.runner.Description" ]
import org.junit.runner.Description;
import org.junit.runner.*;
[ "org.junit.runner" ]
org.junit.runner;
562,178
protected String getPath(String fileName) throws IOException { return new File("src/it/resources/com/google/checkstyle/test/" + fileName) .getCanonicalPath(); }
String function(String fileName) throws IOException { return new File(STR + fileName) .getCanonicalPath(); }
/** * Returns canonical path for the file with the given file name. * The path is formed based on the specific root location. * This implementation uses 'src/it/resources/com/google/checkstyle/test/' as a root location. * @param fileName file name. * @return canonical path for the the file with the given file name. * @throws IOException if I/O exception occurs while forming the path. */
Returns canonical path for the file with the given file name. The path is formed based on the specific root location. This implementation uses 'src/it/resources/com/google/checkstyle/test/' as a root location
getPath
{ "repo_name": "sharang108/checkstyle", "path": "src/it/java/com/google/checkstyle/test/base/BaseCheckTestSupport.java", "license": "lgpl-2.1", "size": 15459 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
857,834
@Override protected boolean doWrite(SpreadSheet content, OutputStream out) { return doWrite(new SpreadSheet[]{content}, out); }
boolean function(SpreadSheet content, OutputStream out) { return doWrite(new SpreadSheet[]{content}, out); }
/** * Performs the actual writing. The caller must ensure that the output stream * gets closed. * * @param content the spreadsheet to write * @param out the output stream to write the spreadsheet to * @return true if successfully written */
Performs the actual writing. The caller must ensure that the output stream gets closed
doWrite
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-spreadsheet/src/main/java/adams/data/io/output/AbstractMultiSheetSpreadSheetWriter.java", "license": "gpl-3.0", "size": 7965 }
[ "java.io.OutputStream" ]
import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,759,762
public native String getProperties(JavaScriptObject e) ;
native String function(JavaScriptObject e) ;
/** * Returns the list of properties of an unexpected JavaScript exception. */
Returns the list of properties of an unexpected JavaScript exception
getProperties
{ "repo_name": "mvniekerk/titanium4j", "path": "src/com/google/gwt/core/client/impl/StackTraceCreator.java", "license": "apache-2.0", "size": 19342 }
[ "com.google.gwt.core.client.JavaScriptObject" ]
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.*;
[ "com.google.gwt" ]
com.google.gwt;
696,419
@Override public void commit(final boolean onSave) { // definitions List<String> definitions = FormHelper.getSerializedInput(definitionsTable); getModel().setAttribute(MODEL_PARAMETER_DEFINITIONS, definitions); // new definitions String newDefinitions = FormHelper.trimTrailingSpaces(newDefinitionsSource.getDocument().get()); getModel().setAttribute(MODEL_PARAMETER_NEW_DEFINITIONS, newDefinitions); // model values String modelValues = FormHelper.trimTrailingSpaces(modelValuesSource.getDocument().get()); TypedSet modelValuesSet = TypedSet.parseSet(modelValues); getModel().setAttribute(MODEL_PARAMETER_MODEL_VALUES, modelValuesSet.toString()); // constraint formula String constraintFormula = FormHelper.trimTrailingSpaces(constraintSource.getDocument().get()); getModel().setAttribute(MODEL_PARAMETER_CONSTRAINT, constraintFormula); // action constraint formula String actionConstraintFormula = FormHelper.trimTrailingSpaces(actionConstraintSource.getDocument().get()); getModel().setAttribute(MODEL_PARAMETER_ACTION_CONSTRAINT, actionConstraintFormula); super.commit(onSave); }
void function(final boolean onSave) { List<String> definitions = FormHelper.getSerializedInput(definitionsTable); getModel().setAttribute(MODEL_PARAMETER_DEFINITIONS, definitions); String newDefinitions = FormHelper.trimTrailingSpaces(newDefinitionsSource.getDocument().get()); getModel().setAttribute(MODEL_PARAMETER_NEW_DEFINITIONS, newDefinitions); String modelValues = FormHelper.trimTrailingSpaces(modelValuesSource.getDocument().get()); TypedSet modelValuesSet = TypedSet.parseSet(modelValues); getModel().setAttribute(MODEL_PARAMETER_MODEL_VALUES, modelValuesSet.toString()); String constraintFormula = FormHelper.trimTrailingSpaces(constraintSource.getDocument().get()); getModel().setAttribute(MODEL_PARAMETER_CONSTRAINT, constraintFormula); String actionConstraintFormula = FormHelper.trimTrailingSpaces(actionConstraintSource.getDocument().get()); getModel().setAttribute(MODEL_PARAMETER_ACTION_CONSTRAINT, actionConstraintFormula); super.commit(onSave); }
/** * Save data back to config */
Save data back to config
commit
{ "repo_name": "lemmy/tlaplus", "path": "toolbox/org.lamport.tla.toolbox.tool.tlc.ui/src/org/lamport/tla/toolbox/tool/tlc/ui/editor/page/advanced/AdvancedModelPage.java", "license": "mit", "size": 24777 }
[ "java.util.List", "org.lamport.tla.toolbox.tool.tlc.ui.util.FormHelper" ]
import java.util.List; import org.lamport.tla.toolbox.tool.tlc.ui.util.FormHelper;
import java.util.*; import org.lamport.tla.toolbox.tool.tlc.ui.util.*;
[ "java.util", "org.lamport.tla" ]
java.util; org.lamport.tla;
968,027
public String[] getInputAsArray() { List<StringValue> list = getRequest().getRequestParameters().getParameterValues( getInputName()); String[] values = null; if (list != null) { values = new String[list.size()]; for (int i = 0; i < list.size(); ++i) { values[i] = list.get(i).toString(); } } if (!isInputNullable()) { if (values != null && values.length == 1 && values[0] == null) { // we the key got passed in (otherwise values would be null), // but the value was set to null. // As the servlet spec isn't clear on what to do with 'empty' // request values - most return an empty string, but some null - // we have to workaround here and deliberately set to an empty // string if the the component is not nullable (text components) return EMPTY_STRING_ARRAY; } } return values; }
String[] function() { List<StringValue> list = getRequest().getRequestParameters().getParameterValues( getInputName()); String[] values = null; if (list != null) { values = new String[list.size()]; for (int i = 0; i < list.size(); ++i) { values[i] = list.get(i).toString(); } } if (!isInputNullable()) { if (values != null && values.length == 1 && values[0] == null) { return EMPTY_STRING_ARRAY; } } return values; }
/** * Gets the request parameters for this component as strings. * * @return The values in the request for this component */
Gets the request parameters for this component as strings
getInputAsArray
{ "repo_name": "afiantara/apache-wicket-1.5.7", "path": "src/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java", "license": "apache-2.0", "size": 39990 }
[ "java.util.List", "org.apache.wicket.util.string.StringValue" ]
import java.util.List; import org.apache.wicket.util.string.StringValue;
import java.util.*; import org.apache.wicket.util.string.*;
[ "java.util", "org.apache.wicket" ]
java.util; org.apache.wicket;
2,635,998
checkNotNull(apkPath); checkArgument(new File(apkPath).exists(), "Apk ain't there: %s", apkPath); AaptDumpPackageLineProcessor stdoutProcessor = aaptDumpProcessorProvider.get(); String packageName = null; for (int i = 0; i < MAX_TRIES; i++) { SubprocessCommunicator.Builder subComBuilder = communicatorBuilderProvider.get().withStdoutProcessor(stdoutProcessor); makeUncheckedAaptCall(subComBuilder, "dump", "badging", apkPath); packageName = stdoutProcessor.getResult(); if (null != packageName) { return packageName; } } throw new RuntimeException("aapt output did not contain the package name."); }
checkNotNull(apkPath); checkArgument(new File(apkPath).exists(), STR, apkPath); AaptDumpPackageLineProcessor stdoutProcessor = aaptDumpProcessorProvider.get(); String packageName = null; for (int i = 0; i < MAX_TRIES; i++) { SubprocessCommunicator.Builder subComBuilder = communicatorBuilderProvider.get().withStdoutProcessor(stdoutProcessor); makeUncheckedAaptCall(subComBuilder, "dump", STR, apkPath); packageName = stdoutProcessor.getResult(); if (null != packageName) { return packageName; } } throw new RuntimeException(STR); }
/** * Returns the package name of the provided apk. */
Returns the package name of the provided apk
getPackageNameFromApk
{ "repo_name": "android/android-test", "path": "tools/device_broker/java/com/google/android/apps/common/testing/broker/AaptUtil.java", "license": "apache-2.0", "size": 3273 }
[ "com.google.common.base.Preconditions", "java.io.File" ]
import com.google.common.base.Preconditions; import java.io.File;
import com.google.common.base.*; import java.io.*;
[ "com.google.common", "java.io" ]
com.google.common; java.io;
1,922,307
protected void initSystemProperties(final HierarchicalConfiguration<?> config, final String basePath) throws ConfigurationException { final String fileName = config.getString(KEY_SYSTEM_PROPS); if (fileName != null) { try { SystemConfiguration.setSystemProperties(basePath, fileName); } catch (final Exception ex) { throw new ConfigurationException("Error setting system properties from " + fileName, ex); } } }
void function(final HierarchicalConfiguration<?> config, final String basePath) throws ConfigurationException { final String fileName = config.getString(KEY_SYSTEM_PROPS); if (fileName != null) { try { SystemConfiguration.setSystemProperties(basePath, fileName); } catch (final Exception ex) { throw new ConfigurationException(STR + fileName, ex); } } }
/** * Handles a file with system properties that may be defined in the definition configuration. If such property file is * configured, all of its properties are added to the system properties. * * @param config the definition configuration * @param basePath the base path defined for this builder (may be <b>null</b>) * @throws ConfigurationException if an error occurs. */
Handles a file with system properties that may be defined in the definition configuration. If such property file is configured, all of its properties are added to the system properties
initSystemProperties
{ "repo_name": "apache/commons-configuration", "path": "src/main/java/org/apache/commons/configuration2/builder/combined/CombinedConfigurationBuilder.java", "license": "apache-2.0", "size": 63605 }
[ "org.apache.commons.configuration2.HierarchicalConfiguration", "org.apache.commons.configuration2.SystemConfiguration", "org.apache.commons.configuration2.ex.ConfigurationException" ]
import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.configuration2.SystemConfiguration; import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.configuration2.*; import org.apache.commons.configuration2.ex.*;
[ "org.apache.commons" ]
org.apache.commons;
581,874
public void setConnectionManager(ConnectionManager connectionManager) { this.connectionManager = connectionManager; }
void function(ConnectionManager connectionManager) { this.connectionManager = connectionManager; }
/** * Set the JCA ConnectionManager that should be used to create the * desired connection factory. * <p>A ConnectionManager implementation for local usage is often * included with a JCA connector. Such an included ConnectionManager * might be set as default, with no need to explicitly specify one. * @see javax.resource.spi.ManagedConnectionFactory#createConnectionFactory(javax.resource.spi.ConnectionManager) */
Set the JCA ConnectionManager that should be used to create the desired connection factory. A ConnectionManager implementation for local usage is often included with a JCA connector. Such an included ConnectionManager might be set as default, with no need to explicitly specify one
setConnectionManager
{ "repo_name": "cbeams-archive/spring-framework-2.5.x", "path": "src/org/springframework/jca/support/LocalConnectionFactoryBean.java", "license": "apache-2.0", "size": 6131 }
[ "javax.resource.spi.ConnectionManager" ]
import javax.resource.spi.ConnectionManager;
import javax.resource.spi.*;
[ "javax.resource" ]
javax.resource;
2,471,821
@CheckReturnValue @Nullable public static File getLastScreenshot() { return screenshots.getLastScreenshot(); }
static File function() { return screenshots.getLastScreenshot(); }
/** * Get the last screenshot taken * * @return null if there were no any screenshots taken */
Get the last screenshot taken
getLastScreenshot
{ "repo_name": "codeborne/selenide", "path": "statics/src/main/java/com/codeborne/selenide/Screenshots.java", "license": "mit", "size": 3973 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
833,135
//------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF public static PositionSearchRequest.Meta meta() { return PositionSearchRequest.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(PositionSearchRequest.Meta.INSTANCE); }
static PositionSearchRequest.Meta function() { return PositionSearchRequest.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(PositionSearchRequest.Meta.INSTANCE); }
/** * The meta-bean for {@code PositionSearchRequest}. * @return the meta-bean, not null */
The meta-bean for PositionSearchRequest
meta
{ "repo_name": "McLeodMoores/starling", "path": "projects/master/src/main/java/com/opengamma/master/position/PositionSearchRequest.java", "license": "apache-2.0", "size": 29171 }
[ "org.joda.beans.JodaBeanUtils" ]
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
176,006
@ApiOperation(value = "Create key") @PostMapping(value = "/apikey/user") public @ResponseBody APIKey createKey(@RequestBody APIKey body, Authentication auth) throws EntityNotFoundException, InvalidDefinitionException { String userId = SecurityUtils.getOAuthUserId(auth, true); Collection<String> scope = SecurityUtils.getOAuthScopes(auth); String clientId = body.getClientId(); if (!scope.contains(Config.SCOPE_APIKEY_USER) && scope.contains(Config.SCOPE_APIKEY_USER_CLIENT)) { // authorized clients can add keys only for themselves clientId = SecurityUtils.getOAuthClientId(auth); } if (clientId == null) { throw new InvalidDefinitionException("clientId required"); } int validity = 0; if (body.getValidity() != null) { validity = body.getValidity().intValue(); } Set<String> scopes = null; if (body.getScope() != null) { scopes = new HashSet<>(Arrays.asList(body.getScope())); // TODO check if client access which scopes user has already authorized! if (!scope.contains(Config.SCOPE_APIKEY_USER) && scope.contains(Config.SCOPE_APIKEY_USER_CLIENT)) { // TODO filter scopes } } return keyManager.createKey(clientId, userId, validity, body.getAdditionalInformation(), scopes); }
@ApiOperation(value = STR) @PostMapping(value = STR) @ResponseBody APIKey function(@RequestBody APIKey body, Authentication auth) throws EntityNotFoundException, InvalidDefinitionException { String userId = SecurityUtils.getOAuthUserId(auth, true); Collection<String> scope = SecurityUtils.getOAuthScopes(auth); String clientId = body.getClientId(); if (!scope.contains(Config.SCOPE_APIKEY_USER) && scope.contains(Config.SCOPE_APIKEY_USER_CLIENT)) { clientId = SecurityUtils.getOAuthClientId(auth); } if (clientId == null) { throw new InvalidDefinitionException(STR); } int validity = 0; if (body.getValidity() != null) { validity = body.getValidity().intValue(); } Set<String> scopes = null; if (body.getScope() != null) { scopes = new HashSet<>(Arrays.asList(body.getScope())); if (!scope.contains(Config.SCOPE_APIKEY_USER) && scope.contains(Config.SCOPE_APIKEY_USER_CLIENT)) { } } return keyManager.createKey(clientId, userId, validity, body.getAdditionalInformation(), scopes); }
/** * Create an API key with the specified properties (validity and additional * info) * * @param apiKey * @return created entity * @throws InvalidDefinitionException */
Create an API key with the specified properties (validity and additional info)
createKey
{ "repo_name": "smartcommunitylab/AAC", "path": "src/main/java/it/smartcommunitylab/aac/apikey/endpoint/APIKeyUserController.java", "license": "apache-2.0", "size": 8533 }
[ "io.swagger.annotations.ApiOperation", "it.smartcommunitylab.aac.Config", "it.smartcommunitylab.aac.common.InvalidDefinitionException", "it.smartcommunitylab.aac.common.SecurityUtils", "it.smartcommunitylab.aac.dto.APIKey", "java.util.Arrays", "java.util.Collection", "java.util.HashSet", "java.util.Set", "javax.persistence.EntityNotFoundException", "org.springframework.security.core.Authentication", "org.springframework.web.bind.annotation.PostMapping", "org.springframework.web.bind.annotation.RequestBody", "org.springframework.web.bind.annotation.ResponseBody" ]
import io.swagger.annotations.ApiOperation; import it.smartcommunitylab.aac.Config; import it.smartcommunitylab.aac.common.InvalidDefinitionException; import it.smartcommunitylab.aac.common.SecurityUtils; import it.smartcommunitylab.aac.dto.APIKey; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Set; import javax.persistence.EntityNotFoundException; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseBody;
import io.swagger.annotations.*; import it.smartcommunitylab.aac.*; import it.smartcommunitylab.aac.common.*; import it.smartcommunitylab.aac.dto.*; import java.util.*; import javax.persistence.*; import org.springframework.security.core.*; import org.springframework.web.bind.annotation.*;
[ "io.swagger.annotations", "it.smartcommunitylab.aac", "java.util", "javax.persistence", "org.springframework.security", "org.springframework.web" ]
io.swagger.annotations; it.smartcommunitylab.aac; java.util; javax.persistence; org.springframework.security; org.springframework.web;
870,872
public void splitLog(final List<ServerName> serverNames, PathFilter filter) throws IOException { long splitTime = 0, splitLogSize = 0; List<Path> logDirs = getLogDirs(serverNames); if (logDirs.isEmpty()) { LOG.info("No logs to split"); return; } boolean lockAcquired = false; if (distributedLogSplitting) { try { if (!this.services.isServerShutdownHandlerEnabled()) { // process one log splitting task at one time before SSH is enabled. // because ROOT SSH and HMaster#assignMeta could both log split a same server this.splitLogLock.lock(); lockAcquired = true; } splitLogManager.handleDeadWorkers(serverNames); splitTime = EnvironmentEdgeManager.currentTimeMillis(); splitLogSize = splitLogManager.splitLogDistributed(logDirs, filter); splitTime = EnvironmentEdgeManager.currentTimeMillis() - splitTime; } finally { if (lockAcquired) { this.splitLogLock.unlock(); } } } else { for(Path logDir: logDirs){ // splitLogLock ensures that dead region servers' logs are processed // one at a time this.splitLogLock.lock(); try { HLogSplitter splitter = HLogSplitter.createLogSplitter( conf, rootdir, logDir, oldLogDir, this.fs); try { // If FS is in safe mode, just wait till out of it. FSUtils.waitOnSafeMode(conf, conf.getInt(HConstants.THREAD_WAKE_FREQUENCY, 1000)); splitter.splitLog(); } catch (OrphanHLogAfterSplitException e) { LOG.warn("Retrying splitting because of:", e); //An HLogSplitter instance can only be used once. Get new instance. splitter = HLogSplitter.createLogSplitter(conf, rootdir, logDir, oldLogDir, this.fs); splitter.splitLog(); } splitTime = splitter.getTime(); splitLogSize = splitter.getSize(); } finally { this.splitLogLock.unlock(); } } } if (this.metrics != null) { this.metrics.addSplit(splitTime, splitLogSize); } }
void function(final List<ServerName> serverNames, PathFilter filter) throws IOException { long splitTime = 0, splitLogSize = 0; List<Path> logDirs = getLogDirs(serverNames); if (logDirs.isEmpty()) { LOG.info(STR); return; } boolean lockAcquired = false; if (distributedLogSplitting) { try { if (!this.services.isServerShutdownHandlerEnabled()) { this.splitLogLock.lock(); lockAcquired = true; } splitLogManager.handleDeadWorkers(serverNames); splitTime = EnvironmentEdgeManager.currentTimeMillis(); splitLogSize = splitLogManager.splitLogDistributed(logDirs, filter); splitTime = EnvironmentEdgeManager.currentTimeMillis() - splitTime; } finally { if (lockAcquired) { this.splitLogLock.unlock(); } } } else { for(Path logDir: logDirs){ this.splitLogLock.lock(); try { HLogSplitter splitter = HLogSplitter.createLogSplitter( conf, rootdir, logDir, oldLogDir, this.fs); try { FSUtils.waitOnSafeMode(conf, conf.getInt(HConstants.THREAD_WAKE_FREQUENCY, 1000)); splitter.splitLog(); } catch (OrphanHLogAfterSplitException e) { LOG.warn(STR, e); splitter = HLogSplitter.createLogSplitter(conf, rootdir, logDir, oldLogDir, this.fs); splitter.splitLog(); } splitTime = splitter.getTime(); splitLogSize = splitter.getSize(); } finally { this.splitLogLock.unlock(); } } } if (this.metrics != null) { this.metrics.addSplit(splitTime, splitLogSize); } }
/** * This method is the base split method that splits HLog files matching a filter. * Callers should pass the appropriate filter for meta and non-meta HLogs. * @param serverNames * @param filter * @throws IOException */
This method is the base split method that splits HLog files matching a filter. Callers should pass the appropriate filter for meta and non-meta HLogs
splitLog
{ "repo_name": "xiaofu/apache-hbase-0.94.10-read", "path": "src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java", "license": "apache-2.0", "size": 25651 }
[ "java.io.IOException", "java.util.List", "org.apache.hadoop.fs.Path", "org.apache.hadoop.fs.PathFilter", "org.apache.hadoop.hbase.HConstants", "org.apache.hadoop.hbase.ServerName", "org.apache.hadoop.hbase.regionserver.wal.HLogSplitter", "org.apache.hadoop.hbase.regionserver.wal.OrphanHLogAfterSplitException", "org.apache.hadoop.hbase.util.EnvironmentEdgeManager", "org.apache.hadoop.hbase.util.FSUtils" ]
import java.io.IOException; import java.util.List; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.PathFilter; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.regionserver.wal.HLogSplitter; import org.apache.hadoop.hbase.regionserver.wal.OrphanHLogAfterSplitException; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.FSUtils;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.regionserver.wal.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
1,111,392
SourceDirectorySet getScala();
SourceDirectorySet getScala();
/** * Returns the source to be compiled by the Scala compiler for this source set. This may contain both Java and Scala * source files. * * @return The Scala source. Never returns null. */
Returns the source to be compiled by the Scala compiler for this source set. This may contain both Java and Scala source files
getScala
{ "repo_name": "gstevey/gradle", "path": "subprojects/scala/src/main/java/org/gradle/api/tasks/ScalaSourceSet.java", "license": "apache-2.0", "size": 2079 }
[ "org.gradle.api.file.SourceDirectorySet" ]
import org.gradle.api.file.SourceDirectorySet;
import org.gradle.api.file.*;
[ "org.gradle.api" ]
org.gradle.api;
1,140,448
private void paintBackground(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) { // if the background color of the component is 100% transparent // then we should not paint any background graphics. This is a solution // for there being no way of turning off Nimbus background painting as // basic components are all non-opaque by default. Component c = ctx.getComponent(); Color bg = (c != null) ? c.getBackground() : null; if (bg == null || bg.getAlpha() > 0) { SeaGlassPainter backgroundPainter = style.getBackgroundPainter(ctx); if (backgroundPainter != null) { paint(backgroundPainter, ctx, g, x, y, w, h, transform); } } }
void function(SynthContext ctx, Graphics g, int x, int y, int w, int h, AffineTransform transform) { Component c = ctx.getComponent(); Color bg = (c != null) ? c.getBackground() : null; if (bg == null bg.getAlpha() > 0) { SeaGlassPainter backgroundPainter = style.getBackgroundPainter(ctx); if (backgroundPainter != null) { paint(backgroundPainter, ctx, g, x, y, w, h, transform); } } }
/** * Paint the object's background. * * @param ctx the SynthContext. * @param g the Graphics context. * @param x the x location corresponding to the upper-left * coordinate to paint. * @param y the y location corresponding to the upper left * coordinate to paint. * @param w the width to paint. * @param h the height to paint. * @param transform the affine transform to apply, or {@code null} if none * is to be applied. */
Paint the object's background
paintBackground
{ "repo_name": "anhtu1995ok/seaglass", "path": "src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java", "license": "apache-2.0", "size": 119406 }
[ "com.seaglasslookandfeel.painter.SeaGlassPainter", "java.awt.Color", "java.awt.Component", "java.awt.Graphics", "java.awt.geom.AffineTransform", "javax.swing.plaf.synth.SynthContext" ]
import com.seaglasslookandfeel.painter.SeaGlassPainter; import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.geom.AffineTransform; import javax.swing.plaf.synth.SynthContext;
import com.seaglasslookandfeel.painter.*; import java.awt.*; import java.awt.geom.*; import javax.swing.plaf.synth.*;
[ "com.seaglasslookandfeel.painter", "java.awt", "javax.swing" ]
com.seaglasslookandfeel.painter; java.awt; javax.swing;
1,401,327
private long markableStreamLength(InputStream stream) throws IOException { long size = 0; stream.mark(MAX_UPLOAD_BYTES); while (stream.read() != -1) { size += 1; } stream.reset(); return size; } /** * {@inheritDoc}
long function(InputStream stream) throws IOException { long size = 0; stream.mark(MAX_UPLOAD_BYTES); while (stream.read() != -1) { size += 1; } stream.reset(); return size; } /** * {@inheritDoc}
/** * Get the length of a markable InputStream. */
Get the length of a markable InputStream
markableStreamLength
{ "repo_name": "buckett/sakai-gitflow", "path": "cloud-content/impl/src/main/java/coza/opencollab/sakai/cloudcontent/BlobStoreFileSystemHandler.java", "license": "apache-2.0", "size": 10941 }
[ "java.io.IOException", "java.io.InputStream" ]
import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
368,857
public static <T> T newInstance(Class<?> actualType, Class<T> expectedType) { try { Object value = actualType.newInstance(); return cast(expectedType, value); } catch (InstantiationException e) { throw new RuntimeCamelException(e); } catch (IllegalAccessException e) { throw new RuntimeCamelException(e); } }
static <T> T function(Class<?> actualType, Class<T> expectedType) { try { Object value = actualType.newInstance(); return cast(expectedType, value); } catch (InstantiationException e) { throw new RuntimeCamelException(e); } catch (IllegalAccessException e) { throw new RuntimeCamelException(e); } }
/** * A helper method to create a new instance of a type using the default * constructor arguments. */
A helper method to create a new instance of a type using the default constructor arguments
newInstance
{ "repo_name": "pkletsko/camel", "path": "camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java", "license": "apache-2.0", "size": 79019 }
[ "org.apache.camel.RuntimeCamelException" ]
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.*;
[ "org.apache.camel" ]
org.apache.camel;
920,720
public static <T> T[] resize(T[] buffer, int newSize) { Class<T> componentType = (Class<T>) buffer.getClass().getComponentType(); T[] temp = (T[]) Array.newInstance(componentType, newSize); System.arraycopy(buffer, 0, temp, 0, buffer.length >= newSize ? newSize : buffer.length); return temp; }
static <T> T[] function(T[] buffer, int newSize) { Class<T> componentType = (Class<T>) buffer.getClass().getComponentType(); T[] temp = (T[]) Array.newInstance(componentType, newSize); System.arraycopy(buffer, 0, temp, 0, buffer.length >= newSize ? newSize : buffer.length); return temp; }
/** * Resizes an array. */
Resizes an array
resize
{ "repo_name": "007slm/jodd", "path": "jodd-core/src/main/java/jodd/util/ArraysUtil.java", "license": "bsd-3-clause", "size": 55985 }
[ "java.lang.reflect.Array" ]
import java.lang.reflect.Array;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,355,582
SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = securityContext.getAuthentication(); String userName = null; if (authentication != null) { if (authentication.getPrincipal() instanceof UserDetails) { UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal(); userName = springSecurityUser.getUsername(); } else if (authentication.getPrincipal() instanceof String) { userName = (String) authentication.getPrincipal(); } } return userName; }
SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = securityContext.getAuthentication(); String userName = null; if (authentication != null) { if (authentication.getPrincipal() instanceof UserDetails) { UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal(); userName = springSecurityUser.getUsername(); } else if (authentication.getPrincipal() instanceof String) { userName = (String) authentication.getPrincipal(); } } return userName; }
/** * Get the login of the current user. * * @return the login of the current user */
Get the login of the current user
getCurrentUserLogin
{ "repo_name": "klask-io/klask-io", "path": "src/main/java/io/klask/security/SecurityUtils.java", "license": "gpl-3.0", "size": 2940 }
[ "org.springframework.security.core.Authentication", "org.springframework.security.core.context.SecurityContext", "org.springframework.security.core.context.SecurityContextHolder", "org.springframework.security.core.userdetails.UserDetails" ]
import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.*; import org.springframework.security.core.context.*; import org.springframework.security.core.userdetails.*;
[ "org.springframework.security" ]
org.springframework.security;
1,259,557
@FIXVersion(introduced="5.0SP1") public UnderlyingLegSecurityAltIDGroup deleteUnderlyingLegSecurityAltIDGroup(int index) { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
@FIXVersion(introduced=STR) UnderlyingLegSecurityAltIDGroup function(int index) { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
/** * This method deletes a {@link UnderlyingLegSecurityAltIDGroup} object from the existing array * of <code>underlyingLegSecurityAltIDGroups</code> and shrink the static array with 1 place.<br/> * If the array does not have the index position then a null object will be returned.)<br/> * This method will also update <code>noUnderlyingLegSecurityAltID</code> field to the proper value.<br/> * @param index position in array to be deleted starting at 0 * @return deleted block object */
This method deletes a <code>UnderlyingLegSecurityAltIDGroup</code> object from the existing array of <code>underlyingLegSecurityAltIDGroups</code> and shrink the static array with 1 place. If the array does not have the index position then a null object will be returned.) This method will also update <code>noUnderlyingLegSecurityAltID</code> field to the proper value
deleteUnderlyingLegSecurityAltIDGroup
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/comp/UnderlyingLegInstrument.java", "license": "gpl-3.0", "size": 27982 }
[ "net.hades.fix.message.anno.FIXVersion", "net.hades.fix.message.group.UnderlyingLegSecurityAltIDGroup" ]
import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.group.UnderlyingLegSecurityAltIDGroup;
import net.hades.fix.message.anno.*; import net.hades.fix.message.group.*;
[ "net.hades.fix" ]
net.hades.fix;
1,046,780
public void setContainerPartitionElementHLAPI( PartitionElementHLAPI elem);
void function( PartitionElementHLAPI elem);
/** * set ContainerPartitionElement */
set ContainerPartitionElement
setContainerPartitionElementHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-SNNet/src/fr/lip6/move/pnml/symmetricnet/terms/hlapi/OperatorHLAPI.java", "license": "epl-1.0", "size": 21731 }
[ "fr.lip6.move.pnml.symmetricnet.partitions.hlapi.PartitionElementHLAPI" ]
import fr.lip6.move.pnml.symmetricnet.partitions.hlapi.PartitionElementHLAPI;
import fr.lip6.move.pnml.symmetricnet.partitions.hlapi.*;
[ "fr.lip6.move" ]
fr.lip6.move;
208,318