method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@Pure @Inline(value = "$2.valueOf($1.doubleValue())", imported = BigDecimal.class) public static BigDecimal toBigDecimal(AtomicDouble number) { return BigDecimal.valueOf(number.doubleValue()); }
@Inline(value = STR, imported = BigDecimal.class) static BigDecimal function(AtomicDouble number) { return BigDecimal.valueOf(number.doubleValue()); }
/** Convert the given value to {@code BigDecimal}. * * @param number a number of {@code AtomicDouble} type. * @return the equivalent value to {@code number} of {@code BigDecimal} type. */
Convert the given value to BigDecimal
toBigDecimal
{ "repo_name": "sarl/sarl", "path": "main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/scoping/extensions/numbers/cast/AtomicDoubleCastExtensions.java", "license": "apache-2.0", "size": 5522 }
[ "com.google.common.util.concurrent.AtomicDouble", "java.math.BigDecimal", "org.eclipse.xtext.xbase.lib.Inline" ]
import com.google.common.util.concurrent.AtomicDouble; import java.math.BigDecimal; import org.eclipse.xtext.xbase.lib.Inline;
import com.google.common.util.concurrent.*; import java.math.*; import org.eclipse.xtext.xbase.lib.*;
[ "com.google.common", "java.math", "org.eclipse.xtext" ]
com.google.common; java.math; org.eclipse.xtext;
1,797,362
static boolean isString(Node n) { return n.getType() == Token.STRING; }
static boolean isString(Node n) { return n.getType() == Token.STRING; }
/** * Is this a STRING node? */
Is this a STRING node
isString
{ "repo_name": "johan/closure-compiler", "path": "src/com/google/javascript/jscomp/NodeUtil.java", "license": "apache-2.0", "size": 59336 }
[ "com.google.javascript.rhino.Node", "com.google.javascript.rhino.Token" ]
import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
1,353,635
public List<Profile> getAllProfiles() { return new ArrayList<>(existingProfiles.values()); } /** * Returns the profile with the given id. * * @param id * Id of profile. * @return {@link Profile}
List<Profile> function() { return new ArrayList<>(existingProfiles.values()); } /** * Returns the profile with the given id. * * @param id * Id of profile. * @return {@link Profile}
/** * Returns all existing profiles. * * @return Returns all existing profiles. */
Returns all existing profiles
getAllProfiles
{ "repo_name": "andy32323/inspectIT", "path": "CMR/src/info/novatec/inspectit/cmr/ci/ConfigurationInterfaceManager.java", "license": "agpl-3.0", "size": 22068 }
[ "info.novatec.inspectit.ci.Profile", "java.util.ArrayList", "java.util.List" ]
import info.novatec.inspectit.ci.Profile; import java.util.ArrayList; import java.util.List;
import info.novatec.inspectit.ci.*; import java.util.*;
[ "info.novatec.inspectit", "java.util" ]
info.novatec.inspectit; java.util;
2,709,668
public void sendNotification(String providerId, Object payload, Notification notification, TaskTracker tracker) throws Exception;
void function(String providerId, Object payload, Notification notification, TaskTracker tracker) throws Exception;
/** * send a notification * @param providerId * @param payload * @param notification * @param tracker * @throws Exception */
send a notification
sendNotification
{ "repo_name": "mdunker/usergrid", "path": "stack/services/src/main/java/org/apache/usergrid/services/notifications/ProviderAdapter.java", "license": "apache-2.0", "size": 2843 }
[ "org.apache.usergrid.persistence.entities.Notification" ]
import org.apache.usergrid.persistence.entities.Notification;
import org.apache.usergrid.persistence.entities.*;
[ "org.apache.usergrid" ]
org.apache.usergrid;
830,157
public int stringMonitorNotification() throws Exception { StringMonitor stringMonitor = new StringMonitor(); try { // Create a new StringMonitor MBean and add it to the MBeanServer. // echo(">>> CREATE a new StringMonitor MBean"); ObjectName stringMonitorName = new ObjectName( domain + ":type=" + StringMonitor.class.getName()); server.registerMBean(stringMonitor, stringMonitorName); echo(">>> ADD a listener to the StringMonitor"); stringMonitor.addNotificationListener(this, null, null); // // MANAGEMENT OF A STANDARD MBEAN // echo(">>> SET the attributes of the StringMonitor:"); stringMonitor.addObservedObject(obsObjName); echo("\tATTRIBUTE \"ObservedObject\" = " + obsObjName); stringMonitor.setObservedAttribute("StringAttribute"); echo("\tATTRIBUTE \"ObservedAttribute\" = StringAttribute"); stringMonitor.setNotifyMatch(false); echo("\tATTRIBUTE \"NotifyMatch\" = false"); stringMonitor.setNotifyDiffer(false); echo("\tATTRIBUTE \"NotifyDiffer\" = false"); stringMonitor.setStringToCompare("dummy"); echo("\tATTRIBUTE \"StringToCompare\" = \"dummy\""); int granularityperiod = 500; stringMonitor.setGranularityPeriod(granularityperiod); echo("\tATTRIBUTE \"GranularityPeriod\" = " + granularityperiod); echo(">>> START the StringMonitor"); stringMonitor.start(); // Check if notification was received // doWait(); if (messageReceived) { echo("\tOK: StringMonitor got RUNTIME_ERROR notification!"); } else { echo("\tKO: StringMonitor did not get " + "RUNTIME_ERROR notification!"); return 1; } } finally { messageReceived = false; if (stringMonitor != null) stringMonitor.stop(); } return 0; }
int function() throws Exception { StringMonitor stringMonitor = new StringMonitor(); try { ObjectName stringMonitorName = new ObjectName( domain + STR + StringMonitor.class.getName()); server.registerMBean(stringMonitor, stringMonitorName); echo(STR); stringMonitor.addNotificationListener(this, null, null); echo(STR); stringMonitor.addObservedObject(obsObjName); echo(STRObservedObject\STR + obsObjName); stringMonitor.setObservedAttribute(STR); echo(STRObservedAttribute\STR); stringMonitor.setNotifyMatch(false); echo(STRNotifyMatch\STR); stringMonitor.setNotifyDiffer(false); echo(STRNotifyDiffer\STR); stringMonitor.setStringToCompare("dummy"); echo(STRStringToCompare\STRdummy\""); int granularityperiod = 500; stringMonitor.setGranularityPeriod(granularityperiod); echo(STRGranularityPeriod\STR + granularityperiod); echo(">>> START the StringMonitorSTR\tOK: StringMonitor got RUNTIME_ERROR notification!STR\tKO: StringMonitor did not get STRRUNTIME_ERROR notification!"); return 1; } } finally { messageReceived = false; if (stringMonitor != null) stringMonitor.stop(); } return 0; }
/** * Update the string and check for notifications */
Update the string and check for notifications
stringMonitorNotification
{ "repo_name": "FauxFaux/jdk9-jdk", "path": "test/javax/management/monitor/ReflectionExceptionTest.java", "license": "gpl-2.0", "size": 13298 }
[ "javax.management.ObjectName", "javax.management.monitor.StringMonitor" ]
import javax.management.ObjectName; import javax.management.monitor.StringMonitor;
import javax.management.*; import javax.management.monitor.*;
[ "javax.management" ]
javax.management;
1,852,230
public double getScore(NDArray point) { return points.contains(point) ? 1.0 : 0.0; }
double function(NDArray point) { return points.contains(point) ? 1.0 : 0.0; }
/** * Gets the score of the given vector respective to the cluster * * @param point The point whose score we want */
Gets the score of the given vector respective to the cluster
getScore
{ "repo_name": "dbracewell/apollo", "path": "src/main/java/com/davidbracewell/apollo/ml/clustering/Cluster.java", "license": "apache-2.0", "size": 2887 }
[ "com.davidbracewell.apollo.linear.NDArray" ]
import com.davidbracewell.apollo.linear.NDArray;
import com.davidbracewell.apollo.linear.*;
[ "com.davidbracewell.apollo" ]
com.davidbracewell.apollo;
661,459
private void prepareGameAreaForNewGame() { // deal to piles Iterator<Card> deckIterator = game.getDeck().iterator(); int cardsToPut = 1; for (CardPileView standardPileView : gameArea.getStandardPileViews()) { for (int i = 0; i < cardsToPut; i++) { standardPileView.addCardView(CardViewFactory.createCardView(deckIterator.next())); gameArea.getChildren().add(standardPileView.getTopCardView()); gameArea.cardViewList.add(standardPileView.getTopCardView()); mouseUtil.makeDraggable(standardPileView.getTopCardView()); standardPileView.getTopCardView().setMouseTransparent(true); } standardPileView.getTopCardView().setMouseTransparent(false); cardsToPut++; } deckIterator.forEachRemaining(card -> { gameArea.getStockView().addCardView(CardViewFactory.createCardView(card)); mouseUtil.makeClickable(gameArea.getStockView().getTopCardView()); gameArea.cardViewList.add(gameArea.getStockView().getTopCardView()); gameArea.getChildren().add(gameArea.getStockView().getTopCardView()); }); gameArea.getStockView().setOnMouseClicked(mouseUtil.stockReverseCardsHandler); }
void function() { Iterator<Card> deckIterator = game.getDeck().iterator(); int cardsToPut = 1; for (CardPileView standardPileView : gameArea.getStandardPileViews()) { for (int i = 0; i < cardsToPut; i++) { standardPileView.addCardView(CardViewFactory.createCardView(deckIterator.next())); gameArea.getChildren().add(standardPileView.getTopCardView()); gameArea.cardViewList.add(standardPileView.getTopCardView()); mouseUtil.makeDraggable(standardPileView.getTopCardView()); standardPileView.getTopCardView().setMouseTransparent(true); } standardPileView.getTopCardView().setMouseTransparent(false); cardsToPut++; } deckIterator.forEachRemaining(card -> { gameArea.getStockView().addCardView(CardViewFactory.createCardView(card)); mouseUtil.makeClickable(gameArea.getStockView().getTopCardView()); gameArea.cardViewList.add(gameArea.getStockView().getTopCardView()); gameArea.getChildren().add(gameArea.getStockView().getTopCardView()); }); gameArea.getStockView().setOnMouseClicked(mouseUtil.stockReverseCardsHandler); }
/** * Sets up the {@link KlondikeGameArea} object for a new game. */
Sets up the <code>KlondikeGameArea</code> object for a new game
prepareGameAreaForNewGame
{ "repo_name": "ZoltanDalmadi/JCardGamesFX", "path": "src/main/java/hu/unideb/inf/JCardGamesFX/klondike/KlondikeApp.java", "license": "mit", "size": 4798 }
[ "hu.unideb.inf.JCardGamesFX", "java.util.Iterator" ]
import hu.unideb.inf.JCardGamesFX; import java.util.Iterator;
import hu.unideb.inf.*; import java.util.*;
[ "hu.unideb.inf", "java.util" ]
hu.unideb.inf; java.util;
1,060,426
public static Integer getDimension(int index, Object[] row) { Integer[] dimensions = (Integer[]) row[IgnoreDictionary.DIMENSION_INDEX_IN_ROW.getIndex()]; return dimensions[index]; }
static Integer function(int index, Object[] row) { Integer[] dimensions = (Integer[]) row[IgnoreDictionary.DIMENSION_INDEX_IN_ROW.getIndex()]; return dimensions[index]; }
/** * Method to get the required Dimension from obj [] * * @param index * @param row * @return */
Method to get the required Dimension from obj []
getDimension
{ "repo_name": "JihongMA/incubator-carbondata", "path": "processing/src/main/java/org/apache/carbondata/processing/util/RemoveDictionaryUtil.java", "license": "apache-2.0", "size": 15123 }
[ "org.apache.carbondata.core.constants.IgnoreDictionary" ]
import org.apache.carbondata.core.constants.IgnoreDictionary;
import org.apache.carbondata.core.constants.*;
[ "org.apache.carbondata" ]
org.apache.carbondata;
2,237,019
public void show(CardAnimation animation) { _show(animation.getJSO()); }
void function(CardAnimation animation) { _show(animation.getJSO()); }
/** * show this component */
show this component
show
{ "repo_name": "ahome-it/ahome-touch", "path": "ahome-touch/src/main/java/com/ait/toolkit/sencha/touch/client/core/Component.java", "license": "apache-2.0", "size": 73764 }
[ "com.ait.toolkit.sencha.touch.client.layout.card.CardAnimation" ]
import com.ait.toolkit.sencha.touch.client.layout.card.CardAnimation;
import com.ait.toolkit.sencha.touch.client.layout.card.*;
[ "com.ait.toolkit" ]
com.ait.toolkit;
2,546,275
public Map<Integer, Map<Integer, Long>> getNumL2InterThreadEvictions() { return numL2InterThreadEvictions; }
Map<Integer, Map<Integer, Long>> function() { return numL2InterThreadEvictions; }
/** * Get the number of L2 cache inter-thread evictions. * * @return the number of L2 cache inter-thread evictions */
Get the number of L2 cache inter-thread evictions
getNumL2InterThreadEvictions
{ "repo_name": "mcai/Archimulator", "path": "src/main/java/archimulator/uncore/cache/interference/CacheInteractionHelper.java", "license": "mit", "size": 7599 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,187,080
public ServiceFuture<List<DatabasePrincipalInner>> listPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, final ServiceCallback<List<DatabasePrincipalInner>> serviceCallback) { return ServiceFuture.fromResponse(listPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName), serviceCallback); }
ServiceFuture<List<DatabasePrincipalInner>> function(String resourceGroupName, String clusterName, String databaseName, final ServiceCallback<List<DatabasePrincipalInner>> serviceCallback) { return ServiceFuture.fromResponse(listPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName), serviceCallback); }
/** * Returns a list of database principals of the given Kusto cluster and database. * * @param resourceGroupName The name of the resource group containing the Kusto cluster. * @param clusterName The name of the Kusto cluster. * @param databaseName The name of the database in the Kusto cluster. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Returns a list of database principals of the given Kusto cluster and database
listPrincipalsAsync
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/kusto/mgmt-v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasesInner.java", "license": "mit", "size": 87420 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture", "java.util.List" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.List;
import com.microsoft.rest.*; import java.util.*;
[ "com.microsoft.rest", "java.util" ]
com.microsoft.rest; java.util;
2,126,017
public synchronized boolean append(TxnHeader hdr, Record txn) throws IOException { if (hdr != null) { if (hdr.getZxid() <= lastZxidSeen) { LOG.warn("Current zxid " + hdr.getZxid() + " is <= " + lastZxidSeen + " for " + hdr.getType()); } if (logStream==null) { if(LOG.isInfoEnabled()){ LOG.info("Creating new log file: log." + Long.toHexString(hdr.getZxid())); } logFileWrite = new File(logDir, ("log." + Long.toHexString(hdr.getZxid()))); fos = new FileOutputStream(logFileWrite); logStream=new BufferedOutputStream(fos); oa = BinaryOutputArchive.getArchive(logStream); FileHeader fhdr = new FileHeader(TXNLOG_MAGIC,VERSION, dbId); fhdr.serialize(oa, "fileheader"); // Make sure that the magic number is written before padding. logStream.flush(); currentSize = fos.getChannel().position(); streamsToFlush.add(fos); } padFile(fos); byte[] buf = Util.marshallTxnEntry(hdr, txn); if (buf == null || buf.length == 0) { throw new IOException("Faulty serialization for header " + "and txn"); } Checksum crc = makeChecksumAlgorithm(); crc.update(buf, 0, buf.length); oa.writeLong(crc.getValue(), "txnEntryCRC"); Util.writeTxnBytes(oa, buf); return true; } return false; }
synchronized boolean function(TxnHeader hdr, Record txn) throws IOException { if (hdr != null) { if (hdr.getZxid() <= lastZxidSeen) { LOG.warn(STR + hdr.getZxid() + STR + lastZxidSeen + STR + hdr.getType()); } if (logStream==null) { if(LOG.isInfoEnabled()){ LOG.info(STR + Long.toHexString(hdr.getZxid())); } logFileWrite = new File(logDir, ("log." + Long.toHexString(hdr.getZxid()))); fos = new FileOutputStream(logFileWrite); logStream=new BufferedOutputStream(fos); oa = BinaryOutputArchive.getArchive(logStream); FileHeader fhdr = new FileHeader(TXNLOG_MAGIC,VERSION, dbId); fhdr.serialize(oa, STR); logStream.flush(); currentSize = fos.getChannel().position(); streamsToFlush.add(fos); } padFile(fos); byte[] buf = Util.marshallTxnEntry(hdr, txn); if (buf == null buf.length == 0) { throw new IOException(STR + STR); } Checksum crc = makeChecksumAlgorithm(); crc.update(buf, 0, buf.length); oa.writeLong(crc.getValue(), STR); Util.writeTxnBytes(oa, buf); return true; } return false; }
/** * append an entry to the transaction log * @param hdr the header of the transaction * @param txn the transaction part of the entry * returns true iff something appended, otw false */
append an entry to the transaction log
append
{ "repo_name": "zhushuchen/Ocean", "path": "组件/zookeeper-3.3.6/src/java/main/org/apache/zookeeper/server/persistence/FileTxnLog.java", "license": "agpl-3.0", "size": 21459 }
[ "java.io.BufferedOutputStream", "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.util.zip.Checksum", "org.apache.jute.BinaryOutputArchive", "org.apache.jute.Record", "org.apache.zookeeper.txn.TxnHeader" ]
import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.Checksum; import org.apache.jute.BinaryOutputArchive; import org.apache.jute.Record; import org.apache.zookeeper.txn.TxnHeader;
import java.io.*; import java.util.zip.*; import org.apache.jute.*; import org.apache.zookeeper.txn.*;
[ "java.io", "java.util", "org.apache.jute", "org.apache.zookeeper" ]
java.io; java.util; org.apache.jute; org.apache.zookeeper;
175,079
public static native void navEvent(String from, String to, String name, JavaScriptObject data) ;
static native void function(String from, String to, String name, JavaScriptObject data) ;
/** * send an analytics nav event for the application session * * @param from , the from location in the nav event * @param to , the to location in the nav event * @param name , the event name * @param data , event data or null if not specified. the object must be * serializable as JSON */
send an analytics nav event for the application session
navEvent
{ "repo_name": "CraigAndrew/titanium4j", "path": "src/com/emitrom/ti4j/mobile/client/analytics/Analytics.java", "license": "apache-2.0", "size": 7539 }
[ "com.google.gwt.core.client.JavaScriptObject" ]
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.*;
[ "com.google.gwt" ]
com.google.gwt;
37,885
public static <T1, T2, R> PropertyStream<R> combine(PropertyStream<T1> stream1, PropertyStream<T2> stream2, BiFunction<T1, T2, R> combiner) { List<PropertyStream<?>> streams = Arrays.asList(stream1, stream2); Supplier<R> combineSupplier = () -> combiner.apply(stream1.get(), stream2.get()); return new PropertyStream<R>(new CombinePropertyPublisher<R>(combineSupplier, streams)); }
static <T1, T2, R> PropertyStream<R> function(PropertyStream<T1> stream1, PropertyStream<T2> stream2, BiFunction<T1, T2, R> combiner) { List<PropertyStream<?>> streams = Arrays.asList(stream1, stream2); Supplier<R> combineSupplier = () -> combiner.apply(stream1.get(), stream2.get()); return new PropertyStream<R>(new CombinePropertyPublisher<R>(combineSupplier, streams)); }
/** * Combines the values of two property streams and produces a new result * using the provided function any time either of the values changes. * * @param stream1 * the first stream to combine * @param stream2 * the second stream to combine * @param combiner * some function that will be called any time either of the * provided streams changes * @return a new {@link PropertyStream} that will emit the result of combining * the values of the provided streams using the provided * function any time either streams' value changes. * @param <T1> * the type of the property stream of the first input stream * @param <T2> * the type of the property stream of the first input stream * @param <R> * the type of the property stream created by applying the combiner function */
Combines the values of two property streams and produces a new result using the provided function any time either of the values changes
combine
{ "repo_name": "Tiger-UI/tigerui-core", "path": "src/main/java/tigerui/property/PropertyStream.java", "license": "apache-2.0", "size": 19479 }
[ "java.util.Arrays", "java.util.List", "java.util.function.BiFunction", "java.util.function.Supplier" ]
import java.util.Arrays; import java.util.List; import java.util.function.BiFunction; import java.util.function.Supplier;
import java.util.*; import java.util.function.*;
[ "java.util" ]
java.util;
2,627,596
@Ignore public void testDeployTwoServicesOpenStack() throws IOException, InterruptedException { BlockingQueue<ServicePlatformMessage> muxQueue = new LinkedBlockingQueue<ServicePlatformMessage>(); BlockingQueue<ServicePlatformMessage> dispatcherQueue = new LinkedBlockingQueue<ServicePlatformMessage>(); TestProducer producer = new TestProducer(muxQueue, this); consumer = new TestConsumer(dispatcherQueue); AdaptorCore core = new AdaptorCore(muxQueue, dispatcherQueue, consumer, producer, 0.1); core.start(); int counter = 0; try { while (counter < 2) { synchronized (mon) { mon.wait(); if (lastHeartbeat.contains("RUNNING")) counter++; } } } catch (Exception e) { Assert.assertTrue(false); } String addVimBody = "{\"wr_type\":\"compute\",\"vim_type\":\"Heat\", " + "\"tenant_ext_router\":\"20790da5-2dc1-4c7e-b9c3-a8d590517563\", " + "\"tenant_ext_net\":\"decd89e2-1681-427e-ac24-6e9f1abb1715\"," + "\"vim_address\":\"openstack.sonata-nfv.eu\",\"username\":\"op_sonata\"," + "\"pass\":\"op_s0n@t@\",\"tenant\":\"op_sonata\"}"; String topic = "infrastructure.management.compute.add"; ServicePlatformMessage addVimMessage = new ServicePlatformMessage(addVimBody, "application/json", topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(addVimMessage); Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } JSONTokener tokener = new JSONTokener(output); JSONObject jsonObject = (JSONObject) tokener.nextValue(); String status = jsonObject.getString("status"); String wrUuid = jsonObject.getString("uuid"); Assert.assertTrue(status.equals("COMPLETED")); System.out.println("OenStack Wrapper added, with uuid: " + wrUuid); output = null; String baseInstanceUuid = data.getNsd().getInstanceUuid(); data.setVimUuid(wrUuid); data.getNsd().setInstanceUuid(baseInstanceUuid + "-01"); String body = mapper.writeValueAsString(data); topic = "infrastructure.service.deploy"; ServicePlatformMessage deployServiceMessage = new ServicePlatformMessage(body, "application/x-yaml", topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(deployServiceMessage); Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } Assert.assertNotNull(output); int retry = 0; int maxRetry = 60; while (output.contains("heartbeat") || output.contains("Vim Added") && retry < maxRetry) synchronized (mon) { mon.wait(1000); retry++; } System.out.println("DeployServiceResponse: "); System.out.println(output); Assert.assertTrue("No Deploy service response received", retry < maxRetry); DeployServiceResponse response = mapper.readValue(output, DeployServiceResponse.class); Assert.assertTrue(response.getRequestStatus().equals("DEPLOYED")); Assert.assertTrue(response.getNsr().getStatus() == Status.offline); for (VnfRecord vnfr : response.getVnfrs()) Assert.assertTrue(vnfr.getStatus() == Status.offline); // Deploy a second instance of the same service data1.getNsd().setInstanceUuid(baseInstanceUuid + "-02"); output = null; body = mapper.writeValueAsString(data1); topic = "infrastructure.service.deploy"; deployServiceMessage = new ServicePlatformMessage(body, "application/x-yaml", topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(deployServiceMessage); Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } Assert.assertNotNull(output); retry = 0; while (output.contains("heartbeat") || output.contains("Vim Added") && retry < maxRetry) synchronized (mon) { mon.wait(1000); retry++; } System.out.println("DeployServiceResponse: "); System.out.println(output); Assert.assertTrue("No Deploy service response received", retry < maxRetry); response = mapper.readValue(output, DeployServiceResponse.class); Assert.assertTrue(response.getRequestStatus().equals("DEPLOYED")); Assert.assertTrue(response.getNsr().getStatus() == Status.offline); for (VnfRecord vnfr : response.getVnfrs()) Assert.assertTrue(vnfr.getStatus() == Status.offline); // // Clean the OpenStack tenant from the stack // OpenStackHeatClient client = // new OpenStackHeatClient("143.233.127.3", "op_sonata", "op_s0n@t@", "op_sonata"); // String stackName = response.getInstanceName(); // // String deleteStatus = client.deleteStack(stackName, response.getInstanceVimUuid()); // assertNotNull("Failed to delete stack", deleteStatus); // // if (deleteStatus != null) { // System.out.println("status of deleted stack " + stackName + " is " + deleteStatus); // assertEquals("DELETED", deleteStatus); // } // Service removal output = null; String instanceUuid = baseInstanceUuid + "-01"; String message = "{\"instance_uuid\":\"" + instanceUuid + "\",\"vim_uuid\":\"" + wrUuid + "\"}"; topic = "infrastructure.service.remove"; ServicePlatformMessage removeInstanceMessage = new ServicePlatformMessage(message, "application/json", topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(removeInstanceMessage); while (output == null) { synchronized (mon) { mon.wait(2000); System.out.println(output); } } System.out.println(output); tokener = new JSONTokener(output); jsonObject = (JSONObject) tokener.nextValue(); status = jsonObject.getString("request_status"); Assert.assertTrue("Adapter returned an unexpected status: " + status, status.equals("SUCCESS")); output = null; instanceUuid = baseInstanceUuid + "-02"; message = "{\"instance_uuid\":\"" + instanceUuid + "\",\"vim_uuid\":\"" + wrUuid + "\"}"; topic = "infrastructure.service.remove"; removeInstanceMessage = new ServicePlatformMessage(message, "application/json", topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(removeInstanceMessage); while (output == null) { synchronized (mon) { mon.wait(2000); System.out.println(output); } } System.out.println(output); tokener = new JSONTokener(output); jsonObject = (JSONObject) tokener.nextValue(); status = jsonObject.getString("request_status"); Assert.assertTrue("Adapter returned an unexpected status: " + status, status.equals("SUCCESS")); output = null; message = "{\"wr_type\":\"compute\",\"uuid\":\"" + wrUuid + "\"}"; topic = "infrastructure.management.compute.remove"; ServicePlatformMessage removeVimMessage = new ServicePlatformMessage(message, "application/json", topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(removeVimMessage); while (output == null) { synchronized (mon) { mon.wait(1000); } } System.out.println(output); tokener = new JSONTokener(output); jsonObject = (JSONObject) tokener.nextValue(); status = jsonObject.getString("status"); Assert.assertTrue(status.equals("COMPLETED")); core.stop(); } /* * public void testDeployServiceMockStack() throws Exception { * * OpenStackHeatClient client = Mockito.mock(OpenStackHeatClient.class); * Mockito.when(client.createStack(Matchers.anyString(),Matchers.anyString())).thenReturn(UUID. * randomUUID().toString()); * * Mockito.when(client.getStackStatus(Matchers.anyString(), * Matchers.anyString())).thenReturn("CREATE_COMPLETE"); * * Mockito.when(client.deleteStack(Matchers.anyString(), * Matchers.anyString())).thenReturn("DELETED"); * * StackComposition comp = * * Mockito.when(client.getStackComposition(Matchers.anyString(), * Matchers.anyString())).thenReturn(comp); * * PowerMockito.whenNew(OpenStackHeatClient.class).withAnyArguments().thenReturn(client); * * * * BlockingQueue<ServicePlatformMessage> muxQueue = new * LinkedBlockingQueue<ServicePlatformMessage>(); BlockingQueue<ServicePlatformMessage> * dispatcherQueue = new LinkedBlockingQueue<ServicePlatformMessage>(); * * TestProducer producer = new TestProducer(muxQueue, this); consumer = new * TestConsumer(dispatcherQueue); AdaptorCore core = new AdaptorCore(muxQueue, dispatcherQueue, * consumer, producer, 0.1); * * core.start(); int counter = 0; * * try { while (counter < 2) { synchronized (mon) { mon.wait(); if * (lastHeartbeat.contains("RUNNING")) counter++; } } } catch (Exception e) { assertTrue(false); } * * * String addVimBody= * "{\"wr_type\":\"compute\",\"vim_type\":\"Heat\", \"tenant_ext_router\":\"20790da5-2dc1-4c7e-b9c3-a8d590517563\", \"tenant_ext_net\":\"decd89e2-1681-427e-ac24-6e9f1abb1715\",\"vim_address\":\"openstack.sonata-nfv.eu\",\"username\":\"op_sonata\",\"pass\":\"op_s0n@t@\",\"tenant\":\"op_sonata\"}" * ; String topic = "infrastructure.management.compute.add"; ServicePlatformMessage addVimMessage * = new ServicePlatformMessage(addVimBody, "application/json", topic, * UUID.randomUUID().toString(), topic); consumer.injectMessage(addVimMessage); * Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } * * JSONTokener tokener = new JSONTokener(output); JSONObject jsonObject = (JSONObject) * tokener.nextValue(); String status = jsonObject.getString("status"); String wrUuid = * jsonObject.getString("uuid"); assertTrue(status.equals("COMPLETED")); * System.out.println("OenStack Wrapper added, with uuid: " + wrUuid); * * output = null; String baseInstanceUuid = data.getNsd().getInstanceUuid(); * data.setVimUuid(wrUuid); data.getNsd().setInstanceUuid(baseInstanceUuid + "-01"); * * String body = mapper.writeValueAsString(data); * * topic = "infrastructure.service.deploy"; ServicePlatformMessage deployServiceMessage = new * ServicePlatformMessage(body, "application/x-yaml", topic, UUID.randomUUID().toString(), topic); * * consumer.injectMessage(deployServiceMessage); * * Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } * assertNotNull(output); int retry = 0; int maxRetry = 60; while (output.contains("heartbeat") || * output.contains("Vim Added") && retry < maxRetry) synchronized (mon) { mon.wait(1000); retry++; * } * * System.out.println("DeployServiceResponse: "); System.out.println(output); * assertTrue("No Deploy service response received", retry < maxRetry); DeployServiceResponse * response = mapper.readValue(output, DeployServiceResponse.class); * assertTrue(response.getRequestStatus().equals("DEPLOYED")); * assertTrue(response.getNsr().getStatus() == Status.offline); * * for (VnfRecord vnfr : response.getVnfrs()) assertTrue(vnfr.getStatus() == Status.offline); * * * // Deploy a second instance of the same service * * data.getNsd().setInstanceUuid(baseInstanceUuid + "-02"); output = null; * * body = mapper.writeValueAsString(data); * * topic = "infrastructure.service.deploy"; deployServiceMessage = new * ServicePlatformMessage(body, "application/x-yaml", topic, UUID.randomUUID().toString(), topic); * * consumer.injectMessage(deployServiceMessage); * * Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } * assertNotNull(output); retry = 0; while (output.contains("heartbeat") || * output.contains("Vim Added") && retry < maxRetry) synchronized (mon) { mon.wait(1000); retry++; * } * * System.out.println("DeployServiceResponse: "); System.out.println(output); * assertTrue("No Deploy service response received", retry < maxRetry); response = * mapper.readValue(output, DeployServiceResponse.class); * assertTrue(response.getRequestStatus().equals("DEPLOYED")); * assertTrue(response.getNsr().getStatus() == Status.offline); for (VnfRecord vnfr : * response.getVnfrs()) assertTrue(vnfr.getStatus() == Status.offline); * * * // // Clean the OpenStack tenant from the stack // OpenStackHeatClient client = // new * OpenStackHeatClient("143.233.127.3", "op_sonata", "op_s0n@t@", "op_sonata"); // String * stackName = response.getInstanceName(); // // String deleteStatus = * client.deleteStack(stackName, response.getInstanceVimUuid()); // * assertNotNull("Failed to delete stack", deleteStatus); // // if (deleteStatus != null) { // * System.out.println("status of deleted stack " + stackName + " is " + deleteStatus); // * assertEquals("DELETED", deleteStatus); // } * * * // Service removal output = null; String instanceUuid = baseInstanceUuid + "-01"; String * message = "{\"instance_uuid\":\"" + instanceUuid + "\",\"vim_uuid\":\"" + wrUuid + "\"}"; topic * = "infrastructure.service.remove"; ServicePlatformMessage removeInstanceMessage = new * ServicePlatformMessage(message, "application/json", topic, UUID.randomUUID().toString(), * topic); consumer.injectMessage(removeInstanceMessage); * * while (output == null) { synchronized (mon) { mon.wait(2000); System.out.println(output); } } * System.out.println(output); tokener = new JSONTokener(output); jsonObject = (JSONObject) * tokener.nextValue(); status = jsonObject.getString("request_status"); * assertTrue("Adapter returned an unexpected status: " + status, status.equals("SUCCESS")); * * output = null; instanceUuid = baseInstanceUuid + "-02"; message = "{\"instance_uuid\":\"" + * instanceUuid + "\",\"vim_uuid\":\"" + wrUuid + "\"}"; topic = "infrastructure.service.remove"; * removeInstanceMessage = new ServicePlatformMessage(message, "application/json", topic, * UUID.randomUUID().toString(), topic); consumer.injectMessage(removeInstanceMessage); * * while (output == null) { synchronized (mon) { mon.wait(2000); System.out.println(output); } } * System.out.println(output); tokener = new JSONTokener(output); jsonObject = (JSONObject) * tokener.nextValue(); status = jsonObject.getString("request_status"); * assertTrue("Adapter returned an unexpected status: " + status, status.equals("SUCCESS")); * * * * output = null; message = "{\"wr_type\":\"compute\",\"uuid\":\"" + wrUuid + "\"}"; topic = * "infrastructure.management.compute.remove"; ServicePlatformMessage removeVimMessage = new * ServicePlatformMessage(message, "application/json", topic, UUID.randomUUID().toString(), * topic); consumer.injectMessage(removeVimMessage); * * while (output == null) { synchronized (mon) { mon.wait(1000); } } System.out.println(output); * tokener = new JSONTokener(output); jsonObject = (JSONObject) tokener.nextValue(); status = * jsonObject.getString("status"); assertTrue(status.equals("COMPLETED")); core.stop(); * * }
void function() throws IOException, InterruptedException { BlockingQueue<ServicePlatformMessage> muxQueue = new LinkedBlockingQueue<ServicePlatformMessage>(); BlockingQueue<ServicePlatformMessage> dispatcherQueue = new LinkedBlockingQueue<ServicePlatformMessage>(); TestProducer producer = new TestProducer(muxQueue, this); consumer = new TestConsumer(dispatcherQueue); AdaptorCore core = new AdaptorCore(muxQueue, dispatcherQueue, consumer, producer, 0.1); core.start(); int counter = 0; try { while (counter < 2) { synchronized (mon) { mon.wait(); if (lastHeartbeat.contains(STR)) counter++; } } } catch (Exception e) { Assert.assertTrue(false); } String addVimBody = "{\"wr_type\":\"compute\",\"vim_type\":\"Heat\STR + "\"tenant_ext_router\":\"20790da5-2dc1-4c7e-b9c3-a8d590517563\STR + "\"tenant_ext_net\":\"decd89e2-1681-427e-ac24-6e9f1abb1715\"," + "\"vim_address\":\"openstack.sonata-nfv.eu\",\"username\":\"op_sonata\"," + "\"pass\":\"op_s0n@t@\",\"tenant\":\"op_sonata\"}"; String topic = STR; ServicePlatformMessage addVimMessage = new ServicePlatformMessage(addVimBody, STR, topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(addVimMessage); Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } JSONTokener tokener = new JSONTokener(output); JSONObject jsonObject = (JSONObject) tokener.nextValue(); String status = jsonObject.getString(STR); String wrUuid = jsonObject.getString("uuid"); Assert.assertTrue(status.equals(STR)); System.out.println(STR + wrUuid); output = null; String baseInstanceUuid = data.getNsd().getInstanceUuid(); data.setVimUuid(wrUuid); data.getNsd().setInstanceUuid(baseInstanceUuid + "-01"); String body = mapper.writeValueAsString(data); topic = STR; ServicePlatformMessage deployServiceMessage = new ServicePlatformMessage(body, STR, topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(deployServiceMessage); Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } Assert.assertNotNull(output); int retry = 0; int maxRetry = 60; while (output.contains(STR) output.contains(STR) && retry < maxRetry) synchronized (mon) { mon.wait(1000); retry++; } System.out.println(STR); System.out.println(output); Assert.assertTrue(STR, retry < maxRetry); DeployServiceResponse response = mapper.readValue(output, DeployServiceResponse.class); Assert.assertTrue(response.getRequestStatus().equals(STR)); Assert.assertTrue(response.getNsr().getStatus() == Status.offline); for (VnfRecord vnfr : response.getVnfrs()) Assert.assertTrue(vnfr.getStatus() == Status.offline); data1.getNsd().setInstanceUuid(baseInstanceUuid + "-02"); output = null; body = mapper.writeValueAsString(data1); topic = STR; deployServiceMessage = new ServicePlatformMessage(body, STR, topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(deployServiceMessage); Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } Assert.assertNotNull(output); retry = 0; while (output.contains(STR) output.contains(STR) && retry < maxRetry) synchronized (mon) { mon.wait(1000); retry++; } System.out.println(STR); System.out.println(output); Assert.assertTrue(STR, retry < maxRetry); response = mapper.readValue(output, DeployServiceResponse.class); Assert.assertTrue(response.getRequestStatus().equals(STR)); Assert.assertTrue(response.getNsr().getStatus() == Status.offline); for (VnfRecord vnfr : response.getVnfrs()) Assert.assertTrue(vnfr.getStatus() == Status.offline); output = null; String instanceUuid = baseInstanceUuid + "-01"; String message = "{\"instance_uuid\":\"STR\",\"vim_uuid\":\"STR\"}"; topic = STR; ServicePlatformMessage removeInstanceMessage = new ServicePlatformMessage(message, STR, topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(removeInstanceMessage); while (output == null) { synchronized (mon) { mon.wait(2000); System.out.println(output); } } System.out.println(output); tokener = new JSONTokener(output); jsonObject = (JSONObject) tokener.nextValue(); status = jsonObject.getString(STR); Assert.assertTrue(STR + status, status.equals(STR)); output = null; instanceUuid = baseInstanceUuid + "-02"; message = "{\"instance_uuid\":\"STR\",\"vim_uuid\":\"STR\"}"; topic = STR; removeInstanceMessage = new ServicePlatformMessage(message, STR, topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(removeInstanceMessage); while (output == null) { synchronized (mon) { mon.wait(2000); System.out.println(output); } } System.out.println(output); tokener = new JSONTokener(output); jsonObject = (JSONObject) tokener.nextValue(); status = jsonObject.getString(STR); Assert.assertTrue(STR + status, status.equals(STR)); output = null; message = "{\"wr_type\":\"compute\",\"uuid\":\"STR\"}"; topic = STR; ServicePlatformMessage removeVimMessage = new ServicePlatformMessage(message, STR, topic, UUID.randomUUID().toString(), topic); consumer.injectMessage(removeVimMessage); while (output == null) { synchronized (mon) { mon.wait(1000); } } System.out.println(output); tokener = new JSONTokener(output); jsonObject = (JSONObject) tokener.nextValue(); status = jsonObject.getString(STR); Assert.assertTrue(status.equals(STR)); core.stop(); } /* * public void testDeployServiceMockStack() throws Exception { * * OpenStackHeatClient client = Mockito.mock(OpenStackHeatClient.class); * Mockito.when(client.createStack(Matchers.anyString(),Matchers.anyString())).thenReturn(UUID. * randomUUID().toString()); * * Mockito.when(client.getStackStatus(Matchers.anyString(), * Matchers.anyString())).thenReturn(STR); * * Mockito.when(client.deleteStack(Matchers.anyString(), * Matchers.anyString())).thenReturn(STR); * * StackComposition comp = * * Mockito.when(client.getStackComposition(Matchers.anyString(), * Matchers.anyString())).thenReturn(comp); * * PowerMockito.whenNew(OpenStackHeatClient.class).withAnyArguments().thenReturn(client); * * * * BlockingQueue<ServicePlatformMessage> muxQueue = new * LinkedBlockingQueue<ServicePlatformMessage>(); BlockingQueue<ServicePlatformMessage> * dispatcherQueue = new LinkedBlockingQueue<ServicePlatformMessage>(); * * TestProducer producer = new TestProducer(muxQueue, this); consumer = new * TestConsumer(dispatcherQueue); AdaptorCore core = new AdaptorCore(muxQueue, dispatcherQueue, * consumer, producer, 0.1); * * core.start(); int counter = 0; * * try { while (counter < 2) { synchronized (mon) { mon.wait(); if * (lastHeartbeat.contains(STR)) counter++; } } } catch (Exception e) { assertTrue(false); } * * * String addVimBody= * "{\"wr_type\":\"compute\",\"vim_type\":\"Heat\STRtenant_ext_router\":\"20790da5-2dc1-4c7e-b9c3-a8d590517563\STRtenant_ext_net\":\"decd89e2-1681-427e-ac24-6e9f1abb1715\",\"vim_address\":\"openstack.sonata-nfv.eu\",\"username\":\"op_sonata\",\"pass\":\"op_s0n@t@\",\"tenant\":\"op_sonata\"}" * ; String topic = STR; ServicePlatformMessage addVimMessage * = new ServicePlatformMessage(addVimBody, STR, topic, * UUID.randomUUID().toString(), topic); consumer.injectMessage(addVimMessage); * Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } * * JSONTokener tokener = new JSONTokener(output); JSONObject jsonObject = (JSONObject) * tokener.nextValue(); String status = jsonObject.getString(STR); String wrUuid = * jsonObject.getString("uuid"); assertTrue(status.equals(STR)); * System.out.println(STR + wrUuid); * * output = null; String baseInstanceUuid = data.getNsd().getInstanceUuid(); * data.setVimUuid(wrUuid); data.getNsd().setInstanceUuid(baseInstanceUuid + "-01"); * * String body = mapper.writeValueAsString(data); * * topic = STR; ServicePlatformMessage deployServiceMessage = new * ServicePlatformMessage(body, STR, topic, UUID.randomUUID().toString(), topic); * * consumer.injectMessage(deployServiceMessage); * * Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } * assertNotNull(output); int retry = 0; int maxRetry = 60; while (output.contains(STR) * output.contains(STR) && retry < maxRetry) synchronized (mon) { mon.wait(1000); retry++; * } * * System.out.println(STR); System.out.println(output); * assertTrue(STR, retry < maxRetry); DeployServiceResponse * response = mapper.readValue(output, DeployServiceResponse.class); * assertTrue(response.getRequestStatus().equals(STR)); * assertTrue(response.getNsr().getStatus() == Status.offline); * * for (VnfRecord vnfr : response.getVnfrs()) assertTrue(vnfr.getStatus() == Status.offline); * * * * * data.getNsd().setInstanceUuid(baseInstanceUuid + "-02"); output = null; * * body = mapper.writeValueAsString(data); * * topic = STR; deployServiceMessage = new * ServicePlatformMessage(body, STR, topic, UUID.randomUUID().toString(), topic); * * consumer.injectMessage(deployServiceMessage); * * Thread.sleep(2000); while (output == null) synchronized (mon) { mon.wait(1000); } * assertNotNull(output); retry = 0; while (output.contains(STR) * output.contains(STR) && retry < maxRetry) synchronized (mon) { mon.wait(1000); retry++; * } * * System.out.println(STR); System.out.println(output); * assertTrue(STR, retry < maxRetry); response = * mapper.readValue(output, DeployServiceResponse.class); * assertTrue(response.getRequestStatus().equals(STR)); * assertTrue(response.getNsr().getStatus() == Status.offline); for (VnfRecord vnfr : * response.getVnfrs()) assertTrue(vnfr.getStatus() == Status.offline); * * * * OpenStackHeatClient("143.233.127.3STRop_sonataSTRop_s0n@t@STRop_sonata"); * stackName = response.getInstanceName(); * client.deleteStack(stackName, response.getInstanceVimUuid()); * System.out.println(STR + stackName + STR + deleteStatus); * * * * message = "{\"instance_uuid\":\"STR\",\"vim_uuid\":\"STR\"}"; topic * = STR; ServicePlatformMessage removeInstanceMessage = new * ServicePlatformMessage(message, STR, topic, UUID.randomUUID().toString(), * topic); consumer.injectMessage(removeInstanceMessage); * * while (output == null) { synchronized (mon) { mon.wait(2000); System.out.println(output); } } * System.out.println(output); tokener = new JSONTokener(output); jsonObject = (JSONObject) * tokener.nextValue(); status = jsonObject.getString(STR); * assertTrue(STR + status, status.equals(STR)); * * output = null; instanceUuid = baseInstanceUuid + "-02"; message = "{\"instance_uuid\":\"STR\",\"vim_uuid\":\"STR\"}"; topic = STR; * removeInstanceMessage = new ServicePlatformMessage(message, STR, topic, * UUID.randomUUID().toString(), topic); consumer.injectMessage(removeInstanceMessage); * * while (output == null) { synchronized (mon) { mon.wait(2000); System.out.println(output); } } * System.out.println(output); tokener = new JSONTokener(output); jsonObject = (JSONObject) * tokener.nextValue(); status = jsonObject.getString(STR); * assertTrue(STR + status, status.equals(STR)); * * * * output = null; message = "{\"wr_type\":\"compute\",\"uuid\":\"STR\"}"; topic = * STR; ServicePlatformMessage removeVimMessage = new * ServicePlatformMessage(message, STR, topic, UUID.randomUUID().toString(), * topic); consumer.injectMessage(removeVimMessage); * * while (output == null) { synchronized (mon) { mon.wait(1000); } } System.out.println(output); * tokener = new JSONTokener(output); jsonObject = (JSONObject) tokener.nextValue(); status = * jsonObject.getString(STR); assertTrue(status.equals(STR)); core.stop(); * * }
/** * This test is de-activated, if you want to use it with your NFVi-PoP, please edit the addVimBody * String Member to match your OpenStack configuration and substitute the @ignore annotation with * the @test annotation * * @throws IOException */
This test is de-activated, if you want to use it with your NFVi-PoP, please edit the addVimBody String Member to match your OpenStack configuration and substitute the @ignore annotation with the @test annotation
testDeployTwoServicesOpenStack
{ "repo_name": "aw32/son-sp-infrabstract", "path": "vim-adaptor/adaptor/src/test/java/sonata/kernel/VimAdaptor/DeployServiceTest.java", "license": "apache-2.0", "size": 35569 }
[ "java.io.IOException", "java.util.UUID", "java.util.concurrent.BlockingQueue", "java.util.concurrent.LinkedBlockingQueue", "org.json.JSONObject", "org.json.JSONTokener", "org.junit.Assert" ]
import java.io.IOException; import java.util.UUID; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import org.json.JSONObject; import org.json.JSONTokener; import org.junit.Assert;
import java.io.*; import java.util.*; import java.util.concurrent.*; import org.json.*; import org.junit.*;
[ "java.io", "java.util", "org.json", "org.junit" ]
java.io; java.util; org.json; org.junit;
384,751
@Test public void builderInterfaceGenerationTest() { String builderInterfaceJavaDoc = JavaDocGen.getJavaDoc(JavaDocType.BUILDER_INTERFACE, "testGeneration1"); assertTrue(builderInterfaceJavaDoc.contains("Builder for") && builderInterfaceJavaDoc.contains(" */\n")); }
void function() { String builderInterfaceJavaDoc = JavaDocGen.getJavaDoc(JavaDocType.BUILDER_INTERFACE, STR); assertTrue(builderInterfaceJavaDoc.contains(STR) && builderInterfaceJavaDoc.contains(STR)); }
/** * This test case checks the content recieved for the builder interface ge java doc. */
This test case checks the content recieved for the builder interface ge java doc
builderInterfaceGenerationTest
{ "repo_name": "sonu283304/onos", "path": "utils/yangutils/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java", "license": "apache-2.0", "size": 6285 }
[ "org.junit.Assert", "org.onosproject.yangutils.utils.io.impl.JavaDocGen" ]
import org.junit.Assert; import org.onosproject.yangutils.utils.io.impl.JavaDocGen;
import org.junit.*; import org.onosproject.yangutils.utils.io.impl.*;
[ "org.junit", "org.onosproject.yangutils" ]
org.junit; org.onosproject.yangutils;
356,026
public JsonContentAssert isNotEqualToJson(CharSequence expected, JSONCompareMode compareMode) { String expectedJson = this.loader.getJson(expected); return assertNotPassed(compare(expectedJson, compareMode)); }
JsonContentAssert function(CharSequence expected, JSONCompareMode compareMode) { String expectedJson = this.loader.getJson(expected); return assertNotPassed(compare(expectedJson, compareMode)); }
/** * Verifies that the actual value is not equal to the specified JSON. The * {@code expected} value can contain the JSON itself or, if it ends with * {@code .json}, the name of a resource to be loaded using {@code resourceLoadClass}. * @param expected the expected JSON or the name of a resource containing the expected * JSON * @param compareMode the compare mode used when checking * @return {@code this} assertion object * @throws AssertionError if the actual JSON value is equal to the given one */
Verifies that the actual value is not equal to the specified JSON. The expected value can contain the JSON itself or, if it ends with .json, the name of a resource to be loaded using resourceLoadClass
isNotEqualToJson
{ "repo_name": "ptahchiev/spring-boot", "path": "spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java", "license": "apache-2.0", "size": 46401 }
[ "org.skyscreamer.jsonassert.JSONCompareMode" ]
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.skyscreamer.jsonassert.*;
[ "org.skyscreamer.jsonassert" ]
org.skyscreamer.jsonassert;
1,948,745
public static CmsXmlContentDefinition unmarshal(String xmlData, String schemaLocation, EntityResolver resolver) throws CmsXmlException { schemaLocation = translateSchema(schemaLocation); CmsXmlContentDefinition result = getCachedContentDefinition(schemaLocation, resolver); if (result == null) { // content definition was not found in the cache, unmarshal the XML document result = unmarshalInternal(CmsXmlUtils.unmarshalHelper(xmlData, resolver), schemaLocation, resolver); } return result; }
static CmsXmlContentDefinition function(String xmlData, String schemaLocation, EntityResolver resolver) throws CmsXmlException { schemaLocation = translateSchema(schemaLocation); CmsXmlContentDefinition result = getCachedContentDefinition(schemaLocation, resolver); if (result == null) { result = unmarshalInternal(CmsXmlUtils.unmarshalHelper(xmlData, resolver), schemaLocation, resolver); } return result; }
/** * Factory method to unmarshal (read) a XML content definition instance from a String * that contains XML data.<p> * * @param xmlData the XML data in a String * @param schemaLocation the location from which the XML schema was read (system id) * @param resolver the XML entity resolver to use * * @return a XML content definition instance unmarshalled from the byte array * * @throws CmsXmlException if something goes wrong */
Factory method to unmarshal (read) a XML content definition instance from a String that contains XML data
unmarshal
{ "repo_name": "ggiudetti/opencms-core", "path": "src/org/opencms/xml/CmsXmlContentDefinition.java", "license": "lgpl-2.1", "size": 63164 }
[ "org.xml.sax.EntityResolver" ]
import org.xml.sax.EntityResolver;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
187,166
GameProfile lookupGameProfile(String name) throws AuthenticationException;
GameProfile lookupGameProfile(String name) throws AuthenticationException;
/** * Returns the profile of the player that uses the specified username, or * null if no such a player exists. * * @param name the player's name * @return the profile of the player that uses the specified username, or * null if no such a player exists * @throws AuthenticationException if an exception occurs during requesting */
Returns the profile of the player that uses the specified username, or null if no such a player exists
lookupGameProfile
{ "repo_name": "zhoulifu/JMCCC", "path": "jmccc-yggdrasil-authenticator/src/main/java/org/to2mbn/jmccc/auth/yggdrasil/core/ProfileService.java", "license": "mit", "size": 2659 }
[ "org.to2mbn.jmccc.auth.AuthenticationException" ]
import org.to2mbn.jmccc.auth.AuthenticationException;
import org.to2mbn.jmccc.auth.*;
[ "org.to2mbn.jmccc" ]
org.to2mbn.jmccc;
2,515,972
private static Connection getPostgreSQLConnection(ImportCaseData icd) throws SQLException { return getPostgreSQLConnection(icd, icd.getPostgreSQLDbName()); }
static Connection function(ImportCaseData icd) throws SQLException { return getPostgreSQLConnection(icd, icd.getPostgreSQLDbName()); }
/** * Open the PostgreSQL database * * @param icd Import Case Data holding connection credentials * * @return returns a Connection * * @throws SQLException if unable to open */
Open the PostgreSQL database
getPostgreSQLConnection
{ "repo_name": "dgrove727/autopsy", "path": "Core/src/org/sleuthkit/autopsy/casemodule/SingleUserCaseConverter.java", "license": "apache-2.0", "size": 52290 }
[ "java.sql.Connection", "java.sql.SQLException" ]
import java.sql.Connection; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,270,367
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadDOM()); // Function was called with no parameters if (argumentCount() == 0) { il.append(methodGen.loadContextNode()); } // Function was called with node parameter else if (_paramType == Type.Node) { _param.translate(classGen, methodGen); } else if (_paramType == Type.Reference) { _param.translate(classGen, methodGen); il.append(new INVOKESTATIC(cpg.addMethodref (BASIS_LIBRARY_CLASS, "referenceToNodeSet", "(" + OBJECT_SIG + ")" + NODE_ITERATOR_SIG))); il.append(methodGen.nextNode()); } // Function was called with node-set parameter else { _param.translate(classGen, methodGen); _param.startIterator(classGen, methodGen); il.append(methodGen.nextNode()); } }
void function(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadDOM()); if (argumentCount() == 0) { il.append(methodGen.loadContextNode()); } else if (_paramType == Type.Node) { _param.translate(classGen, methodGen); } else if (_paramType == Type.Reference) { _param.translate(classGen, methodGen); il.append(new INVOKESTATIC(cpg.addMethodref (BASIS_LIBRARY_CLASS, STR, "(" + OBJECT_SIG + ")" + NODE_ITERATOR_SIG))); il.append(methodGen.nextNode()); } else { _param.translate(classGen, methodGen); _param.startIterator(classGen, methodGen); il.append(methodGen.nextNode()); } }
/** * Translate the code required for getting the node for which the * QName, local-name or namespace URI should be extracted. */
Translate the code required for getting the node for which the QName, local-name or namespace URI should be extracted
translate
{ "repo_name": "shun634501730/java_source_cn", "path": "src_en/com/sun/org/apache/xalan/internal/xsltc/compiler/NameBase.java", "license": "apache-2.0", "size": 4368 }
[ "com.sun.org.apache.bcel.internal.generic.ConstantPoolGen", "com.sun.org.apache.bcel.internal.generic.InstructionList", "com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator", "com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator", "com.sun.org.apache.xalan.internal.xsltc.co...
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; import com.sun.org.apache.bcel.internal.generic.InstructionList; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
import com.sun.org.apache.bcel.internal.generic.*; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.*;
[ "com.sun.org" ]
com.sun.org;
2,882,442
ServiceResponse<A> get200Model204NoModelDefaultError202None() throws ErrorException, IOException;
ServiceResponse<A> get200Model204NoModelDefaultError202None() throws ErrorException, IOException;
/** * Send a 202 response with no payload:. * * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the A object wrapped in {@link ServiceResponse} if successful. */
Send a 202 response with no payload:
get200Model204NoModelDefaultError202None
{ "repo_name": "brodyberg/autorest", "path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponsesOperations.java", "license": "mit", "size": 29440 }
[ "com.microsoft.rest.ServiceResponse", "java.io.IOException" ]
import com.microsoft.rest.ServiceResponse; import java.io.IOException;
import com.microsoft.rest.*; import java.io.*;
[ "com.microsoft.rest", "java.io" ]
com.microsoft.rest; java.io;
2,102,745
public void setTldExtractor(BasicTldExtractor tldExtractor) { this.tldExtractor = tldExtractor; }
void function(BasicTldExtractor tldExtractor) { this.tldExtractor = tldExtractor; }
/** * Sets the tldExtractor. * @param tldExtractor the tldExtractor. */
Sets the tldExtractor
setTldExtractor
{ "repo_name": "mbittmann/opensoc-streaming", "path": "OpenSOC-Common/src/main/java/com/opensoc/tldextractor/test/BasicTldExtractorTest.java", "license": "apache-2.0", "size": 3303 }
[ "com.opensoc.tldextractor.BasicTldExtractor" ]
import com.opensoc.tldextractor.BasicTldExtractor;
import com.opensoc.tldextractor.*;
[ "com.opensoc.tldextractor" ]
com.opensoc.tldextractor;
1,764,011
List<Weather> get(String iataCode, double radiusKm);
List<Weather> get(String iataCode, double radiusKm);
/** * Retrieve the most up to date atmospheric information from the given airport and other airports in the given * radius. */
Retrieve the most up to date atmospheric information from the given airport and other airports in the given radius
get
{ "repo_name": "victorrentea/training", "path": "kata/assignment-weather-done/src/main/java/com/crossover/trial/weather/webservice/RestWeatherQuery.java", "license": "mit", "size": 810 }
[ "com.crossover.trial.weather.domain.Weather", "java.util.List" ]
import com.crossover.trial.weather.domain.Weather; import java.util.List;
import com.crossover.trial.weather.domain.*; import java.util.*;
[ "com.crossover.trial", "java.util" ]
com.crossover.trial; java.util;
1,597,026
@Override public T visitTransbody(@NotNull PoCoParser.TransbodyContext ctx) { return visitChildren(ctx); }
@Override public T visitTransbody(@NotNull PoCoParser.TransbodyContext ctx) { return visitChildren(ctx); }
/** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */
The default implementation returns the result of calling <code>#visitChildren</code> on ctx
visitTransaction
{ "repo_name": "Corjuh/PoCoScanner", "path": "src/main/java/com/coryjuhlin/pocoscanner/antlr/PoCoParserBaseVisitor.java", "license": "gpl-3.0", "size": 13743 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
2,345,069
public Country getCountryV6(String ipAddress) { InetAddress addr; try { addr = Inet6Address.getByName(ipAddress); } catch (UnknownHostException e) { return UNKNOWN_COUNTRY; } return getCountryV6(addr); }
Country function(String ipAddress) { InetAddress addr; try { addr = Inet6Address.getByName(ipAddress); } catch (UnknownHostException e) { return UNKNOWN_COUNTRY; } return getCountryV6(addr); }
/** * Returns the country the IP address is in. * * @param ipAddress String version of an IPv6 address, i.e. "::127.0.0.1" * @return the country the IP address is from. */
Returns the country the IP address is in
getCountryV6
{ "repo_name": "molindo/maxmind-geoip", "path": "src/main/java/at/molindo/thirdparty/com/maxmind/geoip/LookupService.java", "license": "lgpl-2.1", "size": 44501 }
[ "java.net.Inet6Address", "java.net.InetAddress", "java.net.UnknownHostException" ]
import java.net.Inet6Address; import java.net.InetAddress; import java.net.UnknownHostException;
import java.net.*;
[ "java.net" ]
java.net;
1,288,497
private void runInBackground(Runnable r) { ExecutorService es = Executors.newSingleThreadExecutor(); Future<?> f = es.submit(r); try { Object obj = f.get(2, TimeUnit.SECONDS); Assert.assertNull(obj); } catch (InterruptedException e) { e.printStackTrace(); fail(e.getMessage()); } catch (ExecutionException e) { e.printStackTrace(); fail(e.getMessage()); } catch (TimeoutException e) { // e.printStackTrace(); // do nothing here. } }
void function(Runnable r) { ExecutorService es = Executors.newSingleThreadExecutor(); Future<?> f = es.submit(r); try { Object obj = f.get(2, TimeUnit.SECONDS); Assert.assertNull(obj); } catch (InterruptedException e) { e.printStackTrace(); fail(e.getMessage()); } catch (ExecutionException e) { e.printStackTrace(); fail(e.getMessage()); } catch (TimeoutException e) { } }
/** * Run the runnable r in the background. * * @param r */
Run the runnable r in the background
runInBackground
{ "repo_name": "domiyang/sus", "path": "src/test/java/com/dmb/tools/sus/SocketUtilAppTest.java", "license": "apache-2.0", "size": 16829 }
[ "java.util.concurrent.ExecutionException", "java.util.concurrent.ExecutorService", "java.util.concurrent.Executors", "java.util.concurrent.Future", "java.util.concurrent.TimeUnit", "java.util.concurrent.TimeoutException", "org.junit.Assert" ]
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.junit.Assert;
import java.util.concurrent.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,133,447
public List<MarketOrdersResponse> getMarketsRegionIdOrders(String orderType, Integer regionId, String datasource, String ifNoneMatch, Integer page, Integer typeId) throws ApiException { ApiResponse<List<MarketOrdersResponse>> localVarResp = getMarketsRegionIdOrdersWithHttpInfo(orderType, regionId, datasource, ifNoneMatch, page, typeId); return localVarResp.getData(); }
List<MarketOrdersResponse> function(String orderType, Integer regionId, String datasource, String ifNoneMatch, Integer page, Integer typeId) throws ApiException { ApiResponse<List<MarketOrdersResponse>> localVarResp = getMarketsRegionIdOrdersWithHttpInfo(orderType, regionId, datasource, ifNoneMatch, page, typeId); return localVarResp.getData(); }
/** * List orders in a region Return a list of orders in a region --- This * route is cached for up to 300 seconds * * @param orderType * Filter buy/sell orders, return all orders by default. If you * query without type_id, we always return both buy and sell * orders (required) * @param regionId * Return orders in this region (required) * @param datasource * The server name you would like data from (optional, default to * tranquility) * @param ifNoneMatch * ETag from a previous request. A 304 will be returned if this * matches the current ETag (optional) * @param page * Which page of results to return (optional, default to 1) * @param typeId * Return orders only for this type (optional) * @return List&lt;MarketOrdersResponse&gt; * @throws ApiException * If fail to call the API, e.g. server error or cannot * deserialize the response body * @http.response.details <table summary="Response Details" border="1"> * <tr> * <td>Status Code</td> * <td>Description</td> * <td>Response Headers</td> * </tr> * <tr> * <td>200</td> * <td>A list of orders</td> * <td>Cache-Control - The caching mechanism used <br> * ETag - RFC7232 compliant entity tag <br> * Expires - RFC7231 formatted datetime string <br> * Last-Modified - RFC7231 formatted datetime string * <br> * X-Pages - Maximum page number <br> * </td> * </tr> * <tr> * <td>304</td> * <td>Not modified</td> * <td>Cache-Control - The caching mechanism used <br> * ETag - RFC7232 compliant entity tag <br> * Expires - RFC7231 formatted datetime string <br> * Last-Modified - RFC7231 formatted datetime string * <br> * </td> * </tr> * <tr> * <td>400</td> * <td></td> * <td>-</td> * </tr> * <tr> * <td>401</td> * <td></td> * <td>-</td> * </tr> * <tr> * <td>403</td> * <td></td> * <td>-</td> * </tr> * <tr> * <td>404</td> * <td></td> * <td>-</td> * </tr> * <tr> * <td>420</td> * <td></td> * <td>-</td> * </tr> * <tr> * <td>422</td> * <td></td> * <td>-</td> * </tr> * <tr> * <td>500</td> * <td></td> * <td>-</td> * </tr> * <tr> * <td>502</td> * <td></td> * <td>-</td> * </tr> * <tr> * <td>503</td> * <td></td> * <td>-</td> * </tr> * <tr> * <td>504</td> * <td></td> * <td>-</td> * </tr> * <tr> * <td>520</td> * <td></td> * <td>-</td> * </tr> * </table> */
List orders in a region Return a list of orders in a region --- This route is cached for up to 300 seconds
getMarketsRegionIdOrders
{ "repo_name": "burberius/eve-esi", "path": "src/main/java/net/troja/eve/esi/api/MarketApi.java", "license": "apache-2.0", "size": 251369 }
[ "java.util.List", "net.troja.eve.esi.ApiException", "net.troja.eve.esi.ApiResponse", "net.troja.eve.esi.model.MarketOrdersResponse" ]
import java.util.List; import net.troja.eve.esi.ApiException; import net.troja.eve.esi.ApiResponse; import net.troja.eve.esi.model.MarketOrdersResponse;
import java.util.*; import net.troja.eve.esi.*; import net.troja.eve.esi.model.*;
[ "java.util", "net.troja.eve" ]
java.util; net.troja.eve;
2,122,948
@Override public final PArray optArray(final String key) { return optJSONArray(key); }
final PArray function(final String key) { return optJSONArray(key); }
/** * Get a property as a array or null. * @param key the property name */
Get a property as a array or null
optArray
{ "repo_name": "tsauerwein/mapfish-print", "path": "core/src/main/java/org/mapfish/print/wrapper/json/PJsonObject.java", "license": "mit", "size": 7533 }
[ "org.mapfish.print.wrapper.PArray" ]
import org.mapfish.print.wrapper.PArray;
import org.mapfish.print.wrapper.*;
[ "org.mapfish.print" ]
org.mapfish.print;
1,623,653
EClass getJoinNode();
EClass getJoinNode();
/** * Returns the meta object for class '{@link activitydiagram.JoinNode <em>Join Node</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Join Node</em>'. * @see activitydiagram.JoinNode * @generated */
Returns the meta object for class '<code>activitydiagram.JoinNode Join Node</code>'.
getJoinNode
{ "repo_name": "gemoc/activitydiagram", "path": "dev/gemoc_sequential/language_workbench/org.gemoc.activitydiagram.sequential.model/src/activitydiagram/ActivitydiagramPackage.java", "license": "epl-1.0", "size": 91129 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,770,900
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>POST</code> method
doPost
{ "repo_name": "KurtDC6794/BomGosto", "path": "src/java/controller/GerenciarMenu.java", "license": "gpl-3.0", "size": 7188 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
1,817,509
public void addTransport(Transport transport) { Objects.requireNonNull(transport); transports.add(transport); if (isRunning.compareAndSet(false, true)) { if (thread == null) { thread = threadFactory.newThread(this); } thread.start(); while (!started.compareAndSet(true, true)) ; } }
void function(Transport transport) { Objects.requireNonNull(transport); transports.add(transport); if (isRunning.compareAndSet(false, true)) { if (thread == null) { thread = threadFactory.newThread(this); } thread.start(); while (!started.compareAndSet(true, true)) ; } }
/** * Adds a Transport to dispatch its messages If the dispatcher thread has not yet been started, * this Dispatcher is started synchronously. * * @param transport * a Transport */
Adds a Transport to dispatch its messages If the dispatcher thread has not yet been started, this Dispatcher is started synchronously
addTransport
{ "repo_name": "FIXTradingCommunity/silverflash", "path": "silverflash-core/src/main/java/io/fixprotocol/silverflash/transport/Dispatcher.java", "license": "apache-2.0", "size": 3788 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
1,155,909
@Override public void doPostAddAssociation(String associationName, String workflowId, String eventId, String condition) throws WorkflowException { String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); if (StringUtils.isBlank(loggedInUser)) { loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME; } String auditData = "\"" + "Association Name" + "\" : \"" + associationName + "\",\"" + "Workflow ID" + "\" : \"" + workflowId + "\",\"" + "Event ID" + "\" : \"" + eventId + "\",\"" + "Condition" + "\" : \"" + condition + "\""; AUDIT_LOG.info(String.format(AUDIT_MESSAGE, loggedInUser, "Add Association", auditData, AUDIT_SUCCESS)); }
void function(String associationName, String workflowId, String eventId, String condition) throws WorkflowException { String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); if (StringUtils.isBlank(loggedInUser)) { loggedInUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME; } String auditData = "\"STRAssociation NameSTR\STRSTR\",\"STRWorkflow IDSTR\STRSTR\",\"STREvent IDSTR\STRSTR\",\"STRConditionSTR\STRSTR\STRAdd Association", auditData, AUDIT_SUCCESS)); }
/** * Trigger after adding a association * * @param associationName * @param workflowId * @param eventId * @param condition * @throws WorkflowException */
Trigger after adding a association
doPostAddAssociation
{ "repo_name": "thariyarox/carbon-identity", "path": "components/workflow-mgt/org.wso2.carbon.identity.workflow.mgt/src/main/java/org/wso2/carbon/identity/workflow/mgt/listener/WorkflowAuditLogger.java", "license": "apache-2.0", "size": 6610 }
[ "org.apache.commons.lang.StringUtils", "org.wso2.carbon.CarbonConstants", "org.wso2.carbon.context.PrivilegedCarbonContext", "org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException" ]
import org.apache.commons.lang.StringUtils; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.workflow.mgt.exception.WorkflowException;
import org.apache.commons.lang.*; import org.wso2.carbon.*; import org.wso2.carbon.context.*; import org.wso2.carbon.identity.workflow.mgt.exception.*;
[ "org.apache.commons", "org.wso2.carbon" ]
org.apache.commons; org.wso2.carbon;
2,672,407
public java.util.List<fr.lip6.move.pnml.hlpn.lists.hlapi.LengthHLAPI> getSubterm_lists_LengthHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.lists.hlapi.LengthHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.lists.hlapi.LengthHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.lists.impl.LengthImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.lists.hlapi.LengthHLAPI( (fr.lip6.move.pnml.hlpn.lists.Length)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.lists.hlapi.LengthHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.lists.hlapi.LengthHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.lists.hlapi.LengthHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.lists.impl.LengthImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.lists.hlapi.LengthHLAPI( (fr.lip6.move.pnml.hlpn.lists.Length)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of LengthHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of LengthHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_lists_LengthHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/strings/hlapi/LessThanOrEqualHLAPI.java", "license": "epl-1.0", "size": 108661 }
[ "fr.lip6.move.pnml.hlpn.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
2,815,413
private double computeScore( RelNode factRel, RelNode dimRel, SemiJoin semiJoin) { // Estimate savings as a result of applying semijoin filter on fact // table. As a heuristic, the selectivity of the semijoin needs to // be less than half. There may be instances where an even smaller // selectivity value is required because of the overhead of // index lookups on a very large fact table. Half was chosen as // a middle ground based on testing that was done with a large // data set. final ImmutableBitSet dimCols = ImmutableBitSet.of(semiJoin.getRightKeys()); final double selectivity = RelMdUtil.computeSemiJoinSelectivity(mq, factRel, dimRel, semiJoin); if (selectivity > .5) { return 0; } final RelOptCost factCost = mq.getCumulativeCost(factRel); // if not enough information, return a low score if (factCost == null) { return 0; } double savings = (1.0 - Math.sqrt(selectivity)) * Math.max(1.0, factCost.getRows()); // Additional savings if the dimension columns are unique. We can // ignore nulls since they will be filtered out by the semijoin. boolean uniq = RelMdUtil.areColumnsDefinitelyUniqueWhenNullsFiltered(mq, dimRel, dimCols); if (uniq) { savings *= 2.0; } // compute the cost of doing an extra scan on the dimension table, // including the distinct sort on top of the scan; if the dimension // columns are already unique, no need to add on the dup removal cost final Double dimSortCost = mq.getRowCount(dimRel); final Double dupRemCost = uniq ? 0 : dimSortCost; final RelOptCost dimCost = mq.getCumulativeCost(dimRel); if ((dimSortCost == null) || (dupRemCost == null) || (dimCost == null)) { return 0; } Double dimRows = dimCost.getRows(); if (dimRows < 1.0) { dimRows = 1.0; } return savings / dimRows; }
double function( RelNode factRel, RelNode dimRel, SemiJoin semiJoin) { final ImmutableBitSet dimCols = ImmutableBitSet.of(semiJoin.getRightKeys()); final double selectivity = RelMdUtil.computeSemiJoinSelectivity(mq, factRel, dimRel, semiJoin); if (selectivity > .5) { return 0; } final RelOptCost factCost = mq.getCumulativeCost(factRel); if (factCost == null) { return 0; } double savings = (1.0 - Math.sqrt(selectivity)) * Math.max(1.0, factCost.getRows()); boolean uniq = RelMdUtil.areColumnsDefinitelyUniqueWhenNullsFiltered(mq, dimRel, dimCols); if (uniq) { savings *= 2.0; } final Double dimSortCost = mq.getRowCount(dimRel); final Double dupRemCost = uniq ? 0 : dimSortCost; final RelOptCost dimCost = mq.getCumulativeCost(dimRel); if ((dimSortCost == null) (dupRemCost == null) (dimCost == null)) { return 0; } Double dimRows = dimCost.getRows(); if (dimRows < 1.0) { dimRows = 1.0; } return savings / dimRows; }
/** * Computes a score relevant to applying a set of semijoins on a fact table. * The higher the score, the better. * * @param factRel fact table being filtered * @param dimRel dimension table that participates in semijoin * @param semiJoin semijoin between fact and dimension tables * * @return computed score of applying the dimension table filters on the * fact table */
Computes a score relevant to applying a set of semijoins on a fact table. The higher the score, the better
computeScore
{ "repo_name": "sreev/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/rel/rules/LoptSemiJoinOptimizer.java", "license": "apache-2.0", "size": 29760 }
[ "org.apache.calcite.plan.RelOptCost", "org.apache.calcite.rel.RelNode", "org.apache.calcite.rel.core.SemiJoin", "org.apache.calcite.rel.metadata.RelMdUtil", "org.apache.calcite.util.ImmutableBitSet" ]
import org.apache.calcite.plan.RelOptCost; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.core.SemiJoin; import org.apache.calcite.rel.metadata.RelMdUtil; import org.apache.calcite.util.ImmutableBitSet;
import org.apache.calcite.plan.*; import org.apache.calcite.rel.*; import org.apache.calcite.rel.core.*; import org.apache.calcite.rel.metadata.*; import org.apache.calcite.util.*;
[ "org.apache.calcite" ]
org.apache.calcite;
2,767,241
@Ignore @Test public void testManualCancelOnFailure() throws Exception { // Test propagation of KILLED status to embedded flows different branch EventCollectorListener eventCollector = new EventCollectorListener(); FlowRunner runner = createFlowRunner(eventCollector, "jobf"); ExecutableFlow flow = runner.getExecutableFlow(); Map<String, Status> expectedStateMap = new HashMap<String, Status>(); Map<String, ExecutableNode> nodeMap = new HashMap<String, ExecutableNode>(); // 1. START FLOW createExpectedStateMap(flow, expectedStateMap, nodeMap); Thread thread = runFlowRunnerInThread(runner); pause(250); // After it starts up, only joba should be running expectedStateMap.put("joba", Status.RUNNING); expectedStateMap.put("joba1", Status.RUNNING); compareStates(expectedStateMap, nodeMap); // 2. JOB in subflow FAILS InteractiveTestJob.getTestJob("joba").succeedJob(); pause(250); expectedStateMap.put("joba", Status.SUCCEEDED); expectedStateMap.put("jobb", Status.RUNNING); expectedStateMap.put("jobc", Status.RUNNING); expectedStateMap.put("jobd", Status.RUNNING); expectedStateMap.put("jobb:innerJobA", Status.RUNNING); expectedStateMap.put("jobd:innerJobA", Status.RUNNING); compareStates(expectedStateMap, nodeMap); InteractiveTestJob.getTestJob("joba1").succeedJob(); InteractiveTestJob.getTestJob("jobb:innerJobA").succeedJob(); pause(250); expectedStateMap.put("jobb:innerJobA", Status.SUCCEEDED); expectedStateMap.put("joba1", Status.SUCCEEDED); expectedStateMap.put("jobb:innerJobB", Status.RUNNING); expectedStateMap.put("jobb:innerJobC", Status.RUNNING); compareStates(expectedStateMap, nodeMap); InteractiveTestJob.getTestJob("jobb:innerJobB").failJob(); pause(250); expectedStateMap.put("jobb:innerJobB", Status.FAILED); expectedStateMap.put("jobb", Status.FAILED_FINISHING); Assert.assertEquals(Status.FAILED_FINISHING, flow.getStatus()); compareStates(expectedStateMap, nodeMap); runner.kill("me"); pause(1000); expectedStateMap.put("jobb", Status.FAILED); expectedStateMap.put("jobb:innerJobC", Status.KILLED); expectedStateMap.put("jobb:innerFlow", Status.CANCELLED); expectedStateMap.put("jobc", Status.KILLED); expectedStateMap.put("jobd", Status.KILLED); expectedStateMap.put("jobd:innerJobA", Status.KILLED); expectedStateMap.put("jobd:innerFlow2", Status.CANCELLED); expectedStateMap.put("jobe", Status.CANCELLED); expectedStateMap.put("jobf", Status.CANCELLED); Assert.assertEquals(Status.KILLED, flow.getStatus()); compareStates(expectedStateMap, nodeMap); Assert.assertFalse(thread.isAlive()); }
@Ignore void function() throws Exception { EventCollectorListener eventCollector = new EventCollectorListener(); FlowRunner runner = createFlowRunner(eventCollector, "jobf"); ExecutableFlow flow = runner.getExecutableFlow(); Map<String, Status> expectedStateMap = new HashMap<String, Status>(); Map<String, ExecutableNode> nodeMap = new HashMap<String, ExecutableNode>(); createExpectedStateMap(flow, expectedStateMap, nodeMap); Thread thread = runFlowRunnerInThread(runner); pause(250); expectedStateMap.put("joba", Status.RUNNING); expectedStateMap.put("joba1", Status.RUNNING); compareStates(expectedStateMap, nodeMap); InteractiveTestJob.getTestJob("joba").succeedJob(); pause(250); expectedStateMap.put("joba", Status.SUCCEEDED); expectedStateMap.put("jobb", Status.RUNNING); expectedStateMap.put("jobc", Status.RUNNING); expectedStateMap.put("jobd", Status.RUNNING); expectedStateMap.put(STR, Status.RUNNING); expectedStateMap.put(STR, Status.RUNNING); compareStates(expectedStateMap, nodeMap); InteractiveTestJob.getTestJob("joba1").succeedJob(); InteractiveTestJob.getTestJob(STR).succeedJob(); pause(250); expectedStateMap.put(STR, Status.SUCCEEDED); expectedStateMap.put("joba1", Status.SUCCEEDED); expectedStateMap.put(STR, Status.RUNNING); expectedStateMap.put(STR, Status.RUNNING); compareStates(expectedStateMap, nodeMap); InteractiveTestJob.getTestJob(STR).failJob(); pause(250); expectedStateMap.put(STR, Status.FAILED); expectedStateMap.put("jobb", Status.FAILED_FINISHING); Assert.assertEquals(Status.FAILED_FINISHING, flow.getStatus()); compareStates(expectedStateMap, nodeMap); runner.kill("me"); pause(1000); expectedStateMap.put("jobb", Status.FAILED); expectedStateMap.put(STR, Status.KILLED); expectedStateMap.put(STR, Status.CANCELLED); expectedStateMap.put("jobc", Status.KILLED); expectedStateMap.put("jobd", Status.KILLED); expectedStateMap.put(STR, Status.KILLED); expectedStateMap.put(STR, Status.CANCELLED); expectedStateMap.put("jobe", Status.CANCELLED); expectedStateMap.put("jobf", Status.CANCELLED); Assert.assertEquals(Status.KILLED, flow.getStatus()); compareStates(expectedStateMap, nodeMap); Assert.assertFalse(thread.isAlive()); }
/** * Tests the manual invocation of cancel on a flow that is FAILED_FINISHING * * @throws Exception */
Tests the manual invocation of cancel on a flow that is FAILED_FINISHING
testManualCancelOnFailure
{ "repo_name": "mariacioffi/azkaban", "path": "azkaban-exec-server/src/test/java/azkaban/execapp/FlowRunnerTest2.java", "license": "apache-2.0", "size": 57868 }
[ "java.util.HashMap", "java.util.Map", "org.junit.Assert", "org.junit.Ignore" ]
import java.util.HashMap; import java.util.Map; import org.junit.Assert; import org.junit.Ignore;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,965,772
protected void preShow() { if (mRootView == null) throw new IllegalStateException( "setContentView was not called with a view to display."); onShow(); if (mBackground == null) mWindow.setBackgroundDrawable(new BitmapDrawable()); else mWindow.setBackgroundDrawable(mBackground); mWindow.setWidth(LayoutParams.WRAP_CONTENT); mWindow.setHeight(LayoutParams.WRAP_CONTENT); mWindow.setTouchable(true); mWindow.setFocusable(true); mWindow.setOutsideTouchable(true); mWindow.setContentView(mRootView); }
void function() { if (mRootView == null) throw new IllegalStateException( STR); onShow(); if (mBackground == null) mWindow.setBackgroundDrawable(new BitmapDrawable()); else mWindow.setBackgroundDrawable(mBackground); mWindow.setWidth(LayoutParams.WRAP_CONTENT); mWindow.setHeight(LayoutParams.WRAP_CONTENT); mWindow.setTouchable(true); mWindow.setFocusable(true); mWindow.setOutsideTouchable(true); mWindow.setContentView(mRootView); }
/** * On pre show */
On pre show
preShow
{ "repo_name": "harism/android_lucidchat", "path": "src/fi/harism/lucidchat/quickaction/PopupWindows.java", "license": "apache-2.0", "size": 3009 }
[ "android.graphics.drawable.BitmapDrawable", "android.view.ViewGroup" ]
import android.graphics.drawable.BitmapDrawable; import android.view.ViewGroup;
import android.graphics.drawable.*; import android.view.*;
[ "android.graphics", "android.view" ]
android.graphics; android.view;
264,785
int getIdByBuddyName(String buddy) throws SQLException;
int getIdByBuddyName(String buddy) throws SQLException;
/** * liefert die zum uebergebenen Buddyname gehoerende id. * * @param buddy Buuddyname * * @return die zum uebergebenen Buddynamen gehoerende ID. Falls der Buddyname nicht existiert, dann wird 1 * zurueckgegeben. * * @throws SQLException DOCUMENT ME! */
liefert die zum uebergebenen Buddyname gehoerende id
getIdByBuddyName
{ "repo_name": "cismet/time-tracker", "path": "src/main/java/de/cismet/web/timetracker/DatabaseInterface.java", "license": "lgpl-3.0", "size": 8294 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,740,678
void drawCircle(Object parent, String name, Coordinate position, double radius, ShapeStyle style);
void drawCircle(Object parent, String name, Coordinate position, double radius, ShapeStyle style);
/** * Draw a circle on the <code>GraphicsContext</code>. * * @param parent * parent group object * @param name * The circle's name. * @param position * The center position as a coordinate. * @param radius * The circle's radius. * @param style * The styling object by which the circle should be drawn. */
Draw a circle on the <code>GraphicsContext</code>
drawCircle
{ "repo_name": "olivermay/geomajas", "path": "face/geomajas-face-gwt/client/src/main/java/org/geomajas/gwt/client/gfx/GraphicsContext.java", "license": "agpl-3.0", "size": 15079 }
[ "org.geomajas.geometry.Coordinate", "org.geomajas.gwt.client.gfx.style.ShapeStyle" ]
import org.geomajas.geometry.Coordinate; import org.geomajas.gwt.client.gfx.style.ShapeStyle;
import org.geomajas.geometry.*; import org.geomajas.gwt.client.gfx.style.*;
[ "org.geomajas.geometry", "org.geomajas.gwt" ]
org.geomajas.geometry; org.geomajas.gwt;
389,862
private static Optional<String> extractWearApkName(ModuleEntry wearApkDescriptionXmlEntry) { XmlProtoNode root; try (InputStream content = wearApkDescriptionXmlEntry.getContent().openStream()) { root = new XmlProtoNode(XmlNode.parseFrom(content)); } catch (InvalidProtocolBufferException e) { throw InvalidBundleException.builder() .withCause(e) .withUserMessage( "The wear APK description file '%s' could not be parsed.", wearApkDescriptionXmlEntry.getPath()) .build(); } catch (IOException e) { throw new UncheckedIOException( String.format( "An unexpected error occurred while reading APK description file '%s'.", wearApkDescriptionXmlEntry.getPath()), e); } // If the Wear APK is unbundled, there is nothing to find. if (root.getElement().getOptionalChildElement("unbundled").isPresent()) { return Optional.empty(); } // If 'unbundled' is not present, then 'rawPathResId' must be. Optional<XmlProtoElement> rawPathResId = root.getElement().getOptionalChildElement("rawPathResId"); if (!rawPathResId.isPresent()) { throw InvalidBundleException.builder() .withUserMessage( "The wear APK description file '%s' does not contain 'unbundled' or 'rawPathResId'.", wearApkDescriptionXmlEntry.getPath()) .build(); } return Optional.of(rawPathResId.get().getChildText().get().getText()); } private WearApkLocator() {}
static Optional<String> function(ModuleEntry wearApkDescriptionXmlEntry) { XmlProtoNode root; try (InputStream content = wearApkDescriptionXmlEntry.getContent().openStream()) { root = new XmlProtoNode(XmlNode.parseFrom(content)); } catch (InvalidProtocolBufferException e) { throw InvalidBundleException.builder() .withCause(e) .withUserMessage( STR, wearApkDescriptionXmlEntry.getPath()) .build(); } catch (IOException e) { throw new UncheckedIOException( String.format( STR, wearApkDescriptionXmlEntry.getPath()), e); } if (root.getElement().getOptionalChildElement(STR).isPresent()) { return Optional.empty(); } Optional<XmlProtoElement> rawPathResId = root.getElement().getOptionalChildElement(STR); if (!rawPathResId.isPresent()) { throw InvalidBundleException.builder() .withUserMessage( STR, wearApkDescriptionXmlEntry.getPath()) .build(); } return Optional.of(rawPathResId.get().getChildText().get().getText()); } private WearApkLocator() {}
/** * Parses the XML description file for the name of the wear APK. * * <p>According to * https://developer.android.com/training/wearables/apps/packaging#PackageManually, it is the * value inside the tag <rawPathResId>. */
Parses the XML description file for the name of the wear APK. According to HREF it is the value inside the tag
extractWearApkName
{ "repo_name": "google/bundletool", "path": "src/main/java/com/android/tools/build/bundletool/model/WearApkLocator.java", "license": "apache-2.0", "size": 7517 }
[ "com.android.aapt.Resources", "com.android.tools.build.bundletool.model.exceptions.InvalidBundleException", "com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoElement", "com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoNode", "com.google.protobuf.InvalidProtocolBufferException",...
import com.android.aapt.Resources; import com.android.tools.build.bundletool.model.exceptions.InvalidBundleException; import com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoElement; import com.android.tools.build.bundletool.model.utils.xmlproto.XmlProtoNode; import com.google.protobuf.InvalidProtocolBufferException; import java.io.IOException; import java.io.InputStream; import java.io.UncheckedIOException; import java.util.Optional;
import com.android.aapt.*; import com.android.tools.build.bundletool.model.exceptions.*; import com.android.tools.build.bundletool.model.utils.xmlproto.*; import com.google.protobuf.*; import java.io.*; import java.util.*;
[ "com.android.aapt", "com.android.tools", "com.google.protobuf", "java.io", "java.util" ]
com.android.aapt; com.android.tools; com.google.protobuf; java.io; java.util;
2,066,642
void onLongPress(int pointerCount); } private OnTapListener mListener; private Handler mHandler; private int mPointerCount = 0; private SparseArray<PointF> mInitialPositions = new SparseArray<PointF>(); private int mTouchSlopSquare; private boolean mTapCancelled = false;
void onLongPress(int pointerCount); } private OnTapListener mListener; private Handler mHandler; private int mPointerCount = 0; private SparseArray<PointF> mInitialPositions = new SparseArray<PointF>(); private int mTouchSlopSquare; private boolean mTapCancelled = false;
/** * Notified when a long-touch event occurs. * * @param pointerCount The number of fingers held down. */
Notified when a long-touch event occurs
onLongPress
{ "repo_name": "7kbird/chrome", "path": "remoting/android/java/src/org/chromium/chromoting/TapGestureDetector.java", "license": "bsd-3-clause", "size": 6646 }
[ "android.graphics.PointF", "android.os.Handler", "android.util.SparseArray" ]
import android.graphics.PointF; import android.os.Handler; import android.util.SparseArray;
import android.graphics.*; import android.os.*; import android.util.*;
[ "android.graphics", "android.os", "android.util" ]
android.graphics; android.os; android.util;
1,622,487
@Override public void setMessageSource(MessageSource messageSource) { this.messageSource = messageSource; }
void function(MessageSource messageSource) { this.messageSource = messageSource; }
/** * Set the message source. * @param messageSource the message source */
Set the message source
setMessageSource
{ "repo_name": "fjlopez/spring-boot", "path": "spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java", "license": "apache-2.0", "size": 11126 }
[ "org.springframework.context.MessageSource" ]
import org.springframework.context.MessageSource;
import org.springframework.context.*;
[ "org.springframework.context" ]
org.springframework.context;
1,630,941
private String getStylesheetFileName(Source source) { String systemId = source.getSystemId(); if (systemId != null) { File file = new File(systemId); if (file.exists()) return systemId; else { URL url = null; try { url = new URL(systemId); } catch (MalformedURLException e) { return null; } if ("file".equals(url.getProtocol())) return url.getFile(); else return null; } } else return null; }
String function(Source source) { String systemId = source.getSystemId(); if (systemId != null) { File file = new File(systemId); if (file.exists()) return systemId; else { URL url = null; try { url = new URL(systemId); } catch (MalformedURLException e) { return null; } if ("file".equals(url.getProtocol())) return url.getFile(); else return null; } } else return null; }
/** * Return the local file name from the systemId of the Source object * * @param source The Source * @return The file name in the local filesystem, or null if the * systemId does not represent a local file. */
Return the local file name from the systemId of the Source object
getStylesheetFileName
{ "repo_name": "openjdk/jdk7u", "path": "jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java", "license": "gpl-2.0", "size": 59477 }
[ "java.io.File", "java.net.MalformedURLException", "javax.xml.transform.Source" ]
import java.io.File; import java.net.MalformedURLException; import javax.xml.transform.Source;
import java.io.*; import java.net.*; import javax.xml.transform.*;
[ "java.io", "java.net", "javax.xml" ]
java.io; java.net; javax.xml;
1,325,235
public TelemetryClientClientBuilder iamCredentials(AWSCredentialsProvider iamCredentials) { setIamCredentials(iamCredentials); return this; }
TelemetryClientClientBuilder function(AWSCredentialsProvider iamCredentials) { setIamCredentials(iamCredentials); return this; }
/** * Specify an implementation of {@link AWSCredentialsProvider} to be used when signing IAM auth'd requests * * @param iamCredentials * the credential provider * @return This object for method chaining. */
Specify an implementation of <code>AWSCredentialsProvider</code> to be used when signing IAM auth'd requests
iamCredentials
{ "repo_name": "aws/aws-toolkit-eclipse", "path": "bundles/com.amazonaws.eclipse.core/src/software/amazon/awssdk/services/toolkittelemetry/TelemetryClientClientBuilder.java", "license": "apache-2.0", "size": 4284 }
[ "com.amazonaws.auth.AWSCredentialsProvider" ]
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.*;
[ "com.amazonaws.auth" ]
com.amazonaws.auth;
2,221,412
@Test public void testFsckError() throws Exception { // bring up a one-node cluster cluster = new MiniDFSCluster.Builder(conf).build(); String fileName = "/test.txt"; Path filePath = new Path(fileName); FileSystem fs = cluster.getFileSystem(); // create a one-block file DFSTestUtil.createFile(fs, filePath, 1L, (short)1, 1L); DFSTestUtil.waitReplication(fs, filePath, (short)1); // intentionally corrupt NN data structure INodeFile node = (INodeFile) cluster.getNamesystem().dir.getINode( fileName, DirOp.READ); final BlockInfo[] blocks = node.getBlocks(); assertEquals(blocks.length, 1); blocks[0].setNumBytes(-1L); // set the block length to be negative // run fsck and expect a failure with -1 as the error code String outStr = runFsck(conf, -1, true, fileName); System.out.println(outStr); assertTrue(outStr.contains(NamenodeFsck.FAILURE_STATUS)); // clean up file system fs.delete(filePath, true); }
void function() throws Exception { cluster = new MiniDFSCluster.Builder(conf).build(); String fileName = STR; Path filePath = new Path(fileName); FileSystem fs = cluster.getFileSystem(); DFSTestUtil.createFile(fs, filePath, 1L, (short)1, 1L); DFSTestUtil.waitReplication(fs, filePath, (short)1); INodeFile node = (INodeFile) cluster.getNamesystem().dir.getINode( fileName, DirOp.READ); final BlockInfo[] blocks = node.getBlocks(); assertEquals(blocks.length, 1); blocks[0].setNumBytes(-1L); String outStr = runFsck(conf, -1, true, fileName); System.out.println(outStr); assertTrue(outStr.contains(NamenodeFsck.FAILURE_STATUS)); fs.delete(filePath, true); }
/** Test if fsck can return -1 in case of failure. * * @throws Exception */
Test if fsck can return -1 in case of failure
testFsckError
{ "repo_name": "jaypatil/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFsck.java", "license": "gpl-3.0", "size": 80741 }
[ "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hdfs.DFSTestUtil", "org.apache.hadoop.hdfs.MiniDFSCluster", "org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo", "org.apache.hadoop.hdfs.server.namenode.FSDirectory", "org.junit.Assert" ]
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DFSTestUtil; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo; import org.apache.hadoop.hdfs.server.namenode.FSDirectory; import org.junit.Assert;
import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.server.blockmanagement.*; import org.apache.hadoop.hdfs.server.namenode.*; import org.junit.*;
[ "org.apache.hadoop", "org.junit" ]
org.apache.hadoop; org.junit;
2,243,811
public static boolean createRecestGeometryList(JSONObject pJsonObject) throws JSONException, org.json.JSONException{ JSONArray features = pJsonObject.getJSONArray(mFeatures); System.out.println("Response: create geometry list by agol" ); mPolygonList = new HashMap<String,JSONObject>(); for(int i = 0 ; i < features.length();i++){ mPolygonList.put(features.getJSONObject(i).getJSONObject(mAttributes) .getString(mPramMap.get(PramKey_uniqField)), features.getJSONObject(i)); } return true; }
static boolean function(JSONObject pJsonObject) throws JSONException, org.json.JSONException{ JSONArray features = pJsonObject.getJSONArray(mFeatures); System.out.println(STR ); mPolygonList = new HashMap<String,JSONObject>(); for(int i = 0 ; i < features.length();i++){ mPolygonList.put(features.getJSONObject(i).getJSONObject(mAttributes) .getString(mPramMap.get(PramKey_uniqField)), features.getJSONObject(i)); } return true; }
/** * create geometry list * attribures:FID,colectionpoint * geometry:xy * @throws org.json.JSONException * */
create geometry list attribures:FID,colectionpoint geometry:xy
createRecestGeometryList
{ "repo_name": "wakanasato/resas2arcgis", "path": "src/com/esrij/rest/jaxrs/IndexAction.java", "license": "apache-2.0", "size": 18595 }
[ "java.util.HashMap", "org.json.JSONArray", "org.json.JSONException", "org.json.JSONObject" ]
import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject;
import java.util.*; import org.json.*;
[ "java.util", "org.json" ]
java.util; org.json;
893,840
public boolean tieneAlgunaExencion(List<Exencion> listExencion, Date fecha) throws Exception { String funcName = "tieneAlgunaExencion"; // Recupero las exenciones vigentes de la cuenta. List<CueExe> listCueExe = getListCueExeVigente(fecha); log.debug(funcName + " listCueExe.size: " + listCueExe.size()); log.debug(funcName + " listExencion.size: " + listExencion.size()); // Si no posee ninguna, salgo por falso. if (listCueExe.size() == 0){ return false; } // Si posee al menos una exencion vigente, de las contenidas en la lista recibida. for (CueExe cueExe:listCueExe){ Exencion exencion = cueExe.getExencion(); log.debug(funcName + " exencion: " + exencion.getDesExencion()); if (ListUtilBean.contains(listExencion, exencion)){ return true; } } // Sale por falso si ninguna de las exenciones de la cuenta esta en la lista recibida. return false; }
boolean function(List<Exencion> listExencion, Date fecha) throws Exception { String funcName = STR; List<CueExe> listCueExe = getListCueExeVigente(fecha); log.debug(funcName + STR + listCueExe.size()); log.debug(funcName + STR + listExencion.size()); if (listCueExe.size() == 0){ return false; } for (CueExe cueExe:listCueExe){ Exencion exencion = cueExe.getExencion(); log.debug(funcName + STR + exencion.getDesExencion()); if (ListUtilBean.contains(listExencion, exencion)){ return true; } } return false; }
/** * Devuelve true si la cuenta posee alguna de las exenciones recibidas. * * @author Cristian * @param listExencion * @param fecha * @return boolean * @throws Exception */
Devuelve true si la cuenta posee alguna de las exenciones recibidas
tieneAlgunaExencion
{ "repo_name": "avdata99/SIAT", "path": "siat-1.0-SOURCE/src/buss/src/ar/gov/rosario/siat/pad/buss/bean/Cuenta.java", "license": "gpl-3.0", "size": 164803 }
[ "ar.gov.rosario.siat.exe.buss.bean.CueExe", "ar.gov.rosario.siat.exe.buss.bean.Exencion", "coop.tecso.demoda.buss.helper.ListUtilBean", "java.util.Date", "java.util.List" ]
import ar.gov.rosario.siat.exe.buss.bean.CueExe; import ar.gov.rosario.siat.exe.buss.bean.Exencion; import coop.tecso.demoda.buss.helper.ListUtilBean; import java.util.Date; import java.util.List;
import ar.gov.rosario.siat.exe.buss.bean.*; import coop.tecso.demoda.buss.helper.*; import java.util.*;
[ "ar.gov.rosario", "coop.tecso.demoda", "java.util" ]
ar.gov.rosario; coop.tecso.demoda; java.util;
654,227
private boolean isApproved(final StudentCurricularPlan studentCurricularPlan, final CurricularCourse curricularCourse) { for (final Enrolment enrolment : studentCurricularPlan.getEnrolmentsSet()) { if (enrolment.getCurricularCourse().isEquivalent(curricularCourse) && enrolment.isApproved()) { return true; } } return false; }
boolean function(final StudentCurricularPlan studentCurricularPlan, final CurricularCourse curricularCourse) { for (final Enrolment enrolment : studentCurricularPlan.getEnrolmentsSet()) { if (enrolment.getCurricularCourse().isEquivalent(curricularCourse) && enrolment.isApproved()) { return true; } } return false; }
/** * Do not use isApproved from StudentCurricularPlan, because that method * also check global equivalences, and in internal substitution we can not * check that. */
Do not use isApproved from StudentCurricularPlan, because that method also check global equivalences, and in internal substitution we can not check that
isApproved
{ "repo_name": "JNPA/fenixedu-academic", "path": "src/main/java/org/fenixedu/academic/dto/administrativeOffice/dismissal/InternalSubstitutionDismissalBean.java", "license": "lgpl-3.0", "size": 3772 }
[ "org.fenixedu.academic.domain.CurricularCourse", "org.fenixedu.academic.domain.Enrolment", "org.fenixedu.academic.domain.StudentCurricularPlan" ]
import org.fenixedu.academic.domain.CurricularCourse; import org.fenixedu.academic.domain.Enrolment; import org.fenixedu.academic.domain.StudentCurricularPlan;
import org.fenixedu.academic.domain.*;
[ "org.fenixedu.academic" ]
org.fenixedu.academic;
2,628,619
Map<IXMLQName, String> getAttributes();
Map<IXMLQName, String> getAttributes();
/** * <p> * Get a copy of tag attributes * </p> * * * * @return Map < IXMLQName --> attribute value > */
Get a copy of tag attributes
getAttributes
{ "repo_name": "Prometeusz/Easy-XML-Mapping", "path": "src/java/org/prometheuscode/xml/treemodel/IXMLTag.java", "license": "gpl-3.0", "size": 2699 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
311,327
public DynamoDBQueryExpression<T> withConditionalOperator(ConditionalOperator conditionalOperator) { setConditionalOperator(conditionalOperator); return this; }
DynamoDBQueryExpression<T> function(ConditionalOperator conditionalOperator) { setConditionalOperator(conditionalOperator); return this; }
/** * Sets the logical operator on the query filter conditions. * <p>Returns a pointer to this object for method-chaining. */
Sets the logical operator on the query filter conditions. Returns a pointer to this object for method-chaining
withConditionalOperator
{ "repo_name": "dagnir/aws-sdk-java", "path": "aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBQueryExpression.java", "license": "apache-2.0", "size": 58474 }
[ "com.amazonaws.services.dynamodbv2.model.ConditionalOperator" ]
import com.amazonaws.services.dynamodbv2.model.ConditionalOperator;
import com.amazonaws.services.dynamodbv2.model.*;
[ "com.amazonaws.services" ]
com.amazonaws.services;
602,060
protected AdHocRouteRecipient buildApproveWorkgroupRecipient(String workgroupId) { AdHocRouteRecipient adHocRouteRecipient = new AdHocRouteWorkgroup(); adHocRouteRecipient.setActionRequested(KewApiConstants.ACTION_REQUEST_APPROVE_REQ); adHocRouteRecipient.setId(workgroupId); return adHocRouteRecipient; }
AdHocRouteRecipient function(String workgroupId) { AdHocRouteRecipient adHocRouteRecipient = new AdHocRouteWorkgroup(); adHocRouteRecipient.setActionRequested(KewApiConstants.ACTION_REQUEST_APPROVE_REQ); adHocRouteRecipient.setId(workgroupId); return adHocRouteRecipient; }
/** * * This method builds a workgroup recipient for Approval. * @param userId * @return */
This method builds a workgroup recipient for Approval
buildApproveWorkgroupRecipient
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/ar/batch/service/impl/InvoiceRecurrenceServiceImpl.java", "license": "agpl-3.0", "size": 13303 }
[ "org.kuali.rice.kew.api.KewApiConstants", "org.kuali.rice.krad.bo.AdHocRouteRecipient", "org.kuali.rice.krad.bo.AdHocRouteWorkgroup" ]
import org.kuali.rice.kew.api.KewApiConstants; import org.kuali.rice.krad.bo.AdHocRouteRecipient; import org.kuali.rice.krad.bo.AdHocRouteWorkgroup;
import org.kuali.rice.kew.api.*; import org.kuali.rice.krad.bo.*;
[ "org.kuali.rice" ]
org.kuali.rice;
248,020
@Test public void valueCharSequenceThis() { final Renderer unit = unit(); Assert.assertSame(unit, unit.list().value("")); }
void function() { final Renderer unit = unit(); Assert.assertSame(unit, unit.list().value("")); }
/** * Tests {@link Renderer#value(CharSequence)} to return this. */
Tests <code>Renderer#value(CharSequence)</code> to return this
valueCharSequenceThis
{ "repo_name": "cosmocode/cosmocode-rendering", "path": "src/test/java/de/cosmocode/rendering/AbstractRendererReferenceValueTest.java", "license": "apache-2.0", "size": 2457 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,103,358
public void layoutContainer(Container parent) { Rectangle b = parent.getBounds(); Insets i = getInsets(); int contentY = 0; int w = b.width - i.right - i.left; int h = b.height - i.top - i.bottom; if (titlepane != null && titlepane.isVisible()) { Dimension mbd = titlepane.getPreferredSize(); titlepane.setBounds(0, 0, w, mbd.height); contentY += mbd.height; } if (contentPane != null) { contentPane.setBounds(0, contentY, w, h - contentY); } }
void function(Container parent) { Rectangle b = parent.getBounds(); Insets i = getInsets(); int contentY = 0; int w = b.width - i.right - i.left; int h = b.height - i.top - i.bottom; if (titlepane != null && titlepane.isVisible()) { Dimension mbd = titlepane.getPreferredSize(); titlepane.setBounds(0, 0, w, mbd.height); contentY += mbd.height; } if (contentPane != null) { contentPane.setBounds(0, contentY, w, h - contentY); } }
/** * Instructs the layout manager to perform the layout for the specified * container. * * @param parent the Container for which this layout manager is being used */
Instructs the layout manager to perform the layout for the specified container
layoutContainer
{ "repo_name": "SuperMap-iDesktop/SuperMap-iDesktop-Cross", "path": "Controls/src/main/java/org/flexdock/view/View.java", "license": "gpl-3.0", "size": 17173 }
[ "java.awt.Container", "java.awt.Dimension", "java.awt.Insets", "java.awt.Rectangle" ]
import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; import java.awt.Rectangle;
import java.awt.*;
[ "java.awt" ]
java.awt;
978,707
public MessagesGetHistoryQuery fields(List<Fields> value) { return unsafeParam("fields", value); }
MessagesGetHistoryQuery function(List<Fields> value) { return unsafeParam(STR, value); }
/** * Profile fields to return. * * @param value value of "fields" parameter. * @return a reference to this {@code AbstractQueryBuilder} object to fulfill the "Builder" pattern. */
Profile fields to return
fields
{ "repo_name": "VKCOM/vk-java-sdk", "path": "sdk/src/main/java/com/vk/api/sdk/queries/messages/MessagesGetHistoryQuery.java", "license": "mit", "size": 5295 }
[ "com.vk.api.sdk.objects.users.Fields", "java.util.List" ]
import com.vk.api.sdk.objects.users.Fields; import java.util.List;
import com.vk.api.sdk.objects.users.*; import java.util.*;
[ "com.vk.api", "java.util" ]
com.vk.api; java.util;
1,249,376
public static List<Element> getElements(Module... modules) { return getElements(Stage.DEVELOPMENT, Arrays.asList(modules)); }
static List<Element> function(Module... modules) { return getElements(Stage.DEVELOPMENT, Arrays.asList(modules)); }
/** * Records the elements executed by {@code modules}. */
Records the elements executed by modules
getElements
{ "repo_name": "bentolor/google-guice", "path": "core/src/com/google/inject/spi/Elements.java", "license": "apache-2.0", "size": 12425 }
[ "com.google.inject.Module", "com.google.inject.Stage", "java.util.Arrays", "java.util.List" ]
import com.google.inject.Module; import com.google.inject.Stage; import java.util.Arrays; import java.util.List;
import com.google.inject.*; import java.util.*;
[ "com.google.inject", "java.util" ]
com.google.inject; java.util;
2,644,603
private static void getConnectionsInSubtreeHelper(Gem gem, Set<Connection> connections) { // Add the connection for the gem's output, if any. if (gem.getOutputPart() != null && gem.getOutputPart().isConnected()) { connections.add(gem.getOutputPart().getConnection()); } // Call this recursively for any connected inputs. Gem.PartInput[] inputs = gem.getInputParts(); for (final PartInput input : inputs) { if (input.isConnected()) { getConnectionsInSubtreeHelper(input.getConnectedGem(), connections); } } }
static void function(Gem gem, Set<Connection> connections) { if (gem.getOutputPart() != null && gem.getOutputPart().isConnected()) { connections.add(gem.getOutputPart().getConnection()); } Gem.PartInput[] inputs = gem.getInputParts(); for (final PartInput input : inputs) { if (input.isConnected()) { getConnectionsInSubtreeHelper(input.getConnectedGem(), connections); } } }
/** * Helper method for getConnectionsInSubtree(). * @param gem * @param connections */
Helper method for getConnectionsInSubtree()
getConnectionsInSubtreeHelper
{ "repo_name": "levans/Open-Quark", "path": "src/Quark_Gems/src/org/openquark/gems/client/GemGraph.java", "license": "bsd-3-clause", "size": 134737 }
[ "java.util.Set", "org.openquark.gems.client.Gem" ]
import java.util.Set; import org.openquark.gems.client.Gem;
import java.util.*; import org.openquark.gems.client.*;
[ "java.util", "org.openquark.gems" ]
java.util; org.openquark.gems;
1,680,652
public void markAsRead() { /// M: Code analyze 060, For bug ALPS00272115, add for WappushNotification /// canceled with other message . @{ if (mIsDoingMarkAsRead || !mHasUnreadMessages) { Log.d(TAG, "markAsRead(): mIsDoingMarkAsRead is true"); return; } /// @} if (mMarkAsReadWaiting) { // We've already been asked to mark everything as read, but we're blocked. return; } if (mMarkAsReadBlocked) { // We're blocked so record the fact that we want to mark the messages as read // when we get unblocked. mMarkAsReadWaiting = true; return; } final Uri threadUri = getUri();
void function() { if (mIsDoingMarkAsRead !mHasUnreadMessages) { Log.d(TAG, STR); return; } if (mMarkAsReadWaiting) { return; } if (mMarkAsReadBlocked) { mMarkAsReadWaiting = true; return; } final Uri threadUri = getUri();
/** * Marks all messages in this conversation as read and updates * relevant notifications. This method returns immediately; * work is dispatched to a background thread. This function should * always be called from the UI thread. */
Marks all messages in this conversation as read and updates relevant notifications. This method returns immediately; work is dispatched to a background thread. This function should always be called from the UI thread
markAsRead
{ "repo_name": "rex-xxx/mt6572_x201", "path": "packages/apps/Mms/src/com/android/mms/data/Conversation.java", "license": "gpl-2.0", "size": 94637 }
[ "android.net.Uri", "android.util.Log" ]
import android.net.Uri; import android.util.Log;
import android.net.*; import android.util.*;
[ "android.net", "android.util" ]
android.net; android.util;
1,736,239
private void validatePasswordLength( String password, PasswordPolicyConfiguration policyConfig ) throws PasswordPolicyException { int maxLen = policyConfig.getPwdMaxLength(); int minLen = policyConfig.getPwdMinLength(); int pwdLen = password.length(); if ( ( maxLen > 0 ) && ( pwdLen > maxLen ) ) { throw new PasswordPolicyException( "Password should not have more than " + maxLen + " characters", INSUFFICIENT_PASSWORD_QUALITY.getValue() ); } if ( ( minLen > 0 ) && ( pwdLen < minLen ) ) { throw new PasswordPolicyException( "Password should have a minimum of " + minLen + " characters", PASSWORD_TOO_SHORT.getValue() ); } }
void function( String password, PasswordPolicyConfiguration policyConfig ) throws PasswordPolicyException { int maxLen = policyConfig.getPwdMaxLength(); int minLen = policyConfig.getPwdMinLength(); int pwdLen = password.length(); if ( ( maxLen > 0 ) && ( pwdLen > maxLen ) ) { throw new PasswordPolicyException( STR + maxLen + STR, INSUFFICIENT_PASSWORD_QUALITY.getValue() ); } if ( ( minLen > 0 ) && ( pwdLen < minLen ) ) { throw new PasswordPolicyException( STR + minLen + STR, PASSWORD_TOO_SHORT.getValue() ); } }
/** * validates the length of the password */
validates the length of the password
validatePasswordLength
{ "repo_name": "apache/directory-server", "path": "interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java", "license": "apache-2.0", "size": 67937 }
[ "org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration", "org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyException" ]
import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration; import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyException;
import org.apache.directory.server.core.api.authn.ppolicy.*;
[ "org.apache.directory" ]
org.apache.directory;
1,683,280
public String command(String payload) throws IOException { if(payload == null || payload.trim().isEmpty()) { throw new IllegalArgumentException("Payload can't be null or empty"); } RconPacket response = this.send(RconPacket.SERVERDATA_EXECCOMMAND, payload.getBytes()); return new String(response.getPayload(), this.getCharset()); }
String function(String payload) throws IOException { if(payload == null payload.trim().isEmpty()) { throw new IllegalArgumentException(STR); } RconPacket response = this.send(RconPacket.SERVERDATA_EXECCOMMAND, payload.getBytes()); return new String(response.getPayload(), this.getCharset()); }
/** * Send a command to the server * * @param payload The command to send * @return The payload of the response * * @throws IOException */
Send a command to the server
command
{ "repo_name": "pavel151/Hubs.RCon", "path": "src/Hubs/Rcon.java", "license": "gpl-3.0", "size": 3109 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
744,721
public int tickRate(World worldIn) { return 10; }
int function(World worldIn) { return 10; }
/** * How many world ticks before ticking */
How many world ticks before ticking
tickRate
{ "repo_name": "boredherobrine13/morefuelsmod-1.10", "path": "build/tmp/recompileMc/sources/net/minecraft/block/Block.java", "license": "lgpl-2.1", "size": 119133 }
[ "net.minecraft.world.World" ]
import net.minecraft.world.World;
import net.minecraft.world.*;
[ "net.minecraft.world" ]
net.minecraft.world;
1,278,845
public boolean validate(File file) { if (file != null) { if (file.lastModified() != this.lastModified) { return false; } if (file.length() != this.length) { return false; } } hit++; return true; }
boolean function(File file) { if (file != null) { if (file.lastModified() != this.lastModified) { return false; } if (file.length() != this.length) { return false; } } hit++; return true; }
/** * Checks the passed file attributes against those cached ones. * * @param file Other file handle to compare to the cached values. May be null in which case the validation is skipped. * @return <code>true</code> if all measured values match, else <code>false</code> */
Checks the passed file attributes against those cached ones
validate
{ "repo_name": "komalsukhani/debian-groovy2", "path": "subprojects/groovy-servlet/src/main/java/groovy/servlet/TemplateServlet.java", "license": "apache-2.0", "size": 17915 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,446,174
public EuroGameEntryInfo getGameEntry() { return this.euroSource.getGameEntry().info(); }
EuroGameEntryInfo function() { return this.euroSource.getGameEntry().info(); }
/** * Returns immutable game entry representing record of the game. * */
Returns immutable game entry representing record of the game
getGameEntry
{ "repo_name": "underplex/tickay", "path": "src/main/java/com/underplex/tickay/info/EuroGameInfo.java", "license": "gpl-2.0", "size": 737 }
[ "com.underplex.tickay.jaxbinfo.EuroGameEntryInfo" ]
import com.underplex.tickay.jaxbinfo.EuroGameEntryInfo;
import com.underplex.tickay.jaxbinfo.*;
[ "com.underplex.tickay" ]
com.underplex.tickay;
925,629
@Override public void enterAnnotation(@NotNull PJParser.AnnotationContext ctx) { }
@Override public void enterAnnotation(@NotNull PJParser.AnnotationContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
exitForUpdate
{ "repo_name": "Diolor/PJ", "path": "src/main/java/com/lorentzos/pj/PJBaseListener.java", "license": "mit", "size": 73292 }
[ "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;
782,584
//========================================================================= public void storeSettings(Object settings) { WizardDescriptor wizDes; AsposeConstants.println("2. ========= storeSettings called.."); if (settings instanceof WizardDescriptor) { wizDes = (WizardDescriptor) settings; boolean cancelled = wizDes.getValue() != WizardDescriptor.FINISH_OPTION; if (!cancelled) { if (!storeSettingsCalled) // First Time { storeSettingsCalled = true; AsposeConstants.println("2. Store Settings is called first time"); performFinish(); } else // Second Time { storeSettingsCalled = false; AsposeConstants.println("2. Store Settings 2nd time - OK"); } } } ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_CELLS, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeCells().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_WORDS, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeWords().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_PDF, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposePdf().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_SLIDES, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeSlides().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_BARCODE, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeBarCode().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_EMAIL, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeEmail().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_OCR, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeOCR().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_IMAGING, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeImaging().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_TASKS, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeTasks().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_DIAGRAM, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeDiagram().isSelected()); }
void function(Object settings) { WizardDescriptor wizDes; AsposeConstants.println(STR); if (settings instanceof WizardDescriptor) { wizDes = (WizardDescriptor) settings; boolean cancelled = wizDes.getValue() != WizardDescriptor.FINISH_OPTION; if (!cancelled) { if (!storeSettingsCalled) { storeSettingsCalled = true; AsposeConstants.println(STR); performFinish(); } else { storeSettingsCalled = false; AsposeConstants.println(STR); } } } ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_CELLS, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeCells().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_WORDS, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeWords().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_PDF, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposePdf().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_SLIDES, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeSlides().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_BARCODE, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeBarCode().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_EMAIL, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeEmail().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_OCR, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeOCR().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_IMAGING, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeImaging().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_TASKS, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeTasks().isSelected()); ((WizardDescriptor) settings).putProperty(AsposeConstants.ASPOSE_DIAGRAM, ((AsposePanelVisualComponent) getComponent()).getjCheckBoxAsposeDiagram().isSelected()); }
/** * This method is called twice * * @param settings */
This method is called twice
storeSettings
{ "repo_name": "asposemarketplace/Aspose_for_NetBeans", "path": "src/com/aspose/nbplugin/AsposeWizardPanelComponent.java", "license": "mit", "size": 12900 }
[ "com.aspose.nbplugin.utils.AsposeConstants", "org.openide.WizardDescriptor" ]
import com.aspose.nbplugin.utils.AsposeConstants; import org.openide.WizardDescriptor;
import com.aspose.nbplugin.utils.*; import org.openide.*;
[ "com.aspose.nbplugin", "org.openide" ]
com.aspose.nbplugin; org.openide;
546,575
private static final void processFile(File file) throws Exception { log.info("processing file: " + file); long timeout = interruptionDefaultTimeoutSecs; // looking for optional expectations Properties expectations = readExpectations(new File(generateExpectationsFileName(file))); if (expectations.getProperty(expectationTimeoutSecs)!=null) { timeout = Long.parseLong(expectations.getProperty(expectationTimeoutSecs)); log.info("overriding default timeout: " + interruptionDefaultTimeoutSecs + " with new value: " + timeout + " [secs]"); } InputStream inputStream = new FileInputStream(file); ExtractedDocumentMetadata extractedMetadata = null; try { // disabling images extraction ExtractionConfigBuilder builder = new ExtractionConfigBuilder(); builder.setProperty(ExtractionConfigProperty.IMAGES_EXTRACTION, false); ExtractionConfigRegister.set(builder.buildConfiguration()); ContentExtractor extractor = new ContentExtractor(timeout); extractor.setPDF(inputStream); Element resultElem = extractor.getContentAsNLM(); String rawText = extractor.getRawFullText(); extractedMetadata = NlmToDocumentWithBasicMetadataConverter.convertFull( generateId(file), new Document(resultElem), rawText); validateContent(extractedMetadata, expectations); } catch (UnmetExpectationException e) { log.error("expectations were unmet for record:\n" + JsonUtils.toPrettyJSON(extractedMetadata.toString())); throw e; } catch (Exception e) { handleException(e, expectations); } finally { inputStream.close(); } }
static final void function(File file) throws Exception { log.info(STR + file); long timeout = interruptionDefaultTimeoutSecs; Properties expectations = readExpectations(new File(generateExpectationsFileName(file))); if (expectations.getProperty(expectationTimeoutSecs)!=null) { timeout = Long.parseLong(expectations.getProperty(expectationTimeoutSecs)); log.info(STR + interruptionDefaultTimeoutSecs + STR + timeout + STR); } InputStream inputStream = new FileInputStream(file); ExtractedDocumentMetadata extractedMetadata = null; try { ExtractionConfigBuilder builder = new ExtractionConfigBuilder(); builder.setProperty(ExtractionConfigProperty.IMAGES_EXTRACTION, false); ExtractionConfigRegister.set(builder.buildConfiguration()); ContentExtractor extractor = new ContentExtractor(timeout); extractor.setPDF(inputStream); Element resultElem = extractor.getContentAsNLM(); String rawText = extractor.getRawFullText(); extractedMetadata = NlmToDocumentWithBasicMetadataConverter.convertFull( generateId(file), new Document(resultElem), rawText); validateContent(extractedMetadata, expectations); } catch (UnmetExpectationException e) { log.error(STR + JsonUtils.toPrettyJSON(extractedMetadata.toString())); throw e; } catch (Exception e) { handleException(e, expectations); } finally { inputStream.close(); } }
/** * Handles PDF file and optional expectations file. */
Handles PDF file and optional expectations file
processFile
{ "repo_name": "openaire/iis", "path": "iis-wf/iis-wf-metadataextraction/src/test/java/eu/dnetlib/iis/wf/metadataextraction/MetadataExtractorMain.java", "license": "apache-2.0", "size": 9365 }
[ "eu.dnetlib.iis.common.java.io.JsonUtils", "eu.dnetlib.iis.metadataextraction.schemas.ExtractedDocumentMetadata", "java.io.File", "java.io.FileInputStream", "java.io.InputStream", "java.util.Properties", "org.jdom.Document", "org.jdom.Element", "pl.edu.icm.cermine.ContentExtractor", "pl.edu.icm.ce...
import eu.dnetlib.iis.common.java.io.JsonUtils; import eu.dnetlib.iis.metadataextraction.schemas.ExtractedDocumentMetadata; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.util.Properties; import org.jdom.Document; import org.jdom.Element; import pl.edu.icm.cermine.ContentExtractor; import pl.edu.icm.cermine.configuration.ExtractionConfigBuilder; import pl.edu.icm.cermine.configuration.ExtractionConfigProperty; import pl.edu.icm.cermine.configuration.ExtractionConfigRegister;
import eu.dnetlib.iis.common.java.io.*; import eu.dnetlib.iis.metadataextraction.schemas.*; import java.io.*; import java.util.*; import org.jdom.*; import pl.edu.icm.cermine.*; import pl.edu.icm.cermine.configuration.*;
[ "eu.dnetlib.iis", "java.io", "java.util", "org.jdom", "pl.edu.icm" ]
eu.dnetlib.iis; java.io; java.util; org.jdom; pl.edu.icm;
384,178
public Long toLong() { return StringGroovyMethods.toLong(text()); }
Long function() { return StringGroovyMethods.toLong(text()); }
/** * Converts the text of this GPathResult to a Long object. * * @return the GPathResult, converted to a <code>Long</code> */
Converts the text of this GPathResult to a Long object
toLong
{ "repo_name": "avafanasiev/groovy", "path": "subprojects/groovy-xml/src/main/java/groovy/util/slurpersupport/GPathResult.java", "license": "apache-2.0", "size": 22688 }
[ "org.codehaus.groovy.runtime.StringGroovyMethods" ]
import org.codehaus.groovy.runtime.StringGroovyMethods;
import org.codehaus.groovy.runtime.*;
[ "org.codehaus.groovy" ]
org.codehaus.groovy;
2,019,788
void getFieldMappings(GetFieldMappingsRequest request, ActionListener<GetFieldMappingsResponse> listener);
void getFieldMappings(GetFieldMappingsRequest request, ActionListener<GetFieldMappingsResponse> listener);
/** * Get the mappings of specific fields */
Get the mappings of specific fields
getFieldMappings
{ "repo_name": "qwerty4030/elasticsearch", "path": "server/src/main/java/org/elasticsearch/client/IndicesAdminClient.java", "license": "apache-2.0", "size": 31749 }
[ "org.elasticsearch.action.ActionListener", "org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest", "org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse" ]
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse;
import org.elasticsearch.action.*; import org.elasticsearch.action.admin.indices.mapping.get.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
2,787,213
protected String nextToken() throws IOException { String token = ""; int ch, nextch; if (!tokenStack.empty()) { return (String) tokenStack.pop(); } // Skip over leading whitespace and comments while (true) { // skip leading whitespace ch = catfile.read(); while (ch <= ' ') { // all ctrls are whitespace ch = catfile.read(); if (ch < 0) { return null; } } // now 'ch' is the current char from the file nextch = catfile.read(); if (nextch < 0) { return null; } if (ch == '-' && nextch == '-') { // we've found a comment, skip it... ch = ' '; nextch = nextChar(); while (ch != '-' || nextch != '-') { ch = nextch; nextch = nextChar(); } // Ok, we've found the end of the comment, // loop back to the top and start again... } else { stack[++top] = nextch; stack[++top] = ch; break; } } ch = nextChar(); if (ch == '"' || ch == '\'') { int quote = ch; while ((ch = nextChar()) != quote) { char[] chararr = new char[1]; chararr[0] = (char) ch; String s = new String(chararr); token = token.concat(s); } return token; } else { // return the next whitespace or comment delimited // string while (ch > ' ') { nextch = nextChar(); if (ch == '-' && nextch == '-') { stack[++top] = ch; stack[++top] = nextch; return token; } else { char[] chararr = new char[1]; chararr[0] = (char) ch; String s = new String(chararr); token = token.concat(s); ch = nextch; } } return token; } }
String function() throws IOException { String token = STR' ch == '\'') { int quote = ch; while ((ch = nextChar()) != quote) { char[] chararr = new char[1]; chararr[0] = (char) ch; String s = new String(chararr); token = token.concat(s); } return token; } else { while (ch > ' ') { nextch = nextChar(); if (ch == '-' && nextch == '-') { stack[++top] = ch; stack[++top] = nextch; return token; } else { char[] chararr = new char[1]; chararr[0] = (char) ch; String s = new String(chararr); token = token.concat(s); ch = nextch; } } return token; } }
/** * Return the next token in the catalog file. * * @return The Catalog file token from the input stream. * @throws IOException If an error occurs reading from the stream. */
Return the next token in the catalog file
nextToken
{ "repo_name": "jboss/jboss-common-core", "path": "src/main/java/org/jboss/util/xml/catalog/readers/TextCatalogReader.java", "license": "apache-2.0", "size": 7262 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
858,021
public UserDetail getSelectedUser() { return selectedUser; }
UserDetail function() { return selectedUser; }
/** * Returns the selected user (if any). */
Returns the selected user (if any)
getSelectedUser
{ "repo_name": "CecileBONIN/Silverpeas-Core", "path": "war-core/src/main/java/com/stratelia/silverpeas/selectionPeas/control/SelectionPeasWrapperSessionController.java", "license": "agpl-3.0", "size": 8704 }
[ "com.stratelia.webactiv.beans.admin.UserDetail" ]
import com.stratelia.webactiv.beans.admin.UserDetail;
import com.stratelia.webactiv.beans.admin.*;
[ "com.stratelia.webactiv" ]
com.stratelia.webactiv;
51,363
public String custToSqlValue(DBValue value) throws DBAdapterException { Object v = custToJdbcValue(value); switch (value.type()) { case STRING: case TEXT: return v!=null ? v.toString().replaceAll("'", "''") : null; } return v.toString(); }
String function(DBValue value) throws DBAdapterException { Object v = custToJdbcValue(value); switch (value.type()) { case STRING: case TEXT: return v!=null ? v.toString().replaceAll("'", "''") : null; } return v.toString(); }
/** * Customize {@link DBValue} to SQL value in string presentation * @param value * @return * @throws DBAdapterException */
Customize <code>DBValue</code> to SQL value in string presentation
custToSqlValue
{ "repo_name": "mozartframework/cms", "path": "src/com/mozartframework/db/adapter/DBAdapter.java", "license": "gpl-3.0", "size": 43627 }
[ "com.mozartframework.db.base.DBValue" ]
import com.mozartframework.db.base.DBValue;
import com.mozartframework.db.base.*;
[ "com.mozartframework.db" ]
com.mozartframework.db;
773,721
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (AssessmentPackage.Literals.NODE__CHILDREN, AssessmentFactory.eINSTANCE.createHttp())); newChildDescriptors.add (createChildParameter (AssessmentPackage.Literals.NODE__CHILDREN, AssessmentFactory.eINSTANCE.createSnippet())); newChildDescriptors.add (createChildParameter (AssessmentPackage.Literals.NODE__CHILDREN, AssessmentFactory.eINSTANCE.createGeneric())); newChildDescriptors.add (createChildParameter (AssessmentPackage.Literals.NODE__CHILDREN, AssessmentFactory.eINSTANCE.createControl())); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (AssessmentPackage.Literals.NODE__CHILDREN, AssessmentFactory.eINSTANCE.createHttp())); newChildDescriptors.add (createChildParameter (AssessmentPackage.Literals.NODE__CHILDREN, AssessmentFactory.eINSTANCE.createSnippet())); newChildDescriptors.add (createChildParameter (AssessmentPackage.Literals.NODE__CHILDREN, AssessmentFactory.eINSTANCE.createGeneric())); newChildDescriptors.add (createChildParameter (AssessmentPackage.Literals.NODE__CHILDREN, AssessmentFactory.eINSTANCE.createControl())); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
collectNewChildDescriptors
{ "repo_name": "CoastalHacking/semiotics-main", "path": "bundles/io.opensemantics.semiotics.model.assessment.edit/src-gen/io/opensemantics/semiotics/model/assessment/provider/NodeItemProvider.java", "license": "apache-2.0", "size": 10772 }
[ "io.opensemantics.semiotics.model.assessment.AssessmentFactory", "io.opensemantics.semiotics.model.assessment.AssessmentPackage", "java.util.Collection" ]
import io.opensemantics.semiotics.model.assessment.AssessmentFactory; import io.opensemantics.semiotics.model.assessment.AssessmentPackage; import java.util.Collection;
import io.opensemantics.semiotics.model.assessment.*; import java.util.*;
[ "io.opensemantics.semiotics", "java.util" ]
io.opensemantics.semiotics; java.util;
2,229,535
public void transform() { sideEffects = new SideEffectChecker(context); kills = new ResizeableArrayList[cfg.size()]; killsSorted = new boolean[cfg.size()]; for (int i = 0; i < kills.length; i++) { kills[i] = new ResizeableArrayList(); killsSorted[i] = false; } // In a single pass over the CFG: // // Number the expressions in each block in ascending order. // Insert all first-order expressions into the worklist. // Insert access path kills into the worklist. // Insert exception throw kills into the worklist. // Locate phi-related expressions. // Find the next value number. worklist = new ExprWorklist(); phiRelated = new HashMap(); // Compile the worklist of expressions on which to perform SSAPRE. collectOccurrences(); // Do the transformation for each expression. while (!worklist.isEmpty()) { final ExprInfo exprInfo = worklist.removeFirst(); transform(exprInfo); } // null these guys so that they'll be garbage collected sooner sideEffects = null; kills = null; worklist = null; }
void function() { sideEffects = new SideEffectChecker(context); kills = new ResizeableArrayList[cfg.size()]; killsSorted = new boolean[cfg.size()]; for (int i = 0; i < kills.length; i++) { kills[i] = new ResizeableArrayList(); killsSorted[i] = false; } worklist = new ExprWorklist(); phiRelated = new HashMap(); collectOccurrences(); while (!worklist.isEmpty()) { final ExprInfo exprInfo = worklist.removeFirst(); transform(exprInfo); } sideEffects = null; kills = null; worklist = null; }
/** * Performs SSA-based partial redundency elimination (PRE) on a control flow * graph. */
Performs SSA-based partial redundency elimination (PRE) on a control flow graph
transform
{ "repo_name": "AlterRS/Deobfuscator", "path": "deps/EDU/purdue/cs/bloat/trans/SSAPRE.java", "license": "mit", "size": 102581 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
265,765
private void createJTreeNode(Cell cell) { // As a special case, if the Cell is an AvatarCell, then simply ignore // and return, since Avatar Cells are returned by the Cell cache. if (cell instanceof AvatarCell) { return; }
void function(Cell cell) { if (cell instanceof AvatarCell) { return; }
/** * Creates a new tree node for the given Cell and inserts it into the tree. */
Creates a new tree node for the given Cell and inserts it into the tree
createJTreeNode
{ "repo_name": "AsherBond/MondocosmOS", "path": "wonderland/modules/world/cell-editor/src/classes/org/jdesktop/wonderland/modules/celleditor/client/CellPropertiesJFrame.java", "license": "agpl-3.0", "size": 63911 }
[ "org.jdesktop.wonderland.client.cell.Cell", "org.jdesktop.wonderland.client.cell.view.AvatarCell" ]
import org.jdesktop.wonderland.client.cell.Cell; import org.jdesktop.wonderland.client.cell.view.AvatarCell;
import org.jdesktop.wonderland.client.cell.*; import org.jdesktop.wonderland.client.cell.view.*;
[ "org.jdesktop.wonderland" ]
org.jdesktop.wonderland;
2,079,546
@Override public int compareTo(Object o) { Outlier outlier = (Outlier) o; Point2D p1 = getPoint(); Point2D p2 = outlier.getPoint(); if (p1.equals(p2)) { return 0; } else if ((p1.getX() < p2.getX()) || (p1.getY() < p2.getY())) { return -1; } else { return 1; } }
int function(Object o) { Outlier outlier = (Outlier) o; Point2D p1 = getPoint(); Point2D p2 = outlier.getPoint(); if (p1.equals(p2)) { return 0; } else if ((p1.getX() < p2.getX()) (p1.getY() < p2.getY())) { return -1; } else { return 1; } }
/** * Compares this object with the specified object for order, based on * the outlier's point. * * @param o the Object to be compared. * @return A negative integer, zero, or a positive integer as this object * is less than, equal to, or greater than the specified object. * */
Compares this object with the specified object for order, based on the outlier's point
compareTo
{ "repo_name": "sebkur/JFreeChart", "path": "src/main/java/org/jfree/chart/renderer/Outlier.java", "license": "lgpl-3.0", "size": 6416 }
[ "java.awt.geom.Point2D" ]
import java.awt.geom.Point2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,188,412
public void addBackwardCompatibleWith(Ontology value) { Base.add(this.model, this.getResource(), BACKWARDCOMPATIBLEWITH, value); }
void function(Ontology value) { Base.add(this.model, this.getResource(), BACKWARDCOMPATIBLEWITH, value); }
/** * Adds a value to property BackwardCompatibleWith from an instance of Ontology * * [Generated from RDFReactor template rule #add4dynamic] */
Adds a value to property BackwardCompatibleWith from an instance of Ontology [Generated from RDFReactor template rule #add4dynamic]
addBackwardCompatibleWith
{ "repo_name": "josectoledo/semweb4j", "path": "org.semweb4j.rdfreactor.runtime/src/main/java/org/ontoware/rdfreactor/schema/owl/Ontology.java", "license": "bsd-2-clause", "size": 50761 }
[ "org.ontoware.rdfreactor.runtime.Base" ]
import org.ontoware.rdfreactor.runtime.Base;
import org.ontoware.rdfreactor.runtime.*;
[ "org.ontoware.rdfreactor" ]
org.ontoware.rdfreactor;
84,511
ViewsTabBar getViewsTabBar();
ViewsTabBar getViewsTabBar();
/** * Gets the TabBar for the views. * * TabBar for views can be provided by extension. Only one TabBar can be active * at a given time (Selectable by user in the global Configuration page). * Default TabBar is provided by Hudson Platform. * @since 1.381 */
Gets the TabBar for the views. TabBar for views can be provided by extension. Only one TabBar can be active at a given time (Selectable by user in the global Configuration page). Default TabBar is provided by Hudson Platform
getViewsTabBar
{ "repo_name": "zll5267/jenkins", "path": "core/src/main/java/hudson/model/ViewGroup.java", "license": "mit", "size": 4987 }
[ "hudson.views.ViewsTabBar" ]
import hudson.views.ViewsTabBar;
import hudson.views.*;
[ "hudson.views" ]
hudson.views;
3,117
protected void configureRoleInfo (RoleInfo ri, ConstraintMapping mapping) { Constraint constraint = mapping.getConstraint(); boolean forbidden = constraint.isForbidden(); ri.setForbidden(forbidden); //set up the data constraint (NOTE: must be done after setForbidden, as it nulls out the data constraint //which we need in order to do combining of omissions in prepareConstraintInfo UserDataConstraint userDataConstraint = UserDataConstraint.get(mapping.getConstraint().getDataConstraint()); ri.setUserDataConstraint(userDataConstraint); //if forbidden, no point setting up roles if (!ri.isForbidden()) { //add in the roles boolean checked = mapping.getConstraint().getAuthenticate(); ri.setChecked(checked); if (ri.isChecked()) { if (mapping.getConstraint().isAnyRole()) { if (_strict) { // * means "all defined roles" for (String role : _roles) ri.addRole(role); } else // * means any role ri.setAnyRole(true); } else { String[] newRoles = mapping.getConstraint().getRoles(); for (String role : newRoles) { if (_strict &&!_roles.contains(role)) throw new IllegalArgumentException("Attempt to use undeclared role: " + role + ", known roles: " + _roles); ri.addRole(role); } } } } }
void function (RoleInfo ri, ConstraintMapping mapping) { Constraint constraint = mapping.getConstraint(); boolean forbidden = constraint.isForbidden(); ri.setForbidden(forbidden); UserDataConstraint userDataConstraint = UserDataConstraint.get(mapping.getConstraint().getDataConstraint()); ri.setUserDataConstraint(userDataConstraint); if (!ri.isForbidden()) { boolean checked = mapping.getConstraint().getAuthenticate(); ri.setChecked(checked); if (ri.isChecked()) { if (mapping.getConstraint().isAnyRole()) { if (_strict) { for (String role : _roles) ri.addRole(role); } else ri.setAnyRole(true); } else { String[] newRoles = mapping.getConstraint().getRoles(); for (String role : newRoles) { if (_strict &&!_roles.contains(role)) throw new IllegalArgumentException(STR + role + STR + _roles); ri.addRole(role); } } } } }
/** * Initialize or update the RoleInfo from the constraint * @param ri * @param mapping */
Initialize or update the RoleInfo from the constraint
configureRoleInfo
{ "repo_name": "whiteley/jetty8", "path": "jetty-security/src/main/java/org/eclipse/jetty/security/ConstraintSecurityHandler.java", "license": "apache-2.0", "size": 29538 }
[ "org.eclipse.jetty.util.security.Constraint" ]
import org.eclipse.jetty.util.security.Constraint;
import org.eclipse.jetty.util.security.*;
[ "org.eclipse.jetty" ]
org.eclipse.jetty;
2,803,914
@Test public void twoEmptySketches() throws IOException { EvalFunc<Tuple> func = new ArrayOfDoublesSketchesToPValueEstimates(); ArrayOfDoublesUpdatableSketch sketchA = new ArrayOfDoublesUpdatableSketchBuilder().build(); ArrayOfDoublesUpdatableSketch sketchB = new ArrayOfDoublesUpdatableSketchBuilder().build(); Tuple inputTuple = PigUtil.objectsToTuple(new DataByteArray(sketchA.compact().toByteArray()), new DataByteArray(sketchB.compact().toByteArray())); Tuple resultTuple = func.exec(inputTuple); Assert.assertNull(resultTuple); }
void function() throws IOException { EvalFunc<Tuple> func = new ArrayOfDoublesSketchesToPValueEstimates(); ArrayOfDoublesUpdatableSketch sketchA = new ArrayOfDoublesUpdatableSketchBuilder().build(); ArrayOfDoublesUpdatableSketch sketchB = new ArrayOfDoublesUpdatableSketchBuilder().build(); Tuple inputTuple = PigUtil.objectsToTuple(new DataByteArray(sketchA.compact().toByteArray()), new DataByteArray(sketchB.compact().toByteArray())); Tuple resultTuple = func.exec(inputTuple); Assert.assertNull(resultTuple); }
/** * Check input of two empty sketches. * @throws IOException from EvalFunc<Tuple>.exec(...) */
Check input of two empty sketches
twoEmptySketches
{ "repo_name": "DataSketches/sketches-pig", "path": "src/test/java/org/apache/datasketches/pig/tuple/ArrayOfDoublesSketchesToPValueEstimatesTest.java", "license": "apache-2.0", "size": 11775 }
[ "java.io.IOException", "org.apache.datasketches.tuple.ArrayOfDoublesUpdatableSketch", "org.apache.datasketches.tuple.ArrayOfDoublesUpdatableSketchBuilder", "org.apache.pig.EvalFunc", "org.apache.pig.data.DataByteArray", "org.apache.pig.data.Tuple", "org.testng.Assert" ]
import java.io.IOException; import org.apache.datasketches.tuple.ArrayOfDoublesUpdatableSketch; import org.apache.datasketches.tuple.ArrayOfDoublesUpdatableSketchBuilder; import org.apache.pig.EvalFunc; import org.apache.pig.data.DataByteArray; import org.apache.pig.data.Tuple; import org.testng.Assert;
import java.io.*; import org.apache.datasketches.tuple.*; import org.apache.pig.*; import org.apache.pig.data.*; import org.testng.*;
[ "java.io", "org.apache.datasketches", "org.apache.pig", "org.testng" ]
java.io; org.apache.datasketches; org.apache.pig; org.testng;
1,675,283
j2DClient.get().addEventLine(new StandardEventLine("This command is outdated. Please use \"/volume\" for changing the volume and \"/mute\" for muting all audio")); return true; }
j2DClient.get().addEventLine(new StandardEventLine(STR/volume\STR/mute\STR)); return true; }
/** * Execute a chat command. * * @param params * The formal parameters. * @param remainder * Line content after parameters. * * @return <code>true</code> if was handled. */
Execute a chat command
execute
{ "repo_name": "acsid/stendhal", "path": "src/games/stendhal/client/actions/SoundAction.java", "license": "gpl-2.0", "size": 1934 }
[ "games.stendhal.client.gui.chatlog.StandardEventLine" ]
import games.stendhal.client.gui.chatlog.StandardEventLine;
import games.stendhal.client.gui.chatlog.*;
[ "games.stendhal.client" ]
games.stendhal.client;
472,167
public static double LASHeader_GetMinZ(LiblasLibrary.LASHeaderH hHeader) { return LASHeader_GetMinZ(Pointer.getPeer(hHeader)); }
static double function(LiblasLibrary.LASHeaderH hHeader) { return LASHeader_GetMinZ(Pointer.getPeer(hHeader)); }
/** * Return the minimum z value<br> * @param hHeader LASHeaderH instance<br> * @return the minimum z value<br> * Original signature : <code>double LASHeader_GetMinZ(const LASHeaderH)</code><br> * <i>native declaration : liblas.h:860</i> */
Return the minimum z value
LASHeader_GetMinZ
{ "repo_name": "petvana/las-bridj", "path": "src/main/java/com/github/petvana/liblas/jna/LiblasLibrary.java", "license": "bsd-3-clause", "size": 116212 }
[ "org.bridj.Pointer" ]
import org.bridj.Pointer;
import org.bridj.*;
[ "org.bridj" ]
org.bridj;
1,558,117
void addNewFriend(String user) { logger.log(Level.INFO, "User {0} is added to the list", user); friendsList.add(user); }
void addNewFriend(String user) { logger.log(Level.INFO, STR, user); friendsList.add(user); }
/** * Adds the new user * * @param user * The user to be added in the set */
Adds the new user
addNewFriend
{ "repo_name": "Mazinkam/DogeDash", "path": "dogeDash/dogeDash-html/src/com/alicode/game/dogedash/FriendStore.java", "license": "apache-2.0", "size": 1527 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
762,433
public KeyOperationResult sign(String keyIdentifier, JsonWebKeySignatureAlgorithm algorithm, byte[] value) { KeyIdentifier id = new KeyIdentifier(keyIdentifier); return innerKeyVaultClient.sign(id.vault, id.name, id.version == null ? "" : id.version, algorithm, value); }
KeyOperationResult function(String keyIdentifier, JsonWebKeySignatureAlgorithm algorithm, byte[] value) { KeyIdentifier id = new KeyIdentifier(keyIdentifier); return innerKeyVaultClient.sign(id.vault, id.name, id.version == null ? "" : id.version, algorithm, value); }
/** * Creates a signature from a digest using the specified key. * * @param keyIdentifier The full key identifier * @param algorithm algorithm identifier * @param value the content to be signed * * @return the KeyOperationResult if successful. */
Creates a signature from a digest using the specified key
sign
{ "repo_name": "pomortaz/azure-sdk-for-java", "path": "azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClient.java", "license": "mit", "size": 85271 }
[ "com.microsoft.azure.keyvault.models.KeyOperationResult", "com.microsoft.azure.keyvault.webkey.JsonWebKeySignatureAlgorithm" ]
import com.microsoft.azure.keyvault.models.KeyOperationResult; import com.microsoft.azure.keyvault.webkey.JsonWebKeySignatureAlgorithm;
import com.microsoft.azure.keyvault.models.*; import com.microsoft.azure.keyvault.webkey.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,164,466
private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); } }
void function() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } }
/** * Set up the {@link android.app.ActionBar}, if the API is available. */
Set up the <code>android.app.ActionBar</code>, if the API is available
setupActionBar
{ "repo_name": "achow101/BitcointalkForum", "path": "app/src/main/java/com/achow101/bitcointalkforum/AboutActivity.java", "license": "gpl-3.0", "size": 2069 }
[ "android.support.v7.app.ActionBar" ]
import android.support.v7.app.ActionBar;
import android.support.v7.app.*;
[ "android.support" ]
android.support;
2,462,066
public GapPolicy gapPolicy() { return gapPolicy; }
GapPolicy function() { return gapPolicy; }
/** * Gets the gap policy to use for this aggregation. */
Gets the gap policy to use for this aggregation
gapPolicy
{ "repo_name": "ern/elasticsearch", "path": "server/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptPipelineAggregationBuilder.java", "license": "apache-2.0", "size": 8740 }
[ "org.elasticsearch.search.aggregations.pipeline.BucketHelpers" ]
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers;
import org.elasticsearch.search.aggregations.pipeline.*;
[ "org.elasticsearch.search" ]
org.elasticsearch.search;
2,469,750
public Set<String> getInteractions() { Set<String> interactions = new HashSet<String>(); interactions.addAll(hypermediaEngine.getInteractionByPath().get(getFQResourcePath())); interactions.add("HEAD"); interactions.add("OPTIONS"); return interactions; }
Set<String> function() { Set<String> interactions = new HashSet<String>(); interactions.addAll(hypermediaEngine.getInteractionByPath().get(getFQResourcePath())); interactions.add("HEAD"); interactions.add(STR); return interactions; }
/** * Get the valid methods for interacting with this resource. * * @return */
Get the valid methods for interacting with this resource
getInteractions
{ "repo_name": "junejosheeraz/IRIS", "path": "interaction-core/src/main/java/com/temenos/interaction/core/rim/HTTPHypermediaRIM.java", "license": "agpl-3.0", "size": 52178 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
772,232
public SweQuantity createSweQuantity(Object value, String uom) { return new SweQuantity().setUom(uom).setValue(JavaHelper.asDouble(value)); }
SweQuantity function(Object value, String uom) { return new SweQuantity().setUom(uom).setValue(JavaHelper.asDouble(value)); }
/** * Create a {@link SweQuantity} from parameter * * @param value * the {@link SweQuantity} value * @param uom * the {@link SweQuantity} unit of measure * @return the {@link SweQuantity} from parameter */
Create a <code>SweQuantity</code> from parameter
createSweQuantity
{ "repo_name": "ahuarte47/SOS", "path": "core/api/src/main/java/org/n52/sos/util/SweHelper.java", "license": "gpl-2.0", "size": 19323 }
[ "org.n52.sos.ogc.swe.simpleType.SweQuantity" ]
import org.n52.sos.ogc.swe.simpleType.SweQuantity;
import org.n52.sos.ogc.swe.*;
[ "org.n52.sos" ]
org.n52.sos;
2,612,361
@SuppressWarnings("deprecation") public boolean isOnFace(BlockFace face) { switch (face) { case WEST: return (getData() & VINE_WEST) == VINE_WEST; case NORTH: return (getData() & VINE_NORTH) == VINE_NORTH; case SOUTH: return (getData() & VINE_SOUTH) == VINE_SOUTH; case EAST: return (getData() & VINE_EAST) == VINE_EAST; case NORTH_EAST: return isOnFace(BlockFace.EAST) && isOnFace(BlockFace.NORTH); case NORTH_WEST: return isOnFace(BlockFace.WEST) && isOnFace(BlockFace.NORTH); case SOUTH_EAST: return isOnFace(BlockFace.EAST) && isOnFace(BlockFace.SOUTH); case SOUTH_WEST: return isOnFace(BlockFace.WEST) && isOnFace(BlockFace.SOUTH); case UP: // It's impossible to be accurate with this since it's contextual return true; default: return false; } }
@SuppressWarnings(STR) boolean function(BlockFace face) { switch (face) { case WEST: return (getData() & VINE_WEST) == VINE_WEST; case NORTH: return (getData() & VINE_NORTH) == VINE_NORTH; case SOUTH: return (getData() & VINE_SOUTH) == VINE_SOUTH; case EAST: return (getData() & VINE_EAST) == VINE_EAST; case NORTH_EAST: return isOnFace(BlockFace.EAST) && isOnFace(BlockFace.NORTH); case NORTH_WEST: return isOnFace(BlockFace.WEST) && isOnFace(BlockFace.NORTH); case SOUTH_EAST: return isOnFace(BlockFace.EAST) && isOnFace(BlockFace.SOUTH); case SOUTH_WEST: return isOnFace(BlockFace.WEST) && isOnFace(BlockFace.SOUTH); case UP: return true; default: return false; } }
/** * Check if the vine is attached to the specified face of an adjacent * block. You can check two faces at once by passing e.g. {@link * BlockFace#NORTH_EAST}. * * @param face The face to check. * @return Whether it is attached to that face. */
Check if the vine is attached to the specified face of an adjacent block. You can check two faces at once by passing e.g. <code>BlockFace#NORTH_EAST</code>
isOnFace
{ "repo_name": "PipeMC/Pipe", "path": "src/main/java/org/bukkit/material/Vine.java", "license": "gpl-3.0", "size": 5925 }
[ "org.bukkit.block.BlockFace" ]
import org.bukkit.block.BlockFace;
import org.bukkit.block.*;
[ "org.bukkit.block" ]
org.bukkit.block;
814,100
public Builder expectedValue(double expectedValue) { this.expectedValue = new DoubleNode(expectedValue); return this; }
Builder function(double expectedValue) { this.expectedValue = new DoubleNode(expectedValue); return this; }
/** * Sets the expected value for this condition. * * @param expectedValue Expected value. * @return This object for method chaining. */
Sets the expected value for this condition
expectedValue
{ "repo_name": "aws/aws-sdk-java", "path": "aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/conditions/NumericLessThanOrEqualCondition.java", "license": "apache-2.0", "size": 4387 }
[ "com.fasterxml.jackson.databind.node.DoubleNode" ]
import com.fasterxml.jackson.databind.node.DoubleNode;
import com.fasterxml.jackson.databind.node.*;
[ "com.fasterxml.jackson" ]
com.fasterxml.jackson;
2,386,671
private void printInterchangeStudentParent(PrintStream ps) throws JAXBException { int studentCounter = 0; int parentCounter = 0; int studentParentAssociationCounter = 0; Marshaller marshaller = getMarshaller(); InterchangeStudentParent interchangeStudentParent = new InterchangeStudentParent(); List<Object> list = interchangeStudentParent.getStudentOrParentOrStudentParentAssociation(); // process student while (studentReader.getCurrentRecord() != null) { list.add(this.getStudent()); studentReader.getNextRecord(); studentCounter++; } // process parent while (parentReader.getCurrentRecord() != null) { list.add(this.getParent()); parentReader.getNextRecord(); parentCounter++; } // process studentParentAssociation while (studentParentAssociationReader.getCurrentRecord() != null) { list.add(this.getStudentParentAssociation()); studentParentAssociationReader.getNextRecord(); studentParentAssociationCounter++; } marshaller.marshal(interchangeStudentParent, ps); System.out.println("Total " + studentCounter + " students are exported."); System.out.println("Total " + parentCounter + " parents are exported."); System.out.println("Total " + studentParentAssociationCounter + " student-parent-associations are exported."); System.out.println("Total " + ( studentCounter + parentCounter + studentParentAssociationCounter) + " entities are exported."); }
void function(PrintStream ps) throws JAXBException { int studentCounter = 0; int parentCounter = 0; int studentParentAssociationCounter = 0; Marshaller marshaller = getMarshaller(); InterchangeStudentParent interchangeStudentParent = new InterchangeStudentParent(); List<Object> list = interchangeStudentParent.getStudentOrParentOrStudentParentAssociation(); while (studentReader.getCurrentRecord() != null) { list.add(this.getStudent()); studentReader.getNextRecord(); studentCounter++; } while (parentReader.getCurrentRecord() != null) { list.add(this.getParent()); parentReader.getNextRecord(); parentCounter++; } while (studentParentAssociationReader.getCurrentRecord() != null) { list.add(this.getStudentParentAssociation()); studentParentAssociationReader.getNextRecord(); studentParentAssociationCounter++; } marshaller.marshal(interchangeStudentParent, ps); System.out.println(STR + studentCounter + STR); System.out.println(STR + parentCounter + STR); System.out.println(STR + studentParentAssociationCounter + STR); System.out.println(STR + ( studentCounter + parentCounter + studentParentAssociationCounter) + STR); }
/** * Iterate through Student, Parent, and studentParentAssociation records in the CSV files, * converts them into JAXB java objects, and then marshals them into SLI-EdFi xml file. * * @param ps * @throws JAXBException */
Iterate through Student, Parent, and studentParentAssociation records in the CSV files, converts them into JAXB java objects, and then marshals them into SLI-EdFi xml file
printInterchangeStudentParent
{ "repo_name": "inbloom/csv2xml", "path": "src/org/slc/sli/sample/transform/CSV2XMLTransformer.java", "license": "apache-2.0", "size": 15664 }
[ "java.io.PrintStream", "java.util.List", "javax.xml.bind.JAXBException", "javax.xml.bind.Marshaller", "org.slc.sli.sample.entities.InterchangeStudentParent" ]
import java.io.PrintStream; import java.util.List; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import org.slc.sli.sample.entities.InterchangeStudentParent;
import java.io.*; import java.util.*; import javax.xml.bind.*; import org.slc.sli.sample.entities.*;
[ "java.io", "java.util", "javax.xml", "org.slc.sli" ]
java.io; java.util; javax.xml; org.slc.sli;
1,803,919
public void log(final Level level, final String str) { if (isEnabled) { final StringBuilder sb = new StringBuilder(); for (int i = 0 ; i < indent ; i++) { sb.append(' '); } sb.append(str); logger.log(level, sb.toString()); } }
void function(final Level level, final String str) { if (isEnabled) { final StringBuilder sb = new StringBuilder(); for (int i = 0 ; i < indent ; i++) { sb.append(' '); } sb.append(str); logger.log(level, sb.toString()); } }
/** * Output log line on this logger at a given level of verbosity * @see java.util.logging.Level * * @param level minimum log level required for logging to take place * @param str string to log */
Output log line on this logger at a given level of verbosity
log
{ "repo_name": "exstar/nashorn", "path": "src/main/java/jdk/nashorn/internal/runtime/DebugLogger.java", "license": "gpl-2.0", "size": 9521 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
1,833,805
public void testHashCode() { int version = 1; int rounds = 5; int wordSize = 16; byte[] iv = {1, 2, 3, 4, 5, 6}; RC5ParameterSpec ps1 = new RC5ParameterSpec(version, rounds, wordSize, iv); RC5ParameterSpec ps2 = new RC5ParameterSpec(version, rounds, wordSize, iv); assertTrue("Equal objects should have the same hash codes.", ps1.hashCode() == ps2.hashCode()); }
void function() { int version = 1; int rounds = 5; int wordSize = 16; byte[] iv = {1, 2, 3, 4, 5, 6}; RC5ParameterSpec ps1 = new RC5ParameterSpec(version, rounds, wordSize, iv); RC5ParameterSpec ps2 = new RC5ParameterSpec(version, rounds, wordSize, iv); assertTrue(STR, ps1.hashCode() == ps2.hashCode()); }
/** * hashCode() method testing. Tests that for equal objects hash codes * are equal. */
hashCode() method testing. Tests that for equal objects hash codes are equal
testHashCode
{ "repo_name": "rex-xxx/mt6572_x201", "path": "external/apache-harmony/crypto/src/test/api/java/org/apache/harmony/crypto/tests/javax/crypto/spec/RC5ParameterSpecTest.java", "license": "gpl-2.0", "size": 10959 }
[ "javax.crypto.spec.RC5ParameterSpec" ]
import javax.crypto.spec.RC5ParameterSpec;
import javax.crypto.spec.*;
[ "javax.crypto" ]
javax.crypto;
1,503,568
public static String getTextForArgumentsAndReturnValue(final CALDocComment caldoc, final FunctionalAgent envEntity, final TypeExpr typeExpr, final ScopedEntityNamingPolicy scopedEntityNamingPolicy) { final StringBuilder buffer = new StringBuilder(); /// The arguments // final int nArgsInCALDoc = (caldoc == null) ? -1 : caldoc.getNArgBlocks(); final int arity = (typeExpr == null) ? -1 : typeExpr.getArity(); final int nArgs = Math.max(nArgsInCALDoc, arity); TypeExpr[] typePieces = null; String[] typePieceStrings = null; if (typeExpr != null) { typePieces = typeExpr.getTypePieces(); typePieceStrings = TypeExpr.toStringArray(typePieces, true, scopedEntityNamingPolicy); } if (nArgs > 0) { buffer.append("\n").append(CALDocMessages.getString("argumentsColon")).append("\n"); final Set<String> setOfArgumentNames = new HashSet<String>(); for (int i = 0; i < nArgs; i++) { buffer.append(spaces(INDENT_LEVEL)).append(getNthArgumentName(caldoc, envEntity, i, setOfArgumentNames)); if (typePieces != null) { buffer.append(" :: ").append(typePieceStrings[i]); } buffer.append("\n"); if (caldoc != null && i < nArgsInCALDoc) { final ArgBlock argBlock = caldoc.getNthArgBlock(i); buffer.append(getTextFromCALDocTextBlockWithLeadingIndentAndTrailingNewline(argBlock.getTextBlock(), INDENT_LEVEL * 2)); } } } /// The return value // final boolean hasReturnBlock = (caldoc != null) && (caldoc.getReturnBlock() != null); if (hasReturnBlock || envEntity instanceof Function || envEntity instanceof ClassMethod) { buffer.append("\n").append(CALDocMessages.getString("returnsColon")).append("\n"); if (typePieces != null) { final String returnTypeString = typePieceStrings[arity]; buffer.append(spaces(INDENT_LEVEL)).append(CALDocMessages.getString("returnValueIndicator")).append(" :: ").append(returnTypeString).append("\n"); } if (hasReturnBlock) { final TextBlock returnBlock = caldoc.getReturnBlock(); buffer.append(getTextFromCALDocTextBlockWithLeadingIndentAndTrailingNewline(returnBlock, INDENT_LEVEL * 2)); } } return buffer.toString(); }
static String function(final CALDocComment caldoc, final FunctionalAgent envEntity, final TypeExpr typeExpr, final ScopedEntityNamingPolicy scopedEntityNamingPolicy) { final StringBuilder buffer = new StringBuilder(); final int nArgsInCALDoc = (caldoc == null) ? -1 : caldoc.getNArgBlocks(); final int arity = (typeExpr == null) ? -1 : typeExpr.getArity(); final int nArgs = Math.max(nArgsInCALDoc, arity); TypeExpr[] typePieces = null; String[] typePieceStrings = null; if (typeExpr != null) { typePieces = typeExpr.getTypePieces(); typePieceStrings = TypeExpr.toStringArray(typePieces, true, scopedEntityNamingPolicy); } if (nArgs > 0) { buffer.append("\n").append(CALDocMessages.getString(STR)).append("\n"); final Set<String> setOfArgumentNames = new HashSet<String>(); for (int i = 0; i < nArgs; i++) { buffer.append(spaces(INDENT_LEVEL)).append(getNthArgumentName(caldoc, envEntity, i, setOfArgumentNames)); if (typePieces != null) { buffer.append(STR).append(typePieceStrings[i]); } buffer.append("\n"); if (caldoc != null && i < nArgsInCALDoc) { final ArgBlock argBlock = caldoc.getNthArgBlock(i); buffer.append(getTextFromCALDocTextBlockWithLeadingIndentAndTrailingNewline(argBlock.getTextBlock(), INDENT_LEVEL * 2)); } } } final boolean hasReturnBlock = (caldoc != null) && (caldoc.getReturnBlock() != null); if (hasReturnBlock envEntity instanceof Function envEntity instanceof ClassMethod) { buffer.append("\n").append(CALDocMessages.getString(STR)).append("\n"); if (typePieces != null) { final String returnTypeString = typePieceStrings[arity]; buffer.append(spaces(INDENT_LEVEL)).append(CALDocMessages.getString(STR)).append(STR).append(returnTypeString).append("\n"); } if (hasReturnBlock) { final TextBlock returnBlock = caldoc.getReturnBlock(); buffer.append(getTextFromCALDocTextBlockWithLeadingIndentAndTrailingNewline(returnBlock, INDENT_LEVEL * 2)); } } return buffer.toString(); }
/** * Generates a plain text representation for the arguments and return value of a function, class method, or data constructor. * @param caldoc the associated CALDoc. Can be null. * @param envEntity the associated entity. Can be null. * @param typeExpr the type of the entity. Can be null if envEntity is null. * @param scopedEntityNamingPolicy the naming policy to use for generating qualified/unqualified names. */
Generates a plain text representation for the arguments and return value of a function, class method, or data constructor
getTextForArgumentsAndReturnValue
{ "repo_name": "levans/Open-Quark", "path": "src/CAL_Platform/src/org/openquark/cal/caldoc/CALDocToTextUtilities.java", "license": "bsd-3-clause", "size": 40030 }
[ "java.util.HashSet", "java.util.Set", "org.openquark.cal.compiler.CALDocComment", "org.openquark.cal.compiler.ClassMethod", "org.openquark.cal.compiler.Function", "org.openquark.cal.compiler.FunctionalAgent", "org.openquark.cal.compiler.ScopedEntityNamingPolicy", "org.openquark.cal.compiler.TypeExpr" ...
import java.util.HashSet; import java.util.Set; import org.openquark.cal.compiler.CALDocComment; import org.openquark.cal.compiler.ClassMethod; import org.openquark.cal.compiler.Function; import org.openquark.cal.compiler.FunctionalAgent; import org.openquark.cal.compiler.ScopedEntityNamingPolicy; import org.openquark.cal.compiler.TypeExpr;
import java.util.*; import org.openquark.cal.compiler.*;
[ "java.util", "org.openquark.cal" ]
java.util; org.openquark.cal;
1,187,790
public IgniteConfiguration setCommunicationSpi(CommunicationSpi commSpi) { this.commSpi = commSpi; return this; }
IgniteConfiguration function(CommunicationSpi commSpi) { this.commSpi = commSpi; return this; }
/** * Sets fully configured instance of {@link CommunicationSpi}. * * @param commSpi Fully configured instance of {@link CommunicationSpi}. * @see IgniteConfiguration#getCommunicationSpi() * @return {@code this} for chaining. */
Sets fully configured instance of <code>CommunicationSpi</code>
setCommunicationSpi
{ "repo_name": "nizhikov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java", "license": "apache-2.0", "size": 125128 }
[ "org.apache.ignite.spi.communication.CommunicationSpi" ]
import org.apache.ignite.spi.communication.CommunicationSpi;
import org.apache.ignite.spi.communication.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,224,745
List<GroupData> loadGroupsForExperimenter(SecurityContext ctx, long id) throws DSOutOfServiceException, DSAccessException { List<GroupData> pojos = new ArrayList<GroupData>(); try { IQueryPrx svc = gw.getQueryService(ctx); List<ExperimenterGroup> groups = null; ParametersI p = new ParametersI(); p.addId(id); groups = (List) svc.findAllByQuery("select distinct g " + "from ExperimenterGroup g " + "left outer join fetch g.groupExperimenterMap m " + "left outer join fetch m.child u " + " where u.id = :id", p); pojos.addAll(PojoMapper.<GroupData>convertToDataObjects(groups)); return pojos; } catch (Throwable t) { handleException(t, "Cannot retrieve the available groups "); } return pojos; }
List<GroupData> loadGroupsForExperimenter(SecurityContext ctx, long id) throws DSOutOfServiceException, DSAccessException { List<GroupData> pojos = new ArrayList<GroupData>(); try { IQueryPrx svc = gw.getQueryService(ctx); List<ExperimenterGroup> groups = null; ParametersI p = new ParametersI(); p.addId(id); groups = (List) svc.findAllByQuery(STR + STR + STR + STR + STR, p); pojos.addAll(PojoMapper.<GroupData>convertToDataObjects(groups)); return pojos; } catch (Throwable t) { handleException(t, STR); } return pojos; }
/** * Loads the groups the experimenters. * * @param ctx The security context. * @param id The group identifier or <code>-1</code>. * @return See above. * @throws DSOutOfServiceException If the connection is broken, or logged * in. * @throws DSAccessException If an error occurred while trying to * retrieve data from OMEDS service. */
Loads the groups the experimenters
loadGroupsForExperimenter
{ "repo_name": "dpwrussell/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java", "license": "gpl-2.0", "size": 262581 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,225,798
@SuppressWarnings( "deprecation" ) @Test public void shouldBeAbleToCreateAndExecuteSqlQueryWithContainsCriteria() throws RepositoryException { String sql = "SELECT * FROM nt:base WHERE jcr:path LIKE '/Cars/%' AND NOT jcr:path LIKE '/Cars/%/%'"; Query query = session.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); QueryResult result = query.execute(); validateQuery().rowCount(4).hasColumns(allColumnNames()).validate(query, result); }
@SuppressWarnings( STR ) void function() throws RepositoryException { String sql = STR; Query query = session.getWorkspace().getQueryManager().createQuery(sql, Query.SQL); QueryResult result = query.execute(); validateQuery().rowCount(4).hasColumns(allColumnNames()).validate(query, result); }
/** * Tests that the child nodes (but no grandchild nodes) are returned. * * @throws RepositoryException */
Tests that the child nodes (but no grandchild nodes) are returned
shouldBeAbleToCreateAndExecuteSqlQueryWithContainsCriteria
{ "repo_name": "jasperstein/modeshape", "path": "modeshape-jcr/src/test/java/org/modeshape/jcr/JcrQueryManagerTest.java", "license": "apache-2.0", "size": 261516 }
[ "javax.jcr.RepositoryException", "javax.jcr.query.Query", "javax.jcr.query.QueryResult" ]
import javax.jcr.RepositoryException; import javax.jcr.query.Query; import javax.jcr.query.QueryResult;
import javax.jcr.*; import javax.jcr.query.*;
[ "javax.jcr" ]
javax.jcr;
620,256
@Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
void function(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
/** * Create contents of the button bar. * * @param parent */
Create contents of the button bar
createButtonsForButtonBar
{ "repo_name": "JKatzwinkel/bts", "path": "org.bbaw.bts.ui.main/src/org/bbaw/bts/ui/main/dialogs/BTSConfigurationDialog.java", "license": "lgpl-3.0", "size": 97372 }
[ "org.eclipse.jface.dialogs.IDialogConstants", "org.eclipse.swt.widgets.Composite" ]
import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.swt.widgets.Composite;
import org.eclipse.jface.dialogs.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.jface", "org.eclipse.swt" ]
org.eclipse.jface; org.eclipse.swt;
1,816,241
@GET @Path("/{roleName}/logs/stdout") @Produces(MediaType.TEXT_PLAIN) public InputStream getStandardOutput( @PathParam(ROLE_NAME) String roleName);
@Path(STR) @Produces(MediaType.TEXT_PLAIN) InputStream function( @PathParam(ROLE_NAME) String roleName);
/** * Retrieves the role's standard output. * <p> * If the role is not started, this will be the output associated with * the last time the role was run. * <p> * Log files are returned as plain text (type "text/plain"). * * @param roleName The role to fetch stdout from. * @return Contents of the role's standard output. */
Retrieves the role's standard output. If the role is not started, this will be the output associated with the last time the role was run. Log files are returned as plain text (type "text/plain")
getStandardOutput
{ "repo_name": "kostin88/cm_api", "path": "java/src/main/java/com/cloudera/api/v1/RolesResource.java", "license": "apache-2.0", "size": 11869 }
[ "java.io.InputStream", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType" ]
import java.io.InputStream; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType;
import java.io.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "java.io", "javax.ws" ]
java.io; javax.ws;
2,155,798
default Complex[] toComplexVector() { return null; }
default Complex[] toComplexVector() { return null; }
/** * Convert this object into a <code>Complex[]</code> vector. * * @return <code>null</code> if this object can not be converted into a <code>Complex[]</code> * vector */
Convert this object into a <code>Complex[]</code> vector
toComplexVector
{ "repo_name": "axkr/symja_android_library", "path": "symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/interfaces/IExpr.java", "license": "gpl-3.0", "size": 152649 }
[ "org.hipparchus.complex.Complex" ]
import org.hipparchus.complex.Complex;
import org.hipparchus.complex.*;
[ "org.hipparchus.complex" ]
org.hipparchus.complex;
72,136
public boolean restoreFailedStorage(String arg) throws IOException { return dfs.restoreFailedStorage(arg); }
boolean function(String arg) throws IOException { return dfs.restoreFailedStorage(arg); }
/** * enable/disable/check restoreFaileStorage * * @see org.apache.hadoop.hdfs.protocol.ClientProtocol#restoreFailedStorage(String arg) */
enable/disable/check restoreFaileStorage
restoreFailedStorage
{ "repo_name": "steveloughran/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java", "license": "apache-2.0", "size": 130691 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
794,342
public void createPlotTracesWithAnnotations() { List<AnnotationInfo> oldAnno = model.getAnnotations(); plot.removeAll(); int i = 0; for (AxisConfig axis : model.getAxes()) plot.updateAxis(i++, axis); for (ModelItem item : model.getItems()) plot.addTrace(item); plot.setAnnotations(oldAnno); }
void function() { List<AnnotationInfo> oldAnno = model.getAnnotations(); plot.removeAll(); int i = 0; for (AxisConfig axis : model.getAxes()) plot.updateAxis(i++, axis); for (ModelItem item : model.getItems()) plot.addTrace(item); plot.setAnnotations(oldAnno); }
/** (Re-) create traces in plot for each item in the model and add * any existing annotations */
(Re-) create traces in plot for each item in the model and add
createPlotTracesWithAnnotations
{ "repo_name": "ControlSystemStudio/cs-studio", "path": "applications/databrowser/databrowser-plugins/org.csstudio.trends.databrowser2/src/org/csstudio/trends/databrowser2/ui/Controller.java", "license": "epl-1.0", "size": 29991 }
[ "java.util.List", "org.csstudio.trends.databrowser2.model.AnnotationInfo", "org.csstudio.trends.databrowser2.model.AxisConfig", "org.csstudio.trends.databrowser2.model.ModelItem" ]
import java.util.List; import org.csstudio.trends.databrowser2.model.AnnotationInfo; import org.csstudio.trends.databrowser2.model.AxisConfig; import org.csstudio.trends.databrowser2.model.ModelItem;
import java.util.*; import org.csstudio.trends.databrowser2.model.*;
[ "java.util", "org.csstudio.trends" ]
java.util; org.csstudio.trends;
2,356,279