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
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private Result doHBaseGet(Get get) throws IOException { final HTableInterface htable = mTable.openHTableConnection(); try { return htable.get(get); } finally { htable.close(); } }
Result function(Get get) throws IOException { final HTableInterface htable = mTable.openHTableConnection(); try { return htable.get(get); } finally { htable.close(); } }
/** * Sends an HBase Get request. * * @param get HBase Get request. * @return the HBase Result. * @throws IOException on I/O error. */
Sends an HBase Get request
doHBaseGet
{ "repo_name": "zenoss/kiji-schema", "path": "kiji-schema/src/main/java/org/kiji/schema/impl/HBaseVersionPager.java", "license": "apache-2.0", "size": 9280 }
[ "java.io.IOException", "org.apache.hadoop.hbase.client.Get", "org.apache.hadoop.hbase.client.HTableInterface", "org.apache.hadoop.hbase.client.Result" ]
import java.io.IOException; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.HTableInterface; import org.apache.hadoop.hbase.client.Result;
import java.io.*; import org.apache.hadoop.hbase.client.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,042,531
@Test public void testNoCache() { // the execution context does not contain a cache Context contextNoCache = Context.EMPTY_CONTEXT(); assertEquals("BLAH", execute("TO_UPPER(name)", contextNoCache)); assertEquals("BLAH", execute("TO_UPPER(name)", contextNoCache)); }
void function() { Context contextNoCache = Context.EMPTY_CONTEXT(); assertEquals("BLAH", execute(STR, contextNoCache)); assertEquals("BLAH", execute(STR, contextNoCache)); }
/** * The processor should work, even if no cache is present in the execution context. */
The processor should work, even if no cache is present in the execution context
testNoCache
{ "repo_name": "justinleet/metron", "path": "metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/common/CachingStellarProcessorTest.java", "license": "apache-2.0", "size": 6062 }
[ "org.apache.metron.stellar.dsl.Context", "org.junit.jupiter.api.Assertions" ]
import org.apache.metron.stellar.dsl.Context; import org.junit.jupiter.api.Assertions;
import org.apache.metron.stellar.dsl.*; import org.junit.jupiter.api.*;
[ "org.apache.metron", "org.junit.jupiter" ]
org.apache.metron; org.junit.jupiter;
198,993
@SuppressWarnings("unchecked") // Needed for downcast from Object to List<String>. private synchronized boolean parseMetaRule(Map<String, Object> map) { Preconditions.checkState(isMetaRule(map)); // INCLUDES_META_RULE maps to a list of file paths: the head is a // dependent build file and the tail is a list of the files it includes. List<String> fileNames = ((List<String>) map.get(INCLUDES_META_RULE)); Path dependent = normalize(Paths.get(fileNames.get(0))); for (String fileName : fileNames) { buildFileDependents.put(normalize(Paths.get(fileName)), dependent); } return true; }
@SuppressWarnings(STR) synchronized boolean function(Map<String, Object> map) { Preconditions.checkState(isMetaRule(map)); List<String> fileNames = ((List<String>) map.get(INCLUDES_META_RULE)); Path dependent = normalize(Paths.get(fileNames.get(0))); for (String fileName : fileNames) { buildFileDependents.put(normalize(Paths.get(fileName)), dependent); } return true; }
/** * Processes build file meta rules and returns true if map represents a meta rule. * @param map a meta rule read from a build file. */
Processes build file meta rules and returns true if map represents a meta rule
parseMetaRule
{ "repo_name": "saleeh93/buck-cutom", "path": "src/com/facebook/buck/parser/Parser.java", "license": "apache-2.0", "size": 43719 }
[ "com.google.common.base.Preconditions", "java.nio.file.Path", "java.nio.file.Paths", "java.util.List", "java.util.Map" ]
import com.google.common.base.Preconditions; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; import java.util.Map;
import com.google.common.base.*; import java.nio.file.*; import java.util.*;
[ "com.google.common", "java.nio", "java.util" ]
com.google.common; java.nio; java.util;
1,731,859
public List<ExperimenterData> cutAndPasteExperimenters( SecurityContext ctx, Map toPaste, Map toRemove) throws DSOutOfServiceException, DSAccessException;
List<ExperimenterData> function( SecurityContext ctx, Map toPaste, Map toRemove) throws DSOutOfServiceException, DSAccessException;
/** * Cuts and paste the specified experimenters. * * @param ctx The security context. * @param toPaste The nodes to paste. * @param toRemove The nodes to remove. * @return See above * @throws DSOutOfServiceException If the connection is broken, or not logged in * @throws DSAccessException If an error occurred while trying to * retrieve data from OMERO service. */
Cuts and paste the specified experimenters
cutAndPasteExperimenters
{ "repo_name": "knabar/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/AdminService.java", "license": "gpl-2.0", "size": 20920 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,845,929
public void setXTranslation(DataNode xTranslation) throws NexusException { sample.addDataNode(NXsample.NX_X_TRANSLATION, xTranslation); }
void function(DataNode xTranslation) throws NexusException { sample.addDataNode(NXsample.NX_X_TRANSLATION, xTranslation); }
/** * Sets the 'x' translation * @param xTranslation x translation data node * @throws NexusException */
Sets the 'x' translation
setXTranslation
{ "repo_name": "belkassaby/dawnsci", "path": "org.eclipse.dawnsci.nexus/src/org/eclipse/dawnsci/nexus/builder/appdef/impl/TomoApplicationBuilder.java", "license": "epl-1.0", "size": 10055 }
[ "org.eclipse.dawnsci.analysis.api.tree.DataNode", "org.eclipse.dawnsci.nexus.NXsample", "org.eclipse.dawnsci.nexus.NexusException" ]
import org.eclipse.dawnsci.analysis.api.tree.DataNode; import org.eclipse.dawnsci.nexus.NXsample; import org.eclipse.dawnsci.nexus.NexusException;
import org.eclipse.dawnsci.analysis.api.tree.*; import org.eclipse.dawnsci.nexus.*;
[ "org.eclipse.dawnsci" ]
org.eclipse.dawnsci;
2,647,365
@Override public void close() throws IOException { reader.close(); }
void function() throws IOException { reader.close(); }
/** * Closes resources. * * @throws IOException * If an I/O error occurs */
Closes resources
close
{ "repo_name": "mirasrael/commons-csv", "path": "src/main/java/org/apache/commons/csv/Lexer.java", "license": "apache-2.0", "size": 18911 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
604,288
public Color setRed(java.lang.Float red) { this.red = red; return this; }
Color function(java.lang.Float red) { this.red = red; return this; }
/** * The amount of red in the color as a value in the interval [0, 1]. * @param red red or {@code null} for none */
The amount of red in the color as a value in the interval [0, 1]
setRed
{ "repo_name": "googleapis/google-api-java-client-services", "path": "clients/google-api-services-vision/v1p1beta1/1.29.2/com/google/api/services/vision/v1p1beta1/model/Color.java", "license": "apache-2.0", "size": 9598 }
[ "com.google.type.Color" ]
import com.google.type.Color;
import com.google.type.*;
[ "com.google.type" ]
com.google.type;
750,205
private void addLineToMainChat(String text) { SimpleDateFormat dateFormat = new SimpleDateFormat("[h:mm:ss a] "); mainChatArea.setText(mainChatArea.getText() + dateFormat.format(new Date()) + text + "\n"); }
void function(String text) { SimpleDateFormat dateFormat = new SimpleDateFormat(STR); mainChatArea.setText(mainChatArea.getText() + dateFormat.format(new Date()) + text + "\n"); }
/** * Adds a time stamped line of text to the main chat area (followed by * a newline) * @param text The text to add to the chat pane */
Adds a time stamped line of text to the main chat area (followed by a newline)
addLineToMainChat
{ "repo_name": "alexcraig/RoboWars", "path": "robowars_server/src/robowars/server/view/AdminView.java", "license": "mit", "size": 12819 }
[ "java.text.SimpleDateFormat", "java.util.Date" ]
import java.text.SimpleDateFormat; import java.util.Date;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
1,230,563
public static Resource NexusDataBlock() { return _namespace_CDAO("CDAO_0000052"); }
static Resource function() { return _namespace_CDAO(STR); }
/** * -- No comment or description provided. -- * (http://purl.obolibrary.org/obo/CDAO_0000052) */
-- No comment or description provided. -- (HREF)
NexusDataBlock
{ "repo_name": "BioInterchange/BioInterchange", "path": "supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/CDAO.java", "license": "mit", "size": 85675 }
[ "com.hp.hpl.jena.rdf.model.Resource" ]
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.*;
[ "com.hp.hpl" ]
com.hp.hpl;
1,656,179
private static void assertReceive (final Logger logger, final Collection<byte[]> expected, final RudpService service, final RudpConnectionId id) { final Collection<byte[]> actual = new ArrayList<byte[]> (expected.size ()); final int expectedSize = expected.size (); for (int i = 0; i < expectedSize; ++i) { logger.debug ("Receiving {} of {}", i + 1, expectedSize); actual.add (service.receive (id)); logger.debug ("Received {} of {}", i + 1, expectedSize); } Assert.assertTrue ("Received bad data", deepEquals (expected, actual)); }
static void function (final Logger logger, final Collection<byte[]> expected, final RudpService service, final RudpConnectionId id) { final Collection<byte[]> actual = new ArrayList<byte[]> (expected.size ()); final int expectedSize = expected.size (); for (int i = 0; i < expectedSize; ++i) { logger.debug (STR, i + 1, expectedSize); actual.add (service.receive (id)); logger.debug (STR, i + 1, expectedSize); } Assert.assertTrue (STR, deepEquals (expected, actual)); }
/** * Asserts that a collection of messages were received in the given * collection order. * * @param logger * The logger for logging messages. * @param expected * The expected messages, in order. * @param service * The service used to receive messages. * @param id * The identifier of the connection from which to receive messages. */
Asserts that a collection of messages were received in the given collection order
assertReceive
{ "repo_name": "adamfisk/littleshoot-client", "path": "common/rudp-test/util/src/test/java/org/lastbamboo/common/rudp/RudpIntegrationTest.java", "license": "gpl-2.0", "size": 16532 }
[ "java.util.ArrayList", "java.util.Collection", "org.junit.Assert", "org.slf4j.Logger" ]
import java.util.ArrayList; import java.util.Collection; import org.junit.Assert; import org.slf4j.Logger;
import java.util.*; import org.junit.*; import org.slf4j.*;
[ "java.util", "org.junit", "org.slf4j" ]
java.util; org.junit; org.slf4j;
2,878,709
public void testFromXContent() throws IOException { for (int runs = 0; runs < NUMBER_OF_TESTBUILDERS; runs++) { SB testShape = createTestShapeBuilder(); XContentBuilder contentBuilder = XContentFactory.contentBuilder(randomFrom(XContentType.values())); if (randomBoolean()) { contentBuilder.prettyPrint(); } XContentBuilder builder = testShape.toXContent(contentBuilder, ToXContent.EMPTY_PARAMS); XContentParser shapeParser = XContentHelper.createParser(builder.bytes()); shapeParser.nextToken(); ShapeBuilder parsedShape = ShapeBuilder.parse(shapeParser); assertNotSame(testShape, parsedShape); assertEquals(testShape, parsedShape); assertEquals(testShape.hashCode(), parsedShape.hashCode()); } }
void function() throws IOException { for (int runs = 0; runs < NUMBER_OF_TESTBUILDERS; runs++) { SB testShape = createTestShapeBuilder(); XContentBuilder contentBuilder = XContentFactory.contentBuilder(randomFrom(XContentType.values())); if (randomBoolean()) { contentBuilder.prettyPrint(); } XContentBuilder builder = testShape.toXContent(contentBuilder, ToXContent.EMPTY_PARAMS); XContentParser shapeParser = XContentHelper.createParser(builder.bytes()); shapeParser.nextToken(); ShapeBuilder parsedShape = ShapeBuilder.parse(shapeParser); assertNotSame(testShape, parsedShape); assertEquals(testShape, parsedShape); assertEquals(testShape.hashCode(), parsedShape.hashCode()); } }
/** * Test that creates new shape from a random test shape and checks both for equality */
Test that creates new shape from a random test shape and checks both for equality
testFromXContent
{ "repo_name": "clintongormley/elasticsearch", "path": "core/src/test/java/org/elasticsearch/common/geo/builders/AbstractShapeBuilderTestCase.java", "license": "apache-2.0", "size": 6620 }
[ "java.io.IOException", "org.elasticsearch.common.xcontent.ToXContent", "org.elasticsearch.common.xcontent.XContentBuilder", "org.elasticsearch.common.xcontent.XContentFactory", "org.elasticsearch.common.xcontent.XContentHelper", "org.elasticsearch.common.xcontent.XContentParser", "org.elasticsearch.common.xcontent.XContentType" ]
import java.io.IOException; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType;
import java.io.*; import org.elasticsearch.common.xcontent.*;
[ "java.io", "org.elasticsearch.common" ]
java.io; org.elasticsearch.common;
2,589,487
@Column(name = "state", nullable = false, length = 128) @Override public String getState() { return (String) get(5); }
@Column(name = "state", nullable = false, length = 128) String function() { return (String) get(5); }
/** * Getter for <code>cattle.storage_driver.state</code>. */
Getter for <code>cattle.storage_driver.state</code>
getState
{ "repo_name": "rancherio/cattle", "path": "modules/model/src/main/java/io/cattle/platform/core/model/tables/records/StorageDriverRecord.java", "license": "apache-2.0", "size": 14474 }
[ "javax.persistence.Column" ]
import javax.persistence.Column;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
1,471,572
LookAndFeel.setLookAndFeel(); MetricsBase.init(); // model = new VisDataModel(new Coords(20f, 20f)); player = new Player(); // player.addEventListener(new ConsolePlayerNotifier()); //for debugging Simple2DVisualization vis2d = new Simple2DVisualization(); visualization_api = vis2d; vis_component = vis2d; ui = new UIMainWindow(vis_component); ui.setVisible(true); visualization_api.addVisActionListener(ui.getDetailsPane()); }
LookAndFeel.setLookAndFeel(); MetricsBase.init(); player = new Player(); Simple2DVisualization vis2d = new Simple2DVisualization(); visualization_api = vis2d; vis_component = vis2d; ui = new UIMainWindow(vis_component); ui.setVisible(true); visualization_api.addVisActionListener(ui.getDetailsPane()); }
/** * Initializes the application when it starts. waitingForSim specifies * whether the application should wait for the processing of the simulator, * or can start immediately. */
Initializes the application when it starts. waitingForSim specifies whether the application should wait for the processing of the simulator, or can start immediately
init
{ "repo_name": "flyroom/PeerfactSimKOM_Clone", "path": "src/org/peerfact/impl/analyzer/visualization2d/controller/Controller.java", "license": "gpl-2.0", "size": 5005 }
[ "org.peerfact.impl.analyzer.visualization2d.controller.player.Player", "org.peerfact.impl.analyzer.visualization2d.metrics.MetricsBase", "org.peerfact.impl.analyzer.visualization2d.ui.common.UIMainWindow", "org.peerfact.impl.analyzer.visualization2d.util.gui.LookAndFeel", "org.peerfact.impl.analyzer.visualization2d.visualization2d.Simple2DVisualization" ]
import org.peerfact.impl.analyzer.visualization2d.controller.player.Player; import org.peerfact.impl.analyzer.visualization2d.metrics.MetricsBase; import org.peerfact.impl.analyzer.visualization2d.ui.common.UIMainWindow; import org.peerfact.impl.analyzer.visualization2d.util.gui.LookAndFeel; import org.peerfact.impl.analyzer.visualization2d.visualization2d.Simple2DVisualization;
import org.peerfact.impl.analyzer.visualization2d.controller.player.*; import org.peerfact.impl.analyzer.visualization2d.metrics.*; import org.peerfact.impl.analyzer.visualization2d.ui.common.*; import org.peerfact.impl.analyzer.visualization2d.util.gui.*; import org.peerfact.impl.analyzer.visualization2d.visualization2d.*;
[ "org.peerfact.impl" ]
org.peerfact.impl;
1,836,820
private void notifyTextListeners(TextEvent ge) { Vector l; synchronized (this) { l = (Vector)m_textListeners.clone(); } if (l.size() > 0) { for(int i = 0; i < l.size(); i++) { ((TextListener)l.elementAt(i)).acceptText(ge); } } }
void function(TextEvent ge) { Vector l; synchronized (this) { l = (Vector)m_textListeners.clone(); } if (l.size() > 0) { for(int i = 0; i < l.size(); i++) { ((TextListener)l.elementAt(i)).acceptText(ge); } } }
/** * Notify all text listeners of a text event * * @param ge a <code>TextEvent</code> value */
Notify all text listeners of a text event
notifyTextListeners
{ "repo_name": "dsibournemouth/autoweka", "path": "weka-3.7.7/src/main/java/weka/gui/beans/TextViewer.java", "license": "gpl-3.0", "size": 19372 }
[ "java.util.Vector" ]
import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
2,322,068
public int getCount() throws ClipboardException;
int function() throws ClipboardException;
/** * Method declaration * * @return * @throws ClipboardException */
Method declaration
getCount
{ "repo_name": "CecileBONIN/Silverpeas-Core", "path": "ejb-core/clipboard/src/main/java/com/stratelia/webactiv/clipboard/control/ejb/Clipboard.java", "license": "agpl-3.0", "size": 3875 }
[ "com.silverpeas.util.clipboard.ClipboardException" ]
import com.silverpeas.util.clipboard.ClipboardException;
import com.silverpeas.util.clipboard.*;
[ "com.silverpeas.util" ]
com.silverpeas.util;
62,258
public ArrayList<Integer> getSkipIds(){ return skipIds; }
ArrayList<Integer> function(){ return skipIds; }
/** * get an integer ArrayList that contains the ids of the future task that should be skipped. Is optional and null if not set. * * @return an integer ArrayList with the ids of future tasks that should be skipped. */
get an integer ArrayList that contains the ids of the future task that should be skipped. Is optional and null if not set
getSkipIds
{ "repo_name": "SimoneCascino/taskservice", "path": "taskservice/src/main/java/it/simonecascino/taskservice/SharedArgs.java", "license": "apache-2.0", "size": 2815 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,357,405
private static Uri stripQueryParameters(Uri uri) { assert(uri.getAuthority() != null); assert(uri.getPath() != null); Uri.Builder builder = new Uri.Builder(); builder.scheme(uri.getScheme()); builder.encodedAuthority(uri.getAuthority()); builder.encodedPath(uri.getPath()); return builder.build(); }
static Uri function(Uri uri) { assert(uri.getAuthority() != null); assert(uri.getPath() != null); Uri.Builder builder = new Uri.Builder(); builder.scheme(uri.getScheme()); builder.encodedAuthority(uri.getAuthority()); builder.encodedPath(uri.getPath()); return builder.build(); }
/** * Remove query parameters from a Uri. * @param uri The input uri. * @return The given uri without query parameters. */
Remove query parameters from a Uri
stripQueryParameters
{ "repo_name": "shaochangbin/crosswalk", "path": "runtime/android/core/src/org/xwalk/core/AndroidProtocolHandler.java", "license": "bsd-3-clause", "size": 11193 }
[ "android.net.Uri" ]
import android.net.Uri;
import android.net.*;
[ "android.net" ]
android.net;
1,564,898
protected String[][] methodOrCtorDefaultReferences(AccessibleObject accobj, Class[] paramTypes) { PetiteReference[] lookupReferences = petiteConfig.getLookupReferences(); MethodParameter[] methodParameters = null; if (petiteConfig.getUseParamo()) { methodParameters = Paramo.resolveParameters(accobj); } String[][] references = new String[paramTypes.length][]; for (int j = 0; j < paramTypes.length; j++) { String[] ref = new String[lookupReferences.length]; references[j] = ref; for (int i = 0; i < ref.length; i++) { switch (lookupReferences[i]) { case NAME: ref[i] = methodParameters != null ? methodParameters[j].getName() : null; break; case TYPE_SHORT_NAME: ref[i] = StringUtil.uncapitalize(paramTypes[j].getSimpleName()); break; case TYPE_FULL_NAME: ref[i] = paramTypes[j].getName(); break; } } } return references; }
String[][] function(AccessibleObject accobj, Class[] paramTypes) { PetiteReference[] lookupReferences = petiteConfig.getLookupReferences(); MethodParameter[] methodParameters = null; if (petiteConfig.getUseParamo()) { methodParameters = Paramo.resolveParameters(accobj); } String[][] references = new String[paramTypes.length][]; for (int j = 0; j < paramTypes.length; j++) { String[] ref = new String[lookupReferences.length]; references[j] = ref; for (int i = 0; i < ref.length; i++) { switch (lookupReferences[i]) { case NAME: ref[i] = methodParameters != null ? methodParameters[j].getName() : null; break; case TYPE_SHORT_NAME: ref[i] = StringUtil.uncapitalize(paramTypes[j].getSimpleName()); break; case TYPE_FULL_NAME: ref[i] = paramTypes[j].getName(); break; } } } return references; }
/** * Builds default method references. */
Builds default method references
methodOrCtorDefaultReferences
{ "repo_name": "007slm/jodd", "path": "jodd-petite/src/main/java/jodd/petite/InjectionPointFactory.java", "license": "bsd-3-clause", "size": 4742 }
[ "java.lang.reflect.AccessibleObject" ]
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
984,801
private void sendPubAck(String clientId, int messageID) { if (log.isTraceEnabled()) { log.trace("sendPubAck invoked"); } PubAckMessage pubAckMessage = new PubAckMessage(); pubAckMessage.setMessageID(messageID); try { if (m_clientIDs == null) { throw new RuntimeException("Internal bad error, found m_clientIDs to null while it should be initialized," + " somewhere it's overwritten!!"); } if (log.isDebugEnabled()) { log.debug("clientIDs are " + m_clientIDs); } if (m_clientIDs.get(clientId) == null) { throw new RuntimeException(String.format("Can't find a ConnectionDEwcriptor for client %s " + "in cache %s", clientId, m_clientIDs)); } // log.debug("Session for clientId " + clientId + " is " + m_clientIDs.get(clientId).getSession()); // m_clientIDs.get(clientId).getSession().write(pubAckMessage); disruptorPublish(new OutputMessagingEvent(m_clientIDs.get(clientId).getSession(), pubAckMessage)); } catch (Throwable t) { log.error(null, t); } }
void function(String clientId, int messageID) { if (log.isTraceEnabled()) { log.trace(STR); } PubAckMessage pubAckMessage = new PubAckMessage(); pubAckMessage.setMessageID(messageID); try { if (m_clientIDs == null) { throw new RuntimeException(STR + STR); } if (log.isDebugEnabled()) { log.debug(STR + m_clientIDs); } if (m_clientIDs.get(clientId) == null) { throw new RuntimeException(String.format(STR + STR, clientId, m_clientIDs)); } disruptorPublish(new OutputMessagingEvent(m_clientIDs.get(clientId).getSession(), pubAckMessage)); } catch (Throwable t) { log.error(null, t); } }
/** * Sent by the broker to the publisher as an acknowledgment for a published message, for QoS 1 * * @param clientId the id of the client * @param messageID the message id */
Sent by the broker to the publisher as an acknowledgment for a published message, for QoS 1
sendPubAck
{ "repo_name": "prabathariyaratna/andes", "path": "modules/andes-core/broker/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/ProtocolProcessor.java", "license": "apache-2.0", "size": 44041 }
[ "org.dna.mqtt.moquette.messaging.spi.impl.events.OutputMessagingEvent", "org.dna.mqtt.moquette.proto.messages.PubAckMessage" ]
import org.dna.mqtt.moquette.messaging.spi.impl.events.OutputMessagingEvent; import org.dna.mqtt.moquette.proto.messages.PubAckMessage;
import org.dna.mqtt.moquette.messaging.spi.impl.events.*; import org.dna.mqtt.moquette.proto.messages.*;
[ "org.dna.mqtt" ]
org.dna.mqtt;
2,064,711
public List<PrivateLinkResourceInner> value() { return this.value; }
List<PrivateLinkResourceInner> function() { return this.value; }
/** * Get the value property: Collection of items of type results. * * @return the value value. */
Get the value property: Collection of items of type results
value
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/purview/azure-resourcemanager-purview/src/main/java/com/azure/resourcemanager/purview/models/PrivateLinkResourceList.java", "license": "mit", "size": 3054 }
[ "com.azure.resourcemanager.purview.fluent.models.PrivateLinkResourceInner", "java.util.List" ]
import com.azure.resourcemanager.purview.fluent.models.PrivateLinkResourceInner; import java.util.List;
import com.azure.resourcemanager.purview.fluent.models.*; import java.util.*;
[ "com.azure.resourcemanager", "java.util" ]
com.azure.resourcemanager; java.util;
147,842
private void getInMemoryFilesInternal(Inode<?> inode, AlluxioURI uri, List<AlluxioURI> files) { AlluxioURI newUri = uri.join(inode.getName()); if (inode.isFile()) { if (isFullyInMemory((InodeFile) inode)) { files.add(newUri); } } else { // This inode is a directory. Set<Inode<?>> children = ((InodeDirectory) inode).getChildren(); for (Inode<?> child : children) { try { child.lockReadAndCheckParent(inode); } catch (InvalidPathException e) { // Inode is no longer part of this directory. continue; } try { getInMemoryFilesInternal(child, newUri, files); } finally { child.unlockRead(); } } } }
void function(Inode<?> inode, AlluxioURI uri, List<AlluxioURI> files) { AlluxioURI newUri = uri.join(inode.getName()); if (inode.isFile()) { if (isFullyInMemory((InodeFile) inode)) { files.add(newUri); } } else { Set<Inode<?>> children = ((InodeDirectory) inode).getChildren(); for (Inode<?> child : children) { try { child.lockReadAndCheckParent(inode); } catch (InvalidPathException e) { continue; } try { getInMemoryFilesInternal(child, newUri, files); } finally { child.unlockRead(); } } } }
/** * Adds in memory files to the array list passed in. This method assumes the inode passed in is * already read locked. * * @param inode the root of the subtree to search * @param uri the uri of the parent of the inode * @param files the list to accumulate the results in */
Adds in memory files to the array list passed in. This method assumes the inode passed in is already read locked
getInMemoryFilesInternal
{ "repo_name": "WilliamZapata/alluxio", "path": "core/server/master/src/main/java/alluxio/master/file/DefaultFileSystemMaster.java", "license": "apache-2.0", "size": 120914 }
[ "java.util.List", "java.util.Set" ]
import java.util.List; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
864,846
public HashMap<String, Double[][]> getValues() { return values; }
HashMap<String, Double[][]> function() { return values; }
/** * Get the valueset for chart * * @return - Values for this chart */
Get the valueset for chart
getValues
{ "repo_name": "tmtsoftware/es-perftest", "path": "mbsuite-utilities/src/com/persistent/bcsuite/charts/objects/GenericScatterChart.java", "license": "mit", "size": 6004 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,884,912
public void syncPersistExistingDirectory(Supplier<JournalContext> context, InodeDirectoryView dir) throws IOException, InvalidPathException, FileDoesNotExistException { RetryPolicy retry = new ExponentialBackoffRetry(PERSIST_WAIT_BASE_SLEEP_MS, PERSIST_WAIT_MAX_SLEEP_MS, PERSIST_WAIT_MAX_RETRIES); while (retry.attempt()) { if (dir.getPersistenceState() == PersistenceState.PERSISTED) { // The directory is persisted return; } Optional<Scoped> persisting = mInodeLockManager.tryAcquirePersistingLock(dir.getId()); if (!persisting.isPresent()) { // Someone else is doing this persist. Continue and wait for them to finish. continue; } try (Scoped s = persisting.get()) { if (dir.getPersistenceState() == PersistenceState.PERSISTED) { // The directory is persisted return; } mState.applyAndJournal(context, UpdateInodeEntry.newBuilder() .setId(dir.getId()) .setPersistenceState(PersistenceState.TO_BE_PERSISTED.name()) .build()); UpdateInodeEntry.Builder entry = UpdateInodeEntry.newBuilder() .setId(dir.getId()); syncPersistDirectory(dir).ifPresent(status -> { if (isRootId(dir.getId())) { // Don't load the root dir metadata from UFS return; } entry.setOwner(status.getOwner()) .setGroup(status.getGroup()) .setMode(status.getMode()); Map<String, byte[]> xattr = status.getXAttr(); if (xattr != null) { entry.putAllXAttr(CommonUtils.convertToByteString(xattr)); } Long lastModificationTime = status.getLastModifiedTime(); if (lastModificationTime != null) { entry.setLastModificationTimeMs(lastModificationTime) .setOverwriteModificationTime(true); } }); entry.setPersistenceState(PersistenceState.PERSISTED.name()); mState.applyAndJournal(context, entry.build()); return; } } throw new IOException(ExceptionMessage.FAILED_UFS_CREATE.getMessage(dir.getName())); }
void function(Supplier<JournalContext> context, InodeDirectoryView dir) throws IOException, InvalidPathException, FileDoesNotExistException { RetryPolicy retry = new ExponentialBackoffRetry(PERSIST_WAIT_BASE_SLEEP_MS, PERSIST_WAIT_MAX_SLEEP_MS, PERSIST_WAIT_MAX_RETRIES); while (retry.attempt()) { if (dir.getPersistenceState() == PersistenceState.PERSISTED) { return; } Optional<Scoped> persisting = mInodeLockManager.tryAcquirePersistingLock(dir.getId()); if (!persisting.isPresent()) { continue; } try (Scoped s = persisting.get()) { if (dir.getPersistenceState() == PersistenceState.PERSISTED) { return; } mState.applyAndJournal(context, UpdateInodeEntry.newBuilder() .setId(dir.getId()) .setPersistenceState(PersistenceState.TO_BE_PERSISTED.name()) .build()); UpdateInodeEntry.Builder entry = UpdateInodeEntry.newBuilder() .setId(dir.getId()); syncPersistDirectory(dir).ifPresent(status -> { if (isRootId(dir.getId())) { return; } entry.setOwner(status.getOwner()) .setGroup(status.getGroup()) .setMode(status.getMode()); Map<String, byte[]> xattr = status.getXAttr(); if (xattr != null) { entry.putAllXAttr(CommonUtils.convertToByteString(xattr)); } Long lastModificationTime = status.getLastModifiedTime(); if (lastModificationTime != null) { entry.setLastModificationTimeMs(lastModificationTime) .setOverwriteModificationTime(true); } }); entry.setPersistenceState(PersistenceState.PERSISTED.name()); mState.applyAndJournal(context, entry.build()); return; } } throw new IOException(ExceptionMessage.FAILED_UFS_CREATE.getMessage(dir.getName())); }
/** * Synchronously persists an inode directory to the UFS. If concurrent calls are made, only * one thread will persist to UFS, and the others will wait until it is persisted. * * @param context journal context supplier * @param dir the inode directory to persist * @throws InvalidPathException if the path for the inode is invalid * @throws FileDoesNotExistException if the path for the inode is invalid */
Synchronously persists an inode directory to the UFS. If concurrent calls are made, only one thread will persist to UFS, and the others will wait until it is persisted
syncPersistExistingDirectory
{ "repo_name": "calvinjia/tachyon", "path": "core/server/master/src/main/java/alluxio/master/file/meta/InodeTree.java", "license": "apache-2.0", "size": 49661 }
[ "java.io.IOException", "java.util.Map", "java.util.Optional", "java.util.function.Supplier" ]
import java.io.IOException; import java.util.Map; import java.util.Optional; import java.util.function.Supplier;
import java.io.*; import java.util.*; import java.util.function.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,799,861
private Object getGeneratedKey(PreparedStatement pst) throws SQLException { ResultSet rs = pst.getGeneratedKeys(); Object id = null; if (rs.next()) id = rs.getObject(1); rs.close(); return id; }
Object function(PreparedStatement pst) throws SQLException { ResultSet rs = pst.getGeneratedKeys(); Object id = null; if (rs.next()) id = rs.getObject(1); rs.close(); return id; }
/** * Get id after insert method getGeneratedKey(). */
Get id after insert method getGeneratedKey()
getGeneratedKey
{ "repo_name": "zhengjiabin/domeke", "path": "core/src/main/java/com/jfinal/plugin/activerecord/DbPro.java", "license": "apache-2.0", "size": 30504 }
[ "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException" ]
import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,647,983
private boolean processResponse(String xml) { boolean newRoutesFound = false; // Build an XML document parser with the given XML as input source and parse it. DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = null; try { documentBuilder = documentBuilderFactory.newDocumentBuilder(); InputSource inputSource = new InputSource(); inputSource.setCharacterStream(new StringReader(xml)); try { Document document = documentBuilder.parse(inputSource); document.getDocumentElement().normalize(); // Retrieve all elements with the tag <route></route>. NodeList routes = document.getElementsByTagName("route"); // For each element retrieve its text content, which represents a route and // attempt adding it to the set discovered routes. If the route was added // a new route has been found. for (int i = 0; i < routes.getLength(); i++) { Node nNode = routes.item(i); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element route = (Element) nNode; boolean added = this.discoveredRoutes.add(route.getTextContent()); if (added && !newRoutesFound) { System.out.println("[INFO{dt}] New discovered route: " + route.getTextContent()); newRoutesFound = true; } } } } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } catch (ParserConfigurationException e) { e.printStackTrace(); } return newRoutesFound; }
boolean function(String xml) { boolean newRoutesFound = false; DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = null; try { documentBuilder = documentBuilderFactory.newDocumentBuilder(); InputSource inputSource = new InputSource(); inputSource.setCharacterStream(new StringReader(xml)); try { Document document = documentBuilder.parse(inputSource); document.getDocumentElement().normalize(); NodeList routes = document.getElementsByTagName("route"); for (int i = 0; i < routes.getLength(); i++) { Node nNode = routes.item(i); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element route = (Element) nNode; boolean added = this.discoveredRoutes.add(route.getTextContent()); if (added && !newRoutesFound) { System.out.println(STR + route.getTextContent()); newRoutesFound = true; } } } } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } catch (ParserConfigurationException e) { e.printStackTrace(); } return newRoutesFound; }
/** * Parses the given XML in search for <code>route</code> tags and adds the new routes found to the * set of discovered routes. * * @param xml The XML to be processed. * @return If one or more new routes were found. */
Parses the given XML in search for <code>route</code> tags and adds the new routes found to the set of discovered routes
processResponse
{ "repo_name": "unicesi/SURF", "path": "WeatherForecastGateway/src/ie/tcd/dsg/surf/weatherforecast/gateway/DiscoveryThread.java", "license": "gpl-3.0", "size": 7615 }
[ "java.io.IOException", "java.io.StringReader", "javax.xml.parsers.DocumentBuilder", "javax.xml.parsers.DocumentBuilderFactory", "javax.xml.parsers.ParserConfigurationException", "org.w3c.dom.Document", "org.w3c.dom.Element", "org.w3c.dom.Node", "org.w3c.dom.NodeList", "org.xml.sax.InputSource", "org.xml.sax.SAXException" ]
import java.io.IOException; import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException;
import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*;
[ "java.io", "javax.xml", "org.w3c.dom", "org.xml.sax" ]
java.io; javax.xml; org.w3c.dom; org.xml.sax;
2,701,694
@Override public void close() throws IOException { try { encKeyVersionQueue.shutdown(); } catch (Exception e) { throw new IOException(e); } finally { if (sslFactory != null) { sslFactory.destroy(); sslFactory = null; } } }
void function() throws IOException { try { encKeyVersionQueue.shutdown(); } catch (Exception e) { throw new IOException(e); } finally { if (sslFactory != null) { sslFactory.destroy(); sslFactory = null; } } }
/** * Shutdown valueQueue executor threads */
Shutdown valueQueue executor threads
close
{ "repo_name": "ChetnaChaudhari/hadoop", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/kms/KMSClientProvider.java", "license": "apache-2.0", "size": 43911 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
246,250
protected void afterWrite(Executor executor) { } // We're mainly doing I/O, so estimate very low CPU usage, e.g. 1%. Just a guess. private static final ResourceSet DEFAULT_FILEWRITE_LOCAL_ACTION_RESOURCE_SET = ResourceSet.createWithRamCpuIo(0.0, 0.01, 0.2);
void function(Executor executor) { } private static final ResourceSet DEFAULT_FILEWRITE_LOCAL_ACTION_RESOURCE_SET = ResourceSet.createWithRamCpuIo(0.0, 0.01, 0.2);
/** * This hook is called after the File has been successfully written to disk. * * @param executor the Executor. */
This hook is called after the File has been successfully written to disk
afterWrite
{ "repo_name": "murugamsm/bazel", "path": "src/main/java/com/google/devtools/build/lib/analysis/actions/AbstractFileWriteAction.java", "license": "apache-2.0", "size": 5291 }
[ "com.google.devtools.build.lib.actions.Executor", "com.google.devtools.build.lib.actions.ResourceSet" ]
import com.google.devtools.build.lib.actions.Executor; import com.google.devtools.build.lib.actions.ResourceSet;
import com.google.devtools.build.lib.actions.*;
[ "com.google.devtools" ]
com.google.devtools;
352,636
EventQueue.invokeLater(new Runnable() {
EventQueue.invokeLater(new Runnable() {
/** * Launch the application. */
Launch the application
main
{ "repo_name": "rafilsk88/Sigma", "path": "src/br/senai/sc/sigma/view/AbrirChamadoUI.java", "license": "apache-2.0", "size": 13351 }
[ "java.awt.EventQueue" ]
import java.awt.EventQueue;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,302,481
@Override public int delete(Uri uri, String selection, String[] selectionArgs) { return mImpl.delete(uri, selection, selectionArgs); }
int function(Uri uri, String selection, String[] selectionArgs) { return mImpl.delete(uri, selection, selectionArgs); }
/** * Method called to handle delete requests from client * applications. */
Method called to handle delete requests from client applications
delete
{ "repo_name": "laishidua/ghostmyselfie", "path": "ghostmyselfie-client/src/com/laishidua/model/GhostMySelfieProvider.java", "license": "gpl-2.0", "size": 3502 }
[ "android.net.Uri" ]
import android.net.Uri;
import android.net.*;
[ "android.net" ]
android.net;
910,165
public AdminInfoServiceAsync getAdminInfoService() { return adminInfoService; }
AdminInfoServiceAsync function() { return adminInfoService; }
/** * Get an instance of the Admin Info service * * @return admin info service instance */
Get an instance of the Admin Info service
getAdminInfoService
{ "repo_name": "kkashi01/appinventor-sources", "path": "appinventor/appengine/src/com/google/appinventor/client/Ode.java", "license": "apache-2.0", "size": 99174 }
[ "com.google.appinventor.shared.rpc.admin.AdminInfoServiceAsync" ]
import com.google.appinventor.shared.rpc.admin.AdminInfoServiceAsync;
import com.google.appinventor.shared.rpc.admin.*;
[ "com.google.appinventor" ]
com.google.appinventor;
1,342,755
@Nullable InstanceIdentifier<?> fromYangInstanceIdentifier(@Nonnull YangInstanceIdentifier dom);
InstanceIdentifier<?> fromYangInstanceIdentifier(@Nonnull YangInstanceIdentifier dom);
/** * Translates supplied YANG Instance Identifier into Binding instance * identifier. * * @param dom * YANG Instance Identifier * @return Binding Instance Identifier, or null if the instance identifier * is not representable. */
Translates supplied YANG Instance Identifier into Binding instance identifier
fromYangInstanceIdentifier
{ "repo_name": "522986491/yangtools", "path": "code-generator/binding-data-codec/src/main/java/org/opendaylight/yangtools/binding/data/codec/api/BindingNormalizedNodeSerializer.java", "license": "epl-1.0", "size": 4481 }
[ "javax.annotation.Nonnull", "org.opendaylight.yangtools.yang.binding.InstanceIdentifier", "org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier" ]
import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import javax.annotation.*; import org.opendaylight.yangtools.yang.binding.*; import org.opendaylight.yangtools.yang.data.api.*;
[ "javax.annotation", "org.opendaylight.yangtools" ]
javax.annotation; org.opendaylight.yangtools;
2,015,884
User updateUser(PerunSession perunSession, User user) throws UserNotExistsException, PrivilegeException;
User updateUser(PerunSession perunSession, User user) throws UserNotExistsException, PrivilegeException;
/** * Updates users data in DB. * * @param perunSession * @param user * @return updated user * @throws InternalErrorException * @throws UserNotExistsException * @throws PrivilegeException */
Updates users data in DB
updateUser
{ "repo_name": "zoraseb/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/UsersManager.java", "license": "bsd-2-clause", "size": 54525 }
[ "cz.metacentrum.perun.core.api.exceptions.PrivilegeException", "cz.metacentrum.perun.core.api.exceptions.UserNotExistsException" ]
import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import cz.metacentrum.perun.core.api.exceptions.UserNotExistsException;
import cz.metacentrum.perun.core.api.exceptions.*;
[ "cz.metacentrum.perun" ]
cz.metacentrum.perun;
1,342,899
@Override public void exitCompDescriptorFormula(@NotNull QueryGrammarParser.CompDescriptorFormulaContext ctx) { }
@Override public void exitCompDescriptorFormula(@NotNull QueryGrammarParser.CompDescriptorFormulaContext ctx) { }
/** * {@inheritDoc} * <p/> * The default implementation does nothing. */
The default implementation does nothing
enterCompDescriptorFormula
{ "repo_name": "pmeisen/dis-timeintervaldataanalyzer", "path": "src/net/meisen/dissertation/impl/parser/query/generated/QueryGrammarBaseListener.java", "license": "bsd-3-clause", "size": 33327 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,760,978
public static <E> ImmutableSet<E> copyOf(Iterator<? extends E> elements) { Collection<E> list = Lists.newArrayList(elements); return copyOfInternal(list); }
static <E> ImmutableSet<E> function(Iterator<? extends E> elements) { Collection<E> list = Lists.newArrayList(elements); return copyOfInternal(list); }
/** * Returns an immutable set containing the given elements, in order. Repeated * occurrences of an element (according to {@link Object#equals}) after the * first are ignored. * * @throws NullPointerException if any of {@code elements} is null */
Returns an immutable set containing the given elements, in order. Repeated occurrences of an element (according to <code>Object#equals</code>) after the first are ignored
copyOf
{ "repo_name": "renatoathaydes/checker-framework", "path": "checker/jdk/nullness/src/com/google/common/collect/ImmutableSet.java", "license": "gpl-2.0", "size": 18077 }
[ "java.util.Collection", "java.util.Iterator" ]
import java.util.Collection; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
723,789
protected void defragmentAndValidateSizesDecreasedAfterDefragmentation(int gridId, CacheGroupContext... groups) throws Exception { for (CacheGroupContext grp : groups) { final long[] oldPartLen = partitionSizes(grp); startGrid(0); waitForDefragmentation(0); stopGrid(0); final long[] newPartLen = partitionSizes(grp); boolean atLeastOneSmaller = false; for (int p = 0; p < oldPartLen.length; p++) { assertTrue(newPartLen[p] <= oldPartLen[p]); if (newPartLen[p] < oldPartLen[p]) atLeastOneSmaller = true; } assertTrue(atLeastOneSmaller); } }
void function(int gridId, CacheGroupContext... groups) throws Exception { for (CacheGroupContext grp : groups) { final long[] oldPartLen = partitionSizes(grp); startGrid(0); waitForDefragmentation(0); stopGrid(0); final long[] newPartLen = partitionSizes(grp); boolean atLeastOneSmaller = false; for (int p = 0; p < oldPartLen.length; p++) { assertTrue(newPartLen[p] <= oldPartLen[p]); if (newPartLen[p] < oldPartLen[p]) atLeastOneSmaller = true; } assertTrue(atLeastOneSmaller); } }
/** * Start node, wait for defragmentation and validate that sizes of caches are less than those before the defragmentation. * @param gridId Idx of ignite grid. * @param groups Cache groups to check. * @throws Exception If failed. */
Start node, wait for defragmentation and validate that sizes of caches are less than those before the defragmentation
defragmentAndValidateSizesDecreasedAfterDefragmentation
{ "repo_name": "ascherbakoff/ignite", "path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDefragmentationTest.java", "license": "apache-2.0", "size": 22653 }
[ "org.apache.ignite.internal.processors.cache.CacheGroupContext" ]
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
import org.apache.ignite.internal.processors.cache.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,988,985
@ServiceMethod(returns = ReturnType.SINGLE) public WorkloadNetworkDnsServiceInner createDnsService( String resourceGroupName, String privateCloudName, String dnsServiceId, WorkloadNetworkDnsServiceInner workloadNetworkDnsService) { return createDnsServiceAsync(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService) .block(); }
@ServiceMethod(returns = ReturnType.SINGLE) WorkloadNetworkDnsServiceInner function( String resourceGroupName, String privateCloudName, String dnsServiceId, WorkloadNetworkDnsServiceInner workloadNetworkDnsService) { return createDnsServiceAsync(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService) .block(); }
/** * Create a DNS service by id in a private cloud workload network. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param privateCloudName Name of the private cloud. * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name. * @param workloadNetworkDnsService NSX DNS Service. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return nSX DNS Service. */
Create a DNS service by id in a private cloud workload network
createDnsService
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/avs/azure-resourcemanager-avs/src/main/java/com/azure/resourcemanager/avs/implementation/WorkloadNetworksClientImpl.java", "license": "mit", "size": 538828 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkDnsServiceInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkDnsServiceInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.avs.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,416,521
static String valueToString(Object value, int indentFactor, int indent) throws JSONException { if (value == null || value.equals(null)) { return "null"; } try { if (value instanceof JSONString) { Object o = ((JSONString)value).toJSONString(); if (o instanceof String) { return (String)o; } } } catch (Exception e) { } if (value instanceof Number) { return numberToString((Number) value); } if (value instanceof Boolean) { return value.toString(); } if (value instanceof JSONObject) { return ((JSONObject)value).toString(indentFactor, indent); } if (value instanceof JSONArray) { return ((JSONArray)value).toString(indentFactor, indent); } if (value instanceof Map) { return new JSONObject((Map)value).toString(indentFactor, indent); } if (value instanceof Collection) { return new JSONArray((Collection)value).toString(indentFactor, indent); } if (value.getClass().isArray()) { return new JSONArray(value).toString(indentFactor, indent); } return quote(value.toString()); }
static String valueToString(Object value, int indentFactor, int indent) throws JSONException { if (value == null value.equals(null)) { return "null"; } try { if (value instanceof JSONString) { Object o = ((JSONString)value).toJSONString(); if (o instanceof String) { return (String)o; } } } catch (Exception e) { } if (value instanceof Number) { return numberToString((Number) value); } if (value instanceof Boolean) { return value.toString(); } if (value instanceof JSONObject) { return ((JSONObject)value).toString(indentFactor, indent); } if (value instanceof JSONArray) { return ((JSONArray)value).toString(indentFactor, indent); } if (value instanceof Map) { return new JSONObject((Map)value).toString(indentFactor, indent); } if (value instanceof Collection) { return new JSONArray((Collection)value).toString(indentFactor, indent); } if (value.getClass().isArray()) { return new JSONArray(value).toString(indentFactor, indent); } return quote(value.toString()); }
/** * Make a prettyprinted JSON text of an object value. * <p> * Warning: This method assumes that the data structure is acyclical. * @param value The value to be serialized. * @param indentFactor The number of spaces to add to each level of * indentation. * @param indent The indentation of the top level. * @return a printable, displayable, transmittable * representation of the object, beginning * with <code>{</code>&nbsp;<small>(left brace)</small> and ending * with <code>}</code>&nbsp;<small>(right brace)</small>. * @throws JSONException If the object contains an invalid number. */
Make a prettyprinted JSON text of an object value. Warning: This method assumes that the data structure is acyclical
valueToString
{ "repo_name": "shaunmahony/seqcode", "path": "src/edu/psu/compbio/seqcode/gse/utils/json/JSONObject.java", "license": "mit", "size": 51939 }
[ "java.util.Collection", "java.util.Map" ]
import java.util.Collection; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,599,077
public ServiceCall<DateTime> getLocalPositiveOffsetMinDateTimeAsync(final ServiceCallback<DateTime> serviceCallback) { return ServiceCall.create(getLocalPositiveOffsetMinDateTimeWithServiceResponseAsync(), serviceCallback); }
ServiceCall<DateTime> function(final ServiceCallback<DateTime> serviceCallback) { return ServiceCall.create(getLocalPositiveOffsetMinDateTimeWithServiceResponseAsync(), serviceCallback); }
/** * Get min datetime value 0001-01-01T00:00:00+14:00. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */
Get min datetime value 0001-01-01T00:00:00+14:00
getLocalPositiveOffsetMinDateTimeAsync
{ "repo_name": "tbombach/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydatetime/implementation/DatetimesImpl.java", "license": "mit", "size": 60457 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback", "org.joda.time.DateTime" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import org.joda.time.DateTime;
import com.microsoft.rest.*; import org.joda.time.*;
[ "com.microsoft.rest", "org.joda.time" ]
com.microsoft.rest; org.joda.time;
395,376
public Element getXMLElement();
Element function();
/** * Generate Element necessary to build final XML file that describes * customized Ribbon * * @return Element */
Generate Element necessary to build final XML file that describes customized Ribbon
getXMLElement
{ "repo_name": "Marcin1112/CustomizeExcelRibbon", "path": "CustomizeRibbon/src/main/java/ribbonElements/SimpleRibbonContainer.java", "license": "gpl-3.0", "size": 941 }
[ "org.w3c.dom.Element" ]
import org.w3c.dom.Element;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,320,711
@Named("ListBucket") @GET @Path("/") @XMLResponseParser(ListBucketHandler.class) ListBucketResponse listBucket(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam( BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName, ListBucketOptions... options);
@Named(STR) @Path("/") @XMLResponseParser(ListBucketHandler.class) ListBucketResponse listBucket(@Bucket @EndpointParam(parser = AssignCorrectHostnameForBucket.class) @BinderParam( BindAsHostPrefixIfConfigured.class) @ParamValidators(BucketNameValidator.class) String bucketName, ListBucketOptions... options);
/** * Retrieve a {@code S3Bucket} listing. A GET request operation using a bucket URI lists * information about the objects in the bucket. You can use {@link ListBucketOptions} to control * the amount of S3Objects to return. * <p /> * To list the keys of a bucket, you must have READ access to the bucket. * <p/> * * @param bucketName namespace of the objects you wish to list * @return potentially empty or partial list of the bucket. * @see ListBucketOptions */
Retrieve a S3Bucket listing. A GET request operation using a bucket URI lists information about the objects in the bucket. You can use <code>ListBucketOptions</code> to control the amount of S3Objects to return. To list the keys of a bucket, you must have READ access to the bucket.
listBucket
{ "repo_name": "yanzhijun/jclouds-aliyun", "path": "apis/s3/src/main/java/org/jclouds/s3/S3Client.java", "license": "apache-2.0", "size": 31935 }
[ "javax.inject.Named", "javax.ws.rs.Path", "org.jclouds.rest.annotations.BinderParam", "org.jclouds.rest.annotations.EndpointParam", "org.jclouds.rest.annotations.ParamValidators", "org.jclouds.rest.annotations.XMLResponseParser", "org.jclouds.s3.binders.BindAsHostPrefixIfConfigured", "org.jclouds.s3.domain.ListBucketResponse", "org.jclouds.s3.functions.AssignCorrectHostnameForBucket", "org.jclouds.s3.options.ListBucketOptions", "org.jclouds.s3.predicates.validators.BucketNameValidator", "org.jclouds.s3.xml.ListBucketHandler" ]
import javax.inject.Named; import javax.ws.rs.Path; import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.ParamValidators; import org.jclouds.rest.annotations.XMLResponseParser; import org.jclouds.s3.binders.BindAsHostPrefixIfConfigured; import org.jclouds.s3.domain.ListBucketResponse; import org.jclouds.s3.functions.AssignCorrectHostnameForBucket; import org.jclouds.s3.options.ListBucketOptions; import org.jclouds.s3.predicates.validators.BucketNameValidator; import org.jclouds.s3.xml.ListBucketHandler;
import javax.inject.*; import javax.ws.rs.*; import org.jclouds.rest.annotations.*; import org.jclouds.s3.binders.*; import org.jclouds.s3.domain.*; import org.jclouds.s3.functions.*; import org.jclouds.s3.options.*; import org.jclouds.s3.predicates.validators.*; import org.jclouds.s3.xml.*;
[ "javax.inject", "javax.ws", "org.jclouds.rest", "org.jclouds.s3" ]
javax.inject; javax.ws; org.jclouds.rest; org.jclouds.s3;
2,167,823
public void setProjectnatures( List projectnatures ) { this.projectnatures = projectnatures; }
void function( List projectnatures ) { this.projectnatures = projectnatures; }
/** * Setter for <code>projectnatures</code>. * * @param projectnatures The projectnatures to set. */
Setter for <code>projectnatures</code>
setProjectnatures
{ "repo_name": "kikinteractive/maven-plugins", "path": "maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseWriterConfig.java", "license": "apache-2.0", "size": 13499 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
495,238
private void init(ImageCacheParams cacheParams) { mCacheParams = cacheParams; // BEGIN_INCLUDE(init_memory_cache) // Set up memory cache if (mCacheParams.memoryCacheEnabled) { if (BuildConfig.DEBUG) { Log.d(TAG, "Memory cache created (size = " + mCacheParams.memCacheSize + ")"); } // If we're running on Honeycomb or newer, create a set of reusable // bitmaps that can be // populated into the inBitmap field of BitmapFactory.Options. Note // that the set is // of SoftReferences which will actually not be very effective due // to the garbage // collector being aggressive clearing Soft/WeakReferences. A better // approach // would be to use a strongly references bitmaps, however this would // require some // balancing of memory usage between this set and the bitmap // LruCache. It would also // require knowledge of the expected size of the bitmaps. From // Honeycomb to JellyBean // the size would need to be precise, from KitKat onward the size // would just need to // be the upper bound (due to changes in how inBitmap can re-use // bitmaps). if (Utils.hasHoneycomb()) { mReusableBitmaps = Collections .synchronizedSet(new HashSet<SoftReference<Bitmap>>()); } mMemoryCache = new LruCache<String, BitmapDrawable>( mCacheParams.memCacheSize) {
void function(ImageCacheParams cacheParams) { mCacheParams = cacheParams; if (mCacheParams.memoryCacheEnabled) { if (BuildConfig.DEBUG) { Log.d(TAG, STR + mCacheParams.memCacheSize + ")"); } if (Utils.hasHoneycomb()) { mReusableBitmaps = Collections .synchronizedSet(new HashSet<SoftReference<Bitmap>>()); } mMemoryCache = new LruCache<String, BitmapDrawable>( mCacheParams.memCacheSize) {
/** * Initialize the cache, providing all parameters. * * @param cacheParams * The cache parameters to initialize the cache */
Initialize the cache, providing all parameters
init
{ "repo_name": "zhenyue007/Decrypt-The-Stranger", "path": "src/com/zgsc/jmmsr/video/util/ImageCache.java", "license": "gpl-2.0", "size": 17547 }
[ "android.graphics.Bitmap", "android.graphics.drawable.BitmapDrawable", "android.support.v4.util.LruCache", "android.util.Log", "com.zgsc.jmmsr.BuildConfig", "java.lang.ref.SoftReference", "java.util.Collections", "java.util.HashSet" ]
import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.support.v4.util.LruCache; import android.util.Log; import com.zgsc.jmmsr.BuildConfig; import java.lang.ref.SoftReference; import java.util.Collections; import java.util.HashSet;
import android.graphics.*; import android.graphics.drawable.*; import android.support.v4.util.*; import android.util.*; import com.zgsc.jmmsr.*; import java.lang.ref.*; import java.util.*;
[ "android.graphics", "android.support", "android.util", "com.zgsc.jmmsr", "java.lang", "java.util" ]
android.graphics; android.support; android.util; com.zgsc.jmmsr; java.lang; java.util;
2,061,472
@Test public void testUpdateValues() throws Exception { int samplesToSend=15; countDownLatch = new CountDownLatch(samplesToSend); Sample[] samples = new Sample[samplesToSend]; long tStamp=19975; for (int t=0; t<samplesToSend; t++) { samples[t]=new Sample(Long.valueOf(13147+t),tStamp++); mVal.submitSample(samples[t]); } assertTrue(countDownLatch.await(refreshRate/2, TimeUnit.MILLISECONDS)); assertEquals(samplesToSend, receivedValues.size()); tStamp=19975; for (int t=0; t<samplesToSend; t++) { ValueToSend v = receivedValues.get(t); assertEquals(mValueId,v.id); assertEquals(samples[t].value, v.value); assertEquals(v.producedTimestamp, tStamp++); } }
void function() throws Exception { int samplesToSend=15; countDownLatch = new CountDownLatch(samplesToSend); Sample[] samples = new Sample[samplesToSend]; long tStamp=19975; for (int t=0; t<samplesToSend; t++) { samples[t]=new Sample(Long.valueOf(13147+t),tStamp++); mVal.submitSample(samples[t]); } assertTrue(countDownLatch.await(refreshRate/2, TimeUnit.MILLISECONDS)); assertEquals(samplesToSend, receivedValues.size()); tStamp=19975; for (int t=0; t<samplesToSend; t++) { ValueToSend v = receivedValues.get(t); assertEquals(mValueId,v.id); assertEquals(samples[t].value, v.value); assertEquals(v.producedTimestamp, tStamp++); } }
/** * Test if all the values are sent after submitting a new * sample. * */
Test if all the values are sent after submitting a new sample
testUpdateValues
{ "repo_name": "IntegratedAlarmSystem-Group/ias", "path": "plugin/src/test/java/org/eso/ias/plugin/test/MonitoredValueTest.java", "license": "lgpl-3.0", "size": 7024 }
[ "java.util.concurrent.CountDownLatch", "java.util.concurrent.TimeUnit", "org.eso.ias.plugin.Sample", "org.eso.ias.plugin.ValueToSend", "org.junit.jupiter.api.Assertions" ]
import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.eso.ias.plugin.Sample; import org.eso.ias.plugin.ValueToSend; import org.junit.jupiter.api.Assertions;
import java.util.concurrent.*; import org.eso.ias.plugin.*; import org.junit.jupiter.api.*;
[ "java.util", "org.eso.ias", "org.junit.jupiter" ]
java.util; org.eso.ias; org.junit.jupiter;
776,425
public static void callPhone(Context context, String phonenum) { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phonenum)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
static void function(Context context, String phonenum) { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phonenum)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
/** * Phone call * @param phonenum */
Phone call
callPhone
{ "repo_name": "connectim/Android", "path": "app/src/main/java/connect/utils/system/SystemUtil.java", "license": "mit", "size": 5726 }
[ "android.content.Context", "android.content.Intent", "android.net.Uri" ]
import android.content.Context; import android.content.Intent; import android.net.Uri;
import android.content.*; import android.net.*;
[ "android.content", "android.net" ]
android.content; android.net;
1,478,795
TypingStrategy getTypingStrategy(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * * * Convenience method, returns empty list for simply reference by default. * Overridden in {@link ParameterizedTypeRefStructural}
TypingStrategy getTypingStrategy(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * * * Convenience method, returns empty list for simply reference by default. * Overridden in {@link ParameterizedTypeRefStructural}
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * * * Returns the typing strategy, either the use or def site, usually NOMINAL. * <!-- end-model-doc --> * @model kind="operation" unique="false" * annotation="http://www.eclipse.org/emf/2002/GenModel body='return &lt;%org.eclipse.n4js.ts.types.TypingStrategy%&gt;.NOMINAL;'" * @generated */
Returns the typing strategy, either the use or def site, usually NOMINAL.
getTypingStrategy
{ "repo_name": "lbeurerkellner/n4js", "path": "plugins/org.eclipse.n4js.ts.model/emf-gen/org/eclipse/n4js/ts/typeRefs/TypeRef.java", "license": "epl-1.0", "size": 13918 }
[ "org.eclipse.n4js.ts.types.TypingStrategy" ]
import org.eclipse.n4js.ts.types.TypingStrategy;
import org.eclipse.n4js.ts.types.*;
[ "org.eclipse.n4js" ]
org.eclipse.n4js;
92,096
protected void executeActionResult(String finalLocation, ActionInvocation invocation) throws Exception { String location = finalLocation; String namespace = invocation.getProxy().getNamespace(); if (LOG.isDebugEnabled()) { String phase = (PortletActionContext.getPhase().isEvent()) ? "Event" : "Action"; LOG.debug("Executing result in "+phase+" phase"); LOG.debug("Setting event render parameter location : " + location); LOG.debug("Setting event render parameter namespace: " + namespace); } Map<String, Object> sessionMap = invocation.getInvocationContext().getSession(); if (location.indexOf('?') != -1) { convertQueryParamsToRenderParams(location.substring(location.indexOf('?') + 1)); location = location.substring(0, location.indexOf('?')); } PortletResponse response = PortletActionContext.getResponse(); if (location.endsWith(".action")) { // View is rendered with a view action...luckily... location = location.substring(0, location.lastIndexOf(".")); resultHelper.setRenderParameter(response, PortletConstants.ACTION_PARAM, location); } else { // View is rendered outside an action...uh oh... resultHelper.setRenderParameter(response, PortletConstants.ACTION_PARAM, "renderDirect"); sessionMap.put(PortletConstants.RENDER_DIRECT_LOCATION, location); } resultHelper.setRenderParameter(response, PortletConstants.RENDER_DIRECT_NAMESPACE, namespace); if(portletMode != null) { resultHelper.setPortletMode(response, portletMode); resultHelper.setRenderParameter(response, PortletConstants.MODE_PARAM, portletMode.toString()); } else { resultHelper.setRenderParameter(response, PortletConstants.MODE_PARAM, PortletActionContext.getRequest().getPortletMode() .toString()); } }
void function(String finalLocation, ActionInvocation invocation) throws Exception { String location = finalLocation; String namespace = invocation.getProxy().getNamespace(); if (LOG.isDebugEnabled()) { String phase = (PortletActionContext.getPhase().isEvent()) ? "Event" : STR; LOG.debug(STR+phase+STR); LOG.debug(STR + location); LOG.debug(STR + namespace); } Map<String, Object> sessionMap = invocation.getInvocationContext().getSession(); if (location.indexOf('?') != -1) { convertQueryParamsToRenderParams(location.substring(location.indexOf('?') + 1)); location = location.substring(0, location.indexOf('?')); } PortletResponse response = PortletActionContext.getResponse(); if (location.endsWith(STR)) { location = location.substring(0, location.lastIndexOf(".")); resultHelper.setRenderParameter(response, PortletConstants.ACTION_PARAM, location); } else { resultHelper.setRenderParameter(response, PortletConstants.ACTION_PARAM, STR); sessionMap.put(PortletConstants.RENDER_DIRECT_LOCATION, location); } resultHelper.setRenderParameter(response, PortletConstants.RENDER_DIRECT_NAMESPACE, namespace); if(portletMode != null) { resultHelper.setPortletMode(response, portletMode); resultHelper.setRenderParameter(response, PortletConstants.MODE_PARAM, portletMode.toString()); } else { resultHelper.setRenderParameter(response, PortletConstants.MODE_PARAM, PortletActionContext.getRequest().getPortletMode() .toString()); } }
/** * Executes the action result. * * @param finalLocation * @param invocation */
Executes the action result
executeActionResult
{ "repo_name": "codeApeFromChina/resource", "path": "frame_packages/java_libs/struts-2.3.15.2/src/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java", "license": "unlicense", "size": 9327 }
[ "com.opensymphony.xwork2.ActionInvocation", "java.util.Map", "javax.portlet.PortletResponse", "org.apache.struts2.portlet.PortletConstants", "org.apache.struts2.portlet.context.PortletActionContext" ]
import com.opensymphony.xwork2.ActionInvocation; import java.util.Map; import javax.portlet.PortletResponse; import org.apache.struts2.portlet.PortletConstants; import org.apache.struts2.portlet.context.PortletActionContext;
import com.opensymphony.xwork2.*; import java.util.*; import javax.portlet.*; import org.apache.struts2.portlet.*; import org.apache.struts2.portlet.context.*;
[ "com.opensymphony.xwork2", "java.util", "javax.portlet", "org.apache.struts2" ]
com.opensymphony.xwork2; java.util; javax.portlet; org.apache.struts2;
1,795,229
@Deployment public void testGetTaskVariables() throws Exception { Calendar cal = Calendar.getInstance(); // Start process with all types of variables Map<String, Object> processVariables = new HashMap<String, Object>(); processVariables.put("stringProcVar", "This is a ProcVariable"); processVariables.put("intProcVar", 123); processVariables.put("longProcVar", 1234L); processVariables.put("shortProcVar", (short) 123); processVariables.put("doubleProcVar", 99.99); processVariables.put("booleanProcVar", Boolean.TRUE); processVariables.put("dateProcVar", cal.getTime()); processVariables.put("byteArrayProcVar", "Some raw bytes".getBytes()); processVariables.put("overlappingVariable", "process-value"); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", processVariables); // Set local task variables, including one that has the same name as one // that is defined in the parent scope (process instance) Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); Map<String, Object> taskVariables = new HashMap<String, Object>(); taskVariables.put("stringTaskVar", "This is a TaskVariable"); taskVariables.put("intTaskVar", 123); taskVariables.put("longTaskVar", 1234L); taskVariables.put("shortTaskVar", (short) 123); taskVariables.put("doubleTaskVar", 99.99); taskVariables.put("booleanTaskVar", Boolean.TRUE); taskVariables.put("dateTaskVar", cal.getTime()); taskVariables.put("byteArrayTaskVar", "Some raw bytes".getBytes()); taskVariables.put("overlappingVariable", "task-value"); taskService.setVariablesLocal(task.getId(), taskVariables); // Request all variables (no scope provides) which include global an // local CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_VARIABLES_COLLECTION, task.getId())), HttpStatus.SC_OK); JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertNotNull(responseNode); assertTrue(responseNode.isArray()); assertEquals(17, responseNode.size()); // Overlapping variable should contain task-value AND be defined as // "local" boolean foundOverlapping = false; for (int i = 0; i < responseNode.size(); i++) { JsonNode var = responseNode.get(i); if (var.get("name") != null && "overlappingVariable".equals(var.get("name").asText())) { foundOverlapping = true; assertEquals("task-value", var.get("value").asText()); assertEquals("local", var.get("scope").asText()); break; } } assertTrue(foundOverlapping); // Check local variables filtering response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_VARIABLES_COLLECTION, task.getId()) + "?scope=local"), HttpStatus.SC_OK); responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertNotNull(responseNode); assertTrue(responseNode.isArray()); assertEquals(9, responseNode.size()); for (int i = 0; i < responseNode.size(); i++) { JsonNode var = responseNode.get(i); assertEquals("local", var.get("scope").asText()); } // Check global variables filtering response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_VARIABLES_COLLECTION, task.getId()) + "?scope=global"), HttpStatus.SC_OK); responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertNotNull(responseNode); assertTrue(responseNode.isArray()); assertEquals(9, responseNode.size()); foundOverlapping = false; for (int i = 0; i < responseNode.size(); i++) { JsonNode var = responseNode.get(i); assertEquals("global", var.get("scope").asText()); if ("overlappingVariable".equals(var.get("name").asText())) { foundOverlapping = true; assertEquals("process-value", var.get("value").asText()); } } assertTrue(foundOverlapping); }
void function() throws Exception { Calendar cal = Calendar.getInstance(); Map<String, Object> processVariables = new HashMap<String, Object>(); processVariables.put(STR, STR); processVariables.put(STR, 123); processVariables.put(STR, 1234L); processVariables.put(STR, (short) 123); processVariables.put(STR, 99.99); processVariables.put(STR, Boolean.TRUE); processVariables.put(STR, cal.getTime()); processVariables.put(STR, STR.getBytes()); processVariables.put(STR, STR); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(STR, processVariables); Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); Map<String, Object> taskVariables = new HashMap<String, Object>(); taskVariables.put(STR, STR); taskVariables.put(STR, 123); taskVariables.put(STR, 1234L); taskVariables.put(STR, (short) 123); taskVariables.put(STR, 99.99); taskVariables.put(STR, Boolean.TRUE); taskVariables.put(STR, cal.getTime()); taskVariables.put(STR, STR.getBytes()); taskVariables.put(STR, STR); taskService.setVariablesLocal(task.getId(), taskVariables); CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_VARIABLES_COLLECTION, task.getId())), HttpStatus.SC_OK); JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertNotNull(responseNode); assertTrue(responseNode.isArray()); assertEquals(17, responseNode.size()); boolean foundOverlapping = false; for (int i = 0; i < responseNode.size(); i++) { JsonNode var = responseNode.get(i); if (var.get("name") != null && STR.equals(var.get("name").asText())) { foundOverlapping = true; assertEquals(STR, var.get("value").asText()); assertEquals("local", var.get("scope").asText()); break; } } assertTrue(foundOverlapping); response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_VARIABLES_COLLECTION, task.getId()) + STR), HttpStatus.SC_OK); responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertNotNull(responseNode); assertTrue(responseNode.isArray()); assertEquals(9, responseNode.size()); for (int i = 0; i < responseNode.size(); i++) { JsonNode var = responseNode.get(i); assertEquals("local", var.get("scope").asText()); } response = executeRequest(new HttpGet(SERVER_URL_PREFIX + RestUrls.createRelativeResourceUrl(RestUrls.URL_TASK_VARIABLES_COLLECTION, task.getId()) + STR), HttpStatus.SC_OK); responseNode = objectMapper.readTree(response.getEntity().getContent()); closeResponse(response); assertNotNull(responseNode); assertTrue(responseNode.isArray()); assertEquals(9, responseNode.size()); foundOverlapping = false; for (int i = 0; i < responseNode.size(); i++) { JsonNode var = responseNode.get(i); assertEquals(STR, var.get("scope").asText()); if (STR.equals(var.get("name").asText())) { foundOverlapping = true; assertEquals(STR, var.get("value").asText()); } } assertTrue(foundOverlapping); }
/** * Test getting all task variables. GET runtime/tasks/{taskId}/variables */
Test getting all task variables. GET runtime/tasks/{taskId}/variables
testGetTaskVariables
{ "repo_name": "motorina0/flowable-engine", "path": "modules/flowable-rest/src/test/java/org/flowable/rest/service/api/runtime/TaskVariablesCollectionResourceTest.java", "license": "apache-2.0", "size": 25928 }
[ "com.fasterxml.jackson.databind.JsonNode", "java.util.Calendar", "java.util.HashMap", "java.util.Map", "org.apache.http.HttpStatus", "org.apache.http.client.methods.CloseableHttpResponse", "org.apache.http.client.methods.HttpGet", "org.flowable.engine.runtime.ProcessInstance", "org.flowable.engine.task.Task", "org.flowable.rest.service.api.RestUrls" ]
import com.fasterxml.jackson.databind.JsonNode; import java.util.Calendar; import java.util.HashMap; import java.util.Map; import org.apache.http.HttpStatus; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.engine.task.Task; import org.flowable.rest.service.api.RestUrls;
import com.fasterxml.jackson.databind.*; import java.util.*; import org.apache.http.*; import org.apache.http.client.methods.*; import org.flowable.engine.runtime.*; import org.flowable.engine.task.*; import org.flowable.rest.service.api.*;
[ "com.fasterxml.jackson", "java.util", "org.apache.http", "org.flowable.engine", "org.flowable.rest" ]
com.fasterxml.jackson; java.util; org.apache.http; org.flowable.engine; org.flowable.rest;
1,447,483
protected void assertTextProtocolResponse(HazelcastInstance hz, TestUrl testUrl) throws UnknownHostException, IOException { try (TextProtocolClient client = new TextProtocolClient(getAddress(hz).getInetSocketAddress())) { client.connect(); client.sendData(testUrl.method + " " + testUrl.requestUri + " HTTP/1.0" + CRLF + CRLF); assertTrueEventually( createResponseAssertTask(testUrl.toString(), client, testUrl.expectedSubstring), 10); } }
void function(HazelcastInstance hz, TestUrl testUrl) throws UnknownHostException, IOException { try (TextProtocolClient client = new TextProtocolClient(getAddress(hz).getInetSocketAddress())) { client.connect(); client.sendData(testUrl.method + " " + testUrl.requestUri + STR + CRLF + CRLF); assertTrueEventually( createResponseAssertTask(testUrl.toString(), client, testUrl.expectedSubstring), 10); } }
/** * Asserts that a text protocol client call to given {@link TestUrl} returns an expected response. */
Asserts that a text protocol client call to given <code>TestUrl</code> returns an expected response
assertTextProtocolResponse
{ "repo_name": "mdogan/hazelcast", "path": "hazelcast/src/test/java/com/hazelcast/internal/nio/ascii/RestApiConfigTestBase.java", "license": "apache-2.0", "size": 9504 }
[ "com.hazelcast.core.HazelcastInstance", "com.hazelcast.test.HazelcastTestSupport", "java.io.IOException", "java.net.UnknownHostException" ]
import com.hazelcast.core.HazelcastInstance; import com.hazelcast.test.HazelcastTestSupport; import java.io.IOException; import java.net.UnknownHostException;
import com.hazelcast.core.*; import com.hazelcast.test.*; import java.io.*; import java.net.*;
[ "com.hazelcast.core", "com.hazelcast.test", "java.io", "java.net" ]
com.hazelcast.core; com.hazelcast.test; java.io; java.net;
1,003,440
public String deposit(String account, double amount) { if (econ == null) return "Economy is disabled."; try { @SuppressWarnings("deprecation") EconomyResponse response = econ.depositPlayer(account, amount); return response.transactionSuccess() ? null : response.errorMessage; } catch (Throwable ex) { handler.getLogHandler().debug(Level.WARNING, Util.getUsefulStack(ex, "deposit({0}, {1})", account, amount)); return ex.toString(); } }
String function(String account, double amount) { if (econ == null) return STR; try { @SuppressWarnings(STR) EconomyResponse response = econ.depositPlayer(account, amount); return response.transactionSuccess() ? null : response.errorMessage; } catch (Throwable ex) { handler.getLogHandler().debug(Level.WARNING, Util.getUsefulStack(ex, STR, account, amount)); return ex.toString(); } }
/** * Attempts to deposit a given amount into a given account's balance. Returns * null if the transaction was a success. * * @param account Account to give money to * @param amount Amount to give * @return Error message, if applicable */
Attempts to deposit a given amount into a given account's balance. Returns null if the transaction was a success
deposit
{ "repo_name": "dmulloy2/SwornAPI", "path": "src/main/java/net/dmulloy2/integration/VaultHandler.java", "license": "gpl-3.0", "size": 9505 }
[ "java.util.logging.Level", "net.dmulloy2.util.Util", "net.milkbowl.vault.economy.EconomyResponse" ]
import java.util.logging.Level; import net.dmulloy2.util.Util; import net.milkbowl.vault.economy.EconomyResponse;
import java.util.logging.*; import net.dmulloy2.util.*; import net.milkbowl.vault.economy.*;
[ "java.util", "net.dmulloy2.util", "net.milkbowl.vault" ]
java.util; net.dmulloy2.util; net.milkbowl.vault;
1,311,112
private void checkCompactStyle(final DetailAST annotation) { final int valuePairCount = annotation.getChildCount( TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); final DetailAST valuePair = annotation.findFirstToken( TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); if (valuePairCount == 1 && ANNOTATION_ELEMENT_SINGLE_NAME.equals( valuePair.getFirstChild().getText())) { log(annotation.getLineNo(), MSG_KEY_ANNOTATION_INCORRECT_STYLE, ElementStyle.COMPACT); } }
void function(final DetailAST annotation) { final int valuePairCount = annotation.getChildCount( TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); final DetailAST valuePair = annotation.findFirstToken( TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); if (valuePairCount == 1 && ANNOTATION_ELEMENT_SINGLE_NAME.equals( valuePair.getFirstChild().getText())) { log(annotation.getLineNo(), MSG_KEY_ANNOTATION_INCORRECT_STYLE, ElementStyle.COMPACT); } }
/** * Checks for compact style type violations. * * @param annotation the annotation token */
Checks for compact style type violations
checkCompactStyle
{ "repo_name": "jochenvdv/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java", "license": "lgpl-2.1", "size": 16825 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST", "com.puppycrawl.tools.checkstyle.api.TokenTypes" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
497,215
ArrayList<ArrayList<HashSet<Individu>>> dispersers = new ArrayList<>(); /// Reproduction, mortality, getting dispersers for (int i = 0; i < metaPopulatie.size(); i++) { metaPopulatie.get(i).reproduction(); metaPopulatie.get(i).mortality(); dispersers.add(i, metaPopulatie.get(i).dispersal(migration.get(i))); } /// Adding dispersers to their new population for (int j = 0; j < metaPopulatie.size(); j++) { for (int k = 0; k < metaPopulatie.size(); k++) { metaPopulatie.get(j).addIndividuals(dispersers.get(k).get(j)); } } /// Carrying capacity and ageing for (Populatie pop : metaPopulatie) { pop.ageing(); pop.carryingCapacity(); } }
ArrayList<ArrayList<HashSet<Individu>>> dispersers = new ArrayList<>(); for (int i = 0; i < metaPopulatie.size(); i++) { metaPopulatie.get(i).reproduction(); metaPopulatie.get(i).mortality(); dispersers.add(i, metaPopulatie.get(i).dispersal(migration.get(i))); } for (int j = 0; j < metaPopulatie.size(); j++) { for (int k = 0; k < metaPopulatie.size(); k++) { metaPopulatie.get(j).addIndividuals(dispersers.get(k).get(j)); } } for (Populatie pop : metaPopulatie) { pop.ageing(); pop.carryingCapacity(); } }
/** * Performs one time step. In order: Reproduction --> Mortality --> * Dispersal --> Ageing --> Carrying Capacity */
Performs one time step. In order: Reproduction --> Mortality --> Dispersal --> Ageing --> Carrying Capacity
timeStep
{ "repo_name": "ToonVanDaele/metapop", "path": "inst/java/MetaPopulation/src/metapopulation/MetaPopulation.java", "license": "gpl-3.0", "size": 23264 }
[ "java.util.ArrayList", "java.util.HashSet" ]
import java.util.ArrayList; import java.util.HashSet;
import java.util.*;
[ "java.util" ]
java.util;
2,083,772
@SuppressWarnings("WeakerAccess") public static JSONObject makeServiceCall( String url, Methods method, Map<String, String> params) { // Open the URL and return a stream InputStream is; try { is = openUrl(url, method, params); } catch (Exception e) { Logger.logError(e, "Failed to open URL: " + url); return null; } // Read the entire stream String response = null; try { BufferedReader reader = new BufferedReader( new InputStreamReader(is, StandardCharsets.UTF_8),8192); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { sb.append(line); sb.append('\n'); } is.close(); response = sb.toString(); } catch (Exception e) { Logger.logError(e, "Exception while reading response"); } // Convert result string to JSON JSONObject json; try { json = new JSONObject(response); //if (!json.get(API_STATUS).equals(API_OK)) { // throw new RuntimeException("API call failed: " + json.get(API_REASON)); //} } catch (JSONException e) { Logger.logError(e); throw new RuntimeException("Unable to parse API result", e); } return json; }
@SuppressWarnings(STR) static JSONObject function( String url, Methods method, Map<String, String> params) { InputStream is; try { is = openUrl(url, method, params); } catch (Exception e) { Logger.logError(e, STR + url); return null; } String response = null; try { BufferedReader reader = new BufferedReader( new InputStreamReader(is, StandardCharsets.UTF_8),8192); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { sb.append(line); sb.append('\n'); } is.close(); response = sb.toString(); } catch (Exception e) { Logger.logError(e, STR); } JSONObject json; try { json = new JSONObject(response); } catch (JSONException e) { Logger.logError(e); throw new RuntimeException(STR, e); } return json; }
/** * Make a call to a Book Catalogue service; assumes the caller has waited for appropriate delay * * @param url Service URL * @param method Method * @param params HashMap of Params * @return JSON result */
Make a call to a Book Catalogue service; assumes the caller has waited for appropriate delay
makeServiceCall
{ "repo_name": "Grunthos/Book-Catalogue", "path": "src/com/eleybourn/bookcatalogue/bcservices/BcService.java", "license": "gpl-3.0", "size": 10565 }
[ "com.eleybourn.bookcatalogue.utils.Logger", "java.io.BufferedReader", "java.io.InputStream", "java.io.InputStreamReader", "java.nio.charset.StandardCharsets", "java.util.Map", "org.json.JSONException", "org.json.JSONObject" ]
import com.eleybourn.bookcatalogue.utils.Logger; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.Map; import org.json.JSONException; import org.json.JSONObject;
import com.eleybourn.bookcatalogue.utils.*; import java.io.*; import java.nio.charset.*; import java.util.*; import org.json.*;
[ "com.eleybourn.bookcatalogue", "java.io", "java.nio", "java.util", "org.json" ]
com.eleybourn.bookcatalogue; java.io; java.nio; java.util; org.json;
1,549,010
public static Frame getParentFrame(Component comp) { if (comp instanceof Container) return (Frame) getParent((Container) comp, Frame.class); else return null; }
static Frame function(Component comp) { if (comp instanceof Container) return (Frame) getParent((Container) comp, Frame.class); else return null; }
/** * Tries to determine the frame the component is part of. * * @param comp the component to get the frame for * @return the parent frame if one exists or null if not */
Tries to determine the frame the component is part of
getParentFrame
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-core/src/main/java/adams/gui/core/GUIHelper.java", "license": "gpl-3.0", "size": 88762 }
[ "java.awt.Component", "java.awt.Container", "java.awt.Frame" ]
import java.awt.Component; import java.awt.Container; import java.awt.Frame;
import java.awt.*;
[ "java.awt" ]
java.awt;
245,463
String pageSize = getSharedPreferenceValue(Constants.PHOTO_PAGE_SIZE, String.valueOf(Constants.DEF_GRID_PAGE_SIZE)); return Integer.valueOf(pageSize); }
String pageSize = getSharedPreferenceValue(Constants.PHOTO_PAGE_SIZE, String.valueOf(Constants.DEF_GRID_PAGE_SIZE)); return Integer.valueOf(pageSize); }
/** * Returns the defiend page size of the grid view. * * @return the page size. */
Returns the defiend page size of the grid view
getPageSize
{ "repo_name": "Grishu/FlickerAPI", "path": "Flick API in Android/flickr.viewer.oauth/src/com/gmail/charleszq/FlickrViewerApplication.java", "license": "epl-1.0", "size": 9047 }
[ "com.gmail.charleszq.utils.Constants" ]
import com.gmail.charleszq.utils.Constants;
import com.gmail.charleszq.utils.*;
[ "com.gmail.charleszq" ]
com.gmail.charleszq;
2,214,741
// The field that keep track of failed asserts FieldGen posAsserts; posAsserts = new FieldGen(Constants.ACC_PRIVATE | Constants.ACC_STATIC, Type.getType(runTime.String.class), "posAsserts", this.getConstantPool()); // constant pool this.addField(posAsserts.getField()); }
FieldGen posAsserts; posAsserts = new FieldGen(Constants.ACC_PRIVATE Constants.ACC_STATIC, Type.getType(runTime.String.class), STR, this.getConstantPool()); this.addField(posAsserts.getField()); }
/** * Create the fields used in the class */
Create the fields used in the class
createFields
{ "repo_name": "Kaos1337/ProjectKitten", "path": "src/javaBytecodeGenerator/TestClassGenerator.java", "license": "gpl-2.0", "size": 10086 }
[ "org.apache.bcel.Constants", "org.apache.bcel.generic.FieldGen", "org.apache.bcel.generic.Type" ]
import org.apache.bcel.Constants; import org.apache.bcel.generic.FieldGen; import org.apache.bcel.generic.Type;
import org.apache.bcel.*; import org.apache.bcel.generic.*;
[ "org.apache.bcel" ]
org.apache.bcel;
985,684
public Root getBuildDataDirectory() { return Root.asDerivedRoot(getExecRoot(), getOutputPath()); }
Root function() { return Root.asDerivedRoot(getExecRoot(), getOutputPath()); }
/** * Returns the configuration-independent root where the build-data should be placed, given the * {@link BlazeDirectories} of this server instance. Nothing else should be placed here. */
Returns the configuration-independent root where the build-data should be placed, given the <code>BlazeDirectories</code> of this server instance. Nothing else should be placed here
getBuildDataDirectory
{ "repo_name": "kamalmarhubi/bazel", "path": "src/main/java/com/google/devtools/build/lib/analysis/BlazeDirectories.java", "license": "apache-2.0", "size": 7892 }
[ "com.google.devtools.build.lib.actions.Root" ]
import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.actions.*;
[ "com.google.devtools" ]
com.google.devtools;
26,461
private void updatePasswordEchoState() { boolean systemEnabled = Settings.System.getInt( getApplicationContext().getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, 1) == 1; if (PrefServiceBridge.getInstance().getPasswordEchoEnabled() == systemEnabled) return; PrefServiceBridge.getInstance().setPasswordEchoEnabled(systemEnabled); }
void function() { boolean systemEnabled = Settings.System.getInt( getApplicationContext().getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, 1) == 1; if (PrefServiceBridge.getInstance().getPasswordEchoEnabled() == systemEnabled) return; PrefServiceBridge.getInstance().setPasswordEchoEnabled(systemEnabled); }
/** * Honor the Android system setting about showing the last character of a password for a short * period of time. */
Honor the Android system setting about showing the last character of a password for a short period of time
updatePasswordEchoState
{ "repo_name": "highweb-project/highweb-webcl-html5spec", "path": "chrome/android/java/src/org/chromium/chrome/browser/ChromeApplication.java", "license": "bsd-3-clause", "size": 36661 }
[ "android.provider.Settings", "org.chromium.chrome.browser.preferences.PrefServiceBridge" ]
import android.provider.Settings; import org.chromium.chrome.browser.preferences.PrefServiceBridge;
import android.provider.*; import org.chromium.chrome.browser.preferences.*;
[ "android.provider", "org.chromium.chrome" ]
android.provider; org.chromium.chrome;
2,002,398
public ListBlbResponse listBlbs(ListBlbRequest listBlbRequest) { checkNotNull(listBlbRequest, "request should not be null."); InternalRequest internalRequest = this.createRequest(listBlbRequest, HttpMethodName.GET, PREFIX); if (StringUtils.isNotEmpty(listBlbRequest.getAddress())) { internalRequest.addParameter("address", listBlbRequest.getAddress()); } if (StringUtils.isNotEmpty(listBlbRequest.getName())) { internalRequest.addParameter("name", listBlbRequest.getName()); } if (StringUtils.isNotEmpty(listBlbRequest.getBlbId())) { internalRequest.addParameter("blbId", listBlbRequest.getBlbId()); } if (StringUtils.isNotEmpty(listBlbRequest.getBccId())) { internalRequest.addParameter("bccId", listBlbRequest.getBccId()); } if (listBlbRequest.getMarker() != null) { internalRequest.addParameter("marker", listBlbRequest.getMarker()); } if (listBlbRequest.getMaxKeys() > 0) { internalRequest.addParameter("maxKeys", String.valueOf(listBlbRequest.getMaxKeys())); } return invokeHttpClient(internalRequest, ListBlbResponse.class); }
ListBlbResponse function(ListBlbRequest listBlbRequest) { checkNotNull(listBlbRequest, STR); InternalRequest internalRequest = this.createRequest(listBlbRequest, HttpMethodName.GET, PREFIX); if (StringUtils.isNotEmpty(listBlbRequest.getAddress())) { internalRequest.addParameter(STR, listBlbRequest.getAddress()); } if (StringUtils.isNotEmpty(listBlbRequest.getName())) { internalRequest.addParameter("name", listBlbRequest.getName()); } if (StringUtils.isNotEmpty(listBlbRequest.getBlbId())) { internalRequest.addParameter("blbId", listBlbRequest.getBlbId()); } if (StringUtils.isNotEmpty(listBlbRequest.getBccId())) { internalRequest.addParameter("bccId", listBlbRequest.getBccId()); } if (listBlbRequest.getMarker() != null) { internalRequest.addParameter(STR, listBlbRequest.getMarker()); } if (listBlbRequest.getMaxKeys() > 0) { internalRequest.addParameter(STR, String.valueOf(listBlbRequest.getMaxKeys())); } return invokeHttpClient(internalRequest, ListBlbResponse.class); }
/** * Return a list of blbs with the specified options. * * @param listBlbRequest The request containing all options for listing blbs. * * @return The response containing a list of blbs with the specified options. */
Return a list of blbs with the specified options
listBlbs
{ "repo_name": "baidubce/bce-sdk-java", "path": "src/main/java/com/baidubce/services/blb/BlbClient.java", "license": "apache-2.0", "size": 27829 }
[ "com.baidubce.http.HttpMethodName", "com.baidubce.internal.InternalRequest", "com.baidubce.services.blb.model.ListBlbRequest", "com.baidubce.services.blb.model.ListBlbResponse", "com.google.common.base.Preconditions", "org.apache.commons.lang3.StringUtils" ]
import com.baidubce.http.HttpMethodName; import com.baidubce.internal.InternalRequest; import com.baidubce.services.blb.model.ListBlbRequest; import com.baidubce.services.blb.model.ListBlbResponse; import com.google.common.base.Preconditions; import org.apache.commons.lang3.StringUtils;
import com.baidubce.http.*; import com.baidubce.internal.*; import com.baidubce.services.blb.model.*; import com.google.common.base.*; import org.apache.commons.lang3.*;
[ "com.baidubce.http", "com.baidubce.internal", "com.baidubce.services", "com.google.common", "org.apache.commons" ]
com.baidubce.http; com.baidubce.internal; com.baidubce.services; com.google.common; org.apache.commons;
1,901,960
public void addSubstitutionFont(BaseFont font) { if (substitutionFonts == null) substitutionFonts = new ArrayList(); substitutionFonts.add(font); } private static final HashMap stdFieldFontNames = new HashMap(); private int totalRevisions; private Map fieldCache; static { stdFieldFontNames.put("CoBO", new String[]{"Courier-BoldOblique"}); stdFieldFontNames.put("CoBo", new String[]{"Courier-Bold"}); stdFieldFontNames.put("CoOb", new String[]{"Courier-Oblique"}); stdFieldFontNames.put("Cour", new String[]{"Courier"}); stdFieldFontNames.put("HeBO", new String[]{"Helvetica-BoldOblique"}); stdFieldFontNames.put("HeBo", new String[]{"Helvetica-Bold"}); stdFieldFontNames.put("HeOb", new String[]{"Helvetica-Oblique"}); stdFieldFontNames.put("Helv", new String[]{"Helvetica"}); stdFieldFontNames.put("Symb", new String[]{"Symbol"}); stdFieldFontNames.put("TiBI", new String[]{"Times-BoldItalic"}); stdFieldFontNames.put("TiBo", new String[]{"Times-Bold"}); stdFieldFontNames.put("TiIt", new String[]{"Times-Italic"}); stdFieldFontNames.put("TiRo", new String[]{"Times-Roman"}); stdFieldFontNames.put("ZaDb", new String[]{"ZapfDingbats"}); stdFieldFontNames.put("HySm", new String[]{"HYSMyeongJo-Medium", "UniKS-UCS2-H"}); stdFieldFontNames.put("HyGo", new String[]{"HYGoThic-Medium", "UniKS-UCS2-H"}); stdFieldFontNames.put("KaGo", new String[]{"HeiseiKakuGo-W5", "UniKS-UCS2-H"}); stdFieldFontNames.put("KaMi", new String[]{"HeiseiMin-W3", "UniJIS-UCS2-H"}); stdFieldFontNames.put("MHei", new String[]{"MHei-Medium", "UniCNS-UCS2-H"}); stdFieldFontNames.put("MSun", new String[]{"MSung-Light", "UniCNS-UCS2-H"}); stdFieldFontNames.put("STSo", new String[]{"STSong-Light", "UniGB-UCS2-H"}); } private static class RevisionStream extends InputStream { private byte b[] = new byte[1]; private RandomAccessFileOrArray raf; private int length; private int rangePosition = 0; private boolean closed; private RevisionStream(RandomAccessFileOrArray raf, int length) { this.raf = raf; this.length = length; }
void function(BaseFont font) { if (substitutionFonts == null) substitutionFonts = new ArrayList(); substitutionFonts.add(font); } private static final HashMap stdFieldFontNames = new HashMap(); private int totalRevisions; private Map fieldCache; static { stdFieldFontNames.put("CoBO", new String[]{STR}); stdFieldFontNames.put("CoBo", new String[]{STR}); stdFieldFontNames.put("CoOb", new String[]{STR}); stdFieldFontNames.put("Cour", new String[]{STR}); stdFieldFontNames.put("HeBO", new String[]{STR}); stdFieldFontNames.put("HeBo", new String[]{STR}); stdFieldFontNames.put("HeOb", new String[]{STR}); stdFieldFontNames.put("Helv", new String[]{STR}); stdFieldFontNames.put("Symb", new String[]{STR}); stdFieldFontNames.put("TiBI", new String[]{STR}); stdFieldFontNames.put("TiBo", new String[]{STR}); stdFieldFontNames.put("TiIt", new String[]{STR}); stdFieldFontNames.put("TiRo", new String[]{STR}); stdFieldFontNames.put("ZaDb", new String[]{STR}); stdFieldFontNames.put("HySm", new String[]{STR, STR}); stdFieldFontNames.put("HyGo", new String[]{STR, STR}); stdFieldFontNames.put("KaGo", new String[]{STR, STR}); stdFieldFontNames.put("KaMi", new String[]{STR, STR}); stdFieldFontNames.put("MHei", new String[]{STR, STR}); stdFieldFontNames.put("MSun", new String[]{STR, STR}); stdFieldFontNames.put("STSo", new String[]{STR, STR}); } private static class RevisionStream extends InputStream { private byte b[] = new byte[1]; private RandomAccessFileOrArray raf; private int length; private int rangePosition = 0; private boolean closed; private RevisionStream(RandomAccessFileOrArray raf, int length) { this.raf = raf; this.length = length; }
/** * Adds a substitution font to the list. The fonts in this list will be used if the original * font doesn't contain the needed glyphs. * * @param font the font */
Adds a substitution font to the list. The fonts in this list will be used if the original font doesn't contain the needed glyphs
addSubstitutionFont
{ "repo_name": "joshovi/fossology", "path": "src/nomos/agent_tests/testdata/NomosTestfiles/LGPL/AcroFields.java", "license": "gpl-2.0", "size": 103695 }
[ "java.io.InputStream", "java.util.ArrayList", "java.util.HashMap", "java.util.Map" ]
import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Map;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,209,532
public @NonNull QueueCoordinator getNewQueue(@NonNull World world) { QueueCoordinator queue = provider.getNewQueue(world); // Auto-inject into the queue PlotSquared.platform().injector().injectMembers(queue); return queue; }
@NonNull QueueCoordinator function(@NonNull World world) { QueueCoordinator queue = provider.getNewQueue(world); PlotSquared.platform().injector().injectMembers(queue); return queue; }
/** * Get a new {@link QueueCoordinator} for the given world. * * @param world world to get new queue for * @return new QueueCoordinator for world */
Get a new <code>QueueCoordinator</code> for the given world
getNewQueue
{ "repo_name": "IntellectualSites/PlotSquared", "path": "Core/src/main/java/com/plotsquared/core/queue/GlobalBlockQueue.java", "license": "gpl-3.0", "size": 2304 }
[ "com.plotsquared.core.PlotSquared", "com.sk89q.worldedit.world.World", "org.checkerframework.checker.nullness.qual.NonNull" ]
import com.plotsquared.core.PlotSquared; import com.sk89q.worldedit.world.World; import org.checkerframework.checker.nullness.qual.NonNull;
import com.plotsquared.core.*; import com.sk89q.worldedit.world.*; import org.checkerframework.checker.nullness.qual.*;
[ "com.plotsquared.core", "com.sk89q.worldedit", "org.checkerframework.checker" ]
com.plotsquared.core; com.sk89q.worldedit; org.checkerframework.checker;
456,432
public BookieSocketAddress getBookie(int index) throws Exception { if (bs.size() <= index || index < 0) { throw new IllegalArgumentException( "Invalid index, there are only " + bs.size() + " bookies. Asked for " + index); } return bs.get(index).getLocalAddress(); }
BookieSocketAddress function(int index) throws Exception { if (bs.size() <= index index < 0) { throw new IllegalArgumentException( STR + bs.size() + STR + index); } return bs.get(index).getLocalAddress(); }
/** * Get bookie address for bookie at index */
Get bookie address for bookie at index
getBookie
{ "repo_name": "massakam/pulsar", "path": "managed-ledger/src/test/java/org/apache/bookkeeper/test/BookKeeperClusterTestCase.java", "license": "apache-2.0", "size": 19088 }
[ "org.apache.bookkeeper.net.BookieSocketAddress" ]
import org.apache.bookkeeper.net.BookieSocketAddress;
import org.apache.bookkeeper.net.*;
[ "org.apache.bookkeeper" ]
org.apache.bookkeeper;
2,220,159
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { ref = LiveRef.read(in, false); }
void function(ObjectInput in) throws IOException, ClassNotFoundException { ref = LiveRef.read(in, false); }
/** * Read in external representation for remote ref. * @exception ClassNotFoundException If the class for an object * being restored cannot be found. */
Read in external representation for remote ref
readExternal
{ "repo_name": "ojdkbuild/lookaside_java-1.8.0-openjdk", "path": "jdk/src/share/classes/sun/rmi/server/UnicastRef.java", "license": "gpl-2.0", "size": 18435 }
[ "java.io.IOException", "java.io.ObjectInput" ]
import java.io.IOException; import java.io.ObjectInput;
import java.io.*;
[ "java.io" ]
java.io;
2,079,780
public boolean setCustomProgramPathConfiguration(@Nullable Path customPath, @Nonnull String configurationKey) { if (isBlank(configurationKey)) { throw new IllegalArgumentException("configurationKey can't be blank"); } if (configuration == null) { return false; } if (customPath == null) { if (configuration.containsKey(configurationKey)) { configuration.clearProperty(configurationKey); return true; } return false; } boolean changed; try { String currentValue = configuration.getString(configurationKey); changed = !customPath.toString().equals(currentValue); } catch (ConversionException e) { changed = true; } if (changed) { configuration.setProperty(configurationKey, customPath.toString()); } return changed; }
boolean function(@Nullable Path customPath, @Nonnull String configurationKey) { if (isBlank(configurationKey)) { throw new IllegalArgumentException(STR); } if (configuration == null) { return false; } if (customPath == null) { if (configuration.containsKey(configurationKey)) { configuration.clearProperty(configurationKey); return true; } return false; } boolean changed; try { String currentValue = configuration.getString(configurationKey); changed = !customPath.toString().equals(currentValue); } catch (ConversionException e) { changed = true; } if (changed) { configuration.setProperty(configurationKey, customPath.toString()); } return changed; }
/** * Sets a new {@link ProgramExecutableType#CUSTOM} {@link Path} in the * {@link Configuration} for the specified key. No change is done to any * {@link ExternalProgramInfo} instance. To set the {@link Path} both in the * {@link Configuration} and in the {@link ExternalProgramInfo} instance in * one operation, use {@link #setCustomProgramPath}. * * @param customPath the new {@link Path} or {@code null} to clear it. * @param configurationKey the {@link Configuration} key under which to * store the {@code path}. * @return {@code true} if a change was made, {@code false} otherwise. */
Sets a new <code>ProgramExecutableType#CUSTOM</code> <code>Path</code> in the <code>Configuration</code> for the specified key. No change is done to any <code>ExternalProgramInfo</code> instance. To set the <code>Path</code> both in the <code>Configuration</code> and in the <code>ExternalProgramInfo</code> instance in one operation, use <code>#setCustomProgramPath</code>
setCustomProgramPathConfiguration
{ "repo_name": "valib/UniversalMediaServer", "path": "src/main/java/net/pms/configuration/ConfigurableProgramPaths.java", "license": "gpl-2.0", "size": 14279 }
[ "java.nio.file.Path", "javax.annotation.Nonnull", "javax.annotation.Nullable", "org.apache.commons.configuration.ConversionException" ]
import java.nio.file.Path; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.configuration.ConversionException;
import java.nio.file.*; import javax.annotation.*; import org.apache.commons.configuration.*;
[ "java.nio", "javax.annotation", "org.apache.commons" ]
java.nio; javax.annotation; org.apache.commons;
2,308,417
public void setContents(String value) { dictionary.setString(COSName.CONTENTS, value); }
void function(String value) { dictionary.setString(COSName.CONTENTS, value); }
/** * Set the "contents" of the field. * * @param value the value of the contents. */
Set the "contents" of the field
setContents
{ "repo_name": "gavanx/pdflearn", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java", "license": "apache-2.0", "size": 19366 }
[ "org.apache.pdfbox.cos.COSName" ]
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
2,548,708
EAttribute getTax_Card_Jobs_activity_type();
EAttribute getTax_Card_Jobs_activity_type();
/** * Returns the meta object for the attribute '{@link TaxationWithRoot.Tax_Card#getJobs_activity_type <em>Jobs activity type</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Jobs activity type</em>'. * @see TaxationWithRoot.Tax_Card#getJobs_activity_type() * @see #getTax_Card() * @generated */
Returns the meta object for the attribute '<code>TaxationWithRoot.Tax_Card#getJobs_activity_type Jobs activity type</code>'.
getTax_Card_Jobs_activity_type
{ "repo_name": "viatra/VIATRA-Generator", "path": "Tests/MODELS2020-CaseStudies/case.study.pledge.model/src/TaxationWithRoot/TaxationPackage.java", "license": "epl-1.0", "size": 295635 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,233,110
public void doView_prev(RunData runData, Context context) { // access the portlet element id to find our state String peid = ((JetspeedRunData) runData).getJs_peid(); SessionState state = ((JetspeedRunData) runData).getPortletSessionState(peid); // set the flag to go to the prev item on the next view state.setAttribute(STATE_GO_PREV, ""); // set the page number int page = ((Integer) state.getAttribute(STATE_CURRENT_PAGE)).intValue(); state.setAttribute(STATE_CURRENT_PAGE, new Integer(page - 1)); } // doView_prev
void function(RunData runData, Context context) { String peid = ((JetspeedRunData) runData).getJs_peid(); SessionState state = ((JetspeedRunData) runData).getPortletSessionState(peid); state.setAttribute(STATE_GO_PREV, ""); int page = ((Integer) state.getAttribute(STATE_CURRENT_PAGE)).intValue(); state.setAttribute(STATE_CURRENT_PAGE, new Integer(page - 1)); }
/** * Handle a prev-item (view) request. */
Handle a prev-item (view) request
doView_prev
{ "repo_name": "ouit0408/sakai", "path": "velocity/tool/src/java/org/sakaiproject/cheftool/NewPagedResourceAction.java", "license": "apache-2.0", "size": 20814 }
[ "org.sakaiproject.event.api.SessionState" ]
import org.sakaiproject.event.api.SessionState;
import org.sakaiproject.event.api.*;
[ "org.sakaiproject.event" ]
org.sakaiproject.event;
1,010,811
protected List<String> initCertificateAIAKeys(List<String> aiaUrls) { List<String> keys = new ArrayList<>(); for (String url : aiaUrls) { keys.add(DSSUtils.getSHA1Digest(url)); } return keys; }
List<String> function(List<String> aiaUrls) { List<String> keys = new ArrayList<>(); for (String url : aiaUrls) { keys.add(DSSUtils.getSHA1Digest(url)); } return keys; }
/** * Initialize a list of AIA certificate token keys {@link String} from the given urls * * @param aiaUrls a list of {@link String} AIA urls * @return list of {@link String} AIA certificate keys */
Initialize a list of AIA certificate token keys <code>String</code> from the given urls
initCertificateAIAKeys
{ "repo_name": "esig/dss", "path": "dss-spi/src/main/java/eu/europa/esig/dss/spi/x509/aia/RepositoryAIASource.java", "license": "lgpl-2.1", "size": 7831 }
[ "eu.europa.esig.dss.spi.DSSUtils", "java.util.ArrayList", "java.util.List" ]
import eu.europa.esig.dss.spi.DSSUtils; import java.util.ArrayList; import java.util.List;
import eu.europa.esig.dss.spi.*; import java.util.*;
[ "eu.europa.esig", "java.util" ]
eu.europa.esig; java.util;
195,487
@Override public JSONObject toJsonObject() throws JSONException { JSONObject returnVal = super.toJsonObject(); //Date Created... if (this.getDateCreated() != null) { returnVal.put(JSONMapping.DATE_CREATED, this.getDateAsObjectFromJson(this.getDateCreated())); } //Rule Executed... if (this.getRuleExecuted() != null) { returnVal.put(JSONMapping.RULE_EXECUTED, this.getRuleExecuted()); } //Rule Executed Result... if (this.getRuleExecutedResult() != null) { returnVal.put(JSONMapping.RULE_EXECUTED_RESULT, this.getRuleExecutedResult()); } //Rule Order... if (this.getFlowRuleOrder() != null) { returnVal.put(JSONMapping.FLOW_RULE_ORDER, this.getFlowRuleOrder()); } //Log Entry Type... if (this.getLogEntryType() != null) { returnVal.put(JSONMapping.LOG_ENTRY_TYPE, this.getLogEntryType()); } //User... if (this.getUser() != null) { returnVal.put(JSONMapping.USER, this.getUser().toJsonObject()); } //Flow Step... if (this.getFlowStep() != null) { returnVal.put(JSONMapping.FLOW_STEP, this.getFlowStep().toJsonObject()); } //Form... if (this.getForm() != null) { returnVal.put(JSONMapping.FORM, this.getForm().toJsonObject()); } //Job View... if (this.getJobView() != null) { returnVal.put(JSONMapping.JOB_VIEW, this.getJobView()); } return returnVal; }
JSONObject function() throws JSONException { JSONObject returnVal = super.toJsonObject(); if (this.getDateCreated() != null) { returnVal.put(JSONMapping.DATE_CREATED, this.getDateAsObjectFromJson(this.getDateCreated())); } if (this.getRuleExecuted() != null) { returnVal.put(JSONMapping.RULE_EXECUTED, this.getRuleExecuted()); } if (this.getRuleExecutedResult() != null) { returnVal.put(JSONMapping.RULE_EXECUTED_RESULT, this.getRuleExecutedResult()); } if (this.getFlowRuleOrder() != null) { returnVal.put(JSONMapping.FLOW_RULE_ORDER, this.getFlowRuleOrder()); } if (this.getLogEntryType() != null) { returnVal.put(JSONMapping.LOG_ENTRY_TYPE, this.getLogEntryType()); } if (this.getUser() != null) { returnVal.put(JSONMapping.USER, this.getUser().toJsonObject()); } if (this.getFlowStep() != null) { returnVal.put(JSONMapping.FLOW_STEP, this.getFlowStep().toJsonObject()); } if (this.getForm() != null) { returnVal.put(JSONMapping.FORM, this.getForm().toJsonObject()); } if (this.getJobView() != null) { returnVal.put(JSONMapping.JOB_VIEW, this.getJobView()); } return returnVal; }
/** * Conversion to {@code JSONObject} from Java Object. * * @return {@code JSONObject} representation of {@code FormFlowHistoricData}. * @throws JSONException If there is a problem with the JSON Body. * * @see ABaseFluidJSONObject#toJsonObject() */
Conversion to JSONObject from Java Object
toJsonObject
{ "repo_name": "Koekiebox-PTY-LTD/Fluid", "path": "fluid-api/src/main/java/com/fluidbpm/program/api/vo/historic/FormFlowHistoricData.java", "license": "gpl-3.0", "size": 9071 }
[ "org.json.JSONException", "org.json.JSONObject" ]
import org.json.JSONException; import org.json.JSONObject;
import org.json.*;
[ "org.json" ]
org.json;
1,908,260
public static ByteBuffer ensureCapacity(ByteBuffer existingBuffer, int newLength) { if (newLength > existingBuffer.capacity()) { ByteBuffer newBuffer = ByteBuffer.allocate(newLength); existingBuffer.flip(); newBuffer.put(existingBuffer); return newBuffer; } return existingBuffer; }
static ByteBuffer function(ByteBuffer existingBuffer, int newLength) { if (newLength > existingBuffer.capacity()) { ByteBuffer newBuffer = ByteBuffer.allocate(newLength); existingBuffer.flip(); newBuffer.put(existingBuffer); return newBuffer; } return existingBuffer; }
/** * Check if the given ByteBuffer capacity * @param existingBuffer ByteBuffer capacity to check * @param newLength new length for the ByteBuffer. * returns ByteBuffer */
Check if the given ByteBuffer capacity
ensureCapacity
{ "repo_name": "robort/kafka", "path": "clients/src/main/java/org/apache/kafka/common/utils/Utils.java", "license": "apache-2.0", "size": 18596 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
584,463
@Test public void test306UnassignRoleEvilFromLechuck() throws Exception { final String TEST_NAME = "test306UnassignRoleEvilFromLechuck"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); // WHEN displayWhen(TEST_NAME); unassignRole(USER_LECHUCK_OID, ROLE_EVIL_OID, task, result); // THEN displayThen(TEST_NAME); result.computeStatus(); TestUtil.assertSuccess(result); Entry entry = assertLdapAccount(USER_LECHUCK_USERNAME, USER_LECHUCK_FULL_NAME); PrismObject<UserType> user = getUser(USER_LECHUCK_OID); String shadowOid = getSingleLinkOid(user); PrismObject<ShadowType> shadow = getShadowModel(shadowOid); display("Shadow (model)", shadow); assertLdapNoGroupMember(entry, GROUP_EVIL_CN); assertLdapGroupMember(entry, GROUP_UNDEAD_CN); Entry ldapEntryEvil = getLdapEntry(toGroupDn(GROUP_EVIL_CN)); display("Evil group", ldapEntryEvil); Entry ldapEntryUndead = getLdapEntry(toGroupDn(GROUP_UNDEAD_CN)); display("Undead group", ldapEntryUndead); assertLdapConnectorInstances(1, 2); }
void function() throws Exception { final String TEST_NAME = STR; displayTestTitle(TEST_NAME); Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); displayWhen(TEST_NAME); unassignRole(USER_LECHUCK_OID, ROLE_EVIL_OID, task, result); displayThen(TEST_NAME); result.computeStatus(); TestUtil.assertSuccess(result); Entry entry = assertLdapAccount(USER_LECHUCK_USERNAME, USER_LECHUCK_FULL_NAME); PrismObject<UserType> user = getUser(USER_LECHUCK_OID); String shadowOid = getSingleLinkOid(user); PrismObject<ShadowType> shadow = getShadowModel(shadowOid); display(STR, shadow); assertLdapNoGroupMember(entry, GROUP_EVIL_CN); assertLdapGroupMember(entry, GROUP_UNDEAD_CN); Entry ldapEntryEvil = getLdapEntry(toGroupDn(GROUP_EVIL_CN)); display(STR, ldapEntryEvil); Entry ldapEntryUndead = getLdapEntry(toGroupDn(GROUP_UNDEAD_CN)); display(STR, ldapEntryUndead); assertLdapConnectorInstances(1, 2); }
/** * MID-2853: Unexpected association behaviour - removing roles does not always remove from groups */
MID-2853: Unexpected association behaviour - removing roles does not always remove from groups
test306UnassignRoleEvilFromLechuck
{ "repo_name": "bshp/midPoint", "path": "testing/conntest/src/test/java/com/evolveum/midpoint/testing/conntest/AbstractLdapConnTest.java", "license": "apache-2.0", "size": 59346 }
[ "com.evolveum.midpoint.prism.PrismObject", "com.evolveum.midpoint.schema.result.OperationResult", "com.evolveum.midpoint.task.api.Task", "com.evolveum.midpoint.test.IntegrationTestTools", "com.evolveum.midpoint.test.util.TestUtil", "com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType", "com.evolveum.midpoint.xml.ns._public.common.common_3.UserType", "org.apache.directory.api.ldap.model.entry.Entry" ]
import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.test.IntegrationTestTools; import com.evolveum.midpoint.test.util.TestUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; import org.apache.directory.api.ldap.model.entry.Entry;
import com.evolveum.midpoint.prism.*; import com.evolveum.midpoint.schema.result.*; import com.evolveum.midpoint.task.api.*; import com.evolveum.midpoint.test.*; import com.evolveum.midpoint.test.util.*; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import org.apache.directory.api.ldap.model.entry.*;
[ "com.evolveum.midpoint", "org.apache.directory" ]
com.evolveum.midpoint; org.apache.directory;
253,312
public List<TestbedSetting> getSettings() { return Collections.unmodifiableList(settings); }
List<TestbedSetting> function() { return Collections.unmodifiableList(settings); }
/** * Returns an unmodifiable list of settings * @return */
Returns an unmodifiable list of settings
getSettings
{ "repo_name": "Latertater/jbox2d", "path": "jbox2d-testbed/src/main/java/org/jbox2d/testbed/framework/TestbedSettings.java", "license": "bsd-2-clause", "size": 5542 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,393,957
public List<GenPolynomial<C>> redTerms(List<GenPolynomial<C>> groebnerBasis) { if (groebnerBasis == null || groebnerBasis.size() == 0) { throw new IllegalArgumentException("groebnerBasis may not be null or empty"); } GenPolynomialRing<C> ring = groebnerBasis.get(0).ring; int numberOfVariables = ring.nvar; //Number of Variables of the given Polynomial Ring long[] degrees = new long[numberOfVariables]; //Array for the degree-limits for the reduced terms List<GenPolynomial<C>> terms = new ArrayList<GenPolynomial<C>>(); //Instantiate the return object for (GenPolynomial<C> g : groebnerBasis) { //For each polynomial of G if (g.isONE()) { terms.clear(); return terms; //If 1 e G, return empty list terms } ExpVector e = g.leadingExpVector(); //Take the exponent of the leading monomial if (e.totalDeg() == e.maxDeg()) { //and check, whether a variable x_i is isolated for (int i = 0; i < numberOfVariables; i++) { long exp = e.getVal(i); if (exp > 0) { degrees[i] = exp; //if true, add the degree of univariate x_i to array degrees } } } } long max = maxArray(degrees); //Find maximum in Array degrees for (int i = 0; i < degrees.length; i++) { //Set all zero grades to maximum of array "degrees" if (degrees[i] == 0) { logger.info("dimension not zero, setting degree to " + max); degrees[i] = max; //--> to "make" the ideal zero-dimensional } } terms.add(ring.ONE); //Add the one-polynomial of the ring to the list of reduced terms ReductionSeq<C> s = new ReductionSeq<C>(); //Create instance of ReductionSeq to use method isReducible //Main Algorithm for (int i = 0; i < numberOfVariables; i++) { GenPolynomial<C> x = ring.univariate(i); //Create Linear Polynomial X_i List<GenPolynomial<C>> S = new ArrayList<GenPolynomial<C>>(terms); //Copy all entries of return list "terms" into list "S" for (GenPolynomial<C> t : S) { for (int l = 1; l <= degrees[i]; l++) { t = t.multiply(x); //Multiply current element t with Linear Polynomial X_i if (!s.isReducible(groebnerBasis, t)) { //Check, if t is irreducible mod groebnerbase terms.add(t); //Add t to return list terms } } } } return terms; }
List<GenPolynomial<C>> function(List<GenPolynomial<C>> groebnerBasis) { if (groebnerBasis == null groebnerBasis.size() == 0) { throw new IllegalArgumentException(STR); } GenPolynomialRing<C> ring = groebnerBasis.get(0).ring; int numberOfVariables = ring.nvar; long[] degrees = new long[numberOfVariables]; List<GenPolynomial<C>> terms = new ArrayList<GenPolynomial<C>>(); for (GenPolynomial<C> g : groebnerBasis) { if (g.isONE()) { terms.clear(); return terms; } ExpVector e = g.leadingExpVector(); if (e.totalDeg() == e.maxDeg()) { for (int i = 0; i < numberOfVariables; i++) { long exp = e.getVal(i); if (exp > 0) { degrees[i] = exp; } } } } long max = maxArray(degrees); for (int i = 0; i < degrees.length; i++) { if (degrees[i] == 0) { logger.info(STR + max); degrees[i] = max; } } terms.add(ring.ONE); ReductionSeq<C> s = new ReductionSeq<C>(); for (int i = 0; i < numberOfVariables; i++) { GenPolynomial<C> x = ring.univariate(i); List<GenPolynomial<C>> S = new ArrayList<GenPolynomial<C>>(terms); for (GenPolynomial<C> t : S) { for (int l = 1; l <= degrees[i]; l++) { t = t.multiply(x); if (!s.isReducible(groebnerBasis, t)) { terms.add(t); } } } } return terms; }
/** * Compute the residues to given polynomial list. * @return List of reduced terms */
Compute the residues to given polynomial list
redTerms
{ "repo_name": "breandan/java-algebra-system", "path": "src/edu/jas/gbufd/GroebnerBaseFGLM.java", "license": "gpl-2.0", "size": 15685 }
[ "edu.jas.gb.ReductionSeq", "edu.jas.poly.ExpVector", "edu.jas.poly.GenPolynomial", "edu.jas.poly.GenPolynomialRing", "java.util.ArrayList", "java.util.List" ]
import edu.jas.gb.ReductionSeq; import edu.jas.poly.ExpVector; import edu.jas.poly.GenPolynomial; import edu.jas.poly.GenPolynomialRing; import java.util.ArrayList; import java.util.List;
import edu.jas.gb.*; import edu.jas.poly.*; import java.util.*;
[ "edu.jas.gb", "edu.jas.poly", "java.util" ]
edu.jas.gb; edu.jas.poly; java.util;
484,805
@Test(expected = IOException.class) public void testGitAddIOExceptionThrown() throws IOException, JavaGitException { try { CliGitAdd gitAdd = new CliGitAdd(); GitAddOptions options = null; List<File> fileNames = new ArrayList<File>(); fileNames.add(new File("testFile")); gitAdd.add(new File("repo/path/should/not/exist"), options, fileNames); } catch (IOException e) { return; } fail("IOException not thrown"); }
@Test(expected = IOException.class) void function() throws IOException, JavaGitException { try { CliGitAdd gitAdd = new CliGitAdd(); GitAddOptions options = null; List<File> fileNames = new ArrayList<File>(); fileNames.add(new File(STR)); gitAdd.add(new File(STR), options, fileNames); } catch (IOException e) { return; } fail(STR); }
/** * Test for testing IOException when the given repository path does not exist. This is different * <code>testGitAddNullRepositoryPath</code> where the repositoryPath is null. * * @throws IOException * * thrown if file paths or repository path provided is found or git command is not found. */
Test for testing IOException when the given repository path does not exist. This is different <code>testGitAddNullRepositoryPath</code> where the repositoryPath is null
testGitAddIOExceptionThrown
{ "repo_name": "alafighting/javagit", "path": "javagit/src/test/java/edu/nyu/cs/javagit/client/cli/TestCliGitAdd.java", "license": "lgpl-2.1", "size": 4475 }
[ "edu.nyu.cs.javagit.api.JavaGitException", "edu.nyu.cs.javagit.api.commands.GitAddOptions", "edu.nyu.cs.javagit.client.cli.CliGitAdd", "java.io.File", "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.junit.Test" ]
import edu.nyu.cs.javagit.api.JavaGitException; import edu.nyu.cs.javagit.api.commands.GitAddOptions; import edu.nyu.cs.javagit.client.cli.CliGitAdd; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.junit.Test;
import edu.nyu.cs.javagit.api.*; import edu.nyu.cs.javagit.api.commands.*; import edu.nyu.cs.javagit.client.cli.*; import java.io.*; import java.util.*; import org.junit.*;
[ "edu.nyu.cs", "java.io", "java.util", "org.junit" ]
edu.nyu.cs; java.io; java.util; org.junit;
275,673
JavaObjectSerializer getJavaObjectSerializer();
JavaObjectSerializer getJavaObjectSerializer();
/** * Return the serializer to be used for java objects being stored in * column of type OTHER. * * @return the serializer to be used for java objects being stored in * column of type OTHER */
Return the serializer to be used for java objects being stored in column of type OTHER
getJavaObjectSerializer
{ "repo_name": "vdr007/ThriftyPaxos", "path": "src/applications/h2/src/main/org/h2/store/DataHandler.java", "license": "apache-2.0", "size": 3064 }
[ "org.h2.api.JavaObjectSerializer" ]
import org.h2.api.JavaObjectSerializer;
import org.h2.api.*;
[ "org.h2.api" ]
org.h2.api;
2,637,435
public XMLString trim() { return new XString(str().trim()); }
XMLString function() { return new XString(str().trim()); }
/** * Removes white space from both ends of this string. * * @return this string, with white space removed from the front and end. */
Removes white space from both ends of this string
trim
{ "repo_name": "shun634501730/java_source_cn", "path": "src_en/com/sun/org/apache/xpath/internal/objects/XString.java", "license": "apache-2.0", "size": 37914 }
[ "com.sun.org.apache.xml.internal.utils.XMLString" ]
import com.sun.org.apache.xml.internal.utils.XMLString;
import com.sun.org.apache.xml.internal.utils.*;
[ "com.sun.org" ]
com.sun.org;
794,780
ServiceCall<Void> putNullAsync(String stringBody, final ServiceCallback<Void> serviceCallback);
ServiceCall<Void> putNullAsync(String stringBody, final ServiceCallback<Void> serviceCallback);
/** * Set string value null. * * @param stringBody Possible values include: '' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */
Set string value null
putNullAsync
{ "repo_name": "haocs/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodystring/Strings.java", "license": "mit", "size": 16817 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,835,721
public static String getMainValuePrefix(org.apache.solr.schema.FieldType ft) { if (ft instanceof TrieDateField) ft = ((TrieDateField) ft).wrappedField; if (ft instanceof TrieField) { final TrieField trie = (TrieField)ft; if (trie.precisionStep == Integer.MAX_VALUE) return null; switch (trie.type) { case INTEGER: case FLOAT: return INT_PREFIX; case LONG: case DOUBLE: case DATE: return LONG_PREFIX; default: throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Unknown type for trie field: " + trie.type); } } return null; }
static String function(org.apache.solr.schema.FieldType ft) { if (ft instanceof TrieDateField) ft = ((TrieDateField) ft).wrappedField; if (ft instanceof TrieField) { final TrieField trie = (TrieField)ft; if (trie.precisionStep == Integer.MAX_VALUE) return null; switch (trie.type) { case INTEGER: case FLOAT: return INT_PREFIX; case LONG: case DOUBLE: case DATE: return LONG_PREFIX; default: throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, STR + trie.type); } } return null; }
/** expert internal use, subject to change. * Returns null if no prefix or prefix not needed, or the prefix of the main value of a trie field * that indexes multiple precisions per value. */
expert internal use, subject to change. Returns null if no prefix or prefix not needed, or the prefix of the main value of a trie field that indexes multiple precisions per value
getMainValuePrefix
{ "repo_name": "williamchengit/TestRepo", "path": "solr/core/src/java/org/apache/solr/schema/TrieField.java", "license": "apache-2.0", "size": 27148 }
[ "org.apache.lucene.document.FieldType", "org.apache.solr.common.SolrException" ]
import org.apache.lucene.document.FieldType; import org.apache.solr.common.SolrException;
import org.apache.lucene.document.*; import org.apache.solr.common.*;
[ "org.apache.lucene", "org.apache.solr" ]
org.apache.lucene; org.apache.solr;
15,157
public final List<Call> getCalls() { return mPhone == null ? Collections.<Call>emptyList() : mPhone.getCalls(); }
final List<Call> function() { return mPhone == null ? Collections.<Call>emptyList() : mPhone.getCalls(); }
/** * Obtains the current list of {@code Call}s to be displayed by this in-call service. * * @return A list of the relevant {@code Call}s. */
Obtains the current list of Calls to be displayed by this in-call service
getCalls
{ "repo_name": "OmniEvo/android_frameworks_base", "path": "telecomm/java/android/telecom/InCallService.java", "license": "gpl-3.0", "size": 27414 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
414,068
@Nullable public static String getGeocodeByUrl(@NonNull final OCApiConnector connector, @NonNull final String url) { final Parameters params = new Parameters("urls", url); final ObjectNode data = request(connector, OkapiService.SERVICE_RESOLVE_URL, params).data; if (data == null) { return null; } return data.path("results").path(0).asText(null); }
static String function(@NonNull final OCApiConnector connector, @NonNull final String url) { final Parameters params = new Parameters("urls", url); final ObjectNode data = request(connector, OkapiService.SERVICE_RESOLVE_URL, params).data; if (data == null) { return null; } return data.path(STR).path(0).asText(null); }
/** * extract the geocode from an URL, by using a backward mapping on the server */
extract the geocode from an URL, by using a backward mapping on the server
getGeocodeByUrl
{ "repo_name": "mucek4/cgeo", "path": "main/src/cgeo/geocaching/connector/oc/OkapiClient.java", "license": "apache-2.0", "size": 43871 }
[ "android.support.annotation.NonNull", "com.fasterxml.jackson.databind.node.ObjectNode" ]
import android.support.annotation.NonNull; import com.fasterxml.jackson.databind.node.ObjectNode;
import android.support.annotation.*; import com.fasterxml.jackson.databind.node.*;
[ "android.support", "com.fasterxml.jackson" ]
android.support; com.fasterxml.jackson;
1,347,156
public void addPermissionFactory(final PermissionFactory permissionFactory) { permissionFactories.add(permissionFactory); }
void function(final PermissionFactory permissionFactory) { permissionFactories.add(permissionFactory); }
/** * Add a permission factory to this deployment. This may include permissions not explicitly specified * in the domain configuration; such permissions must be validated before being added. * * @param permissionFactory the permission factory to add */
Add a permission factory to this deployment. This may include permissions not explicitly specified in the domain configuration; such permissions must be validated before being added
addPermissionFactory
{ "repo_name": "JiriOndrusek/wildfly-core", "path": "server/src/main/java/org/jboss/as/server/deployment/module/ModuleSpecification.java", "license": "lgpl-2.1", "size": 13224 }
[ "org.jboss.modules.security.PermissionFactory" ]
import org.jboss.modules.security.PermissionFactory;
import org.jboss.modules.security.*;
[ "org.jboss.modules" ]
org.jboss.modules;
2,480,497
public void displayChanged(GLAutoDrawable canvas, boolean modeChanged, boolean deviceChanged){ throw new RuntimeException("Renderer: displayChanged not implemented."); }
void function(GLAutoDrawable canvas, boolean modeChanged, boolean deviceChanged){ throw new RuntimeException(STR); }
/** Called when the device or display mode change. * Currently throw a RuntimeException: "Renderer: displayChanged not implemented.". */
Called when the device or display mode change. Currently throw a RuntimeException: "Renderer: displayChanged not implemented."
displayChanged
{ "repo_name": "jzy3d/jzy3d-api-0.8.4", "path": "src/api/org/jzy3d/plot3d/rendering/view/Renderer3d.java", "license": "bsd-3-clause", "size": 4079 }
[ "javax.media.opengl.GLAutoDrawable" ]
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.*;
[ "javax.media" ]
javax.media;
2,213,248
@NotNull List<IdentifierInfo> getInfo();
List<IdentifierInfo> getInfo();
/** * Gets information. * * @return information */
Gets information
getInfo
{ "repo_name": "east301/gprdb-experimental", "path": "gprdb-api/src/main/java/jp/ac/tohoku/ecei/sb/gprdb/dataset/id/Identifier.java", "license": "apache-2.0", "size": 2768 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
984,382
public void setImagen(Image imaImagen) { this.imaImagen = imaImagen; this.imiImagen = new ImageIcon(imaImagen); this.iAncho = this.imiImagen.getIconWidth(); this.iAlto = this.imiImagen.getIconHeight(); }
void function(Image imaImagen) { this.imaImagen = imaImagen; this.imiImagen = new ImageIcon(imaImagen); this.iAncho = this.imiImagen.getIconWidth(); this.iAlto = this.imiImagen.getIconHeight(); }
/** * setImagen * * Metodo modificador usado para cambiar el icono de imagen del objeto * tomandolo de un objeto imagen * * @param imaImagen es la <code>imagen</code> del objeto. * */
setImagen Metodo modificador usado para cambiar el icono de imagen del objeto tomandolo de un objeto imagen
setImagen
{ "repo_name": "humberto-garza/VideoJuegos", "path": "Proyecto_Final/Flood/src/Flood/Base.java", "license": "bsd-3-clause", "size": 5880 }
[ "java.awt.Image", "javax.swing.ImageIcon" ]
import java.awt.Image; import javax.swing.ImageIcon;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
769,412
public static void stop() { synchronized (WorkerEngine.class) { try { if (latest_sub != null) { // [electrum] this replaces the currently WorkerTask so that it exits gracefully try { ObjectOutputStream main2sub = new ObjectOutputStream(wrap(latest_sub.getOutputStream())); main2sub.writeObject(new WorkerTask() { private static final long serialVersionUID = 1L;
static void function() { synchronized (WorkerEngine.class) { try { if (latest_sub != null) { try { ObjectOutputStream main2sub = new ObjectOutputStream(wrap(latest_sub.getOutputStream())); main2sub.writeObject(new WorkerTask() { private static final long serialVersionUID = 1L;
/** * This terminates the subprocess, and prevent any further results from reaching * the parent's callback handler. */
This terminates the subprocess, and prevent any further results from reaching the parent's callback handler
stop
{ "repo_name": "AlloyTools/org.alloytools.alloy", "path": "org.alloytools.alloy.core/src/main/java/edu/mit/csail/sdg/alloy4/WorkerEngine.java", "license": "apache-2.0", "size": 22052 }
[ "java.io.ObjectOutputStream" ]
import java.io.ObjectOutputStream;
import java.io.*;
[ "java.io" ]
java.io;
311,745
private JPanel buildPlayersField() { JPanel column = new JPanel(new BorderLayout()); column.setBorder(new EmptyBorder(0, 5, 0, 5)); playerCountField = new JLabel(world.getPlayers() + ""); playerCountField.setFont(FontManager.getRunescapeSmallFont()); column.add(playerCountField, BorderLayout.WEST); return column; }
JPanel function() { JPanel column = new JPanel(new BorderLayout()); column.setBorder(new EmptyBorder(0, 5, 0, 5)); playerCountField = new JLabel(world.getPlayers() + ""); playerCountField.setFont(FontManager.getRunescapeSmallFont()); column.add(playerCountField, BorderLayout.WEST); return column; }
/** * Builds the players list field (containing the amount of players logged in that world). */
Builds the players list field (containing the amount of players logged in that world)
buildPlayersField
{ "repo_name": "abelbriggs1/runelite", "path": "runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldTableRow.java", "license": "bsd-2-clause", "size": 10092 }
[ "java.awt.BorderLayout", "javax.swing.JLabel", "javax.swing.JPanel", "javax.swing.border.EmptyBorder", "net.runelite.client.ui.FontManager" ]
import java.awt.BorderLayout; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import net.runelite.client.ui.FontManager;
import java.awt.*; import javax.swing.*; import javax.swing.border.*; import net.runelite.client.ui.*;
[ "java.awt", "javax.swing", "net.runelite.client" ]
java.awt; javax.swing; net.runelite.client;
975,348
public Rectangle2D getBounds2D() { return new Rectangle2D.Float(bounds.x, bounds.y, bounds.width, bounds.height); }
Rectangle2D function() { return new Rectangle2D.Float(bounds.x, bounds.y, bounds.width, bounds.height); }
/** * Returns the bounds of the glyph. This is the bounding box of the glyph outline. * Because of rasterization and pixel alignment effects, it does not necessarily * enclose the pixels that are affected when rendering the glyph. * @return a {@link Rectangle2D} that is the bounds of the glyph. */
Returns the bounds of the glyph. This is the bounding box of the glyph outline. Because of rasterization and pixel alignment effects, it does not necessarily enclose the pixels that are affected when rendering the glyph
getBounds2D
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk2/jdk/src/share/classes/java/awt/font/GlyphMetrics.java", "license": "mit", "size": 11783 }
[ "java.awt.geom.Rectangle2D" ]
import java.awt.geom.Rectangle2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,419,079
public boolean matches(String regex) { return Pattern.matches(regex, this); } /** * Replaces the first substring match of the regular expression with a * given replacement. This is shorthand for <code>{@link Pattern}
boolean function(String regex) { return Pattern.matches(regex, this); } /** * Replaces the first substring match of the regular expression with a * given replacement. This is shorthand for <code>{@link Pattern}
/** * Test if this String matches a regular expression. This is shorthand for * <code>{@link Pattern}.matches(regex, this)</code>. * * @param regex the pattern to match * @return true if the pattern matches * @throws NullPointerException if regex is null * @throws PatternSyntaxException if regex is invalid * @see Pattern#matches(String, CharSequence) * @since 1.4 */
Test if this String matches a regular expression. This is shorthand for <code><code>Pattern</code>.matches(regex, this)</code>
matches
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/java/lang/String.java", "license": "bsd-3-clause", "size": 49233 }
[ "java.util.regex.Pattern" ]
import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,681,143
@Test public void checkConstruction() { // Create a MOOSEModel to test MOOSEModel model = new MOOSEModel(projectSpace); // Check the form Form form = model.getForm(); assertNotNull(form); assertEquals(3, form.getComponents().size()); // Check the data component assertTrue(form.getComponent(MOOSEModel.fileDataComponentId) instanceof DataComponent); // Check the MOOSE app entry Entry mooseAppEntry = ((DataComponent) form .getComponent(MOOSEModel.fileDataComponentId)) .retrieveEntry("MOOSE-Based Application"); assertNotNull(mooseAppEntry); assertEquals(1, mooseAppEntry.getId()); assertEquals("Import Application", mooseAppEntry.getDefaultValue()); assertEquals(mooseAppEntry.getDefaultValue(), mooseAppEntry.getValue()); // Check the output file Entry Entry outputFileEntry = ((DataComponent) form .getComponent(MOOSEModel.fileDataComponentId)) .retrieveEntry("Output File Name"); assertNotNull(outputFileEntry); assertEquals(2, outputFileEntry.getId()); assertEquals("mooseModel.i", outputFileEntry.getValue()); // Check the TreeComposite assertTrue(form.getComponent(MOOSEModel.mooseTreeCompositeId) instanceof TreeComposite); // Check the ResourceComponent assertTrue(form.getComponent(MOOSEModel.resourceComponentId) instanceof ResourceComponent); return; }
void function() { MOOSEModel model = new MOOSEModel(projectSpace); Form form = model.getForm(); assertNotNull(form); assertEquals(3, form.getComponents().size()); assertTrue(form.getComponent(MOOSEModel.fileDataComponentId) instanceof DataComponent); Entry mooseAppEntry = ((DataComponent) form .getComponent(MOOSEModel.fileDataComponentId)) .retrieveEntry(STR); assertNotNull(mooseAppEntry); assertEquals(1, mooseAppEntry.getId()); assertEquals(STR, mooseAppEntry.getDefaultValue()); assertEquals(mooseAppEntry.getDefaultValue(), mooseAppEntry.getValue()); Entry outputFileEntry = ((DataComponent) form .getComponent(MOOSEModel.fileDataComponentId)) .retrieveEntry(STR); assertNotNull(outputFileEntry); assertEquals(2, outputFileEntry.getId()); assertEquals(STR, outputFileEntry.getValue()); assertTrue(form.getComponent(MOOSEModel.mooseTreeCompositeId) instanceof TreeComposite); assertTrue(form.getComponent(MOOSEModel.resourceComponentId) instanceof ResourceComponent); return; }
/** * This operation checks the MOOSEModel and makes sure that it can properly * construct its Form. */
This operation checks the MOOSEModel and makes sure that it can properly construct its Form
checkConstruction
{ "repo_name": "SmithRWORNL/ice", "path": "tests/org.eclipse.ice.item.test/src/org/eclipse/ice/item/test/nuclear/MOOSEModelTester.java", "license": "epl-1.0", "size": 17565 }
[ "org.eclipse.ice.datastructures.form.DataComponent", "org.eclipse.ice.datastructures.form.Entry", "org.eclipse.ice.datastructures.form.Form", "org.eclipse.ice.datastructures.form.ResourceComponent", "org.eclipse.ice.datastructures.form.TreeComposite", "org.eclipse.ice.item.nuclear.MOOSEModel", "org.junit.Assert" ]
import org.eclipse.ice.datastructures.form.DataComponent; import org.eclipse.ice.datastructures.form.Entry; import org.eclipse.ice.datastructures.form.Form; import org.eclipse.ice.datastructures.form.ResourceComponent; import org.eclipse.ice.datastructures.form.TreeComposite; import org.eclipse.ice.item.nuclear.MOOSEModel; import org.junit.Assert;
import org.eclipse.ice.datastructures.form.*; import org.eclipse.ice.item.nuclear.*; import org.junit.*;
[ "org.eclipse.ice", "org.junit" ]
org.eclipse.ice; org.junit;
1,623,999
public static void writeMatrix(MatrixWithHeaders matrix, String outFile) throws IOException { logger.info(""); logger.info("Writing table to file " + outFile + "..."); matrix.write(outFile); logger.info("Done writing table."); }
static void function(MatrixWithHeaders matrix, String outFile) throws IOException { logger.info(STRWriting table to file STR...STRDone writing table."); }
/** * Write table of ratios to file for one or all chromosomes * @param matrix Matrix * @param outFile Output file * @throws IOException */
Write table of ratios to file for one or all chromosomes
writeMatrix
{ "repo_name": "mgarber/scriptureV2", "path": "src/java/nextgen/core/normalize/ComparativeCountsMatrix.java", "license": "lgpl-3.0", "size": 11615 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,593,997
protected JavaExportsProvider collectTransitiveExports() { NestedSetBuilder<Label> builder = NestedSetBuilder.stableOrder(); List<TransitiveInfoCollection> currentRuleExports = getExports(ruleContext); builder.addAll(Iterables.transform(currentRuleExports, TransitiveInfoCollection::getLabel)); for (TransitiveInfoCollection dep : currentRuleExports) { JavaExportsProvider exportsProvider = JavaInfo.getProvider(JavaExportsProvider.class, dep); if (exportsProvider != null) { builder.addTransitive(exportsProvider.getTransitiveExports()); } } return new JavaExportsProvider(builder.build()); }
JavaExportsProvider function() { NestedSetBuilder<Label> builder = NestedSetBuilder.stableOrder(); List<TransitiveInfoCollection> currentRuleExports = getExports(ruleContext); builder.addAll(Iterables.transform(currentRuleExports, TransitiveInfoCollection::getLabel)); for (TransitiveInfoCollection dep : currentRuleExports) { JavaExportsProvider exportsProvider = JavaInfo.getProvider(JavaExportsProvider.class, dep); if (exportsProvider != null) { builder.addTransitive(exportsProvider.getTransitiveExports()); } } return new JavaExportsProvider(builder.build()); }
/** * Collects labels of targets and artifacts reached transitively via the "exports" attribute. */
Collects labels of targets and artifacts reached transitively via the "exports" attribute
collectTransitiveExports
{ "repo_name": "dropbox/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java", "license": "apache-2.0", "size": 38270 }
[ "com.google.common.collect.Iterables", "com.google.devtools.build.lib.analysis.TransitiveInfoCollection", "com.google.devtools.build.lib.cmdline.Label", "com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder", "java.util.List" ]
import com.google.common.collect.Iterables; import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import java.util.List;
import com.google.common.collect.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.cmdline.*; import com.google.devtools.build.lib.collect.nestedset.*; import java.util.*;
[ "com.google.common", "com.google.devtools", "java.util" ]
com.google.common; com.google.devtools; java.util;
943,366
public MimeBodyPart generate( MimeBodyPart content, OutputEncryptor encryptor) throws SMIMEException { return make(makeContentBodyPart(content), encryptor); }
MimeBodyPart function( MimeBodyPart content, OutputEncryptor encryptor) throws SMIMEException { return make(makeContentBodyPart(content), encryptor); }
/** * generate an enveloped object that contains an SMIME Enveloped * object using the given content encryptor */
generate an enveloped object that contains an SMIME Enveloped object using the given content encryptor
generate
{ "repo_name": "iseki-masaya/spongycastle", "path": "mail/src/main/java/org/spongycastle/mail/smime/SMIMEEnvelopedGenerator.java", "license": "mit", "size": 9393 }
[ "javax.mail.internet.MimeBodyPart", "org.bouncycastle.operator.OutputEncryptor" ]
import javax.mail.internet.MimeBodyPart; import org.bouncycastle.operator.OutputEncryptor;
import javax.mail.internet.*; import org.bouncycastle.operator.*;
[ "javax.mail", "org.bouncycastle.operator" ]
javax.mail; org.bouncycastle.operator;
2,470,236
public static void assertInterchangedArraysEquals(double[] expecteds, double[] actuals) { assertEquals("different number of elements in arrays", expecteds.length, actuals.length); ArrayList<Integer> foundIndexes = new ArrayList<Integer>(); expactation: for (int i = 0; i < expecteds.length; i++) { for (int j = 0; j < actuals.length; j++) { if (expecteds[i] == actuals[j] && !foundIndexes.contains(Integer.valueOf(j))) { foundIndexes.add(Integer.valueOf(j)); continue expactation; } } fail("Missing element " + expecteds[i]); } }
static void function(double[] expecteds, double[] actuals) { assertEquals(STR, expecteds.length, actuals.length); ArrayList<Integer> foundIndexes = new ArrayList<Integer>(); expactation: for (int i = 0; i < expecteds.length; i++) { for (int j = 0; j < actuals.length; j++) { if (expecteds[i] == actuals[j] && !foundIndexes.contains(Integer.valueOf(j))) { foundIndexes.add(Integer.valueOf(j)); continue expactation; } } fail(STR + expecteds[i]); } }
/** * <p> * Compares to arrays for equality. The elements in the array can be in * different order. * </p> * * @param expecteds * expected values * @param actuals * actual values */
Compares to arrays for equality. The elements in the array can be in different order.
assertInterchangedArraysEquals
{ "repo_name": "Myasuka/systemml", "path": "src/test/java/org/apache/sysml/test/utils/TestUtils.java", "license": "apache-2.0", "size": 65313 }
[ "java.util.ArrayList", "org.junit.Assert" ]
import java.util.ArrayList; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,473,456
public static Object[] readObjectArray(DataInput in) throws IOException, ClassNotFoundException { InternalDataSerializer.checkIn(in); int length = InternalDataSerializer.readArrayLength(in); if (length == -1) { return null; } else { Class<?> c = null; byte typeCode = in.readByte(); String typeString = null; if (typeCode == DSCODE.CLASS) { typeString = readString(in); } GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); boolean lookForPdxInstance = false; ClassNotFoundException cnfEx = null; if (typeCode == DSCODE.CLASS && cache != null && cache.getPdxReadSerializedByAnyGemFireServices()) { try { c = InternalDataSerializer.getCachedClass(typeString); lookForPdxInstance = true; } catch (ClassNotFoundException ignore) { c = Object.class; cnfEx = ignore; } } else { if (typeCode == DSCODE.CLASS) { c = InternalDataSerializer.getCachedClass(typeString); } else { c = InternalDataSerializer.decodePrimitiveClass(typeCode); } } Object o = null; if (length > 0) { o = readObject(in); if (lookForPdxInstance && o instanceof PdxInstance) { lookForPdxInstance = false; c = Object.class; } } Object[] array = (Object[]) Array.newInstance(c, length); if (length > 0) { array[0] = o; } for (int i = 1; i < length; i++) { o = readObject(in); if (lookForPdxInstance && o instanceof PdxInstance) { // create an Object[] and copy all the entries we already did into it lookForPdxInstance = false; c = Object.class; Object[] newArray = (Object[])Array.newInstance(c, length); System.arraycopy(array, 0, newArray, 0, i); array = newArray; } array[i] = o; } if (lookForPdxInstance && cnfEx != null && length > 0) { // We have a non-empty array and didn't find any // PdxInstances in it. So we should have been able // to load the element type. // Note that empty arrays in this case will deserialize // as an Object[] since we can't tell if the element // type is a pdx one. throw cnfEx; } if (logger.isTraceEnabled(LogMarker.SERIALIZER)) { logger.trace(LogMarker.SERIALIZER, "Read Object array of length {}", length); } return array; } }
static Object[] function(DataInput in) throws IOException, ClassNotFoundException { InternalDataSerializer.checkIn(in); int length = InternalDataSerializer.readArrayLength(in); if (length == -1) { return null; } else { Class<?> c = null; byte typeCode = in.readByte(); String typeString = null; if (typeCode == DSCODE.CLASS) { typeString = readString(in); } GemFireCacheImpl cache = GemFireCacheImpl.getInstance(); boolean lookForPdxInstance = false; ClassNotFoundException cnfEx = null; if (typeCode == DSCODE.CLASS && cache != null && cache.getPdxReadSerializedByAnyGemFireServices()) { try { c = InternalDataSerializer.getCachedClass(typeString); lookForPdxInstance = true; } catch (ClassNotFoundException ignore) { c = Object.class; cnfEx = ignore; } } else { if (typeCode == DSCODE.CLASS) { c = InternalDataSerializer.getCachedClass(typeString); } else { c = InternalDataSerializer.decodePrimitiveClass(typeCode); } } Object o = null; if (length > 0) { o = readObject(in); if (lookForPdxInstance && o instanceof PdxInstance) { lookForPdxInstance = false; c = Object.class; } } Object[] array = (Object[]) Array.newInstance(c, length); if (length > 0) { array[0] = o; } for (int i = 1; i < length; i++) { o = readObject(in); if (lookForPdxInstance && o instanceof PdxInstance) { lookForPdxInstance = false; c = Object.class; Object[] newArray = (Object[])Array.newInstance(c, length); System.arraycopy(array, 0, newArray, 0, i); array = newArray; } array[i] = o; } if (lookForPdxInstance && cnfEx != null && length > 0) { throw cnfEx; } if (logger.isTraceEnabled(LogMarker.SERIALIZER)) { logger.trace(LogMarker.SERIALIZER, STR, length); } return array; } }
/** * Reads an array of <code>Object</code>s from a * <code>DataInput</code>. * * @throws IOException * A problem occurs while reading from <code>in</code> * * @see #writeObjectArray * @see #readObject */
Reads an array of <code>Object</code>s from a <code>DataInput</code>
readObjectArray
{ "repo_name": "sshcherbakov/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/DataSerializer.java", "license": "apache-2.0", "size": 109153 }
[ "com.gemstone.gemfire.internal.InternalDataSerializer", "com.gemstone.gemfire.internal.cache.GemFireCacheImpl", "com.gemstone.gemfire.internal.logging.log4j.LogMarker", "com.gemstone.gemfire.pdx.PdxInstance", "java.io.DataInput", "java.io.IOException", "java.lang.reflect.Array" ]
import com.gemstone.gemfire.internal.InternalDataSerializer; import com.gemstone.gemfire.internal.cache.GemFireCacheImpl; import com.gemstone.gemfire.internal.logging.log4j.LogMarker; import com.gemstone.gemfire.pdx.PdxInstance; import java.io.DataInput; import java.io.IOException; import java.lang.reflect.Array;
import com.gemstone.gemfire.internal.*; import com.gemstone.gemfire.internal.cache.*; import com.gemstone.gemfire.internal.logging.log4j.*; import com.gemstone.gemfire.pdx.*; import java.io.*; import java.lang.reflect.*;
[ "com.gemstone.gemfire", "java.io", "java.lang" ]
com.gemstone.gemfire; java.io; java.lang;
2,384,476
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) { this.launchWitherSkullToEntity(0, target); }
void function(EntityLivingBase target, float distanceFactor) { this.launchWitherSkullToEntity(0, target); }
/** * Attack the specified entity using a ranged attack. */
Attack the specified entity using a ranged attack
attackEntityWithRangedAttack
{ "repo_name": "dafuq360/essenceplusnew", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/boss/EntityWither.java", "license": "lgpl-2.1", "size": 27147 }
[ "net.minecraft.entity.EntityLivingBase" ]
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
74,369
@Test public void testECOWithFormB35() { LocalTime eventStartTime = new LocalTime(16, 30, 0); LocalTime eventStopTime = new LocalTime(17, 50, 0); LocalTime formStartTime = new LocalTime(16, 35, 0); LocalTime formStopTime = new LocalTime(17, 45, 0); LocalTime absenceTime = new LocalTime(17, 53, 0); absenceWithClassConflictFormHelper(eventStartTime, eventStopTime, formStartTime, formStopTime, absenceTime, Absence.Type.EarlyCheckOut, Absence.Status.Pending); }
void function() { LocalTime eventStartTime = new LocalTime(16, 30, 0); LocalTime eventStopTime = new LocalTime(17, 50, 0); LocalTime formStartTime = new LocalTime(16, 35, 0); LocalTime formStopTime = new LocalTime(17, 45, 0); LocalTime absenceTime = new LocalTime(17, 53, 0); absenceWithClassConflictFormHelper(eventStartTime, eventStopTime, formStartTime, formStopTime, absenceTime, Absence.Type.EarlyCheckOut, Absence.Status.Pending); }
/** * class times within event but buffer eclipses, tardy time in buffer after * event */
class times within event but buffer eclipses, tardy time in buffer after event
testECOWithFormB35
{ "repo_name": "curtisullerich/attendance", "path": "src/test/java/edu/iastate/music/marching/attendance/test/model/interact/FormClassConflictSimpleTest.java", "license": "mit", "size": 48344 }
[ "edu.iastate.music.marching.attendance.model.store.Absence", "org.joda.time.LocalTime" ]
import edu.iastate.music.marching.attendance.model.store.Absence; import org.joda.time.LocalTime;
import edu.iastate.music.marching.attendance.model.store.*; import org.joda.time.*;
[ "edu.iastate.music", "org.joda.time" ]
edu.iastate.music; org.joda.time;
2,368,359
public DateTime lastReplayTime() { return this.lastReplayTime; }
DateTime function() { return this.lastReplayTime; }
/** * Get the timestamp of the last oplog event replayed, or null if no oplog event has been replayed yet. * * @return the lastReplayTime value */
Get the timestamp of the last oplog event replayed, or null if no oplog event has been replayed yet
lastReplayTime
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/datamigration/mgmt-v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/MongoDbProgress.java", "license": "mit", "size": 12381 }
[ "org.joda.time.DateTime" ]
import org.joda.time.DateTime;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
1,720,783
@Query("SELECT DISTINCT a FROM Alarm a WHERE " + "a.id = :alarmId AND " + "a.timestamp BETWEEN :startTime AND :endTime " + "ORDER BY a.timestamp DESC") List<Alarm> findAllDistinctInTimeSpanOrderByTimestampDesc(@Param("alarmId") Long alarmId, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
@Query(STR + STR + STR + STR) List<Alarm> findAllDistinctInTimeSpanOrderByTimestampDesc(@Param(STR) Long alarmId, @Param(STR) LocalDateTime startTime, @Param(STR) LocalDateTime endTime);
/** * Find all historical alarm records for the given time span and the given alarm id in descending time order * Returns the last N records for a given alarm id in descending time order * @param alarmId alarm id * @param startTime start time to search for an alarm entry * @param endTime end time to search for an alarm entry * @return The requested page */
Find all historical alarm records for the given time span and the given alarm id in descending time order Returns the last N records for a given alarm id in descending time order
findAllDistinctInTimeSpanOrderByTimestampDesc
{ "repo_name": "c2mon/c2mon-client-ext-history", "path": "src/main/java/cern/c2mon/client/ext/history/alarm/AlarmHistoryService.java", "license": "lgpl-3.0", "size": 10797 }
[ "java.time.LocalDateTime", "java.util.List", "org.springframework.data.jpa.repository.Query", "org.springframework.data.repository.query.Param" ]
import java.time.LocalDateTime; import java.util.List; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param;
import java.time.*; import java.util.*; import org.springframework.data.jpa.repository.*; import org.springframework.data.repository.query.*;
[ "java.time", "java.util", "org.springframework.data" ]
java.time; java.util; org.springframework.data;
1,992,477
@Override public boolean shutdown(String virtualMachineId) { Guard.check(virtualMachineId); log_.debug(String.format("Shutting down virtual machine: %s", virtualMachineId)); try { connect_.domainLookupByName(virtualMachineId).shutdown(); } catch (LibvirtException exception) { log_.debug(String.format("Unable to shutdown virtual machine: %s", exception.getMessage())); return false; } log_.debug("Shutdown was successfull"); return true; }
boolean function(String virtualMachineId) { Guard.check(virtualMachineId); log_.debug(String.format(STR, virtualMachineId)); try { connect_.domainLookupByName(virtualMachineId).shutdown(); } catch (LibvirtException exception) { log_.debug(String.format(STR, exception.getMessage())); return false; } log_.debug(STR); return true; }
/** * Shutdown a virtual machine. * * @param virtualMachineId The virtual machine identifier * @return true if everything ok, false otherwise */
Shutdown a virtual machine
shutdown
{ "repo_name": "snoozesoftware/snoozenode", "path": "src/main/java/org/inria/myriads/snoozenode/localcontroller/actuator/api/impl/LibVirtVirtualMachineActuator.java", "license": "gpl-2.0", "size": 12799 }
[ "org.inria.myriads.snoozecommon.guard.Guard", "org.libvirt.LibvirtException" ]
import org.inria.myriads.snoozecommon.guard.Guard; import org.libvirt.LibvirtException;
import org.inria.myriads.snoozecommon.guard.*; import org.libvirt.*;
[ "org.inria.myriads", "org.libvirt" ]
org.inria.myriads; org.libvirt;
478,113
IResult listNodesByPSI(String psi, int start, int count, Set<String> credentials);
IResult listNodesByPSI(String psi, int start, int count, Set<String> credentials);
/** * <p>List nodes associated with <code>psi</code></p> * <p>Note: a <code>psi</code> is theoretically a <em>unique</em> identifier * for a node; there shoule be just one node returned, if any.</p> * @param psi * @param start * @param count * @param credentials * @return */
List nodes associated with <code>psi</code> Note: a <code>psi</code> is theoretically a unique identifier for a node; there shoule be just one node returned, if any
listNodesByPSI
{ "repo_name": "agibsonccc/solrsherlock-maven", "path": "solrsherlock-parent/solrsherlock-core/src/main/java/org/topicquests/model/api/IDataProvider.java", "license": "apache-2.0", "size": 11134 }
[ "java.util.Set", "org.topicquests.common.api.IResult" ]
import java.util.Set; import org.topicquests.common.api.IResult;
import java.util.*; import org.topicquests.common.api.*;
[ "java.util", "org.topicquests.common" ]
java.util; org.topicquests.common;
919,866
public static SchemaDiffGenerator getSchemaDiffGenerator(final Map<Object, Object> ctx) { notNull(ctx); synchronized (ctx) { SchemaDiffGenerator sdg = (SchemaDiffGenerator) ctx.get(SchemaDiffGenerator.class); if (sdg == null) { sdg = new BufferedSchemaDiffGenerator(new MigrateSchemaDiffGenerator()); ctx.put(SchemaDiffGenerator.class, sdg); } return sdg; } }
static SchemaDiffGenerator function(final Map<Object, Object> ctx) { notNull(ctx); synchronized (ctx) { SchemaDiffGenerator sdg = (SchemaDiffGenerator) ctx.get(SchemaDiffGenerator.class); if (sdg == null) { sdg = new BufferedSchemaDiffGenerator(new MigrateSchemaDiffGenerator()); ctx.put(SchemaDiffGenerator.class, sdg); } return sdg; } }
/** * Gets {@link SchemaDiffGenerator} instance from the context. If such is not found, new one is created and is put in the context. * * @param ctx * @return */
Gets <code>SchemaDiffGenerator</code> instance from the context. If such is not found, new one is created and is put in the context
getSchemaDiffGenerator
{ "repo_name": "Persinity/ndt-migrate", "path": "ndt-migrate-1.0-beta/ndtcontroller/src/main/java/com/persinity/ndt/controller/step/ContextUtil.java", "license": "mit", "size": 3016 }
[ "com.persinity.common.invariant.Invariant", "com.persinity.ndt.dbdiff.BufferedSchemaDiffGenerator", "com.persinity.ndt.dbdiff.MigrateSchemaDiffGenerator", "com.persinity.ndt.dbdiff.SchemaDiffGenerator", "java.util.Map" ]
import com.persinity.common.invariant.Invariant; import com.persinity.ndt.dbdiff.BufferedSchemaDiffGenerator; import com.persinity.ndt.dbdiff.MigrateSchemaDiffGenerator; import com.persinity.ndt.dbdiff.SchemaDiffGenerator; import java.util.Map;
import com.persinity.common.invariant.*; import com.persinity.ndt.dbdiff.*; import java.util.*;
[ "com.persinity.common", "com.persinity.ndt", "java.util" ]
com.persinity.common; com.persinity.ndt; java.util;
1,633,115