method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@Override public Object parseObject(final String source, final ParsePosition pos) { return parse(source, pos); }
Object function(final String source, final ParsePosition pos) { return parse(source, pos); }
/** * Parses text from a string to produce a range. The default implementation delegates to * {@link #parse(String, ParsePosition)} with no additional work. * * @param source The text, part of which should be parsed. * @param pos Index and error index information as described above. * @return A range parsed from the string, or {@code null} in case of error. */
Parses text from a string to produce a range. The default implementation delegates to <code>#parse(String, ParsePosition)</code> with no additional work
parseObject
{ "repo_name": "desruisseaux/sis", "path": "core/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java", "license": "apache-2.0", "size": 43898 }
[ "java.text.ParsePosition" ]
import java.text.ParsePosition;
import java.text.*;
[ "java.text" ]
java.text;
170,938
public static boolean hasAlpha(Image image) { // If buffered image, the color model is readily available if (image instanceof BufferedImage) { BufferedImage bimage = (BufferedImage)image; return bimage.getColorModel().hasAlpha(); } // Use a pixel grabber to retrieve the image's color model; // grabbing a single pixel is usually sufficient PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false); try { pg.grabPixels(); } catch (InterruptedException e) { } // Get the image's color model ColorModel cm = pg.getColorModel(); return cm.hasAlpha(); }
static boolean function(Image image) { if (image instanceof BufferedImage) { BufferedImage bimage = (BufferedImage)image; return bimage.getColorModel().hasAlpha(); } PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false); try { pg.grabPixels(); } catch (InterruptedException e) { } ColorModel cm = pg.getColorModel(); return cm.hasAlpha(); }
/** * wether the given image has an alpha channel * * @param image * @return wether the given image has an alpha channel */
wether the given image has an alpha channel
hasAlpha
{ "repo_name": "michielgkalkman/JM2", "path": "JMemorizeSwing/src/main/java/jmemorize/util/ImageConverter.java", "license": "gpl-2.0", "size": 3581 }
[ "java.awt.Image", "java.awt.image.BufferedImage", "java.awt.image.ColorModel", "java.awt.image.PixelGrabber" ]
import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.PixelGrabber;
import java.awt.*; import java.awt.image.*;
[ "java.awt" ]
java.awt;
1,416,798
public void readInCreditsTxt(int creditsReference, String scoreText) { InputStream inputStream = getResources().openRawResource( creditsReference); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream)); String eachLine = ""; while (eachLine != null) { credits.add(new creditsLineItem(eachLine)); try { eachLine = bufferedReader.readLine(); } catch (IOException e) { e.printStackTrace(); } } if ((scoreText != null) && !scoreText.equals("")) { finalScore = scoreText; } }
void function(int creditsReference, String scoreText) { InputStream inputStream = getResources().openRawResource( creditsReference); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream)); String eachLine = STR")) { finalScore = scoreText; } }
/** * Read in credits txt. * * @param creditsReference * the credits reference * @param scoreText * the score text */
Read in credits txt
readInCreditsTxt
{ "repo_name": "huntergdavis/AndroidEasyGameUtils", "path": "src/com/hunterdavis/gameutils/credits/CreditsPanel.java", "license": "bsd-3-clause", "size": 8313 }
[ "java.io.BufferedReader", "java.io.InputStream", "java.io.InputStreamReader" ]
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader;
import java.io.*;
[ "java.io" ]
java.io;
972,922
protected Result[] getResults(String[] passages, String[] docIDs, boolean isHtml) { return getResults(passages, docIDs, new String[docIDs.length], isHtml); }
Result[] function(String[] passages, String[] docIDs, boolean isHtml) { return getResults(passages, docIDs, new String[docIDs.length], isHtml); }
/** * Creates <code>Result</code> objects form an array of text passages and * document IDs. * * @param passages text passages * @param docIDs IDs of the documents the text passages are from * @param isHtml flag indicating that the passages are HTML code * @return <code>Result</code> objects */
Creates <code>Result</code> objects form an array of text passages and document IDs
getResults
{ "repo_name": "Eric-LeiYang/Openephyra", "path": "openephyra-0.1.2/src/info/ephyra/search/searchers/KnowledgeMiner.java", "license": "gpl-3.0", "size": 5715 }
[ "info.ephyra.search.Result" ]
import info.ephyra.search.Result;
import info.ephyra.search.*;
[ "info.ephyra.search" ]
info.ephyra.search;
748,968
public static SerialDataEvent newRxEvent(Object source, String message) { return new SerialDataEvent(source, MessageType.Slave, message); }
static SerialDataEvent function(Object source, String message) { return new SerialDataEvent(source, MessageType.Slave, message); }
/** * Generates a new slave, or Rx, type serial data event * * @param source Object that raised this event * @param message Stringified packet * @return SerialDataEvent event containing packet information */
Generates a new slave, or Rx, type serial data event
newRxEvent
{ "repo_name": "PyramidTechnologies/jPyramid-RS-232", "path": "src/main/java/com/pyramidacceptors/ptalk/api/event/SerialDataEvent.java", "license": "mit", "size": 1904 }
[ "com.pyramidacceptors.ptalk.api.MessageType" ]
import com.pyramidacceptors.ptalk.api.MessageType;
import com.pyramidacceptors.ptalk.api.*;
[ "com.pyramidacceptors.ptalk" ]
com.pyramidacceptors.ptalk;
2,268,042
public static String toStringBinary(ByteBuffer buf) { if (buf == null) return "null"; if (buf.hasArray()) { return toStringBinary(buf.array(), buf.arrayOffset(), buf.limit()); } return toStringBinary(toBytes(buf)); }
static String function(ByteBuffer buf) { if (buf == null) return "null"; if (buf.hasArray()) { return toStringBinary(buf.array(), buf.arrayOffset(), buf.limit()); } return toStringBinary(toBytes(buf)); }
/** * Converts the given byte buffer to a printable representation, * from the index 0 (inclusive) to the limit (exclusive), * regardless of the current position. * The position and the other index parameters are not changed. * * @param buf a byte buffer * @return a string representation of the buffer's binary contents * @see #toBytes(ByteBuffer) * @see #getBytes(ByteBuffer) */
Converts the given byte buffer to a printable representation, from the index 0 (inclusive) to the limit (exclusive), regardless of the current position. The position and the other index parameters are not changed
toStringBinary
{ "repo_name": "ibmsoe/hbase", "path": "hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java", "license": "apache-2.0", "size": 73824 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
1,785,837
private boolean systemListenerChange(Object topic, GridMessageListener expected, GridMessageListener newVal) { assert Thread.holdsLock(sysLsnrsMux); assert topic instanceof GridTopic; int idx = systemListenerIndex(topic); GridMessageListener old = sysLsnrs[idx]; if (old != null && old.equals(expected)) { changeSystemListener(idx, newVal); return true; } return false; }
boolean function(Object topic, GridMessageListener expected, GridMessageListener newVal) { assert Thread.holdsLock(sysLsnrsMux); assert topic instanceof GridTopic; int idx = systemListenerIndex(topic); GridMessageListener old = sysLsnrs[idx]; if (old != null && old.equals(expected)) { changeSystemListener(idx, newVal); return true; } return false; }
/** * Change system listener. * * @param topic Topic. * @param expected Expected value. * @param newVal New value. * @return Result. */
Change system listener
systemListenerChange
{ "repo_name": "tkpanther/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java", "license": "apache-2.0", "size": 85242 }
[ "org.apache.ignite.internal.GridTopic" ]
import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,530,640
void init(LauncherAppState app, LauncherModel model, BgDataModel dataModel, AllAppsList allAppsList, Executor uiExecutor); }
void init(LauncherAppState app, LauncherModel model, BgDataModel dataModel, AllAppsList allAppsList, Executor uiExecutor); }
/** * Called before the task is posted to initialize the internal state. */
Called before the task is posted to initialize the internal state
init
{ "repo_name": "Deletescape-Media/Lawnchair", "path": "src/com/android/launcher3/LauncherModel.java", "license": "gpl-3.0", "size": 23716 }
[ "com.android.launcher3.model.AllAppsList", "com.android.launcher3.model.BgDataModel", "java.util.concurrent.Executor" ]
import com.android.launcher3.model.AllAppsList; import com.android.launcher3.model.BgDataModel; import java.util.concurrent.Executor;
import com.android.launcher3.model.*; import java.util.concurrent.*;
[ "com.android.launcher3", "java.util" ]
com.android.launcher3; java.util;
2,230,753
public static <T> List<T> plus(List<T> left, Collection<T> right) { return (List<T>) plus((Collection<T>) left, right); }
static <T> List<T> function(List<T> left, Collection<T> right) { return (List<T>) plus((Collection<T>) left, right); }
/** * Create a List as a union of a List and a Collection. * This operation will always create a new object for the result, * while the operands remain unchanged. * * @param left the left List * @param right the right Collection * @return the merged List * @since 2.4.0 * @see #plus(Collection, Collection) */
Create a List as a union of a List and a Collection. This operation will always create a new object for the result, while the operands remain unchanged
plus
{ "repo_name": "armsargis/groovy", "path": "src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java", "license": "apache-2.0", "size": 698233 }
[ "java.util.Collection", "java.util.List" ]
import java.util.Collection; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,497,164
V resolve(Class<?> cls, RId annotation, String idFieldName, CommandAsyncExecutor commandAsyncExecutor);
V resolve(Class<?> cls, RId annotation, String idFieldName, CommandAsyncExecutor commandAsyncExecutor);
/** * RLiveObjectService instantiate the class and invokes this method to get * a value used as the value for the field with RId annotation. * * @param cls the class of the LiveObject. * @param annotation the RId annotation used in the class. * @param idFieldName field id * @param commandAsyncExecutor instance * @return resolved RId field value. */
RLiveObjectService instantiate the class and invokes this method to get a value used as the value for the field with RId annotation
resolve
{ "repo_name": "mrniko/redisson", "path": "redisson/src/main/java/org/redisson/liveobject/resolver/RIdResolver.java", "license": "apache-2.0", "size": 1377 }
[ "org.redisson.api.annotation.RId", "org.redisson.command.CommandAsyncExecutor" ]
import org.redisson.api.annotation.RId; import org.redisson.command.CommandAsyncExecutor;
import org.redisson.api.annotation.*; import org.redisson.command.*;
[ "org.redisson.api", "org.redisson.command" ]
org.redisson.api; org.redisson.command;
388,958
private void setVisibility(boolean isVisible) { if (mIsContentViewShowing == isVisible) return; mIsContentViewShowing = isVisible; if (isVisible) { // If the last call to loadUrl was specified to be delayed, load it now. if (!TextUtils.isEmpty(mPendingUrl)) { loadUrl(mPendingUrl, true); } // The CVC is created with the search request, but if none was made we'll need // one in order to display an empty panel. if (mContentViewCore == null) { createNewContentView(); } // NOTE(pedrosimonetti): Calling onShow() on the ContentViewCore will cause the page // to be rendered. This has a side effect of causing the page to be included in // your Web History (if enabled). For this reason, onShow() should only be called // when we know for sure the page will be seen by the user. if (mContentViewCore != null) mContentViewCore.onShow(); mContentDelegate.onContentViewSeen(); } else { if (mContentViewCore != null) mContentViewCore.onHide(); } mContentDelegate.onVisibilityChanged(isVisible); }
void function(boolean isVisible) { if (mIsContentViewShowing == isVisible) return; mIsContentViewShowing = isVisible; if (isVisible) { if (!TextUtils.isEmpty(mPendingUrl)) { loadUrl(mPendingUrl, true); } if (mContentViewCore == null) { createNewContentView(); } if (mContentViewCore != null) mContentViewCore.onShow(); mContentDelegate.onContentViewSeen(); } else { if (mContentViewCore != null) mContentViewCore.onHide(); } mContentDelegate.onVisibilityChanged(isVisible); }
/** * Sets the visibility of the Search Content View. * @param isVisible True to make it visible. */
Sets the visibility of the Search Content View
setVisibility
{ "repo_name": "axinging/chromium-crosswalk", "path": "chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java", "license": "bsd-3-clause", "size": 19069 }
[ "android.text.TextUtils" ]
import android.text.TextUtils;
import android.text.*;
[ "android.text" ]
android.text;
674,680
/////////////////////////////////////////////////////////////////////////// // // MINIONS // /////////////////////////////////////////////////////////////////////////// private UUIDFactory getUUIDFactory() { if ( uuidFactory == null ) { uuidFactory = Monitor.getMonitor().getUUIDFactory(); } return uuidFactory; }
UUIDFactory function() { if ( uuidFactory == null ) { uuidFactory = Monitor.getMonitor().getUUIDFactory(); } return uuidFactory; }
/** * Get the UUID factory * * @return the UUID factory * */
Get the UUID factory
getUUIDFactory
{ "repo_name": "lpxz/grail-derby104", "path": "java/engine/org/apache/derby/impl/sql/compile/ConstraintDefinitionNode.java", "license": "apache-2.0", "size": 12767 }
[ "org.apache.derby.iapi.services.monitor.Monitor", "org.apache.derby.iapi.services.uuid.UUIDFactory" ]
import org.apache.derby.iapi.services.monitor.Monitor; import org.apache.derby.iapi.services.uuid.UUIDFactory;
import org.apache.derby.iapi.services.monitor.*; import org.apache.derby.iapi.services.uuid.*;
[ "org.apache.derby" ]
org.apache.derby;
2,401,275
public static void log(IStatus status) { getDefault().getLog().log(status); }
static void function(IStatus status) { getDefault().getLog().log(status); }
/** * Logs the specified status with this plug-in's log. * * @param status status to log */
Logs the specified status with this plug-in's log
log
{ "repo_name": "Mr-Slippery/eclipse-compositelaunch", "path": "ro.aquacola.compositelaunch.ui/src/ro/aquacola/compositelaunch/ui/CompositeLaunchUIActivator.java", "license": "epl-1.0", "size": 3459 }
[ "org.eclipse.core.runtime.IStatus" ]
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.*;
[ "org.eclipse.core" ]
org.eclipse.core;
1,469,957
public void setSelectedElements(final Object elements) { if (elements instanceof List) { this.selectedElements = (List)elements; } activateSelectedObjects(); }
void function(final Object elements) { if (elements instanceof List) { this.selectedElements = (List)elements; } activateSelectedObjects(); }
/** * DOCUMENT ME! * * @param elements DOCUMENT ME! */
DOCUMENT ME
setSelectedElements
{ "repo_name": "cismet/cids-navigator", "path": "src/main/java/de/cismet/cids/editors/DefaultBindableCheckboxField.java", "license": "gpl-3.0", "size": 16722 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
192,782
public void scale(VisualizationViewer vv, float amount, Point2D from) { MutableTransformer viewTransformer = vv.getViewTransformer(); viewTransformer.scale(amount, amount, from); vv.repaint(); }
void function(VisualizationViewer vv, float amount, Point2D from) { MutableTransformer viewTransformer = vv.getViewTransformer(); viewTransformer.scale(amount, amount, from); vv.repaint(); }
/** * zoom the display in or out, depending on the direction of the * mouse wheel motion. */
zoom the display in or out, depending on the direction of the mouse wheel motion
scale
{ "repo_name": "markus1978/clickwatch", "path": "external/edu.uci.ics.jung/src/edu/uci/ics/jung/visualization/control/ViewScalingControl.java", "license": "apache-2.0", "size": 1255 }
[ "edu.uci.ics.jung.visualization.VisualizationViewer", "edu.uci.ics.jung.visualization.transform.MutableTransformer", "java.awt.geom.Point2D" ]
import edu.uci.ics.jung.visualization.VisualizationViewer; import edu.uci.ics.jung.visualization.transform.MutableTransformer; import java.awt.geom.Point2D;
import edu.uci.ics.jung.visualization.*; import edu.uci.ics.jung.visualization.transform.*; import java.awt.geom.*;
[ "edu.uci.ics", "java.awt" ]
edu.uci.ics; java.awt;
464,097
public static AzureStackManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { return new AzureStackManager(new RestClient.Builder() .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials) .withSerializerAdapter(new AzureJacksonAdapter()) .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) .build(), subscriptionId); }
static AzureStackManager function(AzureTokenCredentials credentials, String subscriptionId) { return new AzureStackManager(new RestClient.Builder() .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) .withCredentials(credentials) .withSerializerAdapter(new AzureJacksonAdapter()) .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) .build(), subscriptionId); }
/** * Creates an instance of AzureStackManager that exposes AzureStack resource management API entry points. * * @param credentials the credentials to use * @param subscriptionId the subscription UUID * @return the AzureStackManager */
Creates an instance of AzureStackManager that exposes AzureStack resource management API entry points
authenticate
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/azurestack/mgmt-v2017_06_01/src/main/java/com/microsoft/azure/management/azurestack/v2017_06_01/implementation/AzureStackManager.java", "license": "mit", "size": 5373 }
[ "com.microsoft.azure.AzureEnvironment", "com.microsoft.azure.AzureResponseBuilder", "com.microsoft.azure.credentials.AzureTokenCredentials", "com.microsoft.azure.serializer.AzureJacksonAdapter", "com.microsoft.rest.RestClient" ]
import com.microsoft.azure.AzureEnvironment; import com.microsoft.azure.AzureResponseBuilder; import com.microsoft.azure.credentials.AzureTokenCredentials; import com.microsoft.azure.serializer.AzureJacksonAdapter; import com.microsoft.rest.RestClient;
import com.microsoft.azure.*; import com.microsoft.azure.credentials.*; import com.microsoft.azure.serializer.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
200,414
private static DetailAST getNextStmt(DetailAST comment) { DetailAST nextStmt = comment.getNextSibling(); while (nextStmt != null && isComment(nextStmt) && comment.getColumnNo() != nextStmt.getColumnNo()) { nextStmt = nextStmt.getNextSibling(); } return nextStmt; }
static DetailAST function(DetailAST comment) { DetailAST nextStmt = comment.getNextSibling(); while (nextStmt != null && isComment(nextStmt) && comment.getColumnNo() != nextStmt.getColumnNo()) { nextStmt = nextStmt.getNextSibling(); } return nextStmt; }
/** * Returns the next statement of a comment. * @param comment comment. * @return the next statement of a comment. */
Returns the next statement of a comment
getNextStmt
{ "repo_name": "AkshitaKukreja30/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java", "license": "lgpl-2.1", "size": 37409 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
466,829
void exitMarkerAnnotation(@NotNull Java8Parser.MarkerAnnotationContext ctx);
void exitMarkerAnnotation(@NotNull Java8Parser.MarkerAnnotationContext ctx);
/** * Exit a parse tree produced by {@link Java8Parser#markerAnnotation}. * * @param ctx the parse tree */
Exit a parse tree produced by <code>Java8Parser#markerAnnotation</code>
exitMarkerAnnotation
{ "repo_name": "BigDaddy-Germany/WHOAMI", "path": "WHOAMI/src/de/aima13/whoami/modules/syntaxcheck/languages/antlrgen/Java8Listener.java", "license": "mit", "size": 97945 }
[ "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;
100,189
public FakeVentura.Builder setNullableMiddleName(@Nullable String middleName) { if (middleName != null) { return setMiddleName(middleName); } else { return clearMiddleName(); } }
FakeVentura.Builder function(@Nullable String middleName) { if (middleName != null) { return setMiddleName(middleName); } else { return clearMiddleName(); } }
/** * Sets the value to be returned by {@link FakeVentura#getMiddleName()}. * * @return this {@code Builder} object */
Sets the value to be returned by <code>FakeVentura#getMiddleName()</code>
setNullableMiddleName
{ "repo_name": "WillBro/assuredly-restful", "path": "faker-example/target/generated-sources/annotations/uk/co/trycatchfinallysoftware/data/FakeVentura_Builder.java", "license": "mit", "size": 19175 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,126,866
private void initGrid() { setSelectionMode(getDefaultSelectionMode()); registerRpc(new GridServerRpc() {
void function() { setSelectionMode(getDefaultSelectionMode()); registerRpc(new GridServerRpc() {
/** * Grid initial setup */
Grid initial setup
initGrid
{ "repo_name": "mstahv/framework", "path": "compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java", "license": "apache-2.0", "size": 273176 }
[ "com.vaadin.v7.shared.ui.grid.GridServerRpc" ]
import com.vaadin.v7.shared.ui.grid.GridServerRpc;
import com.vaadin.v7.shared.ui.grid.*;
[ "com.vaadin.v7" ]
com.vaadin.v7;
19,849
void setWidth( double dimension ) throws SemanticException;
void setWidth( double dimension ) throws SemanticException;
/** * Sets the item's width to a value in default units. The default unit may * be defined by the property in BIRT or the application unit defined in the * design session. * * @param dimension * the new value in application units. * @throws SemanticException * if the property is locked. */
Sets the item's width to a value in default units. The default unit may be defined by the property in BIRT or the application unit defined in the design session
setWidth
{ "repo_name": "sguan-actuate/birt", "path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/simpleapi/IReportItem.java", "license": "epl-1.0", "size": 8125 }
[ "org.eclipse.birt.report.model.api.activity.SemanticException" ]
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.activity.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
2,649,572
public static String getString(String key) { try { return resourceBundle.getString(key); } catch (MissingResourceException mre) { // This will happen frequently since there are no // images for many actions. return null; } }
static String function(String key) { try { return resourceBundle.getString(key); } catch (MissingResourceException mre) { return null; } }
/** * Retrieves the String resource from this bundle. * * @param key name of String resource to retrieve. * @return resource bundle for this package. */
Retrieves the String resource from this bundle
getString
{ "repo_name": "nlfiedler/jrgrep", "path": "src/com/bluemarsh/jrgrep/Bundle.java", "license": "gpl-2.0", "size": 3301 }
[ "java.util.MissingResourceException" ]
import java.util.MissingResourceException;
import java.util.*;
[ "java.util" ]
java.util;
2,740,307
protected GroundStationRequest createGroundStationRequest(List<String> names) { GroundStationRequest request = new GroundStationRequest("request/" + issuedBy); request.addNames(names); request.setIssuedBy(issuedBy); configureInit(request, GroundStation.class); return request; }
GroundStationRequest function(List<String> names) { GroundStationRequest request = new GroundStationRequest(STR + issuedBy); request.addNames(names); request.setIssuedBy(issuedBy); configureInit(request, GroundStation.class); return request; }
/** * Helper method to issued a ground station request to the archive * * @param names List of names of GroundStations * @return The GroundStation request to be issued */
Helper method to issued a ground station request to the archive
createGroundStationRequest
{ "repo_name": "Villemos/hbird-business", "path": "business/business-archive/src/main/java/org/hbird/business/archive/deprecated/api/Catalogue.java", "license": "apache-2.0", "size": 6831 }
[ "java.util.List", "org.hbird.exchange.dataaccess.GroundStationRequest", "org.hbird.exchange.groundstation.GroundStation" ]
import java.util.List; import org.hbird.exchange.dataaccess.GroundStationRequest; import org.hbird.exchange.groundstation.GroundStation;
import java.util.*; import org.hbird.exchange.dataaccess.*; import org.hbird.exchange.groundstation.*;
[ "java.util", "org.hbird.exchange" ]
java.util; org.hbird.exchange;
2,236,402
@Test public void testMountTableEntriesCacheUpdatedAfterRemoveAPICall() throws IOException { // add String srcPath = "/removePathSrc"; MountTable newEntry = MountTable.newInstance(srcPath, Collections.singletonMap("ns0", "/removePathDest"), Time.now(), Time.now()); addMountTableEntry(mountTableManager, newEntry); // When add entry is done, all the routers must have updated its mount // table entry List<RouterContext> routers = getRouters(); for (RouterContext rc : routers) { List<MountTable> result = getMountTableEntries(rc.getAdminClient().getMountTableManager()); assertEquals(1, result.size()); MountTable mountTableResult = result.get(0); assertEquals(srcPath, mountTableResult.getSourcePath()); } // remove RemoveMountTableEntryResponse removeMountTableEntry = mountTableManager.removeMountTableEntry( RemoveMountTableEntryRequest.newInstance(srcPath)); assertTrue(removeMountTableEntry.getStatus()); // When remove entry is done, all the routers must have removed its mount // table entry routers = getRouters(); for (RouterContext rc : routers) { List<MountTable> result = getMountTableEntries(rc.getAdminClient().getMountTableManager()); assertEquals(0, result.size()); } }
void function() throws IOException { String srcPath = STR; MountTable newEntry = MountTable.newInstance(srcPath, Collections.singletonMap("ns0", STR), Time.now(), Time.now()); addMountTableEntry(mountTableManager, newEntry); List<RouterContext> routers = getRouters(); for (RouterContext rc : routers) { List<MountTable> result = getMountTableEntries(rc.getAdminClient().getMountTableManager()); assertEquals(1, result.size()); MountTable mountTableResult = result.get(0); assertEquals(srcPath, mountTableResult.getSourcePath()); } RemoveMountTableEntryResponse removeMountTableEntry = mountTableManager.removeMountTableEntry( RemoveMountTableEntryRequest.newInstance(srcPath)); assertTrue(removeMountTableEntry.getStatus()); routers = getRouters(); for (RouterContext rc : routers) { List<MountTable> result = getMountTableEntries(rc.getAdminClient().getMountTableManager()); assertEquals(0, result.size()); } }
/** * removeMountTableEntry API should internally update the cache on all the * routers. */
removeMountTableEntry API should internally update the cache on all the routers
testMountTableEntriesCacheUpdatedAfterRemoveAPICall
{ "repo_name": "apurtell/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterMountTableCacheRefreshSecure.java", "license": "apache-2.0", "size": 13680 }
[ "java.io.IOException", "java.util.Collections", "java.util.List", "org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster", "org.apache.hadoop.hdfs.server.federation.store.protocol.RemoveMountTableEntryRequest", "org.apache.hadoop.hdfs.server.federation.store.protocol.RemoveMountTableEntryResponse", "org.apache.hadoop.hdfs.server.federation.store.records.MountTable", "org.apache.hadoop.util.Time", "org.junit.Assert" ]
import java.io.IOException; import java.util.Collections; import java.util.List; import org.apache.hadoop.hdfs.server.federation.MiniRouterDFSCluster; import org.apache.hadoop.hdfs.server.federation.store.protocol.RemoveMountTableEntryRequest; import org.apache.hadoop.hdfs.server.federation.store.protocol.RemoveMountTableEntryResponse; import org.apache.hadoop.hdfs.server.federation.store.records.MountTable; import org.apache.hadoop.util.Time; import org.junit.Assert;
import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.server.federation.*; import org.apache.hadoop.hdfs.server.federation.store.protocol.*; import org.apache.hadoop.hdfs.server.federation.store.records.*; import org.apache.hadoop.util.*; import org.junit.*;
[ "java.io", "java.util", "org.apache.hadoop", "org.junit" ]
java.io; java.util; org.apache.hadoop; org.junit;
1,222,796
InternalVariableInstanceQuery executionIds(Collection<String> executionIds);
InternalVariableInstanceQuery executionIds(Collection<String> executionIds);
/** * Query variables with the given execution ids */
Query variables with the given execution ids
executionIds
{ "repo_name": "dbmalkovsky/flowable-engine", "path": "modules/flowable-variable-service/src/main/java/org/flowable/variable/service/InternalVariableInstanceQuery.java", "license": "apache-2.0", "size": 3287 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,625,946
public int getHorseArmorIndex(ItemStack par1ItemStack) { return par1ItemStack == null ? 0 : (par1ItemStack.itemID == Item.horseArmorIron.itemID ? 1 : (par1ItemStack.itemID == Item.horseArmorGold.itemID ? 2 : (par1ItemStack.itemID == Item.horseArmorDiamond.itemID ? 3 : 0))); }
int function(ItemStack par1ItemStack) { return par1ItemStack == null ? 0 : (par1ItemStack.itemID == Item.horseArmorIron.itemID ? 1 : (par1ItemStack.itemID == Item.horseArmorGold.itemID ? 2 : (par1ItemStack.itemID == Item.horseArmorDiamond.itemID ? 3 : 0))); }
/** * 0 = iron, 1 = gold, 2 = diamond */
0 = iron, 1 = gold, 2 = diamond
getHorseArmorIndex
{ "repo_name": "HATB0T/RuneCraftery", "path": "forge/mcp/src/minecraft/net/minecraft/entity/passive/EntityHorse.java", "license": "lgpl-3.0", "size": 54333 }
[ "net.minecraft.item.Item", "net.minecraft.item.ItemStack" ]
import net.minecraft.item.Item; import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
1,229,814
public void setSourcepathRef(Reference r) { createSourcepath().setRefid(r); }
void function(Reference r) { createSourcepath().setRefid(r); }
/** * Adds a reference to a CLASSPATH defined elsewhere. * * @param r the reference containing the source path definition. */
Adds a reference to a CLASSPATH defined elsewhere
setSourcepathRef
{ "repo_name": "Mayo-WE01051879/mayosapp", "path": "Build/src/main/org/apache/tools/ant/taskdefs/Javadoc.java", "license": "mit", "size": 84218 }
[ "org.apache.tools.ant.types.Reference" ]
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.types.*;
[ "org.apache.tools" ]
org.apache.tools;
719,800
public Value createValue(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
Value function(LexicalUnit lu, CSSEngine engine) throws DOMException { switch (lu.getLexicalUnitType()) { case LexicalUnit.SAC_INHERIT: return ValueConstants.INHERIT_VALUE; case LexicalUnit.SAC_URI: return new URIValue(lu.getStringValue(), resolveURI(engine.getCSSBaseURI(), lu.getStringValue())); case LexicalUnit.SAC_IDENT: if (lu.getStringValue().equalsIgnoreCase (CSSConstants.CSS_NONE_VALUE)) { return ValueConstants.NONE_VALUE; } } throw createInvalidLexicalUnitDOMException(lu.getLexicalUnitType()); }
/** * Implements {@link ValueManager#createValue(LexicalUnit,CSSEngine)}. */
Implements <code>ValueManager#createValue(LexicalUnit,CSSEngine)</code>
createValue
{ "repo_name": "shyamalschandra/flex-sdk", "path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/css/engine/value/svg/ClipPathManager.java", "license": "apache-2.0", "size": 4191 }
[ "org.apache.flex.forks.batik.css.engine.CSSEngine", "org.apache.flex.forks.batik.css.engine.value.URIValue", "org.apache.flex.forks.batik.css.engine.value.Value", "org.apache.flex.forks.batik.css.engine.value.ValueConstants", "org.apache.flex.forks.batik.util.CSSConstants", "org.w3c.css.sac.LexicalUnit", "org.w3c.dom.DOMException" ]
import org.apache.flex.forks.batik.css.engine.CSSEngine; import org.apache.flex.forks.batik.css.engine.value.URIValue; import org.apache.flex.forks.batik.css.engine.value.Value; import org.apache.flex.forks.batik.css.engine.value.ValueConstants; import org.apache.flex.forks.batik.util.CSSConstants; import org.w3c.css.sac.LexicalUnit; import org.w3c.dom.DOMException;
import org.apache.flex.forks.batik.css.engine.*; import org.apache.flex.forks.batik.css.engine.value.*; import org.apache.flex.forks.batik.util.*; import org.w3c.css.sac.*; import org.w3c.dom.*;
[ "org.apache.flex", "org.w3c.css", "org.w3c.dom" ]
org.apache.flex; org.w3c.css; org.w3c.dom;
342,391
ContentClaim clone(ContentClaim original, boolean lossTolerant) throws IOException;
ContentClaim clone(ContentClaim original, boolean lossTolerant) throws IOException;
/** * Clones the content for the given content claim and returns content claim * of the new object * * @param original to clone * @param lossTolerant if can be place in a loss tolerant repository * @return new claim * @throws IOException if an IO error occurs. Any content written to the new * destination prior to the error will be destroyed */
Clones the content for the given content claim and returns content claim of the new object
clone
{ "repo_name": "WilliamNouet/nifi", "path": "nifi-framework-api/src/main/java/org/apache/nifi/controller/repository/ContentRepository.java", "license": "apache-2.0", "size": 10601 }
[ "java.io.IOException", "org.apache.nifi.controller.repository.claim.ContentClaim" ]
import java.io.IOException; import org.apache.nifi.controller.repository.claim.ContentClaim;
import java.io.*; import org.apache.nifi.controller.repository.claim.*;
[ "java.io", "org.apache.nifi" ]
java.io; org.apache.nifi;
2,128,819
@SuppressWarnings({"unchecked"}) private static Map contentSummaryToJSON(ContentSummary contentSummary) { Map json = new LinkedHashMap(); json.put(HttpFSFileSystem.CONTENT_SUMMARY_DIRECTORY_COUNT_JSON, contentSummary.getDirectoryCount()); json.put(HttpFSFileSystem.CONTENT_SUMMARY_FILE_COUNT_JSON, contentSummary.getFileCount()); json.put(HttpFSFileSystem.CONTENT_SUMMARY_LENGTH_JSON, contentSummary.getLength()); json.put(HttpFSFileSystem.CONTENT_SUMMARY_QUOTA_JSON, contentSummary.getQuota()); json.put(HttpFSFileSystem.CONTENT_SUMMARY_SPACE_CONSUMED_JSON, contentSummary.getSpaceConsumed()); json.put(HttpFSFileSystem.CONTENT_SUMMARY_SPACE_QUOTA_JSON, contentSummary.getSpaceQuota()); Map response = new LinkedHashMap(); response.put(HttpFSFileSystem.CONTENT_SUMMARY_JSON, json); return response; }
@SuppressWarnings({STR}) static Map function(ContentSummary contentSummary) { Map json = new LinkedHashMap(); json.put(HttpFSFileSystem.CONTENT_SUMMARY_DIRECTORY_COUNT_JSON, contentSummary.getDirectoryCount()); json.put(HttpFSFileSystem.CONTENT_SUMMARY_FILE_COUNT_JSON, contentSummary.getFileCount()); json.put(HttpFSFileSystem.CONTENT_SUMMARY_LENGTH_JSON, contentSummary.getLength()); json.put(HttpFSFileSystem.CONTENT_SUMMARY_QUOTA_JSON, contentSummary.getQuota()); json.put(HttpFSFileSystem.CONTENT_SUMMARY_SPACE_CONSUMED_JSON, contentSummary.getSpaceConsumed()); json.put(HttpFSFileSystem.CONTENT_SUMMARY_SPACE_QUOTA_JSON, contentSummary.getSpaceQuota()); Map response = new LinkedHashMap(); response.put(HttpFSFileSystem.CONTENT_SUMMARY_JSON, json); return response; }
/** * Converts a <code>ContentSummary</code> object into a JSON array * object. * * @param contentSummary the content summary * * @return The JSON representation of the content summary. */
Converts a <code>ContentSummary</code> object into a JSON array object
contentSummaryToJSON
{ "repo_name": "cnfire/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java", "license": "apache-2.0", "size": 39000 }
[ "java.util.LinkedHashMap", "java.util.Map", "org.apache.hadoop.fs.ContentSummary", "org.apache.hadoop.fs.http.client.HttpFSFileSystem" ]
import java.util.LinkedHashMap; import java.util.Map; import org.apache.hadoop.fs.ContentSummary; import org.apache.hadoop.fs.http.client.HttpFSFileSystem;
import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.http.client.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
2,670,197
@Override public void addPendingDelete(ShardId shardId, IndexSettings settings) { if (shardId == null) { throw new IllegalArgumentException("shardId must not be null"); } if (settings == null) { throw new IllegalArgumentException("settings must not be null"); } PendingDelete pendingDelete = new PendingDelete(shardId, settings); addPendingDelete(shardId.getIndex(), pendingDelete); }
void function(ShardId shardId, IndexSettings settings) { if (shardId == null) { throw new IllegalArgumentException(STR); } if (settings == null) { throw new IllegalArgumentException(STR); } PendingDelete pendingDelete = new PendingDelete(shardId, settings); addPendingDelete(shardId.getIndex(), pendingDelete); }
/** * Adds a pending delete for the given index shard. */
Adds a pending delete for the given index shard
addPendingDelete
{ "repo_name": "jimczi/elasticsearch", "path": "core/src/main/java/org/elasticsearch/indices/IndicesService.java", "license": "apache-2.0", "size": 62466 }
[ "org.elasticsearch.index.IndexSettings", "org.elasticsearch.index.shard.ShardId" ]
import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.index.*; import org.elasticsearch.index.shard.*;
[ "org.elasticsearch.index" ]
org.elasticsearch.index;
936,179
Analyzer analyzer = new MockAnalyzer(random()); SimpleQueryParser parser = new SimpleQueryParser(analyzer, "field"); parser.setDefaultOperator(Occur.MUST); return parser.parse(text); }
Analyzer analyzer = new MockAnalyzer(random()); SimpleQueryParser parser = new SimpleQueryParser(analyzer, "field"); parser.setDefaultOperator(Occur.MUST); return parser.parse(text); }
/** * helper to parse a query with whitespace+lowercase analyzer across "field", * with default operator of MUST */
helper to parse a query with whitespace+lowercase analyzer across "field", with default operator of MUST
parse
{ "repo_name": "yida-lxw/solr-5.3.1", "path": "lucene/queryparser/src/test/org/apache/lucene/queryparser/simple/TestSimpleQueryParser.java", "license": "apache-2.0", "size": 27490 }
[ "org.apache.lucene.analysis.Analyzer", "org.apache.lucene.analysis.MockAnalyzer", "org.apache.lucene.search.BooleanClause" ]
import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.analysis.*; import org.apache.lucene.search.*;
[ "org.apache.lucene" ]
org.apache.lucene;
1,447,799
public void setCompactionCompressionType(Compression.Algorithm type) { String compressionType; switch (type) { case LZO: compressionType = "LZO"; break; case GZ: compressionType = "GZ"; break; case SNAPPY: compressionType = "SNAPPY"; break; default: compressionType = "NONE"; break; } setValue(COMPRESSION_COMPACT, compressionType); }
void function(Compression.Algorithm type) { String compressionType; switch (type) { case LZO: compressionType = "LZO"; break; case GZ: compressionType = "GZ"; break; case SNAPPY: compressionType = STR; break; default: compressionType = "NONE"; break; } setValue(COMPRESSION_COMPACT, compressionType); }
/** * Compression types supported in hbase. * LZO is not bundled as part of the hbase distribution. * See <a href="http://wiki.apache.org/hadoop/UsingLzoCompression">LZO Compression</a> * for how to enable it. * @param type Compression type setting. */
Compression types supported in hbase. LZO is not bundled as part of the hbase distribution. See LZO Compression for how to enable it
setCompactionCompressionType
{ "repo_name": "lifeng5042/RStore", "path": "src/org/apache/hadoop/hbase/HColumnDescriptor.java", "license": "gpl-2.0", "size": 25826 }
[ "org.apache.hadoop.hbase.io.hfile.Compression" ]
import org.apache.hadoop.hbase.io.hfile.Compression;
import org.apache.hadoop.hbase.io.hfile.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,013,470
protected Method getGetSerializer() { if (getSerializer == null) { getSerializer = getMethod(javaType, "getSerializer"); } return getSerializer; }
Method function() { if (getSerializer == null) { getSerializer = getMethod(javaType, STR); } return getSerializer; }
/** * Returns the getSerializer. * @return Method */
Returns the getSerializer
getGetSerializer
{ "repo_name": "hugosato/apache-axis", "path": "src/org/apache/axis/encoding/ser/BaseSerializerFactory.java", "license": "apache-2.0", "size": 11593 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,782,011
public void executeStatementBatch(String sqlStatement, Iterable<SqlParameter> parameterMetadata, Iterable<? extends DataValueLookup> parameterData, Connection connection, boolean explicitCommit, int statementsPerFlush) { try { try (NamedParameterPreparedStatement preparedStatement = NamedParameterPreparedStatement.parse(sqlStatement).createFor(connection)) { executeStatementBatch(preparedStatement, parameterMetadata, parameterData, connection, explicitCommit, statementsPerFlush); } finally { if (explicitCommit) { connection.commit(); } } } catch (SQLException e) { throw reclassifiedRuntimeException(e, "SQL exception executing batch"); } }
void function(String sqlStatement, Iterable<SqlParameter> parameterMetadata, Iterable<? extends DataValueLookup> parameterData, Connection connection, boolean explicitCommit, int statementsPerFlush) { try { try (NamedParameterPreparedStatement preparedStatement = NamedParameterPreparedStatement.parse(sqlStatement).createFor(connection)) { executeStatementBatch(preparedStatement, parameterMetadata, parameterData, connection, explicitCommit, statementsPerFlush); } finally { if (explicitCommit) { connection.commit(); } } } catch (SQLException e) { throw reclassifiedRuntimeException(e, STR); } }
/** * Runs the specified SQL statement (which should contain parameters), repeatedly for * each record, mapping the contents of the records into the statement parameters in * their defined order. Use to insert, merge or update a large batch of records * efficiently. * * @param sqlStatement the SQL statement. * @param parameterMetadata the metadata describing the parameters. * @param parameterData the values to insert. * @param connection the JDBC connection to use. * @param explicitCommit Determine if an explicit commit should be invoked after executing the supplied batch * @param statementsPerFlush the number of statements to execute between JDBC batch flushes. Higher numbers have higher memory cost * but reduce the number of I/O round-trips to the database. */
Runs the specified SQL statement (which should contain parameters), repeatedly for each record, mapping the contents of the records into the statement parameters in their defined order. Use to insert, merge or update a large batch of records efficiently
executeStatementBatch
{ "repo_name": "badgerwithagun/morf", "path": "morf-core/src/main/java/org/alfasoftware/morf/jdbc/SqlScriptExecutor.java", "license": "apache-2.0", "size": 32987 }
[ "java.sql.Connection", "java.sql.SQLException", "org.alfasoftware.morf.jdbc.NamedParameterPreparedStatement", "org.alfasoftware.morf.metadata.DataValueLookup", "org.alfasoftware.morf.sql.element.SqlParameter" ]
import java.sql.Connection; import java.sql.SQLException; import org.alfasoftware.morf.jdbc.NamedParameterPreparedStatement; import org.alfasoftware.morf.metadata.DataValueLookup; import org.alfasoftware.morf.sql.element.SqlParameter;
import java.sql.*; import org.alfasoftware.morf.jdbc.*; import org.alfasoftware.morf.metadata.*; import org.alfasoftware.morf.sql.element.*;
[ "java.sql", "org.alfasoftware.morf" ]
java.sql; org.alfasoftware.morf;
1,496,172
public static boolean hasInstrumentationMetadata(JavaTargetAttributes.Builder attributes) { return !attributes.getInstrumentationMetadata().isEmpty(); }
static boolean function(JavaTargetAttributes.Builder attributes) { return !attributes.getInstrumentationMetadata().isEmpty(); }
/** * Returns whether coverage has instrumented artifacts. */
Returns whether coverage has instrumented artifacts
hasInstrumentationMetadata
{ "repo_name": "kchodorow/bazel", "path": "src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java", "license": "apache-2.0", "size": 23890 }
[ "com.google.devtools.build.lib.rules.java.JavaTargetAttributes" ]
import com.google.devtools.build.lib.rules.java.JavaTargetAttributes;
import com.google.devtools.build.lib.rules.java.*;
[ "com.google.devtools" ]
com.google.devtools;
239,981
public static void addRowsToTileTable(GeoPackage geoPackage, TileMatrix tileMatrix, byte[] tileData) { TileDao dao = geoPackage.getTileDao(tileMatrix.getTableName()); for (int column = 0; column < tileMatrix.getMatrixWidth(); column++) { for (int row = 0; row < tileMatrix.getMatrixHeight(); row++) { TileRow newRow = dao.newRow(); newRow.setZoomLevel(tileMatrix.getZoomLevel()); newRow.setTileColumn(column); newRow.setTileRow(row); newRow.setTileData(tileData); dao.create(newRow); } } }
static void function(GeoPackage geoPackage, TileMatrix tileMatrix, byte[] tileData) { TileDao dao = geoPackage.getTileDao(tileMatrix.getTableName()); for (int column = 0; column < tileMatrix.getMatrixWidth(); column++) { for (int row = 0; row < tileMatrix.getMatrixHeight(); row++) { TileRow newRow = dao.newRow(); newRow.setZoomLevel(tileMatrix.getZoomLevel()); newRow.setTileColumn(column); newRow.setTileRow(row); newRow.setTileData(tileData); dao.create(newRow); } } }
/** * Add rows to the tile table * * @param geoPackage * @param tileMatrix * @param tileData */
Add rows to the tile table
addRowsToTileTable
{ "repo_name": "boundlessgeo/geopackage-android", "path": "geopackage-sdk/src/androidTest/java/mil/nga/geopackage/test/TestUtils.java", "license": "mit", "size": 16456 }
[ "mil.nga.geopackage.GeoPackage", "mil.nga.geopackage.tiles.matrix.TileMatrix", "mil.nga.geopackage.tiles.user.TileDao", "mil.nga.geopackage.tiles.user.TileRow" ]
import mil.nga.geopackage.GeoPackage; import mil.nga.geopackage.tiles.matrix.TileMatrix; import mil.nga.geopackage.tiles.user.TileDao; import mil.nga.geopackage.tiles.user.TileRow;
import mil.nga.geopackage.*; import mil.nga.geopackage.tiles.matrix.*; import mil.nga.geopackage.tiles.user.*;
[ "mil.nga.geopackage" ]
mil.nga.geopackage;
2,842,277
Object[] pushWatchedTubes(Client client) { Object[] tubeNames = new Object[2]; List<String> list = client.listTubesWatched(); String newTubeName = "tube-" + UUID.randomUUID().toString(); client.watch(newTubeName); for (String existingTubeName : list) { client.ignore(existingTubeName); } tubeNames[0] = list; tubeNames[1] = newTubeName; return tubeNames; }
Object[] pushWatchedTubes(Client client) { Object[] tubeNames = new Object[2]; List<String> list = client.listTubesWatched(); String newTubeName = "tube-" + UUID.randomUUID().toString(); client.watch(newTubeName); for (String existingTubeName : list) { client.ignore(existingTubeName); } tubeNames[0] = list; tubeNames[1] = newTubeName; return tubeNames; }
/** * ignore all currently watched tubes, retuned in ret[0] watch a new tube, * returned in ret[1] */
ignore all currently watched tubes, retuned in ret[0] watch a new tube, returned in ret[1]
pushWatchedTubes
{ "repo_name": "jpeffer/JavaBeanstalkClient", "path": "src/test/java/com/surftools/BeanstalkClientImpl/ClientImplTest.java", "license": "gpl-3.0", "size": 25401 }
[ "com.surftools.BeanstalkClient", "java.util.List", "java.util.UUID" ]
import com.surftools.BeanstalkClient; import java.util.List; import java.util.UUID;
import com.surftools.*; import java.util.*;
[ "com.surftools", "java.util" ]
com.surftools; java.util;
25,951
public void appendLog(String message){ Log.i("XmlRpcClientoid", new Throwable().getStackTrace()[0].toString()); this.logMessage=this.logMessage+message+"\n"; textView1.setText(this.logMessage); }
void function(String message){ Log.i(STR, new Throwable().getStackTrace()[0].toString()); this.logMessage=this.logMessage+message+"\n"; textView1.setText(this.logMessage); }
/** * The main log control appender */
The main log control appender
appendLog
{ "repo_name": "rodolfoap/XmlRpcOid", "path": "app/src/main/java/org/ydor/xmlrpcclientoid/MainScreen.java", "license": "gpl-3.0", "size": 6331 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
804,745
private void setMeans(SemIm semIm, TetradMatrix dataSet) { double[] means = new double[semIm.getSemPm().getVariableNodes().size()]; int numMeans = means.length; if (dataSet == null) { for (int i = 0; i < numMeans; i++) { means[i] = 0.0; } } else { double[] sum = new double[numMeans]; for (int j = 0; j < dataSet.columns(); j++) { for (int i = 0; i < dataSet.rows(); i++) { sum[j] += dataSet.get(i, j); } means[j] = sum[j] / dataSet.rows(); } } for (int i = 0; i < semIm.getVariableNodes().size(); i++) { Node node = semIm.getVariableNodes().get(i); semIm.setMean(node, means[i]); } }
void function(SemIm semIm, TetradMatrix dataSet) { double[] means = new double[semIm.getSemPm().getVariableNodes().size()]; int numMeans = means.length; if (dataSet == null) { for (int i = 0; i < numMeans; i++) { means[i] = 0.0; } } else { double[] sum = new double[numMeans]; for (int j = 0; j < dataSet.columns(); j++) { for (int i = 0; i < dataSet.rows(); i++) { sum[j] += dataSet.get(i, j); } means[j] = sum[j] / dataSet.rows(); } } for (int i = 0; i < semIm.getVariableNodes().size(); i++) { Node node = semIm.getVariableNodes().get(i); semIm.setMean(node, means[i]); } }
/** * Sets the means of variables in the SEM IM based on the given data set. * * @param semIm SemIm * @param dataSet The data produced by iterating the sampler */
Sets the means of variables in the SEM IM based on the given data set
setMeans
{ "repo_name": "jmogarrio/tetrad", "path": "tetrad-lib/src/main/java/edu/cmu/tetrad/sem/SemEstimatorGibbs.java", "license": "gpl-2.0", "size": 22162 }
[ "edu.cmu.tetrad.graph.Node", "edu.cmu.tetrad.util.TetradMatrix" ]
import edu.cmu.tetrad.graph.Node; import edu.cmu.tetrad.util.TetradMatrix;
import edu.cmu.tetrad.graph.*; import edu.cmu.tetrad.util.*;
[ "edu.cmu.tetrad" ]
edu.cmu.tetrad;
2,399,819
public IdGenerator getGenerator(String name);
IdGenerator function(String name);
/** * Retrieve the id-generator by name. * * @param name The generator name. * * @return The generator, or null. */
Retrieve the id-generator by name
getGenerator
{ "repo_name": "ControlSystemStudio/cs-studio", "path": "thirdparty/plugins/org.csstudio.platform.libs.hibernate/project/annotations/src/main/java/org/hibernate/cfg/ExtendedMappings.java", "license": "epl-1.0", "size": 6869 }
[ "org.hibernate.mapping.IdGenerator" ]
import org.hibernate.mapping.IdGenerator;
import org.hibernate.mapping.*;
[ "org.hibernate.mapping" ]
org.hibernate.mapping;
2,745,820
public void setAccountingLineForValidation(AccountingLine accountingLineForValidation) { this.accountingLineForValidation = accountingLineForValidation; }
void function(AccountingLine accountingLineForValidation) { this.accountingLineForValidation = accountingLineForValidation; }
/** * Sets the accountingLineForValidation attribute value. * @param accountingLineForValidation The accountingLineForValidation to set. */
Sets the accountingLineForValidation attribute value
setAccountingLineForValidation
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/fp/document/validation/impl/CashReceiptFamilyAccountingLineAmountValidation.java", "license": "agpl-3.0", "size": 2847 }
[ "org.kuali.kfs.sys.businessobject.AccountingLine" ]
import org.kuali.kfs.sys.businessobject.AccountingLine;
import org.kuali.kfs.sys.businessobject.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
2,464,166
public boolean dexMergingEnabled() { return getDexMergingStrategy().equals(DexMergingStrategy.MERGE_IF_NEEDED) && getBaseModule().getAndroidManifest().getEffectiveMinSdkVersion() < 21 && getFeatureModules().size() > 1; }
boolean function() { return getDexMergingStrategy().equals(DexMergingStrategy.MERGE_IF_NEEDED) && getBaseModule().getAndroidManifest().getEffectiveMinSdkVersion() < 21 && getFeatureModules().size() > 1; }
/** * Returns {@code true} if bundletool will merge dex files when generating standalone APKs. This * happens for applications with dynamic feature modules that have min sdk below 21 and specified * DexMergingStrategy is MERGE_IF_NEEDED. */
Returns true if bundletool will merge dex files when generating standalone APKs. This happens for applications with dynamic feature modules that have min sdk below 21 and specified DexMergingStrategy is MERGE_IF_NEEDED
dexMergingEnabled
{ "repo_name": "google/bundletool", "path": "src/main/java/com/android/tools/build/bundletool/model/AppBundle.java", "license": "apache-2.0", "size": 9311 }
[ "com.android.bundle.Config" ]
import com.android.bundle.Config;
import com.android.bundle.*;
[ "com.android.bundle" ]
com.android.bundle;
2,671,012
@ApiModelProperty(example = "null", value = "description string") public String getDescription() { return description; }
@ApiModelProperty(example = "null", value = STR) String function() { return description; }
/** * description string * @return description **/
description string
getDescription
{ "repo_name": "Tmin10/EVE-Security-Service", "path": "server-api/src/main/java/ru/tmin10/EVESecurityService/serverApi/model/GetCharactersCharacterIdOk.java", "license": "gpl-3.0", "size": 8549 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
407,626
public void post(Context context, String url, RequestParams params, AsyncHttpResponseHandler responseHandler) { post(context, url, paramsToEntity(params), null, responseHandler); }
void function(Context context, String url, RequestParams params, AsyncHttpResponseHandler responseHandler) { post(context, url, paramsToEntity(params), null, responseHandler); }
/** * Perform a HTTP POST request and track the Android Context which initiated the request. * @param context the Android Context which initiated the request. * @param url the URL to send the request to. * @param params additional POST parameters or files to send with the request. * @param responseHandler the response handler instance that should handle the response. */
Perform a HTTP POST request and track the Android Context which initiated the request
post
{ "repo_name": "jabelai/Neverland", "path": "NeverLand/src/org/jabe/neverland/framework/http/AsyncHttpClient.java", "license": "apache-2.0", "size": 27535 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
2,458,101
FastBitSet set = new FastBitSet(); for (Index i : indices) set.add(i); return set; } public FastBitSet() { service = new BitSetServiceImpl(); } public FastBitSet(Immutable<long[]> bits) { service = new BitSetServiceImpl(bits.value()); } protected FastBitSet(BitSetService impl) { this.service = impl; } //////////////////////////////////////////////////////////////////////////// // Views. //
FastBitSet set = new FastBitSet(); for (Index i : indices) set.add(i); return set; } public FastBitSet() { service = new BitSetServiceImpl(); } public FastBitSet(Immutable<long[]> bits) { service = new BitSetServiceImpl(bits.value()); } protected FastBitSet(BitSetService impl) { this.service = impl; } //
/** * Returns a new bit set holding the specified indices * (convenience method). */
Returns a new bit set holding the specified indices (convenience method)
of
{ "repo_name": "mariusj/org.openntf.domino", "path": "domino/externals/javolution/src/main/java/javolution/util/FastBitSet.java", "license": "apache-2.0", "size": 11570 }
[ "javolution.lang.Immutable", "javolution.util.internal.bitset.BitSetServiceImpl", "javolution.util.service.BitSetService" ]
import javolution.lang.Immutable; import javolution.util.internal.bitset.BitSetServiceImpl; import javolution.util.service.BitSetService;
import javolution.lang.*; import javolution.util.internal.bitset.*; import javolution.util.service.*;
[ "javolution.lang", "javolution.util.internal", "javolution.util.service" ]
javolution.lang; javolution.util.internal; javolution.util.service;
2,324,195
private void init(javax.crypto.Cipher cipher, int mode, java.security.Key key, AlgorithmParameterSpec spec, SecureRandom random) throws CryptoException { try { if (random != null) { if (spec != null) { cipher.init(mode, key, spec, random); } else { cipher.init(mode, key, random); } } else { if (spec != null) { cipher.init(mode, key, spec); } else { cipher.init(mode, key); } } } catch (Exception e) { String msg = "Unable to init cipher instance."; throw new CryptoException(msg, e); } }
void function(javax.crypto.Cipher cipher, int mode, java.security.Key key, AlgorithmParameterSpec spec, SecureRandom random) throws CryptoException { try { if (random != null) { if (spec != null) { cipher.init(mode, key, spec, random); } else { cipher.init(mode, key, random); } } else { if (spec != null) { cipher.init(mode, key, spec); } else { cipher.init(mode, key); } } } catch (Exception e) { String msg = STR; throw new CryptoException(msg, e); } }
/** * Initializes the JDK Cipher with the specified mode and key. This is primarily a utility method to catch any * potential {@link java.security.InvalidKeyException InvalidKeyException} that might arise. * * @param cipher the JDK Cipher to {@link javax.crypto.Cipher#init(int, java.security.Key) init}. * @param mode the Cipher mode * @param key the Cipher's Key * @param spec the JDK AlgorithmParameterSpec for cipher initialization (optional, may be null). * @param random the SecureRandom to use for cipher initialization (optional, may be null). * @throws CryptoException if the key is invalid */
Initializes the JDK Cipher with the specified mode and key. This is primarily a utility method to catch any potential <code>java.security.InvalidKeyException InvalidKeyException</code> that might arise
init
{ "repo_name": "chapmajs/shiro", "path": "core/src/main/java/org/apache/shiro/crypto/JcaCipherService.java", "license": "apache-2.0", "size": 26915 }
[ "java.security.Key", "java.security.SecureRandom", "java.security.spec.AlgorithmParameterSpec" ]
import java.security.Key; import java.security.SecureRandom; import java.security.spec.AlgorithmParameterSpec;
import java.security.*; import java.security.spec.*;
[ "java.security" ]
java.security;
1,178,175
@Test public void testFilterEndToEndWithMultipleResultsAndSelectingSpecificIndexSF() throws Exception { testFilter("test-mabxml.tuples.5.json", Optional.of("skipfiltermorph2.xml"), "filtermorph4.xml", "test-mabxml.filter.result.4.1.json"); }
void function() throws Exception { testFilter(STR, Optional.of(STR), STR, STR); }
/** * ... of all occurences, i.e., the values could be part of different fields, e.g., as it is the case in the 4th record (there the first field contains only one value) * * @throws Exception */
... of all occurences, i.e., the values could be part of different fields, e.g., as it is the case in the 4th record (there the first field contains only one value)
testFilterEndToEndWithMultipleResultsAndSelectingSpecificIndexSF
{ "repo_name": "dswarm/dswarm", "path": "converter/src/test/java/org/dswarm/converter/flow/test/FilterTransformationFlowTest.java", "license": "apache-2.0", "size": 14140 }
[ "java.util.Optional" ]
import java.util.Optional;
import java.util.*;
[ "java.util" ]
java.util;
113,304
public static void injectToken(HttpURLConnection conn, Token token) { HttpCookie authCookie = token.cookieHandler.getAuthCookie(); if (authCookie != null) { conn.addRequestProperty("Cookie", authCookie.toString()); } }
static void function(HttpURLConnection conn, Token token) { HttpCookie authCookie = token.cookieHandler.getAuthCookie(); if (authCookie != null) { conn.addRequestProperty(STR, authCookie.toString()); } }
/** * Helper method that injects an authentication token to send with a * connection. Callers should prefer using * {@link Token#openConnection(URL, ConnectionConfigurator)} which * automatically manages authentication tokens. * * @param conn connection to inject the authentication token into. * @param token authentication token to inject. */
Helper method that injects an authentication token to send with a connection. Callers should prefer using <code>Token#openConnection(URL, ConnectionConfigurator)</code> which automatically manages authentication tokens
injectToken
{ "repo_name": "apurtell/hadoop", "path": "hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/AuthenticatedURL.java", "license": "apache-2.0", "size": 13902 }
[ "java.net.HttpCookie", "java.net.HttpURLConnection" ]
import java.net.HttpCookie; import java.net.HttpURLConnection;
import java.net.*;
[ "java.net" ]
java.net;
1,679,044
private static <E extends Comparable<? super E>> void mergeSortByDescendingCount( DataCount<E>[] counts) { ArrayList<DataCount<E>> tmpArray = new ArrayList<>(counts.length); mergeSortDescending(counts, tmpArray, 0, counts.length - 1); }
static <E extends Comparable<? super E>> void function( DataCount<E>[] counts) { ArrayList<DataCount<E>> tmpArray = new ArrayList<>(counts.length); mergeSortDescending(counts, tmpArray, 0, counts.length - 1); }
/** * Sort the count array in descending order using the merge sort algorithm. * @param counts an array containing a count of the words and the word associated with count * @param <E> */
Sort the count array in descending order using the merge sort algorithm
mergeSortByDescendingCount
{ "repo_name": "Branden-/project4", "path": "src/WordCount.java", "license": "mit", "size": 12262 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,701,152
private void removeSelfFromAncestors() { Object value = getFirstValue(ANCESTORS_KEY); if (!(value instanceof List)) { return; } @SuppressWarnings("unchecked") List<String> listValue = (List<String>) value; listValue.remove(this.getId()); }
void function() { Object value = getFirstValue(ANCESTORS_KEY); if (!(value instanceof List)) { return; } @SuppressWarnings(STR) List<String> listValue = (List<String>) value; listValue.remove(this.getId()); }
/** * The field "term_category" in {@code this.doc} can contain the term itself. It appears that this only happens with * HPO. To avoid this problem, and to avoid writing a separate implementation for HPO specifically, this method * checks for existence of the term in the term_category and takes it out. */
The field "term_category" in this.doc can contain the term itself. It appears that this only happens with HPO. To avoid this problem, and to avoid writing a separate implementation for HPO specifically, this method checks for existence of the term in the term_category and takes it out
removeSelfFromAncestors
{ "repo_name": "phenotips/phenotips", "path": "components/vocabularies/api/src/main/java/org/phenotips/vocabulary/internal/solr/AbstractSolrVocabularyTerm.java", "license": "agpl-3.0", "size": 15302 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
410,957
Collection<Message> getMissedImportantMessages(User user);
Collection<Message> getMissedImportantMessages(User user);
/** * Gets a list of important messages that this user has missed * due to being offline * @param user * @return collection of important messages (both internal and external) */
Gets a list of important messages that this user has missed due to being offline
getMissedImportantMessages
{ "repo_name": "Glamdring/welshare", "path": "src/main/java/com/welshare/service/MessageService.java", "license": "apache-2.0", "size": 9597 }
[ "com.welshare.model.Message", "com.welshare.model.User", "java.util.Collection" ]
import com.welshare.model.Message; import com.welshare.model.User; import java.util.Collection;
import com.welshare.model.*; import java.util.*;
[ "com.welshare.model", "java.util" ]
com.welshare.model; java.util;
664,024
public void off(){ lights.set(Relay.Value.kOn); }
void function(){ lights.set(Relay.Value.kOn); }
/** * Turns underglow off. */
Turns underglow off
off
{ "repo_name": "team1305/SI2014", "path": "src/org/team1305/robot2014/subsystems/Underglow.java", "license": "bsd-3-clause", "size": 1674 }
[ "edu.wpi.first.wpilibj.Relay" ]
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.*;
[ "edu.wpi.first" ]
edu.wpi.first;
2,774,659
@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": "MxSIG/TableAliasV60", "path": "TableAliasV60/src/main/java/tablealias/controlador/GetEco.java", "license": "lgpl-3.0", "size": 4656 }
[ "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,013,866
public static KeyStroke decode(String s) { final int index = s.indexOf(','); //$NON-NLS-1$ if (index < 0) return null; try { return KeyStroke.getKeyStroke (Integer.parseInt(s.substring(0, index)), Integer.parseInt(s.substring(index + 1))); } // FIXME: review error message catch (NumberFormatException e) { return null; } catch (IllegalArgumentException e) { return null; } }
static KeyStroke function(String s) { final int index = s.indexOf(','); if (index < 0) return null; try { return KeyStroke.getKeyStroke (Integer.parseInt(s.substring(0, index)), Integer.parseInt(s.substring(index + 1))); } catch (NumberFormatException e) { return null; } catch (IllegalArgumentException e) { return null; } }
/** * Decode a String into a KeyStroke */
Decode a String into a KeyStroke
decode
{ "repo_name": "fifa0329/vassal", "path": "src/VASSAL/configure/HotKeyConfigurer.java", "license": "lgpl-2.1", "size": 4352 }
[ "javax.swing.KeyStroke" ]
import javax.swing.KeyStroke;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
229,355
public void setEncoding(Charset encoding) { this.encoding = encoding; }
void function(Charset encoding) { this.encoding = encoding; }
/** * Set an encoding which will be used in preference to the default value * obtained from the basepanel. * * @param encoding The name of the encoding to use. */
Set an encoding which will be used in preference to the default value obtained from the basepanel
setEncoding
{ "repo_name": "motokito/jabref", "path": "src/main/java/net/sf/jabref/logic/exporter/ExportFormat.java", "license": "mit", "size": 14885 }
[ "java.nio.charset.Charset" ]
import java.nio.charset.Charset;
import java.nio.charset.*;
[ "java.nio" ]
java.nio;
2,889,041
@Nonnull Map<String, String> cookieMap();
@Nonnull Map<String, String> cookieMap();
/** * Request cookies. * * @return Request cookies. */
Request cookies
cookieMap
{ "repo_name": "jooby-project/jooby", "path": "jooby/src/main/java/io/jooby/Context.java", "license": "apache-2.0", "size": 41138 }
[ "java.util.Map", "javax.annotation.Nonnull" ]
import java.util.Map; import javax.annotation.Nonnull;
import java.util.*; import javax.annotation.*;
[ "java.util", "javax.annotation" ]
java.util; javax.annotation;
2,850,205
@SuppressWarnings("unchecked") public Collection<P> createList(B binding) { Collection<BehaviourDefinition> behaviourDefs = index.find(binding); List<P> policyInterfaces = new ArrayList<P>(behaviourDefs.size()); for (BehaviourDefinition behaviourDef : behaviourDefs) { Behaviour behaviour = behaviourDef.getBehaviour(); P policyIF = behaviour.getInterface(policyClass); if (!(behaviour.getNotificationFrequency().equals(NotificationFrequency.EVERY_EVENT))) { // wrap behaviour in transaction proxy which deals with delaying invocation until necessary if (transactionHandlerFactory == null) { throw new PolicyException("Transaction-level policies not supported as transaction support for the Policy Component has not been initialised."); } InvocationHandler trxHandler = transactionHandlerFactory.createHandler(behaviour, behaviourDef.getPolicyDefinition(), policyIF); policyIF = (P)Proxy.newProxyInstance(policyClass.getClassLoader(), new Class[]{policyClass}, trxHandler); } policyInterfaces.add(policyIF); } return policyInterfaces; }
@SuppressWarnings(STR) Collection<P> function(B binding) { Collection<BehaviourDefinition> behaviourDefs = index.find(binding); List<P> policyInterfaces = new ArrayList<P>(behaviourDefs.size()); for (BehaviourDefinition behaviourDef : behaviourDefs) { Behaviour behaviour = behaviourDef.getBehaviour(); P policyIF = behaviour.getInterface(policyClass); if (!(behaviour.getNotificationFrequency().equals(NotificationFrequency.EVERY_EVENT))) { if (transactionHandlerFactory == null) { throw new PolicyException(STR); } InvocationHandler trxHandler = transactionHandlerFactory.createHandler(behaviour, behaviourDef.getPolicyDefinition(), policyIF); policyIF = (P)Proxy.newProxyInstance(policyClass.getClassLoader(), new Class[]{policyClass}, trxHandler); } policyInterfaces.add(policyIF); } return policyInterfaces; }
/** * Construct a collection of Policy implementations for the specified binding * * @param binding the binding * @return the collection of policy implementations */
Construct a collection of Policy implementations for the specified binding
createList
{ "repo_name": "Tybion/community-edition", "path": "projects/repository/source/java/org/alfresco/repo/policy/PolicyFactory.java", "license": "lgpl-3.0", "size": 13741 }
[ "java.lang.reflect.InvocationHandler", "java.lang.reflect.Proxy", "java.util.ArrayList", "java.util.Collection", "java.util.List", "org.alfresco.repo.policy.Behaviour" ]
import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.alfresco.repo.policy.Behaviour;
import java.lang.reflect.*; import java.util.*; import org.alfresco.repo.policy.*;
[ "java.lang", "java.util", "org.alfresco.repo" ]
java.lang; java.util; org.alfresco.repo;
1,848,217
public static BondFutureTrade.Builder builder() { return new BondFutureTrade.Builder(); } BondFutureTrade( TradeInfo info, BondFuture product, double quantity, double price) { JodaBeanUtils.notNull(product, "product"); ArgChecker.notNegative(price, "price"); this.info = info; this.product = product; this.quantity = quantity; this.price = price; }
static BondFutureTrade.Builder function() { return new BondFutureTrade.Builder(); } BondFutureTrade( TradeInfo info, BondFuture product, double quantity, double price) { JodaBeanUtils.notNull(product, STR); ArgChecker.notNegative(price, "price"); this.info = info; this.product = product; this.quantity = quantity; this.price = price; }
/** * Returns a builder used to create an instance of the bean. * @return the builder, not null */
Returns a builder used to create an instance of the bean
builder
{ "repo_name": "jmptrader/Strata", "path": "modules/product/src/main/java/com/opengamma/strata/product/bond/BondFutureTrade.java", "license": "apache-2.0", "size": 16965 }
[ "com.opengamma.strata.collect.ArgChecker", "com.opengamma.strata.product.TradeInfo", "org.joda.beans.JodaBeanUtils" ]
import com.opengamma.strata.collect.ArgChecker; import com.opengamma.strata.product.TradeInfo; import org.joda.beans.JodaBeanUtils;
import com.opengamma.strata.collect.*; import com.opengamma.strata.product.*; import org.joda.beans.*;
[ "com.opengamma.strata", "org.joda.beans" ]
com.opengamma.strata; org.joda.beans;
510,612
public Array<EffectParameterDefinition> getParameterDefinitions() { return parameters; }
Array<EffectParameterDefinition> function() { return parameters; }
/** * Returns an array describing which parameters this effect * accepts. * * @return */
Returns an array describing which parameters this effect accepts
getParameterDefinitions
{ "repo_name": "mganzarcik/fabulae", "path": "core/src/mg/fishchicken/gamelogic/effects/Effect.java", "license": "mit", "size": 19964 }
[ "com.badlogic.gdx.utils.Array" ]
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
962,149
public List<LockEntry> getValue() { return entries; } private final static class WriteLockEntry extends AbstractLockEntry { private final Scope scope; WriteLockEntry(Type type, Scope scope) { if (!Type.WRITE.equals(type)) { throw new IllegalArgumentException("Invalid Type:" + type); } if (!Scope.EXCLUSIVE.equals(scope) && !Scope.SHARED.equals(scope)) { throw new IllegalArgumentException("Invalid scope:" +scope); } this.scope = scope; }
List<LockEntry> function() { return entries; } private final static class WriteLockEntry extends AbstractLockEntry { private final Scope scope; WriteLockEntry(Type type, Scope scope) { if (!Type.WRITE.equals(type)) { throw new IllegalArgumentException(STR + type); } if (!Scope.EXCLUSIVE.equals(scope) && !Scope.SHARED.equals(scope)) { throw new IllegalArgumentException(STR +scope); } this.scope = scope; }
/** * Returns the list of supported lock entries. * * @return list of supported lock. * @see org.apache.jackrabbit.webdav.property.DavProperty#getValue() */
Returns the list of supported lock entries
getValue
{ "repo_name": "apache/jackrabbit", "path": "jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/lock/SupportedLock.java", "license": "apache-2.0", "size": 5254 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,244,199
boolean avfSubClass(OwlClass other) { for (OwlClass avfClass : this.avfClasses) { Set<Resource> intersection = avfClass.getSuperClasses(); intersection.retainAll(other.allValuesFrom()); if (!intersection.isEmpty()) { return true; } } return false; }
boolean avfSubClass(OwlClass other) { for (OwlClass avfClass : this.avfClasses) { Set<Resource> intersection = avfClass.getSuperClasses(); intersection.retainAll(other.allValuesFrom()); if (!intersection.isEmpty()) { return true; } } return false; }
/** * Compares someValuesFrom target classes, and returns true if this one's * is a subclass of the other's. */
Compares someValuesFrom target classes, and returns true if this one's is a subclass of the other's
avfSubClass
{ "repo_name": "isper3at/incubator-rya", "path": "extras/rya.reasoning/src/main/java/mvm/rya/reasoning/OwlClass.java", "license": "apache-2.0", "size": 15951 }
[ "java.util.Set", "org.openrdf.model.Resource" ]
import java.util.Set; import org.openrdf.model.Resource;
import java.util.*; import org.openrdf.model.*;
[ "java.util", "org.openrdf.model" ]
java.util; org.openrdf.model;
1,320,776
private int readInternal(byte[] buffer, int offset, int readLength) throws IOException { if (readLength == 0) { return 0; } if (bytesToRead != C.LENGTH_UNSET) { long bytesRemaining = bytesToRead - bytesRead; if (bytesRemaining == 0) { return C.RESULT_END_OF_INPUT; } readLength = (int) Math.min(readLength, bytesRemaining); } int read = inputStream.read(buffer, offset, readLength); if (read == -1) { if (bytesToRead != C.LENGTH_UNSET) { // End of stream reached having not read sufficient data. throw new EOFException(); } return C.RESULT_END_OF_INPUT; } bytesRead += read; if (listener != null) { listener.onBytesTransferred(this, read); } return read; }
int function(byte[] buffer, int offset, int readLength) throws IOException { if (readLength == 0) { return 0; } if (bytesToRead != C.LENGTH_UNSET) { long bytesRemaining = bytesToRead - bytesRead; if (bytesRemaining == 0) { return C.RESULT_END_OF_INPUT; } readLength = (int) Math.min(readLength, bytesRemaining); } int read = inputStream.read(buffer, offset, readLength); if (read == -1) { if (bytesToRead != C.LENGTH_UNSET) { throw new EOFException(); } return C.RESULT_END_OF_INPUT; } bytesRead += read; if (listener != null) { listener.onBytesTransferred(this, read); } return read; }
/** * Reads up to {@code length} bytes of data and stores them into {@code buffer}, starting at * index {@code offset}. * <p> * This method blocks until at least one byte of data can be read, the end of the opened range is * detected, or an exception is thrown. * * @param buffer The buffer into which the read data should be stored. * @param offset The start offset into {@code buffer} at which data should be written. * @param readLength The maximum number of bytes to read. * @return The number of bytes read, or {@link C#RESULT_END_OF_INPUT} if the end of the opened * range is reached. * @throws IOException If an error occurs reading from the source. */
Reads up to length bytes of data and stores them into buffer, starting at index offset. This method blocks until at least one byte of data can be read, the end of the opened range is detected, or an exception is thrown
readInternal
{ "repo_name": "thermatk/Telegram-FOSS", "path": "TMessagesProj/src/main/java/org/telegram/messenger/exoplayer2/upstream/DefaultHttpDataSource.java", "license": "gpl-2.0", "size": 25429 }
[ "java.io.EOFException", "java.io.IOException" ]
import java.io.EOFException; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,421,408
private void init(String host, int mask) { // Set the integer mask that represents the actions if ((mask & ALL) != mask) throw new IllegalArgumentException("invalid actions mask"); // always OR in RESOLVE if we allow any of the others this.mask = mask | RESOLVE; // Parse the host name. A name has up to three components, the // hostname, a port number, or two numbers representing a port // range. "www.sun.com:8080-9090" is a valid host name. // With IPv6 an address can be 2010:836B:4179::836B:4179 // An IPv6 address needs to be enclose in [] // For ex: [2010:836B:4179::836B:4179]:8080-9090 // Refer to RFC 2732 for more information. int rb = 0 ; int start = 0, end = 0; int sep = -1; String hostport = host; if (host.charAt(0) == '[') { start = 1; rb = host.indexOf(']'); if (rb != -1) { host = host.substring(start, rb); } else { throw new IllegalArgumentException("invalid host/port: "+host); } sep = hostport.indexOf(':', rb+1); } else { start = 0; sep = host.indexOf(':', rb); end = sep; if (sep != -1) { host = host.substring(start, end); } } if (sep != -1) { String port = hostport.substring(sep+1); try { portrange = parsePort(port); } catch (Exception e) { throw new IllegalArgumentException("invalid port range: "+port); } } else { portrange = new int[] { PORT_MIN, PORT_MAX }; } hostname = host; // is this a domain wildcard specification if (host.lastIndexOf('*') > 0) { throw new IllegalArgumentException("invalid host wildcard specification"); } else if (host.startsWith("*")) { wildcard = true; if (host.equals("*")) { cname = ""; } else if (host.startsWith("*.")) { cname = host.substring(1).toLowerCase(); } else { throw new IllegalArgumentException("invalid host wildcard specification"); } return; } else { if (host.length() > 0) { // see if we are being initialized with an IP address. char ch = host.charAt(0); if (ch == ':' || Character.digit(ch, 16) != -1) { byte ip[] = IPAddressUtil.textToNumericFormatV4(host); if (ip == null) { ip = IPAddressUtil.textToNumericFormatV6(host); } if (ip != null) { try { addresses = new InetAddress[] {InetAddress.getByAddress(ip) }; init_with_ip = true; } catch (UnknownHostException uhe) { // this shouldn't happen invalid = true; } } } } } }
void function(String host, int mask) { if ((mask & ALL) != mask) throw new IllegalArgumentException(STR); this.mask = mask RESOLVE; int rb = 0 ; int start = 0, end = 0; int sep = -1; String hostport = host; if (host.charAt(0) == '[') { start = 1; rb = host.indexOf(']'); if (rb != -1) { host = host.substring(start, rb); } else { throw new IllegalArgumentException(STR+host); } sep = hostport.indexOf(':', rb+1); } else { start = 0; sep = host.indexOf(':', rb); end = sep; if (sep != -1) { host = host.substring(start, end); } } if (sep != -1) { String port = hostport.substring(sep+1); try { portrange = parsePort(port); } catch (Exception e) { throw new IllegalArgumentException(STR+port); } } else { portrange = new int[] { PORT_MIN, PORT_MAX }; } hostname = host; if (host.lastIndexOf('*') > 0) { throw new IllegalArgumentException(STR); } else if (host.startsWith("*")) { wildcard = true; if (host.equals("*")) { cname = STR*.")) { cname = host.substring(1).toLowerCase(); } else { throw new IllegalArgumentException(STR); } return; } else { if (host.length() > 0) { char ch = host.charAt(0); if (ch == ':' Character.digit(ch, 16) != -1) { byte ip[] = IPAddressUtil.textToNumericFormatV4(host); if (ip == null) { ip = IPAddressUtil.textToNumericFormatV6(host); } if (ip != null) { try { addresses = new InetAddress[] {InetAddress.getByAddress(ip) }; init_with_ip = true; } catch (UnknownHostException uhe) { invalid = true; } } } } } }
/** * Initialize the SocketPermission object. We don't do any DNS lookups * as this point, instead we hold off until the implies method is * called. */
Initialize the SocketPermission object. We don't do any DNS lookups as this point, instead we hold off until the implies method is called
init
{ "repo_name": "openjdk/jdk7u", "path": "jdk/src/share/classes/java/net/SocketPermission.java", "license": "gpl-2.0", "size": 50173 }
[ "java.net.InetAddress" ]
import java.net.InetAddress;
import java.net.*;
[ "java.net" ]
java.net;
2,083,498
@Override public void setMaxFiringRateTweak(float val) { if (val > 1) { val = 1; } else if (val < -1) { val = -1; } final float old = maxFiringRate; if (old == val) { return; } maxFiringRate = val; final float MAX = 8, MIN = 100; // limit to approx 8 times shorter refr period than default, and 100 times longer refr.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MIN, MAX)); getChip().getSupport().firePropertyChange(DVSTweaks.MAX_FIRING_RATE, old, val); }
void function(float val) { if (val > 1) { val = 1; } else if (val < -1) { val = -1; } final float old = maxFiringRate; if (old == val) { return; } maxFiringRate = val; final float MAX = 8, MIN = 100; refr.changeByRatioFromPreferred(PotTweakerUtilities.getRatioTweak(val, MIN, MAX)); getChip().getSupport().firePropertyChange(DVSTweaks.MAX_FIRING_RATE, old, val); }
/** * Tweaks max firing rate (refractory period), larger is shorter refractory * period. * * @param val -1 to 1 range */
Tweaks max firing rate (refractory period), larger is shorter refractory period
setMaxFiringRateTweak
{ "repo_name": "SensorsINI/jaer", "path": "src/eu/seebetter/ini/chips/davis/DavisConfig.java", "license": "lgpl-2.1", "size": 54536 }
[ "ch.unizh.ini.jaer.chip.retina.DVSTweaks", "net.sf.jaer.biasgen.PotTweakerUtilities" ]
import ch.unizh.ini.jaer.chip.retina.DVSTweaks; import net.sf.jaer.biasgen.PotTweakerUtilities;
import ch.unizh.ini.jaer.chip.retina.*; import net.sf.jaer.biasgen.*;
[ "ch.unizh.ini", "net.sf.jaer" ]
ch.unizh.ini; net.sf.jaer;
2,294,489
private static Set<String> getThemeIds(String line) { Set<String> themeIds = new HashSet<String>(); Pattern themePattern = Pattern.compile("Theme:([ET]\\d+)"); Matcher m = themePattern.matcher(line); while (m.find()) themeIds.add(m.group(1)); return themeIds; }
static Set<String> function(String line) { Set<String> themeIds = new HashSet<String>(); Pattern themePattern = Pattern.compile(STR); Matcher m = themePattern.matcher(line); while (m.find()) themeIds.add(m.group(1)); return themeIds; }
/** * Extracts all theme Ids, e.g. Theme:T55 from a line * * @param line * @return */
Extracts all theme Ids, e.g. Theme:T55 from a line
getThemeIds
{ "repo_name": "UCDenver-ccp/ccp-nlp", "path": "ccp-nlp-uima-serialization/src/main/java/edu/ucdenver/ccp/nlp/uima/serialization/bionlp/parser/BioNlpEventFactory.java", "license": "bsd-3-clause", "size": 6513 }
[ "java.util.HashSet", "java.util.Set", "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.HashSet; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.*; import java.util.regex.*;
[ "java.util" ]
java.util;
1,799,723
public static String substituteEmailAddress(String s, boolean ignoreLinks) { if (ignoreLinks) { // Do not take existing link tags into account return substituteEmailAddress(s); } logger.info("Source:\n" + s); // initialisation Matcher noLinkMatcher = EMAIL_PATTERN.matcher(s); Matcher withLinkMatcher = EMAIL_PATTERN_INC_LINK.matcher(s); int pos = 0; // current position in s int length = s.length(); StringBuffer buf = new StringBuffer(); while (pos < length) { if (noLinkMatcher.find(pos)) { // an email adress was found - check whether its already a link int s1 = noLinkMatcher.start(); int e1 = noLinkMatcher.end(); boolean insertLink; if (withLinkMatcher.find(pos)) { // found an email address with links - is it the same? int s2 = withLinkMatcher.start(); int e2 = withLinkMatcher.end(); if ((s2 < s1) && (e2 > e1)) { // same email adress - just append and continue buf.append(s.substring(pos, e2)); pos = e2; insertLink = false; // already handled } else { // not the same insertLink = true; } } else { // no match with link tags insertLink = true; } // shall we insert a link? if (insertLink) { String email = s.substring(s1, e1); String link = "<a href=\"mailto:" + email + "\">" + email + "</a>"; buf.append(s.substring(pos, s1)); buf.append(link); pos = e1; } } else { // no more matches - append rest of string buf.append(s.substring(pos)); pos = length; } } // return result String result = buf.toString(); logger.info("Result:\n" + result); return result; }
static String function(String s, boolean ignoreLinks) { if (ignoreLinks) { return substituteEmailAddress(s); } logger.info(STR + s); Matcher noLinkMatcher = EMAIL_PATTERN.matcher(s); Matcher withLinkMatcher = EMAIL_PATTERN_INC_LINK.matcher(s); int pos = 0; int length = s.length(); StringBuffer buf = new StringBuffer(); while (pos < length) { if (noLinkMatcher.find(pos)) { int s1 = noLinkMatcher.start(); int e1 = noLinkMatcher.end(); boolean insertLink; if (withLinkMatcher.find(pos)) { int s2 = withLinkMatcher.start(); int e2 = withLinkMatcher.end(); if ((s2 < s1) && (e2 > e1)) { buf.append(s.substring(pos, e2)); pos = e2; insertLink = false; } else { insertLink = true; } } else { insertLink = true; } if (insertLink) { String email = s.substring(s1, e1); String link = STRmailto:STR\">STR</a>"; buf.append(s.substring(pos, s1)); buf.append(link); pos = e1; } } else { buf.append(s.substring(pos)); pos = length; } } String result = buf.toString(); logger.info(STR + result); return result; }
/** * Transforms email-addresses into HTML just as * substituteEmailAddress(String), but tries to ignore email-addresses, * which are already links, if the ignore links flag is set. <br> * This extended functionality is necessary when parsing a text which is * already (partly) html. <br> * * * @param s * input text * @param ignoreLinks * if true link tags are ignored. This gives a wrong result if * some e-mail adresses are already links (but uses reg. expr. * directly, and is therefore faster) * @return text with email-adresses transformed to links */
Transforms email-addresses into HTML just as substituteEmailAddress(String), but tries to ignore email-addresses, which are already links, if the ignore links flag is set. This extended functionality is necessary when parsing a text which is already (partly) html.
substituteEmailAddress
{ "repo_name": "grusso14/eprot", "path": "src/it/finsiel/siged/util/HtmlParser.java", "license": "apache-2.0", "size": 30331 }
[ "java.util.regex.Matcher" ]
import java.util.regex.Matcher;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,567,483
public static String editFeedbackSession(FeedbackSessionAttributes updatedFeedbackSession) { Map<String, String> params = createParamMap(BackDoorOperation.OPERATION_EDIT_FEEDBACK_SESSION); params.put(BackDoorOperation.PARAMETER_JSON_STRING, JsonUtils.toJson(updatedFeedbackSession)); return makePostRequest(params); }
static String function(FeedbackSessionAttributes updatedFeedbackSession) { Map<String, String> params = createParamMap(BackDoorOperation.OPERATION_EDIT_FEEDBACK_SESSION); params.put(BackDoorOperation.PARAMETER_JSON_STRING, JsonUtils.toJson(updatedFeedbackSession)); return makePostRequest(params); }
/** * Edits a feedback session in the datastore. */
Edits a feedback session in the datastore
editFeedbackSession
{ "repo_name": "aacoba/teammates", "path": "src/test/java/teammates/test/driver/BackDoor.java", "license": "gpl-2.0", "size": 21245 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,809,355
@Test public void shouldUnmarshalAsMap() throws Exception { template.sendBody("direct:map", join("A B C ", "1 2 3 ", "onetwothree")); result.expectedMessageCount(1); result.assertIsSatisfied(); List<?> body = assertIsInstanceOf(List.class, result.getExchanges().get(0).getIn().getBody()); assertEquals(2, body.size()); assertEquals(asMap("A", "1", "B", "2", "C", "3"), body.get(0)); assertEquals(asMap("A", "one", "B", "two", "C", "three"), body.get(1)); }
void function() throws Exception { template.sendBody(STR, join(STR, STR, STR)); result.expectedMessageCount(1); result.assertIsSatisfied(); List<?> body = assertIsInstanceOf(List.class, result.getExchanges().get(0).getIn().getBody()); assertEquals(2, body.size()); assertEquals(asMap("A", "1", "B", "2", "C", "3"), body.get(0)); assertEquals(asMap("A", "one", "B", "two", "C", "three"), body.get(1)); }
/** * Tests that we can unmarshal fixed-width and produce maps for each row */
Tests that we can unmarshal fixed-width and produce maps for each row
shouldUnmarshalAsMap
{ "repo_name": "logzio/camel", "path": "components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormatUnmarshalTest.java", "license": "apache-2.0", "size": 7758 }
[ "java.util.List", "org.apache.camel.dataformat.univocity.UniVocityTestHelper" ]
import java.util.List; import org.apache.camel.dataformat.univocity.UniVocityTestHelper;
import java.util.*; import org.apache.camel.dataformat.univocity.*;
[ "java.util", "org.apache.camel" ]
java.util; org.apache.camel;
1,404,921
public List<Rule> parseRules(String str) { List<Rule> returnValue = new ArrayList<>(); int index = 0; index = skipWhiteSpaceAndComments(str, index); List<String> selectors = new ArrayList<>(); StringBuilder unfinishedSelector = new StringBuilder(); while (true) { char ch = index < str.length() ? str.charAt(index) : CharacterIterator.DONE; if (ch == ',') { if (unfinishedSelector.length() > 0) { selectors.add(unfinishedSelector.toString().trim()); unfinishedSelector.delete(0, unfinishedSelector.length()); } else { throw new RuntimeException("Empty selector"); } index = skipWhiteSpaceAndComments(str, index + 1); continue; } else if (ch == '{') { if (unfinishedSelector.length() > 0) { selectors.add(unfinishedSelector.toString().trim()); unfinishedSelector.delete(0, unfinishedSelector.length()); } if (selectors.isEmpty()) throw new RuntimeException( "No selectors detected before opening curly bracket."); Rule rule = new Rule(selectors); returnValue.add(rule); index = parseRule(str, index + 1, rule); selectors = new ArrayList<>(); } else if (ch == '\\') { index = parseEscapedChar(str, index, unfinishedSelector); } else if (ch == CharacterIterator.DONE) { return returnValue; } else { unfinishedSelector.append(ch); } index++; } }
List<Rule> function(String str) { List<Rule> returnValue = new ArrayList<>(); int index = 0; index = skipWhiteSpaceAndComments(str, index); List<String> selectors = new ArrayList<>(); StringBuilder unfinishedSelector = new StringBuilder(); while (true) { char ch = index < str.length() ? str.charAt(index) : CharacterIterator.DONE; if (ch == ',') { if (unfinishedSelector.length() > 0) { selectors.add(unfinishedSelector.toString().trim()); unfinishedSelector.delete(0, unfinishedSelector.length()); } else { throw new RuntimeException(STR); } index = skipWhiteSpaceAndComments(str, index + 1); continue; } else if (ch == '{') { if (unfinishedSelector.length() > 0) { selectors.add(unfinishedSelector.toString().trim()); unfinishedSelector.delete(0, unfinishedSelector.length()); } if (selectors.isEmpty()) throw new RuntimeException( STR); Rule rule = new Rule(selectors); returnValue.add(rule); index = parseRule(str, index + 1, rule); selectors = new ArrayList<>(); } else if (ch == '\\') { index = parseEscapedChar(str, index, unfinishedSelector); } else if (ch == CharacterIterator.DONE) { return returnValue; } else { unfinishedSelector.append(ch); } index++; } }
/** * Return a series of Rules parsed from the given String. */
Return a series of Rules parsed from the given String
parseRules
{ "repo_name": "mickleness/pumpernickel", "path": "src/main/java/com/pump/text/html/css/CssParser.java", "license": "mit", "size": 10687 }
[ "java.text.CharacterIterator", "java.util.ArrayList", "java.util.List" ]
import java.text.CharacterIterator; import java.util.ArrayList; import java.util.List;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
1,677,055
public BigDecimal getReduced() { return reduced; }
BigDecimal function() { return reduced; }
/** * The value after being divided by the multiplier (e.g. 1.2 K for 1,234.56) * * @return The reduced value */
The value after being divided by the multiplier (e.g. 1.2 K for 1,234.56)
getReduced
{ "repo_name": "libreworks/stellarbase", "path": "stellarbase-core/src/main/java/com/libreworks/stellarbase/math/AbstractMultiplier.java", "license": "apache-2.0", "size": 3308 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
2,180,713
private void ensureMutableMessageList() { if (!isMessagesListMutable) { messages = new ArrayList<MType>(messages); isMessagesListMutable = true; } }
void function() { if (!isMessagesListMutable) { messages = new ArrayList<MType>(messages); isMessagesListMutable = true; } }
/** * Ensures that the list of messages is mutable so it can be updated. If it's immutable, a copy is * made. */
Ensures that the list of messages is mutable so it can be updated. If it's immutable, a copy is made
ensureMutableMessageList
{ "repo_name": "scheib/chromium", "path": "third_party/protobuf/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java", "license": "bsd-3-clause", "size": 22518 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,848,895
public List<String> getSubscriptions() { return subscriptions; }
List<String> function() { return subscriptions; }
/** * Returns the subscriptions. * * @return The subscriptions */
Returns the subscriptions
getSubscriptions
{ "repo_name": "SalesforceEng/Argus", "path": "ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/NotificationDto.java", "license": "bsd-3-clause", "size": 9671 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
667,548
public final void traceReflectionPhoton(Ray r, Color power) { if (map.allowReflectionBounced()) { server.traceReflectionPhoton(this, r, power); } }
final void function(Ray r, Color power) { if (map.allowReflectionBounced()) { server.traceReflectionPhoton(this, r, power); } }
/** * Trace a new photon from the current location. This assumes that the * photon was reflected by a specular surface. * * @param r ray to trace photon along * @param power power of the new photon */
Trace a new photon from the current location. This assumes that the photon was reflected by a specular surface
traceReflectionPhoton
{ "repo_name": "monkstone/sunflow", "path": "src/main/java/org/sunflow/core/ShadingState.java", "license": "mit", "size": 29285 }
[ "org.sunflow.image.Color" ]
import org.sunflow.image.Color;
import org.sunflow.image.*;
[ "org.sunflow.image" ]
org.sunflow.image;
2,370,751
public boolean isServiceUnDeployed(String serviceName) throws RemoteException, NullPointerException { boolean isServiceUnDeployed = false; Calendar startTime = Calendar.getInstance(); while (Calendar.getInstance().getTimeInMillis() - startTime.getTimeInMillis() < SERVICE_DEPLOYMENT_DELAY) { if (!isServiceExists(serviceName)) { isServiceUnDeployed = true; break; } try { Thread.sleep(2000); } catch (InterruptedException ignored) { // Exception is ignored } } return isServiceUnDeployed; }
boolean function(String serviceName) throws RemoteException, NullPointerException { boolean isServiceUnDeployed = false; Calendar startTime = Calendar.getInstance(); while (Calendar.getInstance().getTimeInMillis() - startTime.getTimeInMillis() < SERVICE_DEPLOYMENT_DELAY) { if (!isServiceExists(serviceName)) { isServiceUnDeployed = true; break; } try { Thread.sleep(2000); } catch (InterruptedException ignored) { } } return isServiceUnDeployed; }
/** * Wait till the service get deployed * * @param serviceName * service name * @return deploy status * @throws java.rmi.RemoteException */
Wait till the service get deployed
isServiceUnDeployed
{ "repo_name": "mihilranathunga/WSO2BAM-AS-A-LOGSERVER", "path": "bam-log-client-logviewer-cassandra-jdbc-client-for-toolbox/src/main/java/core/clients/service/ServiceAdminClient.java", "license": "apache-2.0", "size": 7731 }
[ "java.rmi.RemoteException", "java.util.Calendar" ]
import java.rmi.RemoteException; import java.util.Calendar;
import java.rmi.*; import java.util.*;
[ "java.rmi", "java.util" ]
java.rmi; java.util;
2,793,522
public static <A extends Annotation> A findAnnotation(final Annotation source, final Class<A> targetAnnotationClass) { Objects.requireNonNull(source, "incoming 'source' is not valid"); Objects.requireNonNull(targetAnnotationClass, "incoming 'targetAnnotationClass' is not valid"); return findAnnotation(source, targetAnnotationClass, new HashSet<Class<? extends Annotation>>()); } /** * Recursive annotation search, with check in all assigned {@link ElementType#ANNOTATION_TYPE} - annotations. * * @param sourceAnnotation * incoming / source {@link Annotation}
static <A extends Annotation> A function(final Annotation source, final Class<A> targetAnnotationClass) { Objects.requireNonNull(source, STR); Objects.requireNonNull(targetAnnotationClass, STR); return findAnnotation(source, targetAnnotationClass, new HashSet<Class<? extends Annotation>>()); } /** * Recursive annotation search, with check in all assigned {@link ElementType#ANNOTATION_TYPE} - annotations. * * @param sourceAnnotation * incoming / source {@link Annotation}
/** * Deep search of specified source considering "annotation as meta annotation" case (source annotated with specified source). * * @param source * {@link Annotation} - source * @param targetAnnotationClass * represents class of the required annotaiton * @param <A> * type param * @return {@link A} in case if found, {@code null} otherwise */
Deep search of specified source considering "annotation as meta annotation" case (source annotated with specified source)
findAnnotation
{ "repo_name": "anotheria/moskito", "path": "moskito-core/src/main/java/net/anotheria/moskito/core/util/annotation/AnnotationUtils.java", "license": "mit", "size": 5310 }
[ "java.lang.annotation.Annotation", "java.util.HashSet", "java.util.Objects" ]
import java.lang.annotation.Annotation; import java.util.HashSet; import java.util.Objects;
import java.lang.annotation.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
2,593,400
public BarcodeFormat StringToBarcodeFormat(String stringFormat){ BarcodeFormat format; switch(stringFormat){ case "CODBAR": format = BarcodeFormat.CODABAR; break; case "CODE_128": format= BarcodeFormat.CODE_128; break; case "CODE_39": format = BarcodeFormat.CODE_39; break; case "EAN_13": format = BarcodeFormat.EAN_13; break; case "EAN_8": format = BarcodeFormat.EAN_8; break; case "ITF": format = BarcodeFormat.ITF; break; case "PDF_417": format = BarcodeFormat.PDF_417; break; case "UPC_A": format = BarcodeFormat.UPC_A; break; case "QR_CODE": format = BarcodeFormat.QR_CODE; break; case "AZTEC": format = BarcodeFormat.AZTEC; break; default: format = BarcodeFormat.CODABAR; break; } return format; }
BarcodeFormat function(String stringFormat){ BarcodeFormat format; switch(stringFormat){ case STR: format = BarcodeFormat.CODABAR; break; case STR: format= BarcodeFormat.CODE_128; break; case STR: format = BarcodeFormat.CODE_39; break; case STR: format = BarcodeFormat.EAN_13; break; case "EAN_8": format = BarcodeFormat.EAN_8; break; case "ITF": format = BarcodeFormat.ITF; break; case STR: format = BarcodeFormat.PDF_417; break; case "UPC_A": format = BarcodeFormat.UPC_A; break; case STR: format = BarcodeFormat.QR_CODE; break; case "AZTEC": format = BarcodeFormat.AZTEC; break; default: format = BarcodeFormat.CODABAR; break; } return format; }
/** * Method is used to convert parsed String to BarcodeFormat to create an image of the qr code * @param stringFormat as String * @return format as BarcodeFormat */
Method is used to convert parsed String to BarcodeFormat to create an image of the qr code
StringToBarcodeFormat
{ "repo_name": "Fr4gorSoftware/SecScanQR", "path": "app/src/main/java/de/t_dankworth/secscanqr/util/GeneralHandler.java", "license": "gpl-3.0", "size": 5674 }
[ "com.google.zxing.BarcodeFormat" ]
import com.google.zxing.BarcodeFormat;
import com.google.zxing.*;
[ "com.google.zxing" ]
com.google.zxing;
649,384
public void testBlockedRollover() throws IOException, InterruptedException { Layout layout = new SimpleLayout(); String filename = "output/drfa_blockedRollover.log"; String pattern = "'.'yyyy-MM-dd-HH-mm"; Date start = new Date(); DailyRollingFileAppender appender = new DailyRollingFileAppender(layout, filename, pattern); appender.setAppend(false); Logger root = Logger.getRootLogger(); root.addAppender(appender); // // open next two anticipated rollover file names // File block1 = new File(filename + new SimpleDateFormat(pattern).format(start)); File block2 = new File(filename + new SimpleDateFormat(pattern).format( new Date(start.getTime() + 60000))); FileOutputStream os1 = new FileOutputStream(block1); FileOutputStream os2 = new FileOutputStream(block2); root.info("Prior to rollover"); // // sleep until three seconds into next minute // Thread.sleep(63000 - (start.getTime() % 60000)); // // should trigger failed rollover // root.info("Rollover attempt while blocked"); os1.close(); os2.close(); root.info("Message after block removed"); appender.close(); // // combine base file and potential rollovers // since rollover may or may not have been blocked // depending on platform. // String combinedFilename = "output/drfa_blockedRollover.combined"; FileOutputStream combined = new FileOutputStream(combinedFilename); byte[] buf = new byte[500]; append(combined, new FileInputStream(block1), buf); append(combined, new FileInputStream(block2), buf); append(combined, new FileInputStream(filename), buf); combined.close(); assertTrue(Compare.compare(combinedFilename, "witness/drfa_blockedRollover.log")); }
void function() throws IOException, InterruptedException { Layout layout = new SimpleLayout(); String filename = STR; String pattern = STR; Date start = new Date(); DailyRollingFileAppender appender = new DailyRollingFileAppender(layout, filename, pattern); appender.setAppend(false); Logger root = Logger.getRootLogger(); root.addAppender(appender); File block2 = new File(filename + new SimpleDateFormat(pattern).format( new Date(start.getTime() + 60000))); FileOutputStream os1 = new FileOutputStream(block1); FileOutputStream os2 = new FileOutputStream(block2); root.info(STR); os1.close(); os2.close(); root.info(STR); appender.close(); FileOutputStream combined = new FileOutputStream(combinedFilename); byte[] buf = new byte[500]; append(combined, new FileInputStream(block1), buf); append(combined, new FileInputStream(block2), buf); append(combined, new FileInputStream(filename), buf); combined.close(); assertTrue(Compare.compare(combinedFilename, STR)); }
/** * Tests rollOver when log file is unabled to be renamed. * See bug 43374. * * @throws IOException if io error. * @throws InterruptedException if test interrupted while waiting for the start of the next minute. */
Tests rollOver when log file is unabled to be renamed. See bug 43374
testBlockedRollover
{ "repo_name": "DRUNK2013/log4j", "path": "tests/src/java/org/apache/log4j/DRFATestCase.java", "license": "apache-2.0", "size": 16829 }
[ "java.io.File", "java.io.FileInputStream", "java.io.FileOutputStream", "java.io.IOException", "java.text.SimpleDateFormat", "java.util.Date", "org.apache.log4j.util.Compare" ]
import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import org.apache.log4j.util.Compare;
import java.io.*; import java.text.*; import java.util.*; import org.apache.log4j.util.*;
[ "java.io", "java.text", "java.util", "org.apache.log4j" ]
java.io; java.text; java.util; org.apache.log4j;
1,343,436
HttpSession session = request.getSession(true); WebClient client = getWebClient(session); if (client == null || client.isClosed()) { client = WebClient.createWebClient(request); session.setAttribute(WEB_CLIENT_ATTRIBUTE, client); } return client; }
HttpSession session = request.getSession(true); WebClient client = getWebClient(session); if (client == null client.isClosed()) { client = WebClient.createWebClient(request); session.setAttribute(WEB_CLIENT_ATTRIBUTE, client); } return client; }
/** * Helper method to get the client for the current session, lazily creating * a client if there is none currently * * @param request is the current HTTP request * @return the current client or a newly creates */
Helper method to get the client for the current session, lazily creating a client if there is none currently
getWebClient
{ "repo_name": "apnadmin/appynotebook", "path": "src/java/org/apache/activemq/web/WebClient.java", "license": "agpl-3.0", "size": 13880 }
[ "javax.servlet.http.HttpSession" ]
import javax.servlet.http.HttpSession;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
583,097
public static InMemorySyncItem getNotExistingSyncItem(SyncSource syncSource) { InMemorySyncItem notExisting = new InMemorySyncItem(syncSource, "NOT_EXISTING"); notExisting.setState(SyncItemState.NOT_EXISTING); return notExisting; } // ---------------------------------------------------------- Public methods
static InMemorySyncItem function(SyncSource syncSource) { InMemorySyncItem notExisting = new InMemorySyncItem(syncSource, STR); notExisting.setState(SyncItemState.NOT_EXISTING); return notExisting; }
/** * Creates and returns a "not-existing" <i>SyncItem</i>. It is used internally to * represent an item which has not a physical correspondance in a source. * * @param syncSource the <i>SyncSource</i> the not existing item belongs to * @return the a "not-exisiting" <i>SyncItem</i> */
Creates and returns a "not-existing" SyncItem. It is used internally to represent an item which has not a physical correspondance in a source
getNotExistingSyncItem
{ "repo_name": "accesstest3/cfunambol", "path": "common/server-framework/src/main/java/com/funambol/framework/engine/InMemorySyncItem.java", "license": "agpl-3.0", "size": 11011 }
[ "com.funambol.framework.engine.source.SyncSource" ]
import com.funambol.framework.engine.source.SyncSource;
import com.funambol.framework.engine.source.*;
[ "com.funambol.framework" ]
com.funambol.framework;
580,709
@Test public void testFullSizedLevel() throws IOException { Board b = parser.parseMap(getClass().getResourceAsStream("/board.txt")).getBoard(); Square s1 = b.squareAt(1, 1); Unit unit = Navigation.findNearest(Ghost.class, s1); assertNotNull(unit); }
void function() throws IOException { Board b = parser.parseMap(getClass().getResourceAsStream(STR)).getBoard(); Square s1 = b.squareAt(1, 1); Unit unit = Navigation.findNearest(Ghost.class, s1); assertNotNull(unit); }
/** * Verifies that there is ghost on the default board * next to cell [1, 1]. * * @throws IOException if board reading fails. */
Verifies that there is ghost on the default board next to cell [1, 1]
testFullSizedLevel
{ "repo_name": "francois03/jpacman-framework", "path": "src/test/java/nl/tudelft/jpacman/npc/ghost/NavigationTest.java", "license": "apache-2.0", "size": 4669 }
[ "java.io.IOException", "nl.tudelft.jpacman.board.Board", "nl.tudelft.jpacman.board.Square", "nl.tudelft.jpacman.board.Unit", "org.junit.Assert" ]
import java.io.IOException; import nl.tudelft.jpacman.board.Board; import nl.tudelft.jpacman.board.Square; import nl.tudelft.jpacman.board.Unit; import org.junit.Assert;
import java.io.*; import nl.tudelft.jpacman.board.*; import org.junit.*;
[ "java.io", "nl.tudelft.jpacman", "org.junit" ]
java.io; nl.tudelft.jpacman; org.junit;
1,992,760
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.upPaint = SerialUtils.readPaint(stream); this.downPaint = SerialUtils.readPaint(stream); this.volumePaint = SerialUtils.readPaint(stream); }
void function(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.upPaint = SerialUtils.readPaint(stream); this.downPaint = SerialUtils.readPaint(stream); this.volumePaint = SerialUtils.readPaint(stream); }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */
Provides serialization support
readObject
{ "repo_name": "jfree/jfreechart", "path": "src/main/java/org/jfree/chart/renderer/xy/CandlestickRenderer.java", "license": "lgpl-2.1", "size": 30997 }
[ "java.io.IOException", "java.io.ObjectInputStream", "org.jfree.chart.internal.SerialUtils" ]
import java.io.IOException; import java.io.ObjectInputStream; import org.jfree.chart.internal.SerialUtils;
import java.io.*; import org.jfree.chart.internal.*;
[ "java.io", "org.jfree.chart" ]
java.io; org.jfree.chart;
2,655,637
PagedIterable<Application> list(String resourceGroupName, String applicationGroupName, Context context);
PagedIterable<Application> list(String resourceGroupName, String applicationGroupName, Context context);
/** * List applications. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationGroupName The name of the application group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return applicationList. */
List applications
list
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Applications.java", "license": "mit", "size": 7191 }
[ "com.azure.core.http.rest.PagedIterable", "com.azure.core.util.Context" ]
import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context;
import com.azure.core.http.rest.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
950,706
public int getRequestTimeoutTime(){ try{ return Integer.parseInt(jServiceConfig.get(RequestTimeoutKey)); }catch (Exception e) { return 20000; } } private Configuration(){ try { jServiceConfig = Dictionary.getDictionary(ConfigName); } catch (Exception e) { jServiceConfig = null; } }
int function(){ try{ return Integer.parseInt(jServiceConfig.get(RequestTimeoutKey)); }catch (Exception e) { return 20000; } } private Configuration(){ try { jServiceConfig = Dictionary.getDictionary(ConfigName); } catch (Exception e) { jServiceConfig = null; } }
/** * Get HTTP Request Timeout Time, 20s by default. * If it is not set in the dictionary "WPJsonAPIConfig", 20s is returned as default value * * @return The defined HTTP Request Timeout Time. */
Get HTTP Request Timeout Time, 20s by default. If it is not set in the dictionary "WPJsonAPIConfig", 20s is returned as default value
getRequestTimeoutTime
{ "repo_name": "seanchenxi/gwt-wordpress", "path": "src/main/java/com/seanchenxi/gwt/wordpress/json/util/Configuration.java", "license": "apache-2.0", "size": 2079 }
[ "com.google.gwt.i18n.client.Dictionary" ]
import com.google.gwt.i18n.client.Dictionary;
import com.google.gwt.i18n.client.*;
[ "com.google.gwt" ]
com.google.gwt;
1,488,311
private void copyPixelData() throws IOException { if (parser.hasSeenEOF()) return; int len = parser.getReadLength(); dsIn.writeHeader(ios, encodeParam, parser.getReadTag(), parser .getReadVR(), len); if (len == -1) { parser.parseHeader(); while (parser.getReadTag() == Tags.Item) { len = parser.getReadLength(); dsIn.writeHeader(ios, encodeParam, Tags.Item, VRs.NONE, len); copy(iis, ios, len); parser.parseHeader(); } dsIn.writeHeader(ios, encodeParam, Tags.SeqDelimitationItem, VRs.NONE, 0); } else { copy(iis, ios, len); } }
void function() throws IOException { if (parser.hasSeenEOF()) return; int len = parser.getReadLength(); dsIn.writeHeader(ios, encodeParam, parser.getReadTag(), parser .getReadVR(), len); if (len == -1) { parser.parseHeader(); while (parser.getReadTag() == Tags.Item) { len = parser.getReadLength(); dsIn.writeHeader(ios, encodeParam, Tags.Item, VRs.NONE, len); copy(iis, ios, len); parser.parseHeader(); } dsIn.writeHeader(ios, encodeParam, Tags.SeqDelimitationItem, VRs.NONE, 0); } else { copy(iis, ios, len); } }
/** * copy pixel tag without de/encoding */
copy pixel tag without de/encoding
copyPixelData
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4che14/tags/DCM4CHE_1_4_29/samples/java/Transcoder.java", "license": "apache-2.0", "size": 26517 }
[ "java.io.IOException", "org.dcm4che.dict.Tags", "org.dcm4che.dict.VRs" ]
import java.io.IOException; import org.dcm4che.dict.Tags; import org.dcm4che.dict.VRs;
import java.io.*; import org.dcm4che.dict.*;
[ "java.io", "org.dcm4che.dict" ]
java.io; org.dcm4che.dict;
1,347,351
void add(Component component, Metric metric, Measure measure);
void add(Component component, Metric metric, Measure measure);
/** * Adds the specified measure for the specified Component and Metric. There can be no more than one measure for a * specific combination of Component, Metric and association to a specific rule or characteristic. * * @throws NullPointerException if any of the arguments is null * @throws UnsupportedOperationException when trying to add a measure when one already exists for the specified Component/Metric paar */
Adds the specified measure for the specified Component and Metric. There can be no more than one measure for a specific combination of Component, Metric and association to a specific rule or characteristic
add
{ "repo_name": "dgageot/sonarqube", "path": "server/sonar-server/src/main/java/org/sonar/server/computation/measure/MeasureRepository.java", "license": "lgpl-3.0", "size": 4395 }
[ "org.sonar.server.computation.component.Component", "org.sonar.server.computation.metric.Metric" ]
import org.sonar.server.computation.component.Component; import org.sonar.server.computation.metric.Metric;
import org.sonar.server.computation.component.*; import org.sonar.server.computation.metric.*;
[ "org.sonar.server" ]
org.sonar.server;
752,486
private void accumulateDigitalOceanOptions(List<Tuple> optionsArray) { // Source: https://www.digitalocean.com/pricing, Sept. 20, 2013 // One terabyte per month, converted to megabits per second. double oneTerabyteInMbps = Math.pow(2.0, 40) * 8.0 / (Util.SECONDS_PER_YEAR / 12.0); String[] locations = new String[]{"New York", "San Francisco", "Amsterdam"}; Region[] regions = new Region[]{Region.NorthAmerica, Region.NorthAmerica, Region.Europe}; for (int locationIndex = 0; locationIndex < locations.length; locationIndex++) { Tuple baseTuple = new Tuple(); baseTuple.provider = Provider.DigitalOcean; baseTuple.region = regions[locationIndex]; baseTuple.location = locations[locationIndex]; baseTuple.reservationType = "hourly"; baseTuple.diskMB = 0; baseTuple.termMonths = 0; baseTuple.term = Term.Hour; baseTuple.upfrontCost = 0; Tuple tuple = new Tuple(baseTuple); tuple.serverType = "512MB"; tuple.hourlyCost = 5 / 672.0; tuple.cores = 1; tuple.ramMB = 512; tuple.flashMB = 20 * 1024; tuple.networkMbps = 1.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "1GB"; tuple.hourlyCost = 10 / 672.0; tuple.cores = 1; tuple.ramMB = 1024; tuple.flashMB = 30 * 1024; tuple.networkMbps = 2.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "2GB"; tuple.hourlyCost = 20 / 672.0; tuple.cores = 2; tuple.ramMB = 2 * 1024; tuple.flashMB = 40 * 1024; tuple.networkMbps = 3.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "4GB"; tuple.hourlyCost = 40 / 672.0; tuple.cores = 2; tuple.ramMB = 4 * 1024; tuple.flashMB = 60 * 1024; tuple.networkMbps = 4.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "8GB"; tuple.hourlyCost = 80 / 672.0; tuple.cores = 4; tuple.ramMB = 8 * 1024; tuple.flashMB = 80 * 1024; tuple.networkMbps = 5.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "16GB"; tuple.hourlyCost = 160 / 672.0; tuple.cores = 8; tuple.ramMB = 16 * 1024; tuple.flashMB = 160 * 1024; tuple.networkMbps = 6.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "32GB"; tuple.hourlyCost = 320 / 672.0; tuple.cores = 12; tuple.ramMB = 32 * 1024; tuple.flashMB = 320 * 1024; tuple.networkMbps = 7.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "48GB"; tuple.hourlyCost = 480 / 672.0; tuple.cores = 16; tuple.ramMB = 48 * 1024; tuple.flashMB = 480 * 1024; tuple.networkMbps = 8.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "64GB"; tuple.hourlyCost = 640 / 672.0; tuple.cores = 20; tuple.ramMB = 64 * 1024; tuple.flashMB = 640 * 1024; tuple.networkMbps = 9.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "96GB"; tuple.hourlyCost = 960 / 672.0; tuple.cores = 24; tuple.ramMB = 96 * 1024; tuple.flashMB = 960 * 1024; tuple.networkMbps = 10.0 * oneTerabyteInMbps; optionsArray.add(tuple); } }
void function(List<Tuple> optionsArray) { double oneTerabyteInMbps = Math.pow(2.0, 40) * 8.0 / (Util.SECONDS_PER_YEAR / 12.0); String[] locations = new String[]{STR, STR, STR}; Region[] regions = new Region[]{Region.NorthAmerica, Region.NorthAmerica, Region.Europe}; for (int locationIndex = 0; locationIndex < locations.length; locationIndex++) { Tuple baseTuple = new Tuple(); baseTuple.provider = Provider.DigitalOcean; baseTuple.region = regions[locationIndex]; baseTuple.location = locations[locationIndex]; baseTuple.reservationType = STR; baseTuple.diskMB = 0; baseTuple.termMonths = 0; baseTuple.term = Term.Hour; baseTuple.upfrontCost = 0; Tuple tuple = new Tuple(baseTuple); tuple.serverType = "512MB"; tuple.hourlyCost = 5 / 672.0; tuple.cores = 1; tuple.ramMB = 512; tuple.flashMB = 20 * 1024; tuple.networkMbps = 1.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "1GB"; tuple.hourlyCost = 10 / 672.0; tuple.cores = 1; tuple.ramMB = 1024; tuple.flashMB = 30 * 1024; tuple.networkMbps = 2.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "2GB"; tuple.hourlyCost = 20 / 672.0; tuple.cores = 2; tuple.ramMB = 2 * 1024; tuple.flashMB = 40 * 1024; tuple.networkMbps = 3.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "4GB"; tuple.hourlyCost = 40 / 672.0; tuple.cores = 2; tuple.ramMB = 4 * 1024; tuple.flashMB = 60 * 1024; tuple.networkMbps = 4.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "8GB"; tuple.hourlyCost = 80 / 672.0; tuple.cores = 4; tuple.ramMB = 8 * 1024; tuple.flashMB = 80 * 1024; tuple.networkMbps = 5.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "16GB"; tuple.hourlyCost = 160 / 672.0; tuple.cores = 8; tuple.ramMB = 16 * 1024; tuple.flashMB = 160 * 1024; tuple.networkMbps = 6.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "32GB"; tuple.hourlyCost = 320 / 672.0; tuple.cores = 12; tuple.ramMB = 32 * 1024; tuple.flashMB = 320 * 1024; tuple.networkMbps = 7.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "48GB"; tuple.hourlyCost = 480 / 672.0; tuple.cores = 16; tuple.ramMB = 48 * 1024; tuple.flashMB = 480 * 1024; tuple.networkMbps = 8.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "64GB"; tuple.hourlyCost = 640 / 672.0; tuple.cores = 20; tuple.ramMB = 64 * 1024; tuple.flashMB = 640 * 1024; tuple.networkMbps = 9.0 * oneTerabyteInMbps; optionsArray.add(tuple); tuple = new Tuple(baseTuple); tuple.serverType = "96GB"; tuple.hourlyCost = 960 / 672.0; tuple.cores = 24; tuple.ramMB = 96 * 1024; tuple.flashMB = 960 * 1024; tuple.networkMbps = 10.0 * oneTerabyteInMbps; optionsArray.add(tuple); } }
/** * Add a Tuple to optionsArray for each Digital Ocean offering. */
Add a Tuple to optionsArray for each Digital Ocean offering
accumulateDigitalOceanOptions
{ "repo_name": "scalyr/cloud-costs", "path": "CloudPriceFetcher.java", "license": "apache-2.0", "size": 40000 }
[ "com.restartle.core.Util", "java.util.List" ]
import com.restartle.core.Util; import java.util.List;
import com.restartle.core.*; import java.util.*;
[ "com.restartle.core", "java.util" ]
com.restartle.core; java.util;
965,280
public List<PlayerEntity> getEnemies(List<PlayerEntity> results) { Team myTeam = entity.getTeam(); SightMemoryRecord[] records = getSightMemoryRecords(); for(int i = 0; i < records.length; i++) { if( records[i].isValid()) { PlayerEntity otherPlayer = records[i].getEntity(); Team otherTeam = otherPlayer.getTeam(); if(otherTeam==null || myTeam==null || otherTeam.getId() != myTeam.getId()) { results.add(otherPlayer); break; } } } return results; }
List<PlayerEntity> function(List<PlayerEntity> results) { Team myTeam = entity.getTeam(); SightMemoryRecord[] records = getSightMemoryRecords(); for(int i = 0; i < records.length; i++) { if( records[i].isValid()) { PlayerEntity otherPlayer = records[i].getEntity(); Team otherTeam = otherPlayer.getTeam(); if(otherTeam==null myTeam==null otherTeam.getId() != myTeam.getId()) { results.add(otherPlayer); break; } } } return results; }
/** * Get the list of enemies in view * @param results the resulting list of enemies in the view * @return the same results object, just convenience */
Get the list of enemies in view
getEnemies
{ "repo_name": "tonysparks/seventh", "path": "src/seventh/ai/basic/SightSensor.java", "license": "gpl-2.0", "size": 7142 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
918,348
@Deprecated public static boolean isEmpty( StringBuffer val ) { return Utils.isEmpty( val ); }
static boolean function( StringBuffer val ) { return Utils.isEmpty( val ); }
/** * Check if the stringBuffer supplied is empty. A StringBuffer is empty when it is null or when the length is 0 * * @param val * The stringBuffer to check * @return true if the stringBuffer supplied is empty * @deprecated * @see org.pentaho.di.core.util.Utils#isEmpty(CharSequence) */
Check if the stringBuffer supplied is empty. A StringBuffer is empty when it is null or when the length is 0
isEmpty
{ "repo_name": "bmorrise/pentaho-kettle", "path": "core/src/main/java/org/pentaho/di/core/Const.java", "license": "apache-2.0", "size": 122915 }
[ "org.pentaho.di.core.util.Utils" ]
import org.pentaho.di.core.util.Utils;
import org.pentaho.di.core.util.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,795,582
public static String getHexCollationKey(String name) { byte [] arr = getCollationKeyInBytes(name); char[] keys = Hex.encodeHex(arr); return new String(keys, 0, getKeyLen(arr) * 2); }
static String function(String name) { byte [] arr = getCollationKeyInBytes(name); char[] keys = Hex.encodeHex(arr); return new String(keys, 0, getKeyLen(arr) * 2); }
/** * return the collation key in hex format * @param name * @return the collation key in hex format */
return the collation key in hex format
getHexCollationKey
{ "repo_name": "haikuowuya/android_system_code", "path": "src/android/database/DatabaseUtils.java", "license": "apache-2.0", "size": 53995 }
[ "org.apache.commons.codec.binary.Hex" ]
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.binary.*;
[ "org.apache.commons" ]
org.apache.commons;
1,907,247
public Protos.Offer getOffer();
Protos.Offer function();
/** * Get the Mesos resource offer associated with this lease. * * @return the Mesos resource offer */
Get the Mesos resource offer associated with this lease
getOffer
{ "repo_name": "corindwyer/Fenzo", "path": "fenzo-core/src/main/java/com/netflix/fenzo/VirtualMachineLease.java", "license": "apache-2.0", "size": 4442 }
[ "org.apache.mesos.Protos" ]
import org.apache.mesos.Protos;
import org.apache.mesos.*;
[ "org.apache.mesos" ]
org.apache.mesos;
1,441,908
public OAuthRevocationResponseDTO revokeAuthzForAppsByResoureOwner( OAuthRevocationRequestDTO revokeRequestDTO) throws IdentityOAuthAdminException { TokenMgtDAO tokenMgtDAO = new TokenMgtDAO(); if (revokeRequestDTO.getApps() != null && revokeRequestDTO.getApps().length > 0) { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); String tenantAwareUserName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); String userName = tenantAwareUserName + "@" + tenantDomain; String userStoreDomain = null; if (OAuth2Util.checkAccessTokenPartitioningEnabled() && OAuth2Util.checkUserNameAssertionEnabled()) { try { userStoreDomain = OAuth2Util.getUserStoreDomainFromUserId(userName); } catch (IdentityOAuth2Exception e) { throw new IdentityOAuthAdminException( "Error occurred while getting user store domain from User ID : " + userName, e); } } OAuthConsumerAppDTO[] appDTOs = getAppsAuthorizedByUser(); for (String appName : revokeRequestDTO.getApps()) { for (OAuthConsumerAppDTO appDTO : appDTOs) { if (appDTO.getApplicationName().equals(appName)) { Set<AccessTokenDO> accessTokenDOs = null; try { // retrieve all ACTIVE or EXPIRED access tokens for particular client authorized by this user accessTokenDOs = tokenMgtDAO.retrieveAccessTokens( appDTO.getOauthConsumerKey(), userName, userStoreDomain, true); } catch (IdentityOAuth2Exception e) { String errorMsg = "Error occurred while retrieving access tokens issued for " + "Client ID : " + appDTO.getOauthConsumerKey() + ", User ID : " + userName; log.error(errorMsg, e); throw new IdentityOAuthAdminException(errorMsg, e); } User authzUser; for (AccessTokenDO accessTokenDO : accessTokenDOs) { //Clear cache with AccessTokenDO authzUser = accessTokenDO.getAuthzUser(); OAuthUtil.clearOAuthCache(accessTokenDO.getConsumerKey(), authzUser, OAuth2Util.buildScopeString(accessTokenDO.getScope())); OAuthUtil.clearOAuthCache(accessTokenDO.getConsumerKey(), authzUser); OAuthUtil.clearOAuthCache(accessTokenDO.getAccessToken()); AccessTokenDO scopedToken = null; try { // retrieve latest access token for particular client, user and scope combination if its ACTIVE or EXPIRED scopedToken = tokenMgtDAO.retrieveLatestAccessToken( appDTO.getOauthConsumerKey(), userName, userStoreDomain, OAuth2Util.buildScopeString(accessTokenDO.getScope()), true); } catch (IdentityOAuth2Exception e) { String errorMsg = "Error occurred while retrieving latest " + "access token issued for Client ID : " + appDTO.getOauthConsumerKey() + ", User ID : " + userName + " and Scope : " + OAuth2Util.buildScopeString(accessTokenDO.getScope()); log.error(errorMsg, e); throw new IdentityOAuthAdminException(errorMsg, e); } if (scopedToken != null) { //Revoking token from database try { tokenMgtDAO.revokeTokens(new String[]{scopedToken.getAccessToken()}); } catch (IdentityOAuth2Exception e) { String errorMsg = "Error occurred while revoking " + "Access Token : " + scopedToken.getAccessToken(); log.error(errorMsg, e); throw new IdentityOAuthAdminException(errorMsg, e); } } } try { tokenMgtDAO.revokeOAuthConsentByApplicationAndUser(userName, appName); } catch (IdentityOAuth2Exception e) { String errorMsg = "Error occurred while removing OAuth Consent of Application " + appName + " of user " + userName; log.error(errorMsg, e); throw new IdentityOAuthAdminException(errorMsg, e); } } } } } else { OAuthRevocationResponseDTO revokeRespDTO = new OAuthRevocationResponseDTO(); revokeRespDTO.setError(true); revokeRespDTO.setErrorCode(OAuth2ErrorCodes.INVALID_REQUEST); revokeRespDTO.setErrorMsg("Invalid revocation request"); return revokeRespDTO; } return new OAuthRevocationResponseDTO(); }
OAuthRevocationResponseDTO function( OAuthRevocationRequestDTO revokeRequestDTO) throws IdentityOAuthAdminException { TokenMgtDAO tokenMgtDAO = new TokenMgtDAO(); if (revokeRequestDTO.getApps() != null && revokeRequestDTO.getApps().length > 0) { String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); String tenantAwareUserName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); String userName = tenantAwareUserName + "@" + tenantDomain; String userStoreDomain = null; if (OAuth2Util.checkAccessTokenPartitioningEnabled() && OAuth2Util.checkUserNameAssertionEnabled()) { try { userStoreDomain = OAuth2Util.getUserStoreDomainFromUserId(userName); } catch (IdentityOAuth2Exception e) { throw new IdentityOAuthAdminException( STR + userName, e); } } OAuthConsumerAppDTO[] appDTOs = getAppsAuthorizedByUser(); for (String appName : revokeRequestDTO.getApps()) { for (OAuthConsumerAppDTO appDTO : appDTOs) { if (appDTO.getApplicationName().equals(appName)) { Set<AccessTokenDO> accessTokenDOs = null; try { accessTokenDOs = tokenMgtDAO.retrieveAccessTokens( appDTO.getOauthConsumerKey(), userName, userStoreDomain, true); } catch (IdentityOAuth2Exception e) { String errorMsg = STR + STR + appDTO.getOauthConsumerKey() + STR + userName; log.error(errorMsg, e); throw new IdentityOAuthAdminException(errorMsg, e); } User authzUser; for (AccessTokenDO accessTokenDO : accessTokenDOs) { authzUser = accessTokenDO.getAuthzUser(); OAuthUtil.clearOAuthCache(accessTokenDO.getConsumerKey(), authzUser, OAuth2Util.buildScopeString(accessTokenDO.getScope())); OAuthUtil.clearOAuthCache(accessTokenDO.getConsumerKey(), authzUser); OAuthUtil.clearOAuthCache(accessTokenDO.getAccessToken()); AccessTokenDO scopedToken = null; try { scopedToken = tokenMgtDAO.retrieveLatestAccessToken( appDTO.getOauthConsumerKey(), userName, userStoreDomain, OAuth2Util.buildScopeString(accessTokenDO.getScope()), true); } catch (IdentityOAuth2Exception e) { String errorMsg = STR + STR + appDTO.getOauthConsumerKey() + STR + userName + STR + OAuth2Util.buildScopeString(accessTokenDO.getScope()); log.error(errorMsg, e); throw new IdentityOAuthAdminException(errorMsg, e); } if (scopedToken != null) { try { tokenMgtDAO.revokeTokens(new String[]{scopedToken.getAccessToken()}); } catch (IdentityOAuth2Exception e) { String errorMsg = STR + STR + scopedToken.getAccessToken(); log.error(errorMsg, e); throw new IdentityOAuthAdminException(errorMsg, e); } } } try { tokenMgtDAO.revokeOAuthConsentByApplicationAndUser(userName, appName); } catch (IdentityOAuth2Exception e) { String errorMsg = STR + appName + STR + userName; log.error(errorMsg, e); throw new IdentityOAuthAdminException(errorMsg, e); } } } } } else { OAuthRevocationResponseDTO revokeRespDTO = new OAuthRevocationResponseDTO(); revokeRespDTO.setError(true); revokeRespDTO.setErrorCode(OAuth2ErrorCodes.INVALID_REQUEST); revokeRespDTO.setErrorMsg(STR); return revokeRespDTO; } return new OAuthRevocationResponseDTO(); }
/** * Revoke authorization for OAuth apps by resource owners * * @param revokeRequestDTO DTO representing authorized user and apps[] * @return revokeRespDTO DTO representing success or failure message */
Revoke authorization for OAuth apps by resource owners
revokeAuthzForAppsByResoureOwner
{ "repo_name": "thariyarox/carbon-identity", "path": "components/oauth/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth/OAuthAdminService.java", "license": "apache-2.0", "size": 27132 }
[ "java.util.Set", "org.wso2.carbon.context.PrivilegedCarbonContext", "org.wso2.carbon.identity.application.common.model.User", "org.wso2.carbon.identity.oauth.common.OAuth2ErrorCodes", "org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO", "org.wso2.carbon.identity.oauth.dto.OAuthRevocationRequestDTO", "org.wso2.carbon.identity.oauth.dto.OAuthRevocationResponseDTO", "org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception", "org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO", "org.wso2.carbon.identity.oauth2.model.AccessTokenDO", "org.wso2.carbon.identity.oauth2.util.OAuth2Util" ]
import java.util.Set; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.application.common.model.User; import org.wso2.carbon.identity.oauth.common.OAuth2ErrorCodes; import org.wso2.carbon.identity.oauth.dto.OAuthConsumerAppDTO; import org.wso2.carbon.identity.oauth.dto.OAuthRevocationRequestDTO; import org.wso2.carbon.identity.oauth.dto.OAuthRevocationResponseDTO; import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; import org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO; import org.wso2.carbon.identity.oauth2.model.AccessTokenDO; import org.wso2.carbon.identity.oauth2.util.OAuth2Util;
import java.util.*; import org.wso2.carbon.context.*; import org.wso2.carbon.identity.application.common.model.*; import org.wso2.carbon.identity.oauth.common.*; import org.wso2.carbon.identity.oauth.dto.*; import org.wso2.carbon.identity.oauth2.*; import org.wso2.carbon.identity.oauth2.dao.*; import org.wso2.carbon.identity.oauth2.model.*; import org.wso2.carbon.identity.oauth2.util.*;
[ "java.util", "org.wso2.carbon" ]
java.util; org.wso2.carbon;
116,143
Collection<String> markDependencyAvailable(String server, String db, String table, Map<String, String> partitions);
Collection<String> markDependencyAvailable(String server, String db, String table, Map<String, String> partitions);
/** * Mark a partition dependency as available * * @param server host:port of the server * @param db name of the database * @param table name of the table * @param partitions list of available partitions * @return list of actionIDs for which the dependency is now available */
Mark a partition dependency as available
markDependencyAvailable
{ "repo_name": "cbaenziger/oozie", "path": "core/src/main/java/org/apache/oozie/dependency/hcat/HCatDependencyCache.java", "license": "apache-2.0", "size": 3443 }
[ "java.util.Collection", "java.util.Map" ]
import java.util.Collection; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,597,354
public LogLogisticService mergeLogLogisticService(LogLogisticService logLogisticService);
LogLogisticService function(LogLogisticService logLogisticService);
/** * mergeLogLogisticService - merges a LogLogisticService * * @param logLogisticService * @return the merged LogLogisticService */
mergeLogLogisticService - merges a LogLogisticService
mergeLogLogisticService
{ "repo_name": "yauritux/venice-legacy", "path": "Venice/Venice-Interface-Model/src/main/java/com/gdn/venice/facade/LogLogisticServiceSessionEJBRemote.java", "license": "apache-2.0", "size": 2780 }
[ "com.gdn.venice.persistence.LogLogisticService" ]
import com.gdn.venice.persistence.LogLogisticService;
import com.gdn.venice.persistence.*;
[ "com.gdn.venice" ]
com.gdn.venice;
2,587,273
public static final boolean[] readThisBooleanArrayXml(XmlPullParser parser, String endTag, String[] name) throws XmlPullParserException, java.io.IOException { int num; try { num = Integer.parseInt(parser.getAttributeValue(null, "num")); } catch (NullPointerException e) { throw new XmlPullParserException("Need num attribute in string-array"); } catch (NumberFormatException e) { throw new XmlPullParserException("Not a number in num attribute in string-array"); } parser.next(); boolean[] array = new boolean[num]; int i = 0; int eventType = parser.getEventType(); do { if (eventType == parser.START_TAG) { if (parser.getName().equals("item")) { try { array[i] = Boolean.valueOf(parser.getAttributeValue(null, "value")); } catch (NullPointerException e) { throw new XmlPullParserException("Need value attribute in item"); } catch (NumberFormatException e) { throw new XmlPullParserException("Not a number in value attribute in item"); } } else { throw new XmlPullParserException("Expected item tag at: " + parser.getName()); } } else if (eventType == parser.END_TAG) { if (parser.getName().equals(endTag)) { return array; } else if (parser.getName().equals("item")) { i++; } else { throw new XmlPullParserException("Expected " + endTag + " end tag at: " + parser.getName()); } } eventType = parser.next(); } while (eventType != parser.END_DOCUMENT); throw new XmlPullParserException("Document ended before " + endTag + " end tag"); }
static final boolean[] function(XmlPullParser parser, String endTag, String[] name) throws XmlPullParserException, java.io.IOException { int num; try { num = Integer.parseInt(parser.getAttributeValue(null, "num")); } catch (NullPointerException e) { throw new XmlPullParserException(STR); } catch (NumberFormatException e) { throw new XmlPullParserException(STR); } parser.next(); boolean[] array = new boolean[num]; int i = 0; int eventType = parser.getEventType(); do { if (eventType == parser.START_TAG) { if (parser.getName().equals("item")) { try { array[i] = Boolean.valueOf(parser.getAttributeValue(null, "value")); } catch (NullPointerException e) { throw new XmlPullParserException(STR); } catch (NumberFormatException e) { throw new XmlPullParserException(STR); } } else { throw new XmlPullParserException(STR + parser.getName()); } } else if (eventType == parser.END_TAG) { if (parser.getName().equals(endTag)) { return array; } else if (parser.getName().equals("item")) { i++; } else { throw new XmlPullParserException(STR + endTag + STR + parser.getName()); } } eventType = parser.next(); } while (eventType != parser.END_DOCUMENT); throw new XmlPullParserException(STR + endTag + STR); }
/** * Read a boolean[] object from an XmlPullParser. The XML data could * previously have been generated by writeBooleanArrayXml(). The XmlPullParser * must be positioned <em>after</em> the tag that begins the list. * * @param parser The XmlPullParser from which to read the list data. * @param endTag Name of the tag that will end the list, usually "string-array". * @param name An array of one string, used to return the name attribute * of the list's tag. * * @return Returns a newly generated boolean[]. * * @see #readListXml */
Read a boolean[] object from an XmlPullParser. The XML data could previously have been generated by writeBooleanArrayXml(). The XmlPullParser must be positioned after the tag that begins the list
readThisBooleanArrayXml
{ "repo_name": "mobvoi/ticdesign", "path": "ticDesign/src/main/java/ticwear/design/internal/XmlUtils.java", "license": "apache-2.0", "size": 60785 }
[ "java.io.IOException", "org.xmlpull.v1.XmlPullParser", "org.xmlpull.v1.XmlPullParserException" ]
import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException;
import java.io.*; import org.xmlpull.v1.*;
[ "java.io", "org.xmlpull.v1" ]
java.io; org.xmlpull.v1;
2,708,484
@Nullable public WorkbookFunctionResult post() throws ClientException { return send(HttpMethod.POST, body); }
WorkbookFunctionResult function() throws ClientException { return send(HttpMethod.POST, body); }
/** * Invokes the method and returns the result * @return result of the method invocation * @throws ClientException an exception occurs if there was an error while the request was sent */
Invokes the method and returns the result
post
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/WorkbookFunctionsImExpRequest.java", "license": "mit", "size": 2966 }
[ "com.microsoft.graph.core.ClientException", "com.microsoft.graph.http.HttpMethod", "com.microsoft.graph.models.WorkbookFunctionResult" ]
import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.WorkbookFunctionResult;
import com.microsoft.graph.core.*; import com.microsoft.graph.http.*; import com.microsoft.graph.models.*;
[ "com.microsoft.graph" ]
com.microsoft.graph;
513,804
public synchronized JobID getNewJobId() throws IOException { verifyServiceState(ServiceState.LIVE); return new JobID(getTrackerIdentifier(), nextJobId++); }
synchronized JobID function() throws IOException { verifyServiceState(ServiceState.LIVE); return new JobID(getTrackerIdentifier(), nextJobId++); }
/** * Allocates a new JobId string. */
Allocates a new JobId string
getNewJobId
{ "repo_name": "dhootha/hadoop-common", "path": "src/mapred/org/apache/hadoop/mapred/JobTracker.java", "license": "apache-2.0", "size": 128680 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
84,846
helper.loader.getResource(helper.getURI("BusinessTypes.domain", getClass())); helper.loader.getResource(helper.getURI("AA_Accounting.domain", getClass())); URI uri = helper.getURI("AA_ARR_ACCOUNTING,AA.version", getClass()); xmlGenerator.doGenerate(uri, helper.loader, helper.fsa); String genXML = helper.getGeneratedFile("AA_ARR_ACCOUNTING,AA.version.xml"); // Compare xml content with sample one. String expectedXml = Resources.toString(Resources.getResource(getClass(), "AA_ARR_ACCOUNTING,AA.xml"), Charsets.UTF_8); XMLTestsUtils.assertXml("XML content not matched.", expectedXml, genXML, new String()); }
helper.loader.getResource(helper.getURI(STR, getClass())); helper.loader.getResource(helper.getURI(STR, getClass())); URI uri = helper.getURI(STR, getClass()); xmlGenerator.doGenerate(uri, helper.loader, helper.fsa); String genXML = helper.getGeneratedFile(STR); String expectedXml = Resources.toString(Resources.getResource(getClass(), STR), Charsets.UTF_8); XMLTestsUtils.assertXml(STR, expectedXml, genXML, new String()); }
/** * Tests converting test.version to test.version.xml. This first test * intentionally does not put a *.domain into the ResourceSet, so the * forApplication reference will not be resolveable - but it should work * anyways. */
Tests converting test.version to test.version.xml. This first test intentionally does not put a *.domain into the ResourceSet, so the forApplication reference will not be resolveable - but it should work anyways
testVersionXMLGeneratorWithUnresolvedProxy
{ "repo_name": "debabratahazra/DS", "path": "designstudio/components/t24/tests/com.odcgroup.t24.version.model.tests/src/tests/java/com/odcgroup/t24/version/xml/generator/VersionXMLGeneratorTest.java", "license": "epl-1.0", "size": 1812 }
[ "com.google.common.base.Charsets", "com.google.common.io.Resources", "com.odcgroup.workbench.core.tests.util.XMLTestsUtils" ]
import com.google.common.base.Charsets; import com.google.common.io.Resources; import com.odcgroup.workbench.core.tests.util.XMLTestsUtils;
import com.google.common.base.*; import com.google.common.io.*; import com.odcgroup.workbench.core.tests.util.*;
[ "com.google.common", "com.odcgroup.workbench" ]
com.google.common; com.odcgroup.workbench;
2,313,231
private synchronized void addUser(String userName) throws IOException { if (!userNames.contains(userName)) { userNames.add(userName); USER_FILE.getParentFile().mkdirs(); FileOutputStream fos = null; try { fos = new FileOutputStream(USER_FILE); IOUtils.writeLines(userNames, null, fos); } finally { IOUtils.closeQuietly(fos); } } }
synchronized void function(String userName) throws IOException { if (!userNames.contains(userName)) { userNames.add(userName); USER_FILE.getParentFile().mkdirs(); FileOutputStream fos = null; try { fos = new FileOutputStream(USER_FILE); IOUtils.writeLines(userNames, null, fos); } finally { IOUtils.closeQuietly(fos); } } }
/** * Adds a username to the user file * * @param userName * @throws IOException */
Adds a username to the user file
addUser
{ "repo_name": "dominicdesu/openhab2-addons", "path": "addons/io/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/HueEmulationServlet.java", "license": "epl-1.0", "size": 22795 }
[ "java.io.FileOutputStream", "java.io.IOException", "org.apache.commons.io.IOUtils" ]
import java.io.FileOutputStream; import java.io.IOException; import org.apache.commons.io.IOUtils;
import java.io.*; import org.apache.commons.io.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
41,098
@Nonnull PrioritizedOperatorSubtaskState prioritizedOperatorState(OperatorID operatorID);
PrioritizedOperatorSubtaskState prioritizedOperatorState(OperatorID operatorID);
/** * Returns means to restore previously reported state of an operator running in the owning task. * * @param operatorID the id of the operator for which we request state. * @return Previous state for the operator. The previous state can be empty if the operator had no previous state. */
Returns means to restore previously reported state of an operator running in the owning task
prioritizedOperatorState
{ "repo_name": "tzulitai/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/state/TaskStateManager.java", "license": "apache-2.0", "size": 3311 }
[ "org.apache.flink.runtime.checkpoint.PrioritizedOperatorSubtaskState", "org.apache.flink.runtime.jobgraph.OperatorID" ]
import org.apache.flink.runtime.checkpoint.PrioritizedOperatorSubtaskState; import org.apache.flink.runtime.jobgraph.OperatorID;
import org.apache.flink.runtime.checkpoint.*; import org.apache.flink.runtime.jobgraph.*;
[ "org.apache.flink" ]
org.apache.flink;
607,707