repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
adamfisk/littleshoot-commons-id | src/main/java/org/apache/commons/id/uuid/Bytes.java | Bytes.areEqual | public static boolean areEqual(byte[] a, byte[] b) {
int aLength = a.length;
if (aLength != b.length) {
return false;
}
for (int i = 0; i < aLength; i++) {
if (a[i] != b[i]) {
return false;
}
}
return true;
} | java | public static boolean areEqual(byte[] a, byte[] b) {
int aLength = a.length;
if (aLength != b.length) {
return false;
}
for (int i = 0; i < aLength; i++) {
if (a[i] != b[i]) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"areEqual",
"(",
"byte",
"[",
"]",
"a",
",",
"byte",
"[",
"]",
"b",
")",
"{",
"int",
"aLength",
"=",
"a",
".",
"length",
";",
"if",
"(",
"aLength",
"!=",
"b",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
... | Compares two byte arrays for equality.
@param a A byte[].
@param b A byte[].
@return True if the arrays have identical contents. | [
"Compares",
"two",
"byte",
"arrays",
"for",
"equality",
"."
] | train | https://github.com/adamfisk/littleshoot-commons-id/blob/49a8f5f2b10831c509876ca463bf1a87e1e49ae9/src/main/java/org/apache/commons/id/uuid/Bytes.java#L110-L122 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java | WaveformDetailComponent.setPlaybackState | public synchronized void setPlaybackState(int player, long position, boolean playing) {
if (getMonitoredPlayer() != 0 && player != getMonitoredPlayer()) {
throw new IllegalStateException("Cannot setPlaybackState for another player when monitoring player " + getMonitoredPlayer());
}
if (player < 1) {
throw new IllegalArgumentException("player must be positive");
}
PlaybackState oldFurthestState = getFurthestPlaybackState();
PlaybackState newState = new PlaybackState(player, position, playing);
PlaybackState oldState = playbackStateMap.put(player, newState);
if (oldState == null || oldState.position != newState.position) {
repaintDueToPlaybackStateChange(oldState, newState, oldFurthestState);
}
} | java | public synchronized void setPlaybackState(int player, long position, boolean playing) {
if (getMonitoredPlayer() != 0 && player != getMonitoredPlayer()) {
throw new IllegalStateException("Cannot setPlaybackState for another player when monitoring player " + getMonitoredPlayer());
}
if (player < 1) {
throw new IllegalArgumentException("player must be positive");
}
PlaybackState oldFurthestState = getFurthestPlaybackState();
PlaybackState newState = new PlaybackState(player, position, playing);
PlaybackState oldState = playbackStateMap.put(player, newState);
if (oldState == null || oldState.position != newState.position) {
repaintDueToPlaybackStateChange(oldState, newState, oldFurthestState);
}
} | [
"public",
"synchronized",
"void",
"setPlaybackState",
"(",
"int",
"player",
",",
"long",
"position",
",",
"boolean",
"playing",
")",
"{",
"if",
"(",
"getMonitoredPlayer",
"(",
")",
"!=",
"0",
"&&",
"player",
"!=",
"getMonitoredPlayer",
"(",
")",
")",
"{",
... | Set the current playback state for a player.
Will cause part of the component to be redrawn if the player state has
changed (and we have the {@link TrackMetadata} we need to translate the time into a position in the
component). This will be quickly overruled if a player is being monitored, but
can be used in other contexts.
@param player the player number whose playback state is being recorded
@param position the current playback position of that player in milliseconds
@param playing whether the player is actively playing the track
@throws IllegalStateException if the component is configured to monitor a player, and this is called
with state for a different player
@throws IllegalArgumentException if player is less than one
@since 0.5.0 | [
"Set",
"the",
"current",
"playback",
"state",
"for",
"a",
"player",
"."
] | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformDetailComponent.java#L206-L219 |
michael-rapp/AndroidMaterialValidation | library/src/main/java/de/mrapp/android/validation/EditText.java | EditText.getOffsetForPosition | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public final int getOffsetForPosition(final float x, final float y) {
return getView().getOffsetForPosition(x, y);
} | java | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public final int getOffsetForPosition(final float x, final float y) {
return getView().getOffsetForPosition(x, y);
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"ICE_CREAM_SANDWICH",
")",
"public",
"final",
"int",
"getOffsetForPosition",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"{",
"return",
"getView",
"(",
")",
".",
"getOffsetForPosition"... | Get the character offset closest to the specified absolute position. A typical use case is to
pass the result of {@link MotionEvent#getX()} and {@link MotionEvent#getY()} to this method.
@param x
The horizontal absolute position of a point on screen
@param y
The vertical absolute position of a point on screen
@return the character offset for the character whose position is closest to the specified
position. Returns -1 if there is no layout. | [
"Get",
"the",
"character",
"offset",
"closest",
"to",
"the",
"specified",
"absolute",
"position",
".",
"A",
"typical",
"use",
"case",
"is",
"to",
"pass",
"the",
"result",
"of",
"{",
"@link",
"MotionEvent#getX",
"()",
"}",
"and",
"{",
"@link",
"MotionEvent#ge... | train | https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/EditText.java#L2257-L2260 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/SelectAlgorithmAndInputPanel.java | SelectAlgorithmAndInputPanel.loadInputData | @Override
public void loadInputData(String fileName) {
Reader r = media.openFile(fileName);
List<PathLabel> refs = new ArrayList<>();
try {
BufferedReader reader = new BufferedReader(r);
String line;
while( (line = reader.readLine()) != null ) {
String[]z = line.split(":");
String[] names = new String[z.length-1];
for( int i = 1; i < z.length; i++ ) {
names[i-1] = baseDirectory+z[i];
}
refs.add(new PathLabel(z[0],names));
}
setInputList(refs);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | @Override
public void loadInputData(String fileName) {
Reader r = media.openFile(fileName);
List<PathLabel> refs = new ArrayList<>();
try {
BufferedReader reader = new BufferedReader(r);
String line;
while( (line = reader.readLine()) != null ) {
String[]z = line.split(":");
String[] names = new String[z.length-1];
for( int i = 1; i < z.length; i++ ) {
names[i-1] = baseDirectory+z[i];
}
refs.add(new PathLabel(z[0],names));
}
setInputList(refs);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"@",
"Override",
"public",
"void",
"loadInputData",
"(",
"String",
"fileName",
")",
"{",
"Reader",
"r",
"=",
"media",
".",
"openFile",
"(",
"fileName",
")",
";",
"List",
"<",
"PathLabel",
">",
"refs",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try"... | Loads a standardized file for input references
@param fileName path to config file | [
"Loads",
"a",
"standardized",
"file",
"for",
"input",
"references"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/SelectAlgorithmAndInputPanel.java#L108-L133 |
aws/aws-sdk-java | aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/GetFunctionResult.java | GetFunctionResult.withTags | public GetFunctionResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public GetFunctionResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"GetFunctionResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The function's <a href="https://docs.aws.amazon.com/lambda/latest/dg/tagging.html">tags</a>.
</p>
@param tags
The function's <a href="https://docs.aws.amazon.com/lambda/latest/dg/tagging.html">tags</a>.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"function",
"s",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"lambda",
"/",
"latest",
"/",
"dg",
"/",
"tagging",
".",
"html",
">",
"tags<",
"/",
"a",
">",
".",
"<",
"/",
"p",
">... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/GetFunctionResult.java#L170-L173 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/DataDecoder.java | DataDecoder.decodeLong | public static long decodeLong(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
return
(((long)(((src[srcOffset ] ) << 24) |
((src[srcOffset + 1] & 0xff) << 16) |
((src[srcOffset + 2] & 0xff) << 8 ) |
((src[srcOffset + 3] & 0xff) )) ^ 0x80000000 ) << 32) |
(((long)(((src[srcOffset + 4] ) << 24) |
((src[srcOffset + 5] & 0xff) << 16) |
((src[srcOffset + 6] & 0xff) << 8 ) |
((src[srcOffset + 7] & 0xff) )) & 0xffffffffL) );
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | java | public static long decodeLong(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
return
(((long)(((src[srcOffset ] ) << 24) |
((src[srcOffset + 1] & 0xff) << 16) |
((src[srcOffset + 2] & 0xff) << 8 ) |
((src[srcOffset + 3] & 0xff) )) ^ 0x80000000 ) << 32) |
(((long)(((src[srcOffset + 4] ) << 24) |
((src[srcOffset + 5] & 0xff) << 16) |
((src[srcOffset + 6] & 0xff) << 8 ) |
((src[srcOffset + 7] & 0xff) )) & 0xffffffffL) );
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | [
"public",
"static",
"long",
"decodeLong",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcOffset",
")",
"throws",
"CorruptEncodingException",
"{",
"try",
"{",
"return",
"(",
"(",
"(",
"long",
")",
"(",
"(",
"(",
"src",
"[",
"srcOffset",
"]",
")",
"<<",
... | Decodes a signed long from exactly 8 bytes.
@param src source of encoded bytes
@param srcOffset offset into source array
@return signed long value | [
"Decodes",
"a",
"signed",
"long",
"from",
"exactly",
"8",
"bytes",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L88-L104 |
phax/ph-oton | ph-oton-core/src/main/java/com/helger/photon/core/html/AbstractSWECHTMLProvider.java | AbstractSWECHTMLProvider.fillHeadAndBody | @Override
@OverrideOnDemand
protected void fillHeadAndBody (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull final HCHtml aHtml,
@Nonnull final Locale aDisplayLocale)
{
final IMenuTree aMenuTree = RequestSettings.getMenuTree (aRequestScope);
final IUser aLoggedInUser = LoggedInUserManager.getInstance ().getCurrentUser ();
// Build the execution scope
final ISimpleWebExecutionContext aSWEC = new SimpleWebExecutionContext (aRequestScope,
aDisplayLocale,
aMenuTree,
aLoggedInUser);
// fill body
fillBody (aSWEC, aHtml);
// build HTML header (after body for per-request stuff)
fillHead (aSWEC, aHtml);
} | java | @Override
@OverrideOnDemand
protected void fillHeadAndBody (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull final HCHtml aHtml,
@Nonnull final Locale aDisplayLocale)
{
final IMenuTree aMenuTree = RequestSettings.getMenuTree (aRequestScope);
final IUser aLoggedInUser = LoggedInUserManager.getInstance ().getCurrentUser ();
// Build the execution scope
final ISimpleWebExecutionContext aSWEC = new SimpleWebExecutionContext (aRequestScope,
aDisplayLocale,
aMenuTree,
aLoggedInUser);
// fill body
fillBody (aSWEC, aHtml);
// build HTML header (after body for per-request stuff)
fillHead (aSWEC, aHtml);
} | [
"@",
"Override",
"@",
"OverrideOnDemand",
"protected",
"void",
"fillHeadAndBody",
"(",
"@",
"Nonnull",
"final",
"IRequestWebScopeWithoutResponse",
"aRequestScope",
",",
"@",
"Nonnull",
"final",
"HCHtml",
"aHtml",
",",
"@",
"Nonnull",
"final",
"Locale",
"aDisplayLocale... | Overridable method to fill head and body. The default implementation uses
an {@link SimpleWebExecutionContext} which in turn requires a menu tree to
be present. If you have an application without a menu tree, override this
method.
@param aRequestScope
Current request scope
@param aHtml
Created (empty) HTML node
@param aDisplayLocale
The display locale of the current request | [
"Overridable",
"method",
"to",
"fill",
"head",
"and",
"body",
".",
"The",
"default",
"implementation",
"uses",
"an",
"{",
"@link",
"SimpleWebExecutionContext",
"}",
"which",
"in",
"turn",
"requires",
"a",
"menu",
"tree",
"to",
"be",
"present",
".",
"If",
"yo... | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/html/AbstractSWECHTMLProvider.java#L91-L111 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getMasteryInfo | public void getMasteryInfo(int[] ids, Callback<List<Mastery>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getMasteryInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getMasteryInfo(int[] ids, Callback<List<Mastery>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getMasteryInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getMasteryInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Mastery",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",... | or more info on masteries API go <a href="https://wiki.guildwars2.com/wiki/API:2/masteries">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of mastery id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see Mastery mastery info | [
"or",
"more",
"info",
"on",
"masteries",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"masteries",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1834-L1837 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java | VirtualNetworksInner.beginCreateOrUpdateAsync | public Observable<VirtualNetworkInner> beginCreateOrUpdateAsync(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).map(new Func1<ServiceResponse<VirtualNetworkInner>, VirtualNetworkInner>() {
@Override
public VirtualNetworkInner call(ServiceResponse<VirtualNetworkInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualNetworkInner> beginCreateOrUpdateAsync(String resourceGroupName, String virtualNetworkName, VirtualNetworkInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, virtualNetworkName, parameters).map(new Func1<ServiceResponse<VirtualNetworkInner>, VirtualNetworkInner>() {
@Override
public VirtualNetworkInner call(ServiceResponse<VirtualNetworkInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualNetworkInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkName",
",",
"VirtualNetworkInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"res... | Creates or updates a virtual network in the specified resource group.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@param parameters Parameters supplied to the create or update virtual network operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualNetworkInner object | [
"Creates",
"or",
"updates",
"a",
"virtual",
"network",
"in",
"the",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java#L558-L565 |
josueeduardo/snappy | snappy/src/main/java/io/joshworks/snappy/SnappyServer.java | SnappyServer.staticFiles | public static synchronized void staticFiles(String url, String docPath) {
checkStarted();
instance().endpoints.add(HandlerUtil.staticFiles(url, docPath));
} | java | public static synchronized void staticFiles(String url, String docPath) {
checkStarted();
instance().endpoints.add(HandlerUtil.staticFiles(url, docPath));
} | [
"public",
"static",
"synchronized",
"void",
"staticFiles",
"(",
"String",
"url",
",",
"String",
"docPath",
")",
"{",
"checkStarted",
"(",
")",
";",
"instance",
"(",
")",
".",
"endpoints",
".",
"add",
"(",
"HandlerUtil",
".",
"staticFiles",
"(",
"url",
",",... | Serve static files from a given url. Path variables are not supported.
@param url The relative URL to be map this endpoint.
@param docPath The relative path to the classpath. | [
"Serve",
"static",
"files",
"from",
"a",
"given",
"url",
".",
"Path",
"variables",
"are",
"not",
"supported",
"."
] | train | https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/snappy/src/main/java/io/joshworks/snappy/SnappyServer.java#L599-L602 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/SocketGroovyMethods.java | SocketGroovyMethods.leftShift | public static OutputStream leftShift(Socket self, byte[] value) throws IOException {
return IOGroovyMethods.leftShift(self.getOutputStream(), value);
} | java | public static OutputStream leftShift(Socket self, byte[] value) throws IOException {
return IOGroovyMethods.leftShift(self.getOutputStream(), value);
} | [
"public",
"static",
"OutputStream",
"leftShift",
"(",
"Socket",
"self",
",",
"byte",
"[",
"]",
"value",
")",
"throws",
"IOException",
"{",
"return",
"IOGroovyMethods",
".",
"leftShift",
"(",
"self",
".",
"getOutputStream",
"(",
")",
",",
"value",
")",
";",
... | Overloads the left shift operator to provide an append mechanism
to add bytes to the output stream of a socket
@param self a Socket
@param value a value to append
@return an OutputStream
@throws IOException if an IOException occurs.
@since 1.0 | [
"Overloads",
"the",
"left",
"shift",
"operator",
"to",
"provide",
"an",
"append",
"mechanism",
"to",
"add",
"bytes",
"to",
"the",
"output",
"stream",
"of",
"a",
"socket"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/SocketGroovyMethods.java#L146-L148 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RemoteAllResults.java | RemoteAllResults.getLogLists | public Iterable<RemoteInstanceDetails> getLogLists() {
ArrayList<RemoteInstanceDetails> result = new ArrayList<RemoteInstanceDetails>();
for (Date startTime: resultList) {
result.add(new RemoteInstanceDetails(query, startTime, new String[0]));
}
return result;
} | java | public Iterable<RemoteInstanceDetails> getLogLists() {
ArrayList<RemoteInstanceDetails> result = new ArrayList<RemoteInstanceDetails>();
for (Date startTime: resultList) {
result.add(new RemoteInstanceDetails(query, startTime, new String[0]));
}
return result;
} | [
"public",
"Iterable",
"<",
"RemoteInstanceDetails",
">",
"getLogLists",
"(",
")",
"{",
"ArrayList",
"<",
"RemoteInstanceDetails",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"RemoteInstanceDetails",
">",
"(",
")",
";",
"for",
"(",
"Date",
"startTime",
":",
"r... | returns list of server instances satisfying the request.
@return iterable over RemoteInstanceDetails objects | [
"returns",
"list",
"of",
"server",
"instances",
"satisfying",
"the",
"request",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RemoteAllResults.java#L56-L62 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/StereoDisparityWtoNaive.java | StereoDisparityWtoNaive.computeScore | protected double computeScore( int leftX , int rightX , int centerY ) {
double ret=0;
for( int y = -radiusY; y <= radiusY; y++ ) {
for( int x = -radiusX; x <= radiusX; x++ ) {
double l = GeneralizedImageOps.get(imageLeft,leftX+x,centerY+y);
double r = GeneralizedImageOps.get(imageRight,rightX+x,centerY+y);
ret += Math.abs(l-r);
}
}
return ret;
} | java | protected double computeScore( int leftX , int rightX , int centerY ) {
double ret=0;
for( int y = -radiusY; y <= radiusY; y++ ) {
for( int x = -radiusX; x <= radiusX; x++ ) {
double l = GeneralizedImageOps.get(imageLeft,leftX+x,centerY+y);
double r = GeneralizedImageOps.get(imageRight,rightX+x,centerY+y);
ret += Math.abs(l-r);
}
}
return ret;
} | [
"protected",
"double",
"computeScore",
"(",
"int",
"leftX",
",",
"int",
"rightX",
",",
"int",
"centerY",
")",
"{",
"double",
"ret",
"=",
"0",
";",
"for",
"(",
"int",
"y",
"=",
"-",
"radiusY",
";",
"y",
"<=",
"radiusY",
";",
"y",
"++",
")",
"{",
"... | Compute SAD (Sum of Absolute Difference) error.
@param leftX X-axis center left image
@param rightX X-axis center left image
@param centerY Y-axis center for both images
@return Fit score for both regions. | [
"Compute",
"SAD",
"(",
"Sum",
"of",
"Absolute",
"Difference",
")",
"error",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/StereoDisparityWtoNaive.java#L137-L151 |
gresrun/jesque | src/main/java/net/greghaines/jesque/utils/JedisUtils.java | JedisUtils.isDelayedQueue | public static boolean isDelayedQueue(final Jedis jedis, final String key) {
return ZSET.equalsIgnoreCase(jedis.type(key));
} | java | public static boolean isDelayedQueue(final Jedis jedis, final String key) {
return ZSET.equalsIgnoreCase(jedis.type(key));
} | [
"public",
"static",
"boolean",
"isDelayedQueue",
"(",
"final",
"Jedis",
"jedis",
",",
"final",
"String",
"key",
")",
"{",
"return",
"ZSET",
".",
"equalsIgnoreCase",
"(",
"jedis",
".",
"type",
"(",
"key",
")",
")",
";",
"}"
] | Determines if the queue identified by the given key is a delayed queue.
@param jedis
connection to Redis
@param key
the key that identifies a queue
@return true if the key identifies a delayed queue, false otherwise | [
"Determines",
"if",
"the",
"queue",
"identified",
"by",
"the",
"given",
"key",
"is",
"a",
"delayed",
"queue",
"."
] | train | https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/JedisUtils.java#L132-L134 |
apache/incubator-druid | core/src/main/java/org/apache/druid/guice/LifecycleModule.java | LifecycleModule.registerKey | public static void registerKey(Binder binder, Key<?> key)
{
getEagerBinder(binder).addBinding().toInstance(new KeyHolder<Object>(key));
} | java | public static void registerKey(Binder binder, Key<?> key)
{
getEagerBinder(binder).addBinding().toInstance(new KeyHolder<Object>(key));
} | [
"public",
"static",
"void",
"registerKey",
"(",
"Binder",
"binder",
",",
"Key",
"<",
"?",
">",
"key",
")",
"{",
"getEagerBinder",
"(",
"binder",
")",
".",
"addBinding",
"(",
")",
".",
"toInstance",
"(",
"new",
"KeyHolder",
"<",
"Object",
">",
"(",
"key... | Registers a key to instantiate eagerly. {@link Key}s mentioned here will be pulled out of
the injector with an injector.getInstance() call when the lifecycle is created.
Eagerly loaded classes will *not* be automatically added to the Lifecycle unless they are bound to the proper
scope. That is, they are generally eagerly loaded because the loading operation will produce some beneficial
side-effect even if nothing actually directly depends on the instance.
This mechanism exists to allow the {@link Lifecycle} to be the primary entry point
from the injector, not to auto-register things with the {@link Lifecycle}. It is
also possible to just bind things eagerly with Guice, it is not clear which is actually the best approach.
This is more explicit, but eager bindings inside of modules is less error-prone.
@param key The key to use in finding the DruidNode instance | [
"Registers",
"a",
"key",
"to",
"instantiate",
"eagerly",
".",
"{",
"@link",
"Key",
"}",
"s",
"mentioned",
"here",
"will",
"be",
"pulled",
"out",
"of",
"the",
"injector",
"with",
"an",
"injector",
".",
"getInstance",
"()",
"call",
"when",
"the",
"lifecycle"... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/guice/LifecycleModule.java#L105-L108 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/upload/impl/CmsUploaderFileApi.java | CmsUploaderFileApi.onBrowserError | private void onBrowserError(I_CmsUploadDialog dialog, String errorCode) {
int code = new Integer(errorCode).intValue();
String errMsg = org.opencms.gwt.client.Messages.get().key(org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_0);
switch (code) {
case 1: // NOT_FOUND_ERR
errMsg = org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_NOT_FOUND_0);
break;
case 2: // SECURITY_ERR
errMsg = org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_SECURITY_0);
break;
case 3: // ABORT_ERR
errMsg = org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_ABORT_ERR_0);
break;
case 4: // NOT_READABLE_ERR
errMsg = org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_NOT_READABLE_0);
break;
case 5: // ENCODING_ERR
errMsg = org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_ENCODING_0);
break;
default:
break;
}
dialog.showErrorReport(errMsg, null);
} | java | private void onBrowserError(I_CmsUploadDialog dialog, String errorCode) {
int code = new Integer(errorCode).intValue();
String errMsg = org.opencms.gwt.client.Messages.get().key(org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_0);
switch (code) {
case 1: // NOT_FOUND_ERR
errMsg = org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_NOT_FOUND_0);
break;
case 2: // SECURITY_ERR
errMsg = org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_SECURITY_0);
break;
case 3: // ABORT_ERR
errMsg = org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_ABORT_ERR_0);
break;
case 4: // NOT_READABLE_ERR
errMsg = org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_NOT_READABLE_0);
break;
case 5: // ENCODING_ERR
errMsg = org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.ERR_UPLOAD_BROWSER_ENCODING_0);
break;
default:
break;
}
dialog.showErrorReport(errMsg, null);
} | [
"private",
"void",
"onBrowserError",
"(",
"I_CmsUploadDialog",
"dialog",
",",
"String",
"errorCode",
")",
"{",
"int",
"code",
"=",
"new",
"Integer",
"(",
"errorCode",
")",
".",
"intValue",
"(",
")",
";",
"String",
"errMsg",
"=",
"org",
".",
"opencms",
".",... | Switches the error message depending on the given error code.<p>
The error codes are defined in the W3C file API.<p>
<a href="http://www.w3.org/TR/FileAPI/#dfn-fileerror">http://www.w3.org/TR/FileAPI/#dfn-fileerror</a>
@param dialog the upload dialog
@param errorCode the error code as String | [
"Switches",
"the",
"error",
"message",
"depending",
"on",
"the",
"given",
"error",
"code",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/upload/impl/CmsUploaderFileApi.java#L167-L197 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplex.java | BigComplex.valueOf | public static BigComplex valueOf(BigDecimal real, BigDecimal imaginary) {
if (real.signum() == 0) {
if (imaginary.signum() == 0) {
return ZERO;
}
if (imaginary.compareTo(BigDecimal.ONE) == 0) {
return I;
}
}
if (imaginary.signum() == 0 && real.compareTo(BigDecimal.ONE) == 0) {
return ONE;
}
return new BigComplex(real, imaginary);
} | java | public static BigComplex valueOf(BigDecimal real, BigDecimal imaginary) {
if (real.signum() == 0) {
if (imaginary.signum() == 0) {
return ZERO;
}
if (imaginary.compareTo(BigDecimal.ONE) == 0) {
return I;
}
}
if (imaginary.signum() == 0 && real.compareTo(BigDecimal.ONE) == 0) {
return ONE;
}
return new BigComplex(real, imaginary);
} | [
"public",
"static",
"BigComplex",
"valueOf",
"(",
"BigDecimal",
"real",
",",
"BigDecimal",
"imaginary",
")",
"{",
"if",
"(",
"real",
".",
"signum",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"imaginary",
".",
"signum",
"(",
")",
"==",
"0",
")",
"{",
... | Returns a complex number with the specified real and imaginary {@link BigDecimal} parts.
@param real the real {@link BigDecimal} part
@param imaginary the imaginary {@link BigDecimal} part
@return the complex number | [
"Returns",
"a",
"complex",
"number",
"with",
"the",
"specified",
"real",
"and",
"imaginary",
"{",
"@link",
"BigDecimal",
"}",
"parts",
"."
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplex.java#L519-L533 |
Crab2died/Excel4J | src/main/java/com/github/crab2died/ExcelUtils.java | ExcelUtils.exportObjects2CSV | public void exportObjects2CSV(List<?> data, Class clazz, boolean isWriteHeader, String path)
throws Excel4JException {
try {
Writer writer = new FileWriter(path);
exportCSVByMapHandler(data, clazz, isWriteHeader, writer);
} catch (Excel4JException | IOException e) {
throw new Excel4JException(e);
}
} | java | public void exportObjects2CSV(List<?> data, Class clazz, boolean isWriteHeader, String path)
throws Excel4JException {
try {
Writer writer = new FileWriter(path);
exportCSVByMapHandler(data, clazz, isWriteHeader, writer);
} catch (Excel4JException | IOException e) {
throw new Excel4JException(e);
}
} | [
"public",
"void",
"exportObjects2CSV",
"(",
"List",
"<",
"?",
">",
"data",
",",
"Class",
"clazz",
",",
"boolean",
"isWriteHeader",
",",
"String",
"path",
")",
"throws",
"Excel4JException",
"{",
"try",
"{",
"Writer",
"writer",
"=",
"new",
"FileWriter",
"(",
... | 基于注解导出CSV文件
@param data 待导出
@param clazz {@link com.github.crab2died.annotation.ExcelField}映射对象Class
@param isWriteHeader 是否写入文件
@param path 导出文件路径
@throws Excel4JException exception | [
"基于注解导出CSV文件"
] | train | https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L1640-L1649 |
QNJR-GROUP/EasyTransaction | easytrans-core/src/main/java/com/yiqiniu/easytrans/core/EasyTransSynchronizer.java | EasyTransSynchronizer.startSoftTrans | public void startSoftTrans(String busCode,long trxId){
if(isSoftTransBegon()) {
throw new RuntimeException("transaction already started,but try to start again." + busCode + "," + trxId);
}
//hook to TransactionSynchronizer
TransactionSynchronizationManager.registerSynchronization(new TransactionHook());
LogProcessContext logProcessContext = new LogProcessContext(applicationName, busCode, trxId, writer,transStatusLogger);
TransactionSynchronizationManager.bindResource(LOG_PROCESS_CONTEXT,logProcessContext);
//check whether is a parent transaction
TransactionId pTrxId = getParentTransactionId();
if(pTrxId == null){
//if this transaction is roll back, this record is will disappear
//transStatusLogger.writeExecuteFlag(applicationName, busCode, trxId, null, null, null, TransactionStatus.COMMITTED);
// since introduced SAGA, Global-transaction status can not be determined by master transaction commit
transStatusLogger.writeExecuteFlag(applicationName, busCode, trxId, null, null, null, TransactionStatus.UNKNOWN);
} else {
//a transaction with parent transaction,it's status depends on parent
//check whether the parent transaction status is determined
Integer pTransStatus = MetaDataFilter.getMetaData(EasytransConstant.CallHeadKeys.PARENT_TRANSACTION_STATUS);
if(pTransStatus == null){
pTransStatus = TransactionStatus.UNKNOWN;
}
transStatusLogger.writeExecuteFlag(applicationName, busCode, trxId, pTrxId.getAppId(), pTrxId.getBusCode(), pTrxId.getTrxId(), pTransStatus);
}
} | java | public void startSoftTrans(String busCode,long trxId){
if(isSoftTransBegon()) {
throw new RuntimeException("transaction already started,but try to start again." + busCode + "," + trxId);
}
//hook to TransactionSynchronizer
TransactionSynchronizationManager.registerSynchronization(new TransactionHook());
LogProcessContext logProcessContext = new LogProcessContext(applicationName, busCode, trxId, writer,transStatusLogger);
TransactionSynchronizationManager.bindResource(LOG_PROCESS_CONTEXT,logProcessContext);
//check whether is a parent transaction
TransactionId pTrxId = getParentTransactionId();
if(pTrxId == null){
//if this transaction is roll back, this record is will disappear
//transStatusLogger.writeExecuteFlag(applicationName, busCode, trxId, null, null, null, TransactionStatus.COMMITTED);
// since introduced SAGA, Global-transaction status can not be determined by master transaction commit
transStatusLogger.writeExecuteFlag(applicationName, busCode, trxId, null, null, null, TransactionStatus.UNKNOWN);
} else {
//a transaction with parent transaction,it's status depends on parent
//check whether the parent transaction status is determined
Integer pTransStatus = MetaDataFilter.getMetaData(EasytransConstant.CallHeadKeys.PARENT_TRANSACTION_STATUS);
if(pTransStatus == null){
pTransStatus = TransactionStatus.UNKNOWN;
}
transStatusLogger.writeExecuteFlag(applicationName, busCode, trxId, pTrxId.getAppId(), pTrxId.getBusCode(), pTrxId.getTrxId(), pTransStatus);
}
} | [
"public",
"void",
"startSoftTrans",
"(",
"String",
"busCode",
",",
"long",
"trxId",
")",
"{",
"if",
"(",
"isSoftTransBegon",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"transaction already started,but try to start again.\"",
"+",
"busCode",
"+",
... | create LogContext.<br>
pass in busCode and trxId will help about the execute efficient and the debug and statistics<br>
so I demand to pass in busCode and trxId to generate a global unique bus key
@param busCode the unique busCode in AppId
@param trxId the unique trxId in appId+busCode | [
"create",
"LogContext",
".",
"<br",
">",
"pass",
"in",
"busCode",
"and",
"trxId",
"will",
"help",
"about",
"the",
"execute",
"efficient",
"and",
"the",
"debug",
"and",
"statistics<br",
">",
"so",
"I",
"demand",
"to",
"pass",
"in",
"busCode",
"and",
"trxId"... | train | https://github.com/QNJR-GROUP/EasyTransaction/blob/53b031724a3fd1145f32b9a7b5c6fb8138d6a426/easytrans-core/src/main/java/com/yiqiniu/easytrans/core/EasyTransSynchronizer.java#L78-L107 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.invokeSpecialQuiet | public MethodHandle invokeSpecialQuiet(MethodHandles.Lookup lookup, String name, Class<?> caller) {
try {
return invokeSpecial(lookup, name, caller);
} catch (IllegalAccessException | NoSuchMethodException e) {
throw new InvalidTransformException(e);
}
} | java | public MethodHandle invokeSpecialQuiet(MethodHandles.Lookup lookup, String name, Class<?> caller) {
try {
return invokeSpecial(lookup, name, caller);
} catch (IllegalAccessException | NoSuchMethodException e) {
throw new InvalidTransformException(e);
}
} | [
"public",
"MethodHandle",
"invokeSpecialQuiet",
"(",
"MethodHandles",
".",
"Lookup",
"lookup",
",",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"caller",
")",
"{",
"try",
"{",
"return",
"invokeSpecial",
"(",
"lookup",
",",
"name",
",",
"caller",
")",
";... | Apply the chain of transforms and bind them to a special method specified
using the end signature plus the given class and name. The method will
be retrieved using the given Lookup and must match the end signature
exactly.
If the final handle's type does not exactly match the initial type for
this Binder, an additional cast will be attempted.
This version is "quiet" in that it throws an unchecked InvalidTransformException
if the target method does not exist or is inaccessible.
@param lookup the MethodHandles.Lookup to use to look up the method
@param name the name of the method to invoke
@param caller the calling class
@return the full handle chain, bound to the given method | [
"Apply",
"the",
"chain",
"of",
"transforms",
"and",
"bind",
"them",
"to",
"a",
"special",
"method",
"specified",
"using",
"the",
"end",
"signature",
"plus",
"the",
"given",
"class",
"and",
"name",
".",
"The",
"method",
"will",
"be",
"retrieved",
"using",
"... | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1319-L1325 |
google/closure-compiler | src/com/google/javascript/jscomp/ControlFlowAnalysis.java | ControlFlowAnalysis.getNextSiblingOfType | private static Node getNextSiblingOfType(Node first, Token ... types) {
for (Node c = first; c != null; c = c.getNext()) {
for (Token type : types) {
if (c.getToken() == type) {
return c;
}
}
}
return null;
} | java | private static Node getNextSiblingOfType(Node first, Token ... types) {
for (Node c = first; c != null; c = c.getNext()) {
for (Token type : types) {
if (c.getToken() == type) {
return c;
}
}
}
return null;
} | [
"private",
"static",
"Node",
"getNextSiblingOfType",
"(",
"Node",
"first",
",",
"Token",
"...",
"types",
")",
"{",
"for",
"(",
"Node",
"c",
"=",
"first",
";",
"c",
"!=",
"null",
";",
"c",
"=",
"c",
".",
"getNext",
"(",
")",
")",
"{",
"for",
"(",
... | Get the next sibling (including itself) of one of the given types. | [
"Get",
"the",
"next",
"sibling",
"(",
"including",
"itself",
")",
"of",
"one",
"of",
"the",
"given",
"types",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ControlFlowAnalysis.java#L913-L922 |
structurizr/java | structurizr-core/src/com/structurizr/documentation/ViewpointsAndPerspectivesDocumentationTemplate.java | ViewpointsAndPerspectivesDocumentationTemplate.addSystemStakeholdersAndRequirementsSection | public Section addSystemStakeholdersAndRequirementsSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "System Stakeholders and Requirements", files);
} | java | public Section addSystemStakeholdersAndRequirementsSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "System Stakeholders and Requirements", files);
} | [
"public",
"Section",
"addSystemStakeholdersAndRequirementsSection",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"return",
"addSection",
"(",
"softwareSystem",
",",
"\"System Stakeholders and Requirements\"",
",",
... | Adds a "System Stakeholders and Requirements" section relating to a {@link SoftwareSystem} from one or more files.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there is an error reading the files | [
"Adds",
"a",
"System",
"Stakeholders",
"and",
"Requirements",
"section",
"relating",
"to",
"a",
"{",
"@link",
"SoftwareSystem",
"}",
"from",
"one",
"or",
"more",
"files",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/ViewpointsAndPerspectivesDocumentationTemplate.java#L92-L94 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/network/inatsession_stats.java | inatsession_stats.get | public static inatsession_stats get(nitro_service service, inatsession_stats obj) throws Exception{
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(obj));
inatsession_stats response = (inatsession_stats) obj.stat_resource(service,option);
return response;
} | java | public static inatsession_stats get(nitro_service service, inatsession_stats obj) throws Exception{
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(obj));
inatsession_stats response = (inatsession_stats) obj.stat_resource(service,option);
return response;
} | [
"public",
"static",
"inatsession_stats",
"get",
"(",
"nitro_service",
"service",
",",
"inatsession_stats",
"obj",
")",
"throws",
"Exception",
"{",
"options",
"option",
"=",
"new",
"options",
"(",
")",
";",
"option",
".",
"set_args",
"(",
"nitro_util",
".",
"ob... | Use this API to fetch statistics of inatsession_stats resource of the given information. | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"inatsession_stats",
"resource",
"of",
"the",
"given",
"information",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/network/inatsession_stats.java#L241-L246 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/tools/HttpTools.java | HttpTools.validateResponse | private String validateResponse(final DigestedResponse response, final URL url) throws MovieDbException {
if (response.getStatusCode() == 0) {
throw new MovieDbException(ApiExceptionType.CONNECTION_ERROR, response.getContent(), response.getStatusCode(), url, null);
} else if (response.getStatusCode() >= HttpStatus.SC_INTERNAL_SERVER_ERROR) {
throw new MovieDbException(ApiExceptionType.HTTP_503_ERROR, response.getContent(), response.getStatusCode(), url, null);
} else if (response.getStatusCode() >= HttpStatus.SC_MULTIPLE_CHOICES) {
throw new MovieDbException(ApiExceptionType.HTTP_404_ERROR, response.getContent(), response.getStatusCode(), url, null);
}
return response.getContent();
} | java | private String validateResponse(final DigestedResponse response, final URL url) throws MovieDbException {
if (response.getStatusCode() == 0) {
throw new MovieDbException(ApiExceptionType.CONNECTION_ERROR, response.getContent(), response.getStatusCode(), url, null);
} else if (response.getStatusCode() >= HttpStatus.SC_INTERNAL_SERVER_ERROR) {
throw new MovieDbException(ApiExceptionType.HTTP_503_ERROR, response.getContent(), response.getStatusCode(), url, null);
} else if (response.getStatusCode() >= HttpStatus.SC_MULTIPLE_CHOICES) {
throw new MovieDbException(ApiExceptionType.HTTP_404_ERROR, response.getContent(), response.getStatusCode(), url, null);
}
return response.getContent();
} | [
"private",
"String",
"validateResponse",
"(",
"final",
"DigestedResponse",
"response",
",",
"final",
"URL",
"url",
")",
"throws",
"MovieDbException",
"{",
"if",
"(",
"response",
".",
"getStatusCode",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"MovieDbExcep... | Check the status codes of the response and throw exceptions if needed
@param response DigestedResponse to process
@param url URL for notification purposes
@return String content
@throws MovieDbException exception | [
"Check",
"the",
"status",
"codes",
"of",
"the",
"response",
"and",
"throw",
"exceptions",
"if",
"needed"
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/tools/HttpTools.java#L149-L159 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/UpdateMethodResponseResult.java | UpdateMethodResponseResult.withResponseModels | public UpdateMethodResponseResult withResponseModels(java.util.Map<String, String> responseModels) {
setResponseModels(responseModels);
return this;
} | java | public UpdateMethodResponseResult withResponseModels(java.util.Map<String, String> responseModels) {
setResponseModels(responseModels);
return this;
} | [
"public",
"UpdateMethodResponseResult",
"withResponseModels",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseModels",
")",
"{",
"setResponseModels",
"(",
"responseModels",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Specifies the <a>Model</a> resources used for the response's content-type. Response models are represented as a
key/value map, with a content-type as the key and a <a>Model</a> name as the value.
</p>
@param responseModels
Specifies the <a>Model</a> resources used for the response's content-type. Response models are represented
as a key/value map, with a content-type as the key and a <a>Model</a> name as the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Specifies",
"the",
"<a",
">",
"Model<",
"/",
"a",
">",
"resources",
"used",
"for",
"the",
"response",
"s",
"content",
"-",
"type",
".",
"Response",
"models",
"are",
"represented",
"as",
"a",
"key",
"/",
"value",
"map",
"with",
"a",
"content... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/UpdateMethodResponseResult.java#L278-L281 |
cdk/cdk | storage/smiles/src/main/java/org/openscience/cdk/smiles/CDKToBeam.java | CDKToBeam.addTetrahedralConfiguration | private static void addTetrahedralConfiguration(ITetrahedralChirality tc, GraphBuilder gb, Map<IAtom, Integer> indices) {
IAtom[] ligands = tc.getLigands();
int u = indices.get(tc.getChiralAtom());
int vs[] = new int[]{indices.get(ligands[0]), indices.get(ligands[1]), indices.get(ligands[2]),
indices.get(ligands[3])};
gb.tetrahedral(u).lookingFrom(vs[0]).neighbors(vs[1], vs[2], vs[3])
.winding(tc.getStereo() == CLOCKWISE ? Configuration.CLOCKWISE : Configuration.ANTI_CLOCKWISE).build();
} | java | private static void addTetrahedralConfiguration(ITetrahedralChirality tc, GraphBuilder gb, Map<IAtom, Integer> indices) {
IAtom[] ligands = tc.getLigands();
int u = indices.get(tc.getChiralAtom());
int vs[] = new int[]{indices.get(ligands[0]), indices.get(ligands[1]), indices.get(ligands[2]),
indices.get(ligands[3])};
gb.tetrahedral(u).lookingFrom(vs[0]).neighbors(vs[1], vs[2], vs[3])
.winding(tc.getStereo() == CLOCKWISE ? Configuration.CLOCKWISE : Configuration.ANTI_CLOCKWISE).build();
} | [
"private",
"static",
"void",
"addTetrahedralConfiguration",
"(",
"ITetrahedralChirality",
"tc",
",",
"GraphBuilder",
"gb",
",",
"Map",
"<",
"IAtom",
",",
"Integer",
">",
"indices",
")",
"{",
"IAtom",
"[",
"]",
"ligands",
"=",
"tc",
".",
"getLigands",
"(",
")... | Add tetrahedral stereo configuration to the Beam GraphBuilder.
@param tc stereo element specifying tetrahedral configuration
@param gb the current graph builder
@param indices atom indices | [
"Add",
"tetrahedral",
"stereo",
"configuration",
"to",
"the",
"Beam",
"GraphBuilder",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/smiles/src/main/java/org/openscience/cdk/smiles/CDKToBeam.java#L338-L348 |
glyptodon/guacamole-client | guacamole-common/src/main/java/org/apache/guacamole/servlet/GuacamoleHTTPTunnelMap.java | GuacamoleHTTPTunnelMap.put | public void put(String uuid, GuacamoleTunnel tunnel) {
tunnelMap.put(uuid, new GuacamoleHTTPTunnel(tunnel));
} | java | public void put(String uuid, GuacamoleTunnel tunnel) {
tunnelMap.put(uuid, new GuacamoleHTTPTunnel(tunnel));
} | [
"public",
"void",
"put",
"(",
"String",
"uuid",
",",
"GuacamoleTunnel",
"tunnel",
")",
"{",
"tunnelMap",
".",
"put",
"(",
"uuid",
",",
"new",
"GuacamoleHTTPTunnel",
"(",
"tunnel",
")",
")",
";",
"}"
] | Registers that a new connection has been established using HTTP via the
given GuacamoleTunnel.
@param uuid
The UUID of the tunnel being added (registered).
@param tunnel
The GuacamoleTunnel being registered, its associated connection
having just been established via HTTP. | [
"Registers",
"that",
"a",
"new",
"connection",
"has",
"been",
"established",
"using",
"HTTP",
"via",
"the",
"given",
"GuacamoleTunnel",
"."
] | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole-common/src/main/java/org/apache/guacamole/servlet/GuacamoleHTTPTunnelMap.java#L179-L181 |
thorntail/wildfly-config-api | generator/src/main/java/org/wildfly/swarm/config/generator/generator/SupplierFactory.java | SupplierFactory.create | public JavaType create(ClassIndex index, ClassPlan plan) {
// base class
JavaInterfaceSource type = Roaster.parse(
JavaInterfaceSource.class,
"public interface " + plan.getClassName() + "Supplier<T extends " + plan.getClassName() + "> {}"
);
type.setPackage(plan.getPackageName());
type.addAnnotation(FunctionalInterface.class);
addGet( type, plan );
return type;
} | java | public JavaType create(ClassIndex index, ClassPlan plan) {
// base class
JavaInterfaceSource type = Roaster.parse(
JavaInterfaceSource.class,
"public interface " + plan.getClassName() + "Supplier<T extends " + plan.getClassName() + "> {}"
);
type.setPackage(plan.getPackageName());
type.addAnnotation(FunctionalInterface.class);
addGet( type, plan );
return type;
} | [
"public",
"JavaType",
"create",
"(",
"ClassIndex",
"index",
",",
"ClassPlan",
"plan",
")",
"{",
"// base class",
"JavaInterfaceSource",
"type",
"=",
"Roaster",
".",
"parse",
"(",
"JavaInterfaceSource",
".",
"class",
",",
"\"public interface \"",
"+",
"plan",
".",
... | Base template for a resource representation.
Covers the resource attributes
@param index
@param plan
@return | [
"Base",
"template",
"for",
"a",
"resource",
"representation",
".",
"Covers",
"the",
"resource",
"attributes"
] | train | https://github.com/thorntail/wildfly-config-api/blob/ddb3f3bcb7b85b22c6371415546f567bc44493db/generator/src/main/java/org/wildfly/swarm/config/generator/generator/SupplierFactory.java#L28-L43 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.fundamentalToProjective | public static DMatrixRMaj fundamentalToProjective(DMatrixRMaj F ) {
FundamentalToProjective f2p = new FundamentalToProjective();
DMatrixRMaj P = new DMatrixRMaj(3,4);
f2p.twoView(F,P);
return P;
} | java | public static DMatrixRMaj fundamentalToProjective(DMatrixRMaj F ) {
FundamentalToProjective f2p = new FundamentalToProjective();
DMatrixRMaj P = new DMatrixRMaj(3,4);
f2p.twoView(F,P);
return P;
} | [
"public",
"static",
"DMatrixRMaj",
"fundamentalToProjective",
"(",
"DMatrixRMaj",
"F",
")",
"{",
"FundamentalToProjective",
"f2p",
"=",
"new",
"FundamentalToProjective",
"(",
")",
";",
"DMatrixRMaj",
"P",
"=",
"new",
"DMatrixRMaj",
"(",
"3",
",",
"4",
")",
";",
... | <p>
Given a fundamental matrix a pair of camera matrices P0 and P1 can be extracted. Same
{@link #fundamentalToProjective(DMatrixRMaj, Point3D_F64, Vector3D_F64, double)} but with the suggested values
for all variables filled in for you.
</p>
@see FundamentalToProjective
@param F (Input) Fundamental Matrix
@return The canonical camera (projection) matrix P' (3 by 4) Known up to a projective transform. | [
"<p",
">",
"Given",
"a",
"fundamental",
"matrix",
"a",
"pair",
"of",
"camera",
"matrices",
"P0",
"and",
"P1",
"can",
"be",
"extracted",
".",
"Same",
"{",
"@link",
"#fundamentalToProjective",
"(",
"DMatrixRMaj",
"Point3D_F64",
"Vector3D_F64",
"double",
")",
"}"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L930-L935 |
JOML-CI/JOML | src/org/joml/Intersectiond.java | Intersectiond.intersectRayAar | public static int intersectRayAar(Vector2dc origin, Vector2dc dir, Vector2dc min, Vector2dc max, Vector2d result) {
return intersectRayAar(origin.x(), origin.y(), dir.x(), dir.y(), min.x(), min.y(), max.x(), max.y(), result);
} | java | public static int intersectRayAar(Vector2dc origin, Vector2dc dir, Vector2dc min, Vector2dc max, Vector2d result) {
return intersectRayAar(origin.x(), origin.y(), dir.x(), dir.y(), min.x(), min.y(), max.x(), max.y(), result);
} | [
"public",
"static",
"int",
"intersectRayAar",
"(",
"Vector2dc",
"origin",
",",
"Vector2dc",
"dir",
",",
"Vector2dc",
"min",
",",
"Vector2dc",
"max",
",",
"Vector2d",
"result",
")",
"{",
"return",
"intersectRayAar",
"(",
"origin",
".",
"x",
"(",
")",
",",
"... | Determine whether the given ray with the given <code>origin</code> and direction <code>dir</code>
intersects the axis-aligned rectangle given as its minimum corner <code>min</code> and maximum corner <code>max</code>,
and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the near and far point of intersection
as well as the side of the axis-aligned rectangle the ray intersects.
<p>
This method also detects an intersection for a ray whose origin lies inside the axis-aligned rectangle.
<p>
Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a>
@see #intersectRayAar(double, double, double, double, double, double, double, double, Vector2d)
@param origin
the ray's origin
@param dir
the ray's direction
@param min
the minimum corner of the axis-aligned rectangle
@param max
the maximum corner of the axis-aligned rectangle
@param result
a vector which will hold the values of the parameter <i>t</i> in the ray equation
<i>p(t) = origin + t * dir</i> of the near and far point of intersection
@return the side on which the near intersection occurred as one of
{@link #AAR_SIDE_MINX}, {@link #AAR_SIDE_MINY}, {@link #AAR_SIDE_MAXX} or {@link #AAR_SIDE_MAXY};
or <code>-1</code> if the ray does not intersect the axis-aligned rectangle; | [
"Determine",
"whether",
"the",
"given",
"ray",
"with",
"the",
"given",
"<code",
">",
"origin<",
"/",
"code",
">",
"and",
"direction",
"<code",
">",
"dir<",
"/",
"code",
">",
"intersects",
"the",
"axis",
"-",
"aligned",
"rectangle",
"given",
"as",
"its",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L4441-L4443 |
RestComm/jss7 | isup/isup-impl/src/main/java/org/restcomm/protocols/ss7/isup/impl/message/ISUPMessageImpl.java | ISUPMessageImpl.encodeOptionalParameters | protected void encodeOptionalParameters(Map<Integer, ISUPParameter> parameters, ByteArrayOutputStream bos)
throws ParameterException {
// NOTE: parameters MUST have as last endOfOptionalParametersParameter+1
// param
for (ISUPParameter p : parameters.values()) {
if (p == null)
continue;
byte[] b = ((AbstractISUPParameter) p).encode();
// System.err.println("ENCODE O: "+p.getCode()+"---> "+Utils.toHex(b));
// FIXME: this can be slow, maybe we shoudl remove that, and code
// this explicitly?
if (b.length > 255) {
throw new ParameterException("Parameter length is over 255: " + p);
}
if (!(p instanceof EndOfOptionalParametersImpl)) {
bos.write(p.getCode());
bos.write(b.length);
}
try {
bos.write(b);
} catch (IOException e) {
throw new ParameterException("Failed to encode optional parameters.", e);
}
}
} | java | protected void encodeOptionalParameters(Map<Integer, ISUPParameter> parameters, ByteArrayOutputStream bos)
throws ParameterException {
// NOTE: parameters MUST have as last endOfOptionalParametersParameter+1
// param
for (ISUPParameter p : parameters.values()) {
if (p == null)
continue;
byte[] b = ((AbstractISUPParameter) p).encode();
// System.err.println("ENCODE O: "+p.getCode()+"---> "+Utils.toHex(b));
// FIXME: this can be slow, maybe we shoudl remove that, and code
// this explicitly?
if (b.length > 255) {
throw new ParameterException("Parameter length is over 255: " + p);
}
if (!(p instanceof EndOfOptionalParametersImpl)) {
bos.write(p.getCode());
bos.write(b.length);
}
try {
bos.write(b);
} catch (IOException e) {
throw new ParameterException("Failed to encode optional parameters.", e);
}
}
} | [
"protected",
"void",
"encodeOptionalParameters",
"(",
"Map",
"<",
"Integer",
",",
"ISUPParameter",
">",
"parameters",
",",
"ByteArrayOutputStream",
"bos",
")",
"throws",
"ParameterException",
"{",
"// NOTE: parameters MUST have as last endOfOptionalParametersParameter+1",
"// p... | This method must be called ONLY in case there are optional params. This implies ISUPMessage.o_Parameters.size()>1 !!!
@param parameters
@param bos
@throws ParameterException | [
"This",
"method",
"must",
"be",
"called",
"ONLY",
"in",
"case",
"there",
"are",
"optional",
"params",
".",
"This",
"implies",
"ISUPMessage",
".",
"o_Parameters",
".",
"size",
"()",
">",
"1",
"!!!"
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/isup/isup-impl/src/main/java/org/restcomm/protocols/ss7/isup/impl/message/ISUPMessageImpl.java#L281-L310 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java | AbstractExecutableMemberWriter.getTypeParameters | protected Content getTypeParameters(ExecutableElement member) {
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, MEMBER_TYPE_PARAMS, member);
return writer.getTypeParameterLinks(linkInfo);
} | java | protected Content getTypeParameters(ExecutableElement member) {
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration, MEMBER_TYPE_PARAMS, member);
return writer.getTypeParameterLinks(linkInfo);
} | [
"protected",
"Content",
"getTypeParameters",
"(",
"ExecutableElement",
"member",
")",
"{",
"LinkInfoImpl",
"linkInfo",
"=",
"new",
"LinkInfoImpl",
"(",
"configuration",
",",
"MEMBER_TYPE_PARAMS",
",",
"member",
")",
";",
"return",
"writer",
".",
"getTypeParameterLinks... | Get the type parameters for the executable member.
@param member the member for which to get the type parameters.
@return the type parameters. | [
"Get",
"the",
"type",
"parameters",
"for",
"the",
"executable",
"member",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java#L91-L94 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/rocksdb/RocksDbUtils.java | RocksDbUtils.getColumnFamilyList | public static String[] getColumnFamilyList(String path) throws RocksDBException {
List<byte[]> cfList = RocksDB.listColumnFamilies(new Options(), path);
if (cfList == null || cfList.size() == 0) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> result = new ArrayList<>(cfList.size());
for (byte[] cf : cfList) {
result.add(new String(cf, StandardCharsets.UTF_8));
}
return result.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
} | java | public static String[] getColumnFamilyList(String path) throws RocksDBException {
List<byte[]> cfList = RocksDB.listColumnFamilies(new Options(), path);
if (cfList == null || cfList.size() == 0) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> result = new ArrayList<>(cfList.size());
for (byte[] cf : cfList) {
result.add(new String(cf, StandardCharsets.UTF_8));
}
return result.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
} | [
"public",
"static",
"String",
"[",
"]",
"getColumnFamilyList",
"(",
"String",
"path",
")",
"throws",
"RocksDBException",
"{",
"List",
"<",
"byte",
"[",
"]",
">",
"cfList",
"=",
"RocksDB",
".",
"listColumnFamilies",
"(",
"new",
"Options",
"(",
")",
",",
"pa... | Gets all available column family names from a RocksDb data directory.
@param path
@return
@throws RocksDBException | [
"Gets",
"all",
"available",
"column",
"family",
"names",
"from",
"a",
"RocksDb",
"data",
"directory",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/rocksdb/RocksDbUtils.java#L181-L191 |
dbracewell/hermes | hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/WordNet.java | WordNet.getSenses | public List<Sense> getSenses(String surfaceForm, Language language) {
return getSenses(surfaceForm, POS.ANY, language);
} | java | public List<Sense> getSenses(String surfaceForm, Language language) {
return getSenses(surfaceForm, POS.ANY, language);
} | [
"public",
"List",
"<",
"Sense",
">",
"getSenses",
"(",
"String",
"surfaceForm",
",",
"Language",
"language",
")",
"{",
"return",
"getSenses",
"(",
"surfaceForm",
",",
"POS",
".",
"ANY",
",",
"language",
")",
";",
"}"
] | Gets senses.
@param surfaceForm the surface form
@param language the language
@return the senses | [
"Gets",
"senses",
"."
] | train | https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/WordNet.java#L492-L494 |
jenkinsci/jenkins | core/src/main/java/hudson/util/ProcessTree.java | OSProcess.hasMatchingEnvVars | public final boolean hasMatchingEnvVars(Map<String,String> modelEnvVar) {
if(modelEnvVar.isEmpty())
// sanity check so that we don't start rampage.
return false;
SortedMap<String,String> envs = getEnvironmentVariables();
for (Entry<String,String> e : modelEnvVar.entrySet()) {
String v = envs.get(e.getKey());
if(v==null || !v.equals(e.getValue()))
return false; // no match
}
return true;
} | java | public final boolean hasMatchingEnvVars(Map<String,String> modelEnvVar) {
if(modelEnvVar.isEmpty())
// sanity check so that we don't start rampage.
return false;
SortedMap<String,String> envs = getEnvironmentVariables();
for (Entry<String,String> e : modelEnvVar.entrySet()) {
String v = envs.get(e.getKey());
if(v==null || !v.equals(e.getValue()))
return false; // no match
}
return true;
} | [
"public",
"final",
"boolean",
"hasMatchingEnvVars",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"modelEnvVar",
")",
"{",
"if",
"(",
"modelEnvVar",
".",
"isEmpty",
"(",
")",
")",
"// sanity check so that we don't start rampage.",
"return",
"false",
";",
"SortedM... | Given the environment variable of a process and the "model environment variable" that Hudson
used for launching the build, returns true if there's a match (which means the process should
be considered a descendant of a build.) | [
"Given",
"the",
"environment",
"variable",
"of",
"a",
"process",
"and",
"the",
"model",
"environment",
"variable",
"that",
"Hudson",
"used",
"for",
"launching",
"the",
"build",
"returns",
"true",
"if",
"there",
"s",
"a",
"match",
"(",
"which",
"means",
"the"... | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/ProcessTree.java#L317-L330 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/entities/columns/PercentageColumn.java | PercentageColumn.getTextForExpression | public String getTextForExpression(DJGroup group, DJGroup childGroup, String type) {
return "new Double( $V{" + getReportName() + "_" + getGroupVariableName(childGroup) + "}.doubleValue() / $V{" + getReportName() + "_" + getGroupVariableName(type,group.getColumnToGroupBy().getColumnProperty().getProperty()) + "}.doubleValue())";
} | java | public String getTextForExpression(DJGroup group, DJGroup childGroup, String type) {
return "new Double( $V{" + getReportName() + "_" + getGroupVariableName(childGroup) + "}.doubleValue() / $V{" + getReportName() + "_" + getGroupVariableName(type,group.getColumnToGroupBy().getColumnProperty().getProperty()) + "}.doubleValue())";
} | [
"public",
"String",
"getTextForExpression",
"(",
"DJGroup",
"group",
",",
"DJGroup",
"childGroup",
",",
"String",
"type",
")",
"{",
"return",
"\"new Double( $V{\"",
"+",
"getReportName",
"(",
")",
"+",
"\"_\"",
"+",
"getGroupVariableName",
"(",
"childGroup",
")",
... | Returns the formula for the percentage
@param group
@param type
@return | [
"Returns",
"the",
"formula",
"for",
"the",
"percentage"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/entities/columns/PercentageColumn.java#L32-L34 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/search/bingautosuggest/src/main/java/com/microsoft/azure/cognitiveservices/search/autosuggest/implementation/BingAutoSuggestSearchImpl.java | BingAutoSuggestSearchImpl.autoSuggestWithServiceResponseAsync | public Observable<ServiceResponse<Suggestions>> autoSuggestWithServiceResponseAsync(String query, AutoSuggestOptionalParameter autoSuggestOptionalParameter) {
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
final String acceptLanguage = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.acceptLanguage() : null;
final String pragma = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.pragma() : null;
final String userAgent = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.userAgent() : this.client.userAgent();
final String clientId = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.clientId() : null;
final String clientIp = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.clientIp() : null;
final String location = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.location() : null;
final String countryCode = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.countryCode() : null;
final String market = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.market() : null;
final SafeSearch safeSearch = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.safeSearch() : null;
final String setLang = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.setLang() : null;
final List<ResponseFormat> responseFormat = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.responseFormat() : null;
return autoSuggestWithServiceResponseAsync(query, acceptLanguage, pragma, userAgent, clientId, clientIp, location, countryCode, market, safeSearch, setLang, responseFormat);
} | java | public Observable<ServiceResponse<Suggestions>> autoSuggestWithServiceResponseAsync(String query, AutoSuggestOptionalParameter autoSuggestOptionalParameter) {
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
final String acceptLanguage = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.acceptLanguage() : null;
final String pragma = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.pragma() : null;
final String userAgent = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.userAgent() : this.client.userAgent();
final String clientId = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.clientId() : null;
final String clientIp = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.clientIp() : null;
final String location = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.location() : null;
final String countryCode = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.countryCode() : null;
final String market = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.market() : null;
final SafeSearch safeSearch = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.safeSearch() : null;
final String setLang = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.setLang() : null;
final List<ResponseFormat> responseFormat = autoSuggestOptionalParameter != null ? autoSuggestOptionalParameter.responseFormat() : null;
return autoSuggestWithServiceResponseAsync(query, acceptLanguage, pragma, userAgent, clientId, clientIp, location, countryCode, market, safeSearch, setLang, responseFormat);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Suggestions",
">",
">",
"autoSuggestWithServiceResponseAsync",
"(",
"String",
"query",
",",
"AutoSuggestOptionalParameter",
"autoSuggestOptionalParameter",
")",
"{",
"if",
"(",
"query",
"==",
"null",
")",
"{",
"thr... | The AutoSuggest API lets you send a search query to Bing and get back a list of suggestions. This section provides technical details about the query parameters and headers that you use to request suggestions and the JSON response objects that contain them.
@param query The user's search term.
@param autoSuggestOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Suggestions object | [
"The",
"AutoSuggest",
"API",
"lets",
"you",
"send",
"a",
"search",
"query",
"to",
"Bing",
"and",
"get",
"back",
"a",
"list",
"of",
"suggestions",
".",
"This",
"section",
"provides",
"technical",
"details",
"about",
"the",
"query",
"parameters",
"and",
"heade... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingautosuggest/src/main/java/com/microsoft/azure/cognitiveservices/search/autosuggest/implementation/BingAutoSuggestSearchImpl.java#L120-L137 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java | SegmentAggregator.reconcileSealOperation | private CompletableFuture<WriterFlushResult> reconcileSealOperation(SegmentProperties storageInfo, Duration timeout) {
// All we need to do is verify that the Segment is actually sealed in Storage. An exception to this rule is when
// the segment has a length of 0, which means it may not have been created yet.
if (storageInfo.isSealed() || storageInfo.getLength() == 0) {
// Seal the Attribute Index (this is an idempotent operation so it's OK if it's already sealed).
return sealAttributes(timeout)
.thenApplyAsync(v -> {
// Update metadata and the internal state (this also pops the first Op from the operation list).
updateStatePostSeal();
return new WriterFlushResult();
}, this.executor);
} else {
// A Seal was encountered as an Operation that should have been processed (based on its offset),
// but the Segment in Storage is not sealed.
return Futures.failedFuture(new ReconciliationFailureException("Segment was supposed to be sealed in storage but it is not.", this.metadata, storageInfo));
}
} | java | private CompletableFuture<WriterFlushResult> reconcileSealOperation(SegmentProperties storageInfo, Duration timeout) {
// All we need to do is verify that the Segment is actually sealed in Storage. An exception to this rule is when
// the segment has a length of 0, which means it may not have been created yet.
if (storageInfo.isSealed() || storageInfo.getLength() == 0) {
// Seal the Attribute Index (this is an idempotent operation so it's OK if it's already sealed).
return sealAttributes(timeout)
.thenApplyAsync(v -> {
// Update metadata and the internal state (this also pops the first Op from the operation list).
updateStatePostSeal();
return new WriterFlushResult();
}, this.executor);
} else {
// A Seal was encountered as an Operation that should have been processed (based on its offset),
// but the Segment in Storage is not sealed.
return Futures.failedFuture(new ReconciliationFailureException("Segment was supposed to be sealed in storage but it is not.", this.metadata, storageInfo));
}
} | [
"private",
"CompletableFuture",
"<",
"WriterFlushResult",
">",
"reconcileSealOperation",
"(",
"SegmentProperties",
"storageInfo",
",",
"Duration",
"timeout",
")",
"{",
"// All we need to do is verify that the Segment is actually sealed in Storage. An exception to this rule is when",
"/... | Attempts to reconcile a StreamSegmentSealOperation.
@param storageInfo The current state of the Segment in Storage.
@param timeout Timeout for the operation.
@return A CompletableFuture containing a FlushResult with the number of bytes reconciled, or failed with a ReconciliationFailureException,
if the operation cannot be reconciled, based on the in-memory metadata or the current state of the Segment in Storage. | [
"Attempts",
"to",
"reconcile",
"a",
"StreamSegmentSealOperation",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L1464-L1480 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/env/Diagnostics.java | Diagnostics.threadInfo | public static void threadInfo(final Map<String, Object> infos) {
infos.put("thread.count", THREAD_BEAN.getThreadCount());
infos.put("thread.peakCount", THREAD_BEAN.getPeakThreadCount());
infos.put("thread.startedCount", THREAD_BEAN.getTotalStartedThreadCount());
} | java | public static void threadInfo(final Map<String, Object> infos) {
infos.put("thread.count", THREAD_BEAN.getThreadCount());
infos.put("thread.peakCount", THREAD_BEAN.getPeakThreadCount());
infos.put("thread.startedCount", THREAD_BEAN.getTotalStartedThreadCount());
} | [
"public",
"static",
"void",
"threadInfo",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"infos",
")",
"{",
"infos",
".",
"put",
"(",
"\"thread.count\"",
",",
"THREAD_BEAN",
".",
"getThreadCount",
"(",
")",
")",
";",
"infos",
".",
"put",
"(",
... | Collects system information as delivered from the {@link ThreadMXBean}.
@param infos a map where the infos are passed in. | [
"Collects",
"system",
"information",
"as",
"delivered",
"from",
"the",
"{",
"@link",
"ThreadMXBean",
"}",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/Diagnostics.java#L125-L129 |
drewnoakes/metadata-extractor | Source/com/drew/metadata/TagDescriptor.java | TagDescriptor.getBitFlagDescription | @Nullable
protected String getBitFlagDescription(final int tagType, @NotNull final Object... labels)
{
Integer value = _directory.getInteger(tagType);
if (value == null)
return null;
List<String> parts = new ArrayList<String>();
int bitIndex = 0;
while (labels.length > bitIndex) {
Object labelObj = labels[bitIndex];
if (labelObj != null) {
boolean isBitSet = (value & 1) == 1;
if (labelObj instanceof String[]) {
String[] labelPair = (String[])labelObj;
assert(labelPair.length == 2);
parts.add(labelPair[isBitSet ? 1 : 0]);
} else if (isBitSet && labelObj instanceof String) {
parts.add((String)labelObj);
}
}
value >>= 1;
bitIndex++;
}
return StringUtil.join(parts, ", ");
} | java | @Nullable
protected String getBitFlagDescription(final int tagType, @NotNull final Object... labels)
{
Integer value = _directory.getInteger(tagType);
if (value == null)
return null;
List<String> parts = new ArrayList<String>();
int bitIndex = 0;
while (labels.length > bitIndex) {
Object labelObj = labels[bitIndex];
if (labelObj != null) {
boolean isBitSet = (value & 1) == 1;
if (labelObj instanceof String[]) {
String[] labelPair = (String[])labelObj;
assert(labelPair.length == 2);
parts.add(labelPair[isBitSet ? 1 : 0]);
} else if (isBitSet && labelObj instanceof String) {
parts.add((String)labelObj);
}
}
value >>= 1;
bitIndex++;
}
return StringUtil.join(parts, ", ");
} | [
"@",
"Nullable",
"protected",
"String",
"getBitFlagDescription",
"(",
"final",
"int",
"tagType",
",",
"@",
"NotNull",
"final",
"Object",
"...",
"labels",
")",
"{",
"Integer",
"value",
"=",
"_directory",
".",
"getInteger",
"(",
"tagType",
")",
";",
"if",
"(",... | LSB first. Labels may be null, a String, or a String[2] with (low label,high label) values. | [
"LSB",
"first",
".",
"Labels",
"may",
"be",
"null",
"a",
"String",
"or",
"a",
"String",
"[",
"2",
"]",
"with",
"(",
"low",
"label",
"high",
"label",
")",
"values",
"."
] | train | https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/TagDescriptor.java#L222-L250 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nstimer_binding.java | nstimer_binding.get | public static nstimer_binding get(nitro_service service, String name) throws Exception{
nstimer_binding obj = new nstimer_binding();
obj.set_name(name);
nstimer_binding response = (nstimer_binding) obj.get_resource(service);
return response;
} | java | public static nstimer_binding get(nitro_service service, String name) throws Exception{
nstimer_binding obj = new nstimer_binding();
obj.set_name(name);
nstimer_binding response = (nstimer_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"nstimer_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"nstimer_binding",
"obj",
"=",
"new",
"nstimer_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"nst... | Use this API to fetch nstimer_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"nstimer_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nstimer_binding.java#L103-L108 |
kiswanij/jk-util | src/main/java/com/jk/util/JKCollectionUtil.java | JKCollectionUtil.unifyReferences | public static void unifyReferences(final Hashtable hash, final List list) {
if (list != null) {
for (int i = 0; i < list.size(); i++) {
final Object itemAtList = list.get(i);
final Object unifiedReferences = unifyReferences(hash, itemAtList);
list.set(i, unifiedReferences);
}
}
} | java | public static void unifyReferences(final Hashtable hash, final List list) {
if (list != null) {
for (int i = 0; i < list.size(); i++) {
final Object itemAtList = list.get(i);
final Object unifiedReferences = unifyReferences(hash, itemAtList);
list.set(i, unifiedReferences);
}
}
} | [
"public",
"static",
"void",
"unifyReferences",
"(",
"final",
"Hashtable",
"hash",
",",
"final",
"List",
"list",
")",
"{",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"size",
"(",
")",
"... | Unify the objects in the list according to the hash code IMPORTANT : hashcode
usage here is different from the Java Spec , IT SHOULD BE UNIUQUE FOR EACH
OBJECT WHICH SHOULD HOLD SOMTHING LIKE THE DATABASE PRIMARY KEY.
@param hash the hash
@param list the list | [
"Unify",
"the",
"objects",
"in",
"the",
"list",
"according",
"to",
"the",
"hash",
"code",
"IMPORTANT",
":",
"hashcode",
"usage",
"here",
"is",
"different",
"from",
"the",
"Java",
"Spec",
"IT",
"SHOULD",
"BE",
"UNIUQUE",
"FOR",
"EACH",
"OBJECT",
"WHICH",
"S... | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKCollectionUtil.java#L102-L110 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java | TextFormatter.appendElapsed | public static void appendElapsed(StringBuilder buf, long elapsedNanos) {
if (elapsedNanos >= 100000000000L) { // >= 100 s
buf.append(elapsedNanos / 1000000000L).append("s(").append(elapsedNanos).append("ns)");
} else if (elapsedNanos >= 100000000L) { // >= 100 ms
buf.append(elapsedNanos / 1000000L).append("ms(").append(elapsedNanos).append("ns)");
} else if (elapsedNanos >= 100000L) { // >= 100 us
buf.append(elapsedNanos / 1000L).append("\u00B5s(").append(elapsedNanos).append("ns)"); // microsecs
} else {
buf.append(elapsedNanos).append("ns");
}
} | java | public static void appendElapsed(StringBuilder buf, long elapsedNanos) {
if (elapsedNanos >= 100000000000L) { // >= 100 s
buf.append(elapsedNanos / 1000000000L).append("s(").append(elapsedNanos).append("ns)");
} else if (elapsedNanos >= 100000000L) { // >= 100 ms
buf.append(elapsedNanos / 1000000L).append("ms(").append(elapsedNanos).append("ns)");
} else if (elapsedNanos >= 100000L) { // >= 100 us
buf.append(elapsedNanos / 1000L).append("\u00B5s(").append(elapsedNanos).append("ns)"); // microsecs
} else {
buf.append(elapsedNanos).append("ns");
}
} | [
"public",
"static",
"void",
"appendElapsed",
"(",
"StringBuilder",
"buf",
",",
"long",
"elapsedNanos",
")",
"{",
"if",
"(",
"elapsedNanos",
">=",
"100000000000L",
")",
"{",
"// >= 100 s",
"buf",
".",
"append",
"(",
"elapsedNanos",
"/",
"1000000000L",
")",
".",... | Appends the human-readable representation of the duration given as {@code elapsed} to the specified
{@link StringBuilder}. | [
"Appends",
"the",
"human",
"-",
"readable",
"representation",
"of",
"the",
"duration",
"given",
"as",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/TextFormatter.java#L50-L60 |
tobato/FastDFS_Client | src/main/java/com/github/tobato/fastdfs/service/DefaultFastFileStorageClient.java | DefaultFastFileStorageClient.uploadImage | @Override
public StorePath uploadImage(FastImageFile fastImageFile) {
String fileExtName = fastImageFile.getFileExtName();
Validate.notNull(fastImageFile.getInputStream(), "上传文件流不能为空");
Validate.notBlank(fileExtName, "文件扩展名不能为空");
// 检查是否能处理此类图片
if (!isSupportImage(fileExtName)) {
throw new FdfsUnsupportImageTypeException("不支持的图片格式" + fileExtName);
}
// 获取存储节点
StorageNode client = getStorageNode(fastImageFile.getGroupName());
byte[] bytes = inputStreamToByte(fastImageFile.getInputStream());
// 上传文件和metaDataSet
StorePath path = uploadFileAndMetaData(client, new ByteArrayInputStream(bytes),
fastImageFile.getFileSize(), fileExtName,
fastImageFile.getMetaDataSet());
//如果设置了需要上传缩略图
if (null != fastImageFile.getThumbImage()) {
// 上传缩略图
uploadThumbImage(client, new ByteArrayInputStream(bytes), path.getPath(), fastImageFile);
}
bytes = null;
return path;
} | java | @Override
public StorePath uploadImage(FastImageFile fastImageFile) {
String fileExtName = fastImageFile.getFileExtName();
Validate.notNull(fastImageFile.getInputStream(), "上传文件流不能为空");
Validate.notBlank(fileExtName, "文件扩展名不能为空");
// 检查是否能处理此类图片
if (!isSupportImage(fileExtName)) {
throw new FdfsUnsupportImageTypeException("不支持的图片格式" + fileExtName);
}
// 获取存储节点
StorageNode client = getStorageNode(fastImageFile.getGroupName());
byte[] bytes = inputStreamToByte(fastImageFile.getInputStream());
// 上传文件和metaDataSet
StorePath path = uploadFileAndMetaData(client, new ByteArrayInputStream(bytes),
fastImageFile.getFileSize(), fileExtName,
fastImageFile.getMetaDataSet());
//如果设置了需要上传缩略图
if (null != fastImageFile.getThumbImage()) {
// 上传缩略图
uploadThumbImage(client, new ByteArrayInputStream(bytes), path.getPath(), fastImageFile);
}
bytes = null;
return path;
} | [
"@",
"Override",
"public",
"StorePath",
"uploadImage",
"(",
"FastImageFile",
"fastImageFile",
")",
"{",
"String",
"fileExtName",
"=",
"fastImageFile",
".",
"getFileExtName",
"(",
")",
";",
"Validate",
".",
"notNull",
"(",
"fastImageFile",
".",
"getInputStream",
"(... | 上传图片
<pre>
可通过fastImageFile对象配置
1. 上传图像分组
2. 上传元数据metaDataSet
3. 是否生成缩略图
3.1 根据默认配置生成缩略图
3.2 根据指定尺寸生成缩略图
3.3 根据指定比例生成缩略图
<pre/>
@param fastImageFile
@return | [
"上传图片",
"<pre",
">",
"可通过fastImageFile对象配置",
"1",
".",
"上传图像分组",
"2",
".",
"上传元数据metaDataSet",
"3",
".",
"是否生成缩略图",
"3",
".",
"1",
"根据默认配置生成缩略图",
"3",
".",
"2",
"根据指定尺寸生成缩略图",
"3",
".",
"3",
"根据指定比例生成缩略图",
"<pre",
"/",
">"
] | train | https://github.com/tobato/FastDFS_Client/blob/8e3bfe712f1739028beed7f3a6b2cc4579a231e4/src/main/java/com/github/tobato/fastdfs/service/DefaultFastFileStorageClient.java#L130-L155 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Waiter.java | Waiter.waitForActivity | public boolean waitForActivity(Class<? extends Activity> activityClass, int timeout){
if(isActivityMatching(activityClass, activityUtils.getCurrentActivity(false, false))){
return true;
}
boolean foundActivity = false;
ActivityMonitor activityMonitor = getActivityMonitor();
long currentTime = SystemClock.uptimeMillis();
final long endTime = currentTime + timeout;
while(currentTime < endTime){
Activity currentActivity = activityMonitor.waitForActivityWithTimeout(endTime - currentTime);
if(currentActivity != null && currentActivity.getClass().equals(activityClass)) {
foundActivity = true;
break;
}
currentTime = SystemClock.uptimeMillis();
}
removeMonitor(activityMonitor);
return foundActivity;
} | java | public boolean waitForActivity(Class<? extends Activity> activityClass, int timeout){
if(isActivityMatching(activityClass, activityUtils.getCurrentActivity(false, false))){
return true;
}
boolean foundActivity = false;
ActivityMonitor activityMonitor = getActivityMonitor();
long currentTime = SystemClock.uptimeMillis();
final long endTime = currentTime + timeout;
while(currentTime < endTime){
Activity currentActivity = activityMonitor.waitForActivityWithTimeout(endTime - currentTime);
if(currentActivity != null && currentActivity.getClass().equals(activityClass)) {
foundActivity = true;
break;
}
currentTime = SystemClock.uptimeMillis();
}
removeMonitor(activityMonitor);
return foundActivity;
} | [
"public",
"boolean",
"waitForActivity",
"(",
"Class",
"<",
"?",
"extends",
"Activity",
">",
"activityClass",
",",
"int",
"timeout",
")",
"{",
"if",
"(",
"isActivityMatching",
"(",
"activityClass",
",",
"activityUtils",
".",
"getCurrentActivity",
"(",
"false",
",... | Waits for the given {@link Activity}.
@param activityClass the class of the {@code Activity} to wait for
@param timeout the amount of time in milliseconds to wait
@return {@code true} if {@code Activity} appears before the timeout and {@code false} if it does not | [
"Waits",
"for",
"the",
"given",
"{",
"@link",
"Activity",
"}",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L140-L161 |
alkacon/opencms-core | src/org/opencms/loader/CmsImageScaler.java | CmsImageScaler.getWidthScaler | public CmsImageScaler getWidthScaler(CmsImageScaler downScaler) {
int width = downScaler.getWidth();
int height;
if (getWidth() > width) {
// width is too large, re-calculate height
float scale = (float)width / (float)getWidth();
height = Math.round(getHeight() * scale);
} else {
// width is ok
width = getWidth();
height = getHeight();
}
// now create and initialize the result scaler
return new CmsImageScaler(downScaler, width, height);
} | java | public CmsImageScaler getWidthScaler(CmsImageScaler downScaler) {
int width = downScaler.getWidth();
int height;
if (getWidth() > width) {
// width is too large, re-calculate height
float scale = (float)width / (float)getWidth();
height = Math.round(getHeight() * scale);
} else {
// width is ok
width = getWidth();
height = getHeight();
}
// now create and initialize the result scaler
return new CmsImageScaler(downScaler, width, height);
} | [
"public",
"CmsImageScaler",
"getWidthScaler",
"(",
"CmsImageScaler",
"downScaler",
")",
"{",
"int",
"width",
"=",
"downScaler",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
";",
"if",
"(",
"getWidth",
"(",
")",
">",
"width",
")",
"{",
"// width is too la... | Returns a new image scaler that is a width based down scale from the size of <code>this</code> scaler
to the given scaler size.<p>
If no down scale from this to the given scaler is required because the width of <code>this</code>
scaler is not larger than the target width, then the image dimensions of <code>this</code> scaler
are unchanged in the result scaler. No up scaling is done!<p>
@param downScaler the image scaler that holds the down scaled target image dimensions
@return a new image scaler that is a down scale from the size of <code>this</code> scaler
to the given target scaler size | [
"Returns",
"a",
"new",
"image",
"scaler",
"that",
"is",
"a",
"width",
"based",
"down",
"scale",
"from",
"the",
"size",
"of",
"<code",
">",
"this<",
"/",
"code",
">",
"scaler",
"to",
"the",
"given",
"scaler",
"size",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsImageScaler.java#L876-L893 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java | JDBCValueContentAddressStorageImpl.isRecordAlreadyExistsException | private boolean isRecordAlreadyExistsException(SQLException e)
{
// Search in UPPER case
// MySQL 5.0.x - com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException:
// Duplicate entry '4f684b34c0a800030018c34f99165791-0' for key 1
// HSQLDB 8.x - java.sql.SQLException: Violation of unique constraint $$: duplicate value(s) for
// column(s) $$:
// JCR_VCAS_PK in statement [INSERT INTO JCR_VCAS (PROPERTY_ID, ORDER_NUM, CAS_ID)
// VALUES(?,?,?)] String H2_PK_CONSTRAINT_DETECT_PATTERN = "(.*JdbcSQLException.*violation.*PRIMARY_KEY_.*)";
// PostgreSQL 8.2.x - org.postgresql.util.PSQLException: ERROR: duplicate key violates unique
// constraint "jcr_vcas_pk"
// Oracle 9i x64 (on Fedora 7) - java.sql.SQLException: ORA-00001: unique constraint
// (EXOADMIN.JCR_VCAS_PK) violated
// H2 - org.h2.jdbc.JdbcSQLException: Unique index or primary key violation:
// "PRIMARY_KEY_4 ON PUBLIC.JCR_VCAS_TEST(PROPERTY_ID, ORDER_NUM)";
//
String err = e.toString();
if (dialect.startsWith(DBConstants.DB_DIALECT_MYSQL))
{
// for MySQL will search
return MYSQL_PK_CONSTRAINT_DETECT.matcher(err).find();
}
else if (err.toLowerCase().toUpperCase().indexOf(sqlConstraintPK.toLowerCase().toUpperCase()) >= 0)
{
// most of supported dbs prints PK name in exception
return true;
}
else if (dialect.startsWith(DBConstants.DB_DIALECT_DB2))
{
return DB2_PK_CONSTRAINT_DETECT.matcher(err).find();
}
else if (dialect.startsWith(DBConstants.DB_DIALECT_H2))
{
return H2_PK_CONSTRAINT_DETECT.matcher(err).find();
}
// NOTICE! As an additional check we may ask the database for property currently processed in
// VCAS
// and tell true if the property already exists only.
return false;
} | java | private boolean isRecordAlreadyExistsException(SQLException e)
{
// Search in UPPER case
// MySQL 5.0.x - com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException:
// Duplicate entry '4f684b34c0a800030018c34f99165791-0' for key 1
// HSQLDB 8.x - java.sql.SQLException: Violation of unique constraint $$: duplicate value(s) for
// column(s) $$:
// JCR_VCAS_PK in statement [INSERT INTO JCR_VCAS (PROPERTY_ID, ORDER_NUM, CAS_ID)
// VALUES(?,?,?)] String H2_PK_CONSTRAINT_DETECT_PATTERN = "(.*JdbcSQLException.*violation.*PRIMARY_KEY_.*)";
// PostgreSQL 8.2.x - org.postgresql.util.PSQLException: ERROR: duplicate key violates unique
// constraint "jcr_vcas_pk"
// Oracle 9i x64 (on Fedora 7) - java.sql.SQLException: ORA-00001: unique constraint
// (EXOADMIN.JCR_VCAS_PK) violated
// H2 - org.h2.jdbc.JdbcSQLException: Unique index or primary key violation:
// "PRIMARY_KEY_4 ON PUBLIC.JCR_VCAS_TEST(PROPERTY_ID, ORDER_NUM)";
//
String err = e.toString();
if (dialect.startsWith(DBConstants.DB_DIALECT_MYSQL))
{
// for MySQL will search
return MYSQL_PK_CONSTRAINT_DETECT.matcher(err).find();
}
else if (err.toLowerCase().toUpperCase().indexOf(sqlConstraintPK.toLowerCase().toUpperCase()) >= 0)
{
// most of supported dbs prints PK name in exception
return true;
}
else if (dialect.startsWith(DBConstants.DB_DIALECT_DB2))
{
return DB2_PK_CONSTRAINT_DETECT.matcher(err).find();
}
else if (dialect.startsWith(DBConstants.DB_DIALECT_H2))
{
return H2_PK_CONSTRAINT_DETECT.matcher(err).find();
}
// NOTICE! As an additional check we may ask the database for property currently processed in
// VCAS
// and tell true if the property already exists only.
return false;
} | [
"private",
"boolean",
"isRecordAlreadyExistsException",
"(",
"SQLException",
"e",
")",
"{",
"// Search in UPPER case\r",
"// MySQL 5.0.x - com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException:\r",
"// Duplicate entry '4f684b34c0a800030018c34f99165791-0' for key 1\r",
"// HSQLDB... | Tell is it a RecordAlreadyExistsException.
@param e
SQLException
@return boolean | [
"Tell",
"is",
"it",
"a",
"RecordAlreadyExistsException",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java#L338-L379 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/SATSolver.java | SATSolver.addWithRelaxation | public void addWithRelaxation(final Variable relaxationVar, final ImmutableFormulaList formulas) {
for (final Formula formula : formulas) { this.addWithRelaxation(relaxationVar, formula); }
} | java | public void addWithRelaxation(final Variable relaxationVar, final ImmutableFormulaList formulas) {
for (final Formula formula : formulas) { this.addWithRelaxation(relaxationVar, formula); }
} | [
"public",
"void",
"addWithRelaxation",
"(",
"final",
"Variable",
"relaxationVar",
",",
"final",
"ImmutableFormulaList",
"formulas",
")",
"{",
"for",
"(",
"final",
"Formula",
"formula",
":",
"formulas",
")",
"{",
"this",
".",
"addWithRelaxation",
"(",
"relaxationVa... | Adds a formula list to the solver.
@param relaxationVar the relaxation variable
@param formulas the formula list | [
"Adds",
"a",
"formula",
"list",
"to",
"the",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/SATSolver.java#L152-L154 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java | ParameterTool.getShort | public short getShort(String key, short defaultValue) {
addToDefaults(key, Short.toString(defaultValue));
String value = get(key);
if (value == null) {
return defaultValue;
} else {
return Short.valueOf(value);
}
} | java | public short getShort(String key, short defaultValue) {
addToDefaults(key, Short.toString(defaultValue));
String value = get(key);
if (value == null) {
return defaultValue;
} else {
return Short.valueOf(value);
}
} | [
"public",
"short",
"getShort",
"(",
"String",
"key",
",",
"short",
"defaultValue",
")",
"{",
"addToDefaults",
"(",
"key",
",",
"Short",
".",
"toString",
"(",
"defaultValue",
")",
")",
";",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",... | Returns the Short value for the given key. If the key does not exists it will return the default value given.
The method fails if the value is not a Short. | [
"Returns",
"the",
"Short",
"value",
"for",
"the",
"given",
"key",
".",
"If",
"the",
"key",
"does",
"not",
"exists",
"it",
"will",
"return",
"the",
"default",
"value",
"given",
".",
"The",
"method",
"fails",
"if",
"the",
"value",
"is",
"not",
"a",
"Shor... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/ParameterTool.java#L423-L431 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_phone_rma_POST | public OvhRmaReturn billingAccount_line_serviceName_phone_rma_POST(String billingAccount, String serviceName, String mondialRelayId, String newMerchandise, Long shippingContactId, OvhRmaPublicTypeEnum type) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/rma";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "mondialRelayId", mondialRelayId);
addBody(o, "newMerchandise", newMerchandise);
addBody(o, "shippingContactId", shippingContactId);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhRmaReturn.class);
} | java | public OvhRmaReturn billingAccount_line_serviceName_phone_rma_POST(String billingAccount, String serviceName, String mondialRelayId, String newMerchandise, Long shippingContactId, OvhRmaPublicTypeEnum type) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/rma";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "mondialRelayId", mondialRelayId);
addBody(o, "newMerchandise", newMerchandise);
addBody(o, "shippingContactId", shippingContactId);
addBody(o, "type", type);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhRmaReturn.class);
} | [
"public",
"OvhRmaReturn",
"billingAccount_line_serviceName_phone_rma_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"mondialRelayId",
",",
"String",
"newMerchandise",
",",
"Long",
"shippingContactId",
",",
"OvhRmaPublicTypeEnum",
"type",
... | Create a specific rma
REST: POST /telephony/{billingAccount}/line/{serviceName}/phone/rma
@param shippingContactId [required] Shipping contact information id from /me entry point
@param type [required] Typology process of merchandise return
@param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping contact address information entry.
@param newMerchandise [required] New merchandise brand in case of exchange
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Create",
"a",
"specific",
"rma"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1057-L1067 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/cache/FileCache.java | FileCache.createTmpFile | public FutureTask<Path> createTmpFile(String name, String filePath, JobID jobID) {
synchronized (count) {
Pair<JobID, String> key = new ImmutablePair(jobID,name);
if (count.containsKey(key)) {
count.put(key, count.get(key) + 1);
} else {
count.put(key, 1);
}
}
CopyProcess cp = new CopyProcess(name, filePath, jobID);
FutureTask<Path> copyTask = new FutureTask<Path>(cp);
executorService.submit(copyTask);
return copyTask;
} | java | public FutureTask<Path> createTmpFile(String name, String filePath, JobID jobID) {
synchronized (count) {
Pair<JobID, String> key = new ImmutablePair(jobID,name);
if (count.containsKey(key)) {
count.put(key, count.get(key) + 1);
} else {
count.put(key, 1);
}
}
CopyProcess cp = new CopyProcess(name, filePath, jobID);
FutureTask<Path> copyTask = new FutureTask<Path>(cp);
executorService.submit(copyTask);
return copyTask;
} | [
"public",
"FutureTask",
"<",
"Path",
">",
"createTmpFile",
"(",
"String",
"name",
",",
"String",
"filePath",
",",
"JobID",
"jobID",
")",
"{",
"synchronized",
"(",
"count",
")",
"{",
"Pair",
"<",
"JobID",
",",
"String",
">",
"key",
"=",
"new",
"ImmutableP... | If the file doesn't exists locally, it will copy the file to the temp directory. | [
"If",
"the",
"file",
"doesn",
"t",
"exists",
"locally",
"it",
"will",
"copy",
"the",
"file",
"to",
"the",
"temp",
"directory",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/cache/FileCache.java#L56-L70 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java | FaceListsImpl.addFaceFromStreamAsync | public Observable<PersistedFace> addFaceFromStreamAsync(String faceListId, byte[] image, AddFaceFromStreamOptionalParameter addFaceFromStreamOptionalParameter) {
return addFaceFromStreamWithServiceResponseAsync(faceListId, image, addFaceFromStreamOptionalParameter).map(new Func1<ServiceResponse<PersistedFace>, PersistedFace>() {
@Override
public PersistedFace call(ServiceResponse<PersistedFace> response) {
return response.body();
}
});
} | java | public Observable<PersistedFace> addFaceFromStreamAsync(String faceListId, byte[] image, AddFaceFromStreamOptionalParameter addFaceFromStreamOptionalParameter) {
return addFaceFromStreamWithServiceResponseAsync(faceListId, image, addFaceFromStreamOptionalParameter).map(new Func1<ServiceResponse<PersistedFace>, PersistedFace>() {
@Override
public PersistedFace call(ServiceResponse<PersistedFace> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PersistedFace",
">",
"addFaceFromStreamAsync",
"(",
"String",
"faceListId",
",",
"byte",
"[",
"]",
"image",
",",
"AddFaceFromStreamOptionalParameter",
"addFaceFromStreamOptionalParameter",
")",
"{",
"return",
"addFaceFromStreamWithServiceResponse... | Add a face to a face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire.
@param faceListId Id referencing a particular face list.
@param image An image stream.
@param addFaceFromStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PersistedFace object | [
"Add",
"a",
"face",
"to",
"a",
"face",
"list",
".",
"The",
"input",
"face",
"is",
"specified",
"as",
"an",
"image",
"with",
"a",
"targetFace",
"rectangle",
".",
"It",
"returns",
"a",
"persistedFaceId",
"representing",
"the",
"added",
"face",
"and",
"persis... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java#L960-L967 |
spring-projects/spring-android | spring-android-core/src/main/java/org/springframework/util/ReflectionUtils.java | ReflectionUtils.doWithMethods | public static void doWithMethods(Class<?> clazz, MethodCallback mc) throws IllegalArgumentException {
doWithMethods(clazz, mc, null);
} | java | public static void doWithMethods(Class<?> clazz, MethodCallback mc) throws IllegalArgumentException {
doWithMethods(clazz, mc, null);
} | [
"public",
"static",
"void",
"doWithMethods",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"MethodCallback",
"mc",
")",
"throws",
"IllegalArgumentException",
"{",
"doWithMethods",
"(",
"clazz",
",",
"mc",
",",
"null",
")",
";",
"}"
] | Perform the given callback operation on all matching methods of the given
class and superclasses.
<p>The same named method occurring on subclass and superclass will appear
twice, unless excluded by a {@link MethodFilter}.
@param clazz class to start looking at
@param mc the callback to invoke for each method
@see #doWithMethods(Class, MethodCallback, MethodFilter) | [
"Perform",
"the",
"given",
"callback",
"operation",
"on",
"all",
"matching",
"methods",
"of",
"the",
"given",
"class",
"and",
"superclasses",
".",
"<p",
">",
"The",
"same",
"named",
"method",
"occurring",
"on",
"subclass",
"and",
"superclass",
"will",
"appear"... | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/ReflectionUtils.java#L448-L450 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/BaseField.java | BaseField.removeListener | public void removeListener(BaseListener listener, boolean bFreeListener)
{
if (m_listener != null)
{
if (m_listener == listener)
{
m_listener = (FieldListener)listener.getNextListener();
listener.unlink(bFreeListener); // remove theBehavior from the linked list
}
else
m_listener.removeListener(listener, bFreeListener);
} // Remember to free the listener after removing it!
} | java | public void removeListener(BaseListener listener, boolean bFreeListener)
{
if (m_listener != null)
{
if (m_listener == listener)
{
m_listener = (FieldListener)listener.getNextListener();
listener.unlink(bFreeListener); // remove theBehavior from the linked list
}
else
m_listener.removeListener(listener, bFreeListener);
} // Remember to free the listener after removing it!
} | [
"public",
"void",
"removeListener",
"(",
"BaseListener",
"listener",
",",
"boolean",
"bFreeListener",
")",
"{",
"if",
"(",
"m_listener",
"!=",
"null",
")",
"{",
"if",
"(",
"m_listener",
"==",
"listener",
")",
"{",
"m_listener",
"=",
"(",
"FieldListener",
")"... | Remove this listener from the chain.
@param listener The listener to remove.
@param bFreeListener If true, the listener is also freed. | [
"Remove",
"this",
"listener",
"from",
"the",
"chain",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L293-L305 |
camunda/camunda-xml-model | src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java | DomUtil.getEmptyDocument | public static DomDocument getEmptyDocument(DocumentBuilderFactory documentBuilderFactory) {
try {
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
return new DomDocumentImpl(documentBuilder.newDocument());
} catch (ParserConfigurationException e) {
throw new ModelParseException("Unable to create a new document", e);
}
} | java | public static DomDocument getEmptyDocument(DocumentBuilderFactory documentBuilderFactory) {
try {
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
return new DomDocumentImpl(documentBuilder.newDocument());
} catch (ParserConfigurationException e) {
throw new ModelParseException("Unable to create a new document", e);
}
} | [
"public",
"static",
"DomDocument",
"getEmptyDocument",
"(",
"DocumentBuilderFactory",
"documentBuilderFactory",
")",
"{",
"try",
"{",
"DocumentBuilder",
"documentBuilder",
"=",
"documentBuilderFactory",
".",
"newDocumentBuilder",
"(",
")",
";",
"return",
"new",
"DomDocume... | Get an empty DOM document
@param documentBuilderFactory the factory to build to DOM document
@return the new empty document
@throws ModelParseException if unable to create a new document | [
"Get",
"an",
"empty",
"DOM",
"document"
] | train | https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java#L218-L225 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateCustomPrebuiltEntityRole | public OperationStatus updateCustomPrebuiltEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateCustomPrebuiltEntityRoleOptionalParameter updateCustomPrebuiltEntityRoleOptionalParameter) {
return updateCustomPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateCustomPrebuiltEntityRoleOptionalParameter).toBlocking().single().body();
} | java | public OperationStatus updateCustomPrebuiltEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateCustomPrebuiltEntityRoleOptionalParameter updateCustomPrebuiltEntityRoleOptionalParameter) {
return updateCustomPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateCustomPrebuiltEntityRoleOptionalParameter).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateCustomPrebuiltEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
",",
"UpdateCustomPrebuiltEntityRoleOptionalParameter",
"updateCustomPrebuiltEntityRoleOptionalParameter",
")",
"{",
... | Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role ID.
@param updateCustomPrebuiltEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Update",
"an",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13663-L13665 |
jasminb/jsonapi-converter | src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java | ResourceConverter.readObjectCollection | @Deprecated
public <T> List<T> readObjectCollection(byte [] data, Class<T> clazz) {
return readDocumentCollection(data, clazz).get();
} | java | @Deprecated
public <T> List<T> readObjectCollection(byte [] data, Class<T> clazz) {
return readDocumentCollection(data, clazz).get();
} | [
"@",
"Deprecated",
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"readObjectCollection",
"(",
"byte",
"[",
"]",
"data",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"readDocumentCollection",
"(",
"data",
",",
"clazz",
")",
".",
"get",
... | Converts rawdata input into a collection of requested output objects.
@param data raw data input
@param clazz target type
@param <T> type
@return collection of converted elements
@throws RuntimeException in case conversion fails | [
"Converts",
"rawdata",
"input",
"into",
"a",
"collection",
"of",
"requested",
"output",
"objects",
"."
] | train | https://github.com/jasminb/jsonapi-converter/blob/73b41c3b9274e70e62b3425071ca8afdc7bddaf6/src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java#L161-L164 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java | DomHelper.applyAbsolutePosition | private void applyAbsolutePosition(Element element, Coordinate position) {
Dom.setStyleAttribute(element, "position", "absolute");
Dom.setStyleAttribute(element, "left", (int) position.getX() + "px");
Dom.setStyleAttribute(element, "top", (int) position.getY() + "px");
} | java | private void applyAbsolutePosition(Element element, Coordinate position) {
Dom.setStyleAttribute(element, "position", "absolute");
Dom.setStyleAttribute(element, "left", (int) position.getX() + "px");
Dom.setStyleAttribute(element, "top", (int) position.getY() + "px");
} | [
"private",
"void",
"applyAbsolutePosition",
"(",
"Element",
"element",
",",
"Coordinate",
"position",
")",
"{",
"Dom",
".",
"setStyleAttribute",
"(",
"element",
",",
"\"position\"",
",",
"\"absolute\"",
")",
";",
"Dom",
".",
"setStyleAttribute",
"(",
"element",
... | Apply an absolute position on an element.
@param element
The element that needs an absolute position.
@param position
The position as a Coordinate. | [
"Apply",
"an",
"absolute",
"position",
"on",
"an",
"element",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L492-L496 |
inkstand-io/scribble | scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java | Directory.addPartitionInternal | protected void addPartitionInternal(final String partitionId, final String suffix) throws Exception { //NOSONAR
final DirectoryService service = this.getDirectoryService();
final CacheService cacheService = service.getCacheService();
final SchemaManager schemaManager = service.getSchemaManager();
final DnFactory dnFactory = service.getDnFactory();
final URI partitionPath = new File(service.getInstanceLayout().getPartitionsDirectory(), partitionId).toURI();
final AvlPartition partition = new AvlPartition(schemaManager, dnFactory);
partition.setId(partitionId);
partition.setSuffixDn(dnFactory.create(suffix));
partition.setCacheService(cacheService);
partition.setCacheSize(1000);
partition.setSyncOnWrite(true);
partition.setPartitionPath(partitionPath);
partition.addIndex(new AvlIndex<Entry>("objectClass", false));
partition.initialize();
LOG.info("Created partition {} in {}", partitionId, partitionPath);
service.addPartition(partition);
} | java | protected void addPartitionInternal(final String partitionId, final String suffix) throws Exception { //NOSONAR
final DirectoryService service = this.getDirectoryService();
final CacheService cacheService = service.getCacheService();
final SchemaManager schemaManager = service.getSchemaManager();
final DnFactory dnFactory = service.getDnFactory();
final URI partitionPath = new File(service.getInstanceLayout().getPartitionsDirectory(), partitionId).toURI();
final AvlPartition partition = new AvlPartition(schemaManager, dnFactory);
partition.setId(partitionId);
partition.setSuffixDn(dnFactory.create(suffix));
partition.setCacheService(cacheService);
partition.setCacheSize(1000);
partition.setSyncOnWrite(true);
partition.setPartitionPath(partitionPath);
partition.addIndex(new AvlIndex<Entry>("objectClass", false));
partition.initialize();
LOG.info("Created partition {} in {}", partitionId, partitionPath);
service.addPartition(partition);
} | [
"protected",
"void",
"addPartitionInternal",
"(",
"final",
"String",
"partitionId",
",",
"final",
"String",
"suffix",
")",
"throws",
"Exception",
"{",
"//NOSONAR",
"final",
"DirectoryService",
"service",
"=",
"this",
".",
"getDirectoryService",
"(",
")",
";",
"fin... | Creates an AVL implementation based in-memory partition. A partition is required to add entries or import LIDF
data. Once the partition was added, the context entry has to be created. If you're using the ldif import, the use
of this method and the ldif file may look like
<pre>
<code>
directory.addPartition("scribble", "dc=scribble");
...
// LDIF File
dn: dc=scribble
objectClass: top
objectClass: dcObject
objectClass: organization
o: inkstand.io
</code>
</pre>
The method may be invoked after the service is started, i.e. in the setUp method of a test.
@param partitionId
the id of the partition
@param suffix
the suffix dn of all partition entries
@throws Exception
if the partition could not be created | [
"Creates",
"an",
"AVL",
"implementation",
"based",
"in",
"-",
"memory",
"partition",
".",
"A",
"partition",
"is",
"required",
"to",
"add",
"entries",
"or",
"import",
"LIDF",
"data",
".",
"Once",
"the",
"partition",
"was",
"added",
"the",
"context",
"entry",
... | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L264-L284 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.DL | public static HtmlTree DL(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.DL, nullCheck(body));
return htmltree;
} | java | public static HtmlTree DL(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.DL, nullCheck(body));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"DL",
"(",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"DL",
",",
"nullCheck",
"(",
"body",
")",
")",
";",
"return",
"htmltree",
";",
"}"
] | Generates a DL tag with some content.
@param body content for the tag
@return an HtmlTree object for the DL tag | [
"Generates",
"a",
"DL",
"tag",
"with",
"some",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L321-L324 |
Jacksgong/JKeyboardPanelSwitch | library/src/main/java/cn/dreamtobe/kpswitch/util/KeyboardUtil.java | KeyboardUtil.detach | @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static void detach(Activity activity, ViewTreeObserver.OnGlobalLayoutListener l) {
ViewGroup contentView = activity.findViewById(android.R.id.content);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
contentView.getViewTreeObserver().removeOnGlobalLayoutListener(l);
} else {
//noinspection deprecation
contentView.getViewTreeObserver().removeGlobalOnLayoutListener(l);
}
} | java | @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static void detach(Activity activity, ViewTreeObserver.OnGlobalLayoutListener l) {
ViewGroup contentView = activity.findViewById(android.R.id.content);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
contentView.getViewTreeObserver().removeOnGlobalLayoutListener(l);
} else {
//noinspection deprecation
contentView.getViewTreeObserver().removeGlobalOnLayoutListener(l);
}
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"JELLY_BEAN",
")",
"public",
"static",
"void",
"detach",
"(",
"Activity",
"activity",
",",
"ViewTreeObserver",
".",
"OnGlobalLayoutListener",
"l",
")",
"{",
"ViewGroup",
"contentView",
"=",
"activity",
"... | Remove the OnGlobalLayoutListener from the activity root view
@param activity same activity used in {@link #attach} method
@param l ViewTreeObserver.OnGlobalLayoutListener returned by {@link #attach} method | [
"Remove",
"the",
"OnGlobalLayoutListener",
"from",
"the",
"activity",
"root",
"view"
] | train | https://github.com/Jacksgong/JKeyboardPanelSwitch/blob/092128023e824c85da63540780c79088b37a0c74/library/src/main/java/cn/dreamtobe/kpswitch/util/KeyboardUtil.java#L210-L219 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java | Las.getWriter | public static ALasWriter getWriter( File lasFile, CoordinateReferenceSystem crs ) throws Exception {
if (supportsNative()) {
return new LiblasWriter(lasFile, crs);
} else {
return new LasWriterBuffered(lasFile, crs);
}
} | java | public static ALasWriter getWriter( File lasFile, CoordinateReferenceSystem crs ) throws Exception {
if (supportsNative()) {
return new LiblasWriter(lasFile, crs);
} else {
return new LasWriterBuffered(lasFile, crs);
}
} | [
"public",
"static",
"ALasWriter",
"getWriter",
"(",
"File",
"lasFile",
",",
"CoordinateReferenceSystem",
"crs",
")",
"throws",
"Exception",
"{",
"if",
"(",
"supportsNative",
"(",
")",
")",
"{",
"return",
"new",
"LiblasWriter",
"(",
"lasFile",
",",
"crs",
")",
... | Get a las writer.
<p>If available, a native writer is created.
@param lasFile the file to write.
@param crs the {@link CoordinateReferenceSystem} to be written in the prj.
@return the las writer.
@throws Exception if something goes wrong. | [
"Get",
"a",
"las",
"writer",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/core/Las.java#L102-L108 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java | HexUtil.appendHex | public static void appendHex(StringBuilder builder, byte b, boolean toLowerCase) {
final char[] toDigits = toLowerCase ? DIGITS_LOWER : DIGITS_UPPER;
int high = (b & 0xf0) >>> 4;//高位
int low = b & 0x0f;//低位
builder.append(toDigits[high]);
builder.append(toDigits[low]);
} | java | public static void appendHex(StringBuilder builder, byte b, boolean toLowerCase) {
final char[] toDigits = toLowerCase ? DIGITS_LOWER : DIGITS_UPPER;
int high = (b & 0xf0) >>> 4;//高位
int low = b & 0x0f;//低位
builder.append(toDigits[high]);
builder.append(toDigits[low]);
} | [
"public",
"static",
"void",
"appendHex",
"(",
"StringBuilder",
"builder",
",",
"byte",
"b",
",",
"boolean",
"toLowerCase",
")",
"{",
"final",
"char",
"[",
"]",
"toDigits",
"=",
"toLowerCase",
"?",
"DIGITS_LOWER",
":",
"DIGITS_UPPER",
";",
"int",
"high",
"=",... | 将byte值转为16进制并添加到{@link StringBuilder}中
@param builder {@link StringBuilder}
@param b byte
@param toLowerCase 是否使用小写
@since 4.4.1 | [
"将byte值转为16进制并添加到",
"{"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L330-L337 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/search/sort/SearchSort.java | SearchSort.sortGeoDistance | public static SearchSortGeoDistance sortGeoDistance(double locationLon, double locationLat, String field) {
return new SearchSortGeoDistance(locationLon, locationLat, field);
} | java | public static SearchSortGeoDistance sortGeoDistance(double locationLon, double locationLat, String field) {
return new SearchSortGeoDistance(locationLon, locationLat, field);
} | [
"public",
"static",
"SearchSortGeoDistance",
"sortGeoDistance",
"(",
"double",
"locationLon",
",",
"double",
"locationLat",
",",
"String",
"field",
")",
"{",
"return",
"new",
"SearchSortGeoDistance",
"(",
"locationLon",
",",
"locationLat",
",",
"field",
")",
";",
... | Sort by geo location.
@param locationLon longitude of the location.
@param locationLat latitude of the location.
@param field the field name. | [
"Sort",
"by",
"geo",
"location",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/sort/SearchSort.java#L81-L83 |
alkacon/opencms-core | src/org/opencms/ui/components/CmsMacroResolverDialog.java | CmsMacroResolverDialog.getAvailableLocalVariant | private String getAvailableLocalVariant(CmsObject cms, String path, String baseName) {
A_CmsUI.get();
List<String> localVariations = CmsLocaleManager.getLocaleVariants(
baseName,
UI.getCurrent().getLocale(),
false,
true);
for (String name : localVariations) {
if (cms.existsResource(path + name)) {
return name;
}
}
return null;
} | java | private String getAvailableLocalVariant(CmsObject cms, String path, String baseName) {
A_CmsUI.get();
List<String> localVariations = CmsLocaleManager.getLocaleVariants(
baseName,
UI.getCurrent().getLocale(),
false,
true);
for (String name : localVariations) {
if (cms.existsResource(path + name)) {
return name;
}
}
return null;
} | [
"private",
"String",
"getAvailableLocalVariant",
"(",
"CmsObject",
"cms",
",",
"String",
"path",
",",
"String",
"baseName",
")",
"{",
"A_CmsUI",
".",
"get",
"(",
")",
";",
"List",
"<",
"String",
">",
"localVariations",
"=",
"CmsLocaleManager",
".",
"getLocaleV... | Returns the correct variant of a resource name according to locale.<p>
@param cms CmsObject
@param path where the considered resource is.
@param baseName of the resource
@return localized name of resource | [
"Returns",
"the",
"correct",
"variant",
"of",
"a",
"resource",
"name",
"according",
"to",
"locale",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsMacroResolverDialog.java#L180-L195 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.beginCreateOrUpdate | public AppServicePlanInner beginCreateOrUpdate(String resourceGroupName, String name, AppServicePlanInner appServicePlan) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan).toBlocking().single().body();
} | java | public AppServicePlanInner beginCreateOrUpdate(String resourceGroupName, String name, AppServicePlanInner appServicePlan) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan).toBlocking().single().body();
} | [
"public",
"AppServicePlanInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"AppServicePlanInner",
"appServicePlan",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"a... | Creates or updates an App Service Plan.
Creates or updates an App Service Plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param appServicePlan Details of the App Service plan.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppServicePlanInner object if successful. | [
"Creates",
"or",
"updates",
"an",
"App",
"Service",
"Plan",
".",
"Creates",
"or",
"updates",
"an",
"App",
"Service",
"Plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L756-L758 |
korpling/ANNIS | annis-interfaces/src/main/java/annis/CommonHelper.java | CommonHelper.getTextualDSForNode | public static STextualDS getTextualDSForNode(SNode node, SDocumentGraph graph)
{
if (node != null)
{
List<DataSourceSequence> dataSources = graph.getOverlappedDataSourceSequence(
node,
SALT_TYPE.STEXT_OVERLAPPING_RELATION);
if (dataSources != null)
{
for (DataSourceSequence seq : dataSources)
{
if (seq.getDataSource() instanceof STextualDS)
{
return (STextualDS) seq.getDataSource();
}
}
}
}
return null;
} | java | public static STextualDS getTextualDSForNode(SNode node, SDocumentGraph graph)
{
if (node != null)
{
List<DataSourceSequence> dataSources = graph.getOverlappedDataSourceSequence(
node,
SALT_TYPE.STEXT_OVERLAPPING_RELATION);
if (dataSources != null)
{
for (DataSourceSequence seq : dataSources)
{
if (seq.getDataSource() instanceof STextualDS)
{
return (STextualDS) seq.getDataSource();
}
}
}
}
return null;
} | [
"public",
"static",
"STextualDS",
"getTextualDSForNode",
"(",
"SNode",
"node",
",",
"SDocumentGraph",
"graph",
")",
"{",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"List",
"<",
"DataSourceSequence",
">",
"dataSources",
"=",
"graph",
".",
"getOverlappedDataSource... | Finds the {@link STextualDS} for a given node. The node must dominate a
token of this text.
@param node
@return | [
"Finds",
"the",
"{",
"@link",
"STextualDS",
"}",
"for",
"a",
"given",
"node",
".",
"The",
"node",
"must",
"dominate",
"a",
"token",
"of",
"this",
"text",
"."
] | train | https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-interfaces/src/main/java/annis/CommonHelper.java#L360-L379 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSetSpanner.java | UnicodeSetSpanner.deleteFrom | public String deleteFrom(CharSequence sequence) {
return replaceFrom(sequence, "", CountMethod.WHOLE_SPAN, SpanCondition.SIMPLE);
} | java | public String deleteFrom(CharSequence sequence) {
return replaceFrom(sequence, "", CountMethod.WHOLE_SPAN, SpanCondition.SIMPLE);
} | [
"public",
"String",
"deleteFrom",
"(",
"CharSequence",
"sequence",
")",
"{",
"return",
"replaceFrom",
"(",
"sequence",
",",
"\"\"",
",",
"CountMethod",
".",
"WHOLE_SPAN",
",",
"SpanCondition",
".",
"SIMPLE",
")",
";",
"}"
] | Delete all the matching spans in sequence, using SpanCondition.SIMPLE
The code alternates spans; see the class doc for {@link UnicodeSetSpanner} for a note about boundary conditions.
@param sequence
charsequence to replace matching spans in.
@return modified string. | [
"Delete",
"all",
"the",
"matching",
"spans",
"in",
"sequence",
"using",
"SpanCondition",
".",
"SIMPLE",
"The",
"code",
"alternates",
"spans",
";",
"see",
"the",
"class",
"doc",
"for",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSetSpanner.java#L181-L183 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/runtime/impl/QueuedMessage.java | QueuedMessage.copyMessageToExceptionDestination | public void copyMessageToExceptionDestination(LocalTransaction tran)
throws SINotPossibleInCurrentConfigurationException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "copyMessageToExceptionDestination", tran);
SIMPMessage msg = getSIMPMessage();
ExceptionDestinationHandlerImpl edh = null;
if (_destinationHandler.isLink())
edh = new ExceptionDestinationHandlerImpl(_destinationHandler);
else {
edh = new ExceptionDestinationHandlerImpl(null, _messageProcessor);
edh.setDestination(_destinationHandler);
}
edh.sendToExceptionDestination(
msg.getMessage(),
null,
tran,
SIRCConstants.SIRC0036_MESSAGE_ADMINISTRATIVELY_REROUTED_TO_EXCEPTION_DESTINATION,
null,
new String[]{""+_messageID,
_destinationHandler.getName(),
_messageProcessor.getMessagingEngineName()});
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "copyMessageToExceptionDestination");
} | java | public void copyMessageToExceptionDestination(LocalTransaction tran)
throws SINotPossibleInCurrentConfigurationException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "copyMessageToExceptionDestination", tran);
SIMPMessage msg = getSIMPMessage();
ExceptionDestinationHandlerImpl edh = null;
if (_destinationHandler.isLink())
edh = new ExceptionDestinationHandlerImpl(_destinationHandler);
else {
edh = new ExceptionDestinationHandlerImpl(null, _messageProcessor);
edh.setDestination(_destinationHandler);
}
edh.sendToExceptionDestination(
msg.getMessage(),
null,
tran,
SIRCConstants.SIRC0036_MESSAGE_ADMINISTRATIVELY_REROUTED_TO_EXCEPTION_DESTINATION,
null,
new String[]{""+_messageID,
_destinationHandler.getName(),
_messageProcessor.getMessagingEngineName()});
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "copyMessageToExceptionDestination");
} | [
"public",
"void",
"copyMessageToExceptionDestination",
"(",
"LocalTransaction",
"tran",
")",
"throws",
"SINotPossibleInCurrentConfigurationException",
",",
"SIResourceException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isE... | Copy the message to the exception destination
@param tran can be null
@throws SIResourceException
@throws SINotPossibleInCurrentConfigurationException | [
"Copy",
"the",
"message",
"to",
"the",
"exception",
"destination"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/runtime/impl/QueuedMessage.java#L385-L412 |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/AnnualCalendar.java | AnnualCalendar.setDayExcluded | public void setDayExcluded (final Calendar day, final boolean exclude)
{
if (exclude)
{
if (isDayExcluded (day))
{
return;
}
m_aExcludeDays.add (day);
m_bDataSorted = false;
}
else
{
if (!isDayExcluded (day))
{
return;
}
removeExcludedDay (day, true);
}
} | java | public void setDayExcluded (final Calendar day, final boolean exclude)
{
if (exclude)
{
if (isDayExcluded (day))
{
return;
}
m_aExcludeDays.add (day);
m_bDataSorted = false;
}
else
{
if (!isDayExcluded (day))
{
return;
}
removeExcludedDay (day, true);
}
} | [
"public",
"void",
"setDayExcluded",
"(",
"final",
"Calendar",
"day",
",",
"final",
"boolean",
"exclude",
")",
"{",
"if",
"(",
"exclude",
")",
"{",
"if",
"(",
"isDayExcluded",
"(",
"day",
")",
")",
"{",
"return",
";",
"}",
"m_aExcludeDays",
".",
"add",
... | <p>
Redefine a certain day to be excluded (true) or included (false).
</p> | [
"<p",
">",
"Redefine",
"a",
"certain",
"day",
"to",
"be",
"excluded",
"(",
"true",
")",
"or",
"included",
"(",
"false",
")",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/calendar/AnnualCalendar.java#L165-L186 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ResourceBundlesHandlerImpl.java | ResourceBundlesHandlerImpl.getBundleIterator | private ResourceBundlePathsIterator getBundleIterator(DebugMode debugMode, List<JoinableResourceBundle> bundles,
ConditionalCommentCallbackHandler commentCallbackHandler, Map<String, String> variants) {
ResourceBundlePathsIterator bundlesIterator;
if (debugMode.equals(DebugMode.DEBUG)) {
bundlesIterator = new DebugModePathsIteratorImpl(bundles, commentCallbackHandler, variants);
} else if (debugMode.equals(DebugMode.FORCE_NON_DEBUG_IN_IE)) {
bundlesIterator = new IECssDebugPathsIteratorImpl(bundles, commentCallbackHandler, variants);
} else {
bundlesIterator = new PathsIteratorImpl(bundles, commentCallbackHandler, variants);
}
return bundlesIterator;
} | java | private ResourceBundlePathsIterator getBundleIterator(DebugMode debugMode, List<JoinableResourceBundle> bundles,
ConditionalCommentCallbackHandler commentCallbackHandler, Map<String, String> variants) {
ResourceBundlePathsIterator bundlesIterator;
if (debugMode.equals(DebugMode.DEBUG)) {
bundlesIterator = new DebugModePathsIteratorImpl(bundles, commentCallbackHandler, variants);
} else if (debugMode.equals(DebugMode.FORCE_NON_DEBUG_IN_IE)) {
bundlesIterator = new IECssDebugPathsIteratorImpl(bundles, commentCallbackHandler, variants);
} else {
bundlesIterator = new PathsIteratorImpl(bundles, commentCallbackHandler, variants);
}
return bundlesIterator;
} | [
"private",
"ResourceBundlePathsIterator",
"getBundleIterator",
"(",
"DebugMode",
"debugMode",
",",
"List",
"<",
"JoinableResourceBundle",
">",
"bundles",
",",
"ConditionalCommentCallbackHandler",
"commentCallbackHandler",
",",
"Map",
"<",
"String",
",",
"String",
">",
"va... | Returns the bundle iterator
@param debugMode
the flag indicating if we are in debug mode or not
@param commentCallbackHandler
the comment callback handler
@param variants
the variant map
@return the bundle iterator | [
"Returns",
"the",
"bundle",
"iterator"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/handler/ResourceBundlesHandlerImpl.java#L508-L520 |
osmdroid/osmdroid | osmdroid-wms/src/main/java/org/osmdroid/wms/WMSParser.java | WMSParser.parse | public static WMSEndpoint parse(InputStream inputStream) throws Exception {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
dBuilder.setEntityResolver(new EntityResolver() {
@Override
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
return new InputSource(new StringReader(""));
}
});
Document doc = dBuilder.parse(inputStream);
Element element=doc.getDocumentElement();
element.normalize();
if (element.getNodeName().contains("WMT_MS_Capabilities")) {
return DomParserWms111.parse(element);
} else if (element.getNodeName().contains("WMS_Capabilities")) {
return DomParserWms111.parse(element);
}
throw new IllegalArgumentException("Unknown root element: " + element.getNodeName());
} | java | public static WMSEndpoint parse(InputStream inputStream) throws Exception {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
dBuilder.setEntityResolver(new EntityResolver() {
@Override
public InputSource resolveEntity(String publicId, String systemId)
throws SAXException, IOException {
return new InputSource(new StringReader(""));
}
});
Document doc = dBuilder.parse(inputStream);
Element element=doc.getDocumentElement();
element.normalize();
if (element.getNodeName().contains("WMT_MS_Capabilities")) {
return DomParserWms111.parse(element);
} else if (element.getNodeName().contains("WMS_Capabilities")) {
return DomParserWms111.parse(element);
}
throw new IllegalArgumentException("Unknown root element: " + element.getNodeName());
} | [
"public",
"static",
"WMSEndpoint",
"parse",
"(",
"InputStream",
"inputStream",
")",
"throws",
"Exception",
"{",
"DocumentBuilderFactory",
"dbFactory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"DocumentBuilder",
"dBuilder",
"=",
"dbFactory",
".... | note, the input stream remains open after calling this method, closing it is the caller's problem
@param inputStream
@return
@throws Exception | [
"note",
"the",
"input",
"stream",
"remains",
"open",
"after",
"calling",
"this",
"method",
"closing",
"it",
"is",
"the",
"caller",
"s",
"problem"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-wms/src/main/java/org/osmdroid/wms/WMSParser.java#L52-L78 |
btc-ag/redg | redg-runtime/src/main/java/com/btc/redg/runtime/dummy/DefaultDummyFactory.java | DefaultDummyFactory.getDummy | @Override
public <T extends RedGEntity> T getDummy(final AbstractRedG redG, final Class<T> dummyClass) {
// check if a dummy for this type already exists in cache
if (this.dummyCache.containsKey(dummyClass)) {
return dummyClass.cast(this.dummyCache.get(dummyClass));
}
final T obj = createNewDummy(redG, dummyClass); // if no one is found, create new
this.dummyCache.put(dummyClass, obj);
return obj;
} | java | @Override
public <T extends RedGEntity> T getDummy(final AbstractRedG redG, final Class<T> dummyClass) {
// check if a dummy for this type already exists in cache
if (this.dummyCache.containsKey(dummyClass)) {
return dummyClass.cast(this.dummyCache.get(dummyClass));
}
final T obj = createNewDummy(redG, dummyClass); // if no one is found, create new
this.dummyCache.put(dummyClass, obj);
return obj;
} | [
"@",
"Override",
"public",
"<",
"T",
"extends",
"RedGEntity",
">",
"T",
"getDummy",
"(",
"final",
"AbstractRedG",
"redG",
",",
"final",
"Class",
"<",
"T",
">",
"dummyClass",
")",
"{",
"// check if a dummy for this type already exists in cache\r",
"if",
"(",
"this"... | Returns a dummy entity for the requested type.
All this method guarantees is that the returned entity is a valid entity with all non null foreign key relations filled in,
it does not guarantee useful or even semantically correct data.
The dummy objects get taken either from the list of objects to insert from the redG object or are created on the fly. The results are cached and the
same entity will be returned for consecutive calls for an entity of the same type.
@param redG The redG instance
@param dummyClass The class specifying the wanted entity type
@param <T> The wanted entity type
@return a dummy object of thew required type
@throws DummyCreationException When a new dummy has to be created but this creation fails | [
"Returns",
"a",
"dummy",
"entity",
"for",
"the",
"requested",
"type",
".",
"All",
"this",
"method",
"guarantees",
"is",
"that",
"the",
"returned",
"entity",
"is",
"a",
"valid",
"entity",
"with",
"all",
"non",
"null",
"foreign",
"key",
"relations",
"filled",
... | train | https://github.com/btc-ag/redg/blob/416a68639d002512cabfebff09afd2e1909e27df/redg-runtime/src/main/java/com/btc/redg/runtime/dummy/DefaultDummyFactory.java#L47-L56 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java | ReUtil.findAllGroup1 | public static List<String> findAllGroup1(Pattern pattern, CharSequence content) {
return findAll(pattern, content, 1);
} | java | public static List<String> findAllGroup1(Pattern pattern, CharSequence content) {
return findAll(pattern, content, 1);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"findAllGroup1",
"(",
"Pattern",
"pattern",
",",
"CharSequence",
"content",
")",
"{",
"return",
"findAll",
"(",
"pattern",
",",
"content",
",",
"1",
")",
";",
"}"
] | 取得内容中匹配的所有结果,获得匹配的所有结果中正则对应分组1的内容
@param pattern 编译后的正则模式
@param content 被查找的内容
@return 结果列表
@since 3.1.2 | [
"取得内容中匹配的所有结果,获得匹配的所有结果中正则对应分组1的内容"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L430-L432 |
apache/incubator-gobblin | gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/source/extractor/extract/google/GoogleAnalyticsUnsampledExtractor.java | GoogleAnalyticsUnsampledExtractor.prepareUnsampledReport | @VisibleForTesting
UnsampledReport prepareUnsampledReport(UnsampledReport request, final GoogleDriveFsHelper fsHelper, boolean isDeleteTempReport) throws IOException {
UnsampledReport createdReport = createUnsampledReports(request);
final String fileId = createdReport.getDriveDownloadDetails().getDocumentId();
LOG.info("Temporary unsampled report created in Google Drive: " + fileId);
if (isDeleteTempReport) {
closer.register(new Closeable() {
@Override public void close() throws IOException {
LOG.info("Deleting created temporary unsampled report from Google drive " + fileId);
fsHelper.deleteFile(fileId);
}
});
} else {
LOG.warn("Temporary unsampled report will not be deleted as requested. File ID: " + fileId);
}
wuState.setProp(SOURCE_FILEBASED_FILES_TO_PULL, fileId);
if (!wuState.contains(SOURCE_FILEBASED_OPTIONAL_DOWNLOADER_CLASS)) {
wuState.setProp(SOURCE_FILEBASED_OPTIONAL_DOWNLOADER_CLASS, CsvFileDownloader.class.getName());
}
return createdReport;
} | java | @VisibleForTesting
UnsampledReport prepareUnsampledReport(UnsampledReport request, final GoogleDriveFsHelper fsHelper, boolean isDeleteTempReport) throws IOException {
UnsampledReport createdReport = createUnsampledReports(request);
final String fileId = createdReport.getDriveDownloadDetails().getDocumentId();
LOG.info("Temporary unsampled report created in Google Drive: " + fileId);
if (isDeleteTempReport) {
closer.register(new Closeable() {
@Override public void close() throws IOException {
LOG.info("Deleting created temporary unsampled report from Google drive " + fileId);
fsHelper.deleteFile(fileId);
}
});
} else {
LOG.warn("Temporary unsampled report will not be deleted as requested. File ID: " + fileId);
}
wuState.setProp(SOURCE_FILEBASED_FILES_TO_PULL, fileId);
if (!wuState.contains(SOURCE_FILEBASED_OPTIONAL_DOWNLOADER_CLASS)) {
wuState.setProp(SOURCE_FILEBASED_OPTIONAL_DOWNLOADER_CLASS, CsvFileDownloader.class.getName());
}
return createdReport;
} | [
"@",
"VisibleForTesting",
"UnsampledReport",
"prepareUnsampledReport",
"(",
"UnsampledReport",
"request",
",",
"final",
"GoogleDriveFsHelper",
"fsHelper",
",",
"boolean",
"isDeleteTempReport",
")",
"throws",
"IOException",
"{",
"UnsampledReport",
"createdReport",
"=",
"crea... | Create unsampled report in Google drive and add google drive file id into state so that Google drive extractor
can extract record from it. Also, update the state to use CsvFileDownloader unless other downloader is defined.
It also register closer to delete the file from Google Drive unless explicitly requested to not deleting it.
@return documentID of unsampled report in Google drive
@throws IOException | [
"Create",
"unsampled",
"report",
"in",
"Google",
"drive",
"and",
"add",
"google",
"drive",
"file",
"id",
"into",
"state",
"so",
"that",
"Google",
"drive",
"extractor",
"can",
"extract",
"record",
"from",
"it",
".",
"Also",
"update",
"the",
"state",
"to",
"... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/source/extractor/extract/google/GoogleAnalyticsUnsampledExtractor.java#L210-L235 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java | StringSupport.insert | public static String insert(String haystack, String needle, int index) {
StringBuffer val = new StringBuffer(haystack);
val.insert(index, needle);
return val.toString();
} | java | public static String insert(String haystack, String needle, int index) {
StringBuffer val = new StringBuffer(haystack);
val.insert(index, needle);
return val.toString();
} | [
"public",
"static",
"String",
"insert",
"(",
"String",
"haystack",
",",
"String",
"needle",
",",
"int",
"index",
")",
"{",
"StringBuffer",
"val",
"=",
"new",
"StringBuffer",
"(",
"haystack",
")",
";",
"val",
".",
"insert",
"(",
"index",
",",
"needle",
")... | replaces the first occurrence of needle in haystack with newNeedle
@param haystack input string
@param needle string to place
@param index position to place | [
"replaces",
"the",
"first",
"occurrence",
"of",
"needle",
"in",
"haystack",
"with",
"newNeedle"
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L40-L44 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/java/MdwJavaFileManager.java | MdwJavaFileManager.getJavaFileForOutput | public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling)
throws IOException {
if (logger.isMdwDebugEnabled())
logger.mdwDebug("Loading Dynamic Java byte code from: " + (sibling == null ? null : sibling.toUri()));
try {
JavaFileObject jfo = new ByteArrayJavaFileObject(className, kind);
jfoCache.putIfAbsent(className, jfo);
return jfo;
}
catch (Exception ex) {
logger.severeException(ex.getMessage(), ex);
throw new IOException(ex.getMessage(), ex);
}
} | java | public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling)
throws IOException {
if (logger.isMdwDebugEnabled())
logger.mdwDebug("Loading Dynamic Java byte code from: " + (sibling == null ? null : sibling.toUri()));
try {
JavaFileObject jfo = new ByteArrayJavaFileObject(className, kind);
jfoCache.putIfAbsent(className, jfo);
return jfo;
}
catch (Exception ex) {
logger.severeException(ex.getMessage(), ex);
throw new IOException(ex.getMessage(), ex);
}
} | [
"public",
"JavaFileObject",
"getJavaFileForOutput",
"(",
"Location",
"location",
",",
"String",
"className",
",",
"Kind",
"kind",
",",
"FileObject",
"sibling",
")",
"throws",
"IOException",
"{",
"if",
"(",
"logger",
".",
"isMdwDebugEnabled",
"(",
")",
")",
"logg... | Create a new Java file object which will be used by the compiler to
store the generated byte code. Also add a reference to the object to the
cache so it can be accessed by other parts of the application. | [
"Create",
"a",
"new",
"Java",
"file",
"object",
"which",
"will",
"be",
"used",
"by",
"the",
"compiler",
"to",
"store",
"the",
"generated",
"byte",
"code",
".",
"Also",
"add",
"a",
"reference",
"to",
"the",
"object",
"to",
"the",
"cache",
"so",
"it",
"c... | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/java/MdwJavaFileManager.java#L55-L68 |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java | PrimaveraReader.processCalendarDays | private void processCalendarDays(ProjectCalendar calendar, Record root)
{
// Retrieve working hours ...
Record daysOfWeek = root.getChild("DaysOfWeek");
if (daysOfWeek != null)
{
for (Record dayRecord : daysOfWeek.getChildren())
{
processCalendarHours(calendar, dayRecord);
}
}
} | java | private void processCalendarDays(ProjectCalendar calendar, Record root)
{
// Retrieve working hours ...
Record daysOfWeek = root.getChild("DaysOfWeek");
if (daysOfWeek != null)
{
for (Record dayRecord : daysOfWeek.getChildren())
{
processCalendarHours(calendar, dayRecord);
}
}
} | [
"private",
"void",
"processCalendarDays",
"(",
"ProjectCalendar",
"calendar",
",",
"Record",
"root",
")",
"{",
"// Retrieve working hours ...",
"Record",
"daysOfWeek",
"=",
"root",
".",
"getChild",
"(",
"\"DaysOfWeek\"",
")",
";",
"if",
"(",
"daysOfWeek",
"!=",
"n... | Process calendar days of the week.
@param calendar project calendar
@param root calendar data | [
"Process",
"calendar",
"days",
"of",
"the",
"week",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L362-L373 |
aws/aws-sdk-java | aws-java-sdk-events/src/main/java/com/amazonaws/services/cloudwatchevents/model/InputTransformer.java | InputTransformer.withInputPathsMap | public InputTransformer withInputPathsMap(java.util.Map<String, String> inputPathsMap) {
setInputPathsMap(inputPathsMap);
return this;
} | java | public InputTransformer withInputPathsMap(java.util.Map<String, String> inputPathsMap) {
setInputPathsMap(inputPathsMap);
return this;
} | [
"public",
"InputTransformer",
"withInputPathsMap",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"inputPathsMap",
")",
"{",
"setInputPathsMap",
"(",
"inputPathsMap",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Map of JSON paths to be extracted from the event. You can then insert these in the template in
<code>InputTemplate</code> to produce the output you want to be sent to the target.
</p>
<p>
<code>InputPathsMap</code> is an array key-value pairs, where each value is a valid JSON path. You can have as
many as 10 key-value pairs. You must use JSON dot notation, not bracket notation.
</p>
<p>
The keys cannot start with "AWS."
</p>
@param inputPathsMap
Map of JSON paths to be extracted from the event. You can then insert these in the template in
<code>InputTemplate</code> to produce the output you want to be sent to the target.</p>
<p>
<code>InputPathsMap</code> is an array key-value pairs, where each value is a valid JSON path. You can
have as many as 10 key-value pairs. You must use JSON dot notation, not bracket notation.
</p>
<p>
The keys cannot start with "AWS."
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Map",
"of",
"JSON",
"paths",
"to",
"be",
"extracted",
"from",
"the",
"event",
".",
"You",
"can",
"then",
"insert",
"these",
"in",
"the",
"template",
"in",
"<code",
">",
"InputTemplate<",
"/",
"code",
">",
"to",
"produce",
"the",
"output",
"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-events/src/main/java/com/amazonaws/services/cloudwatchevents/model/InputTransformer.java#L187-L190 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/MultipartFormData.java | MultipartFormData.parseRequestStream | public void parseRequestStream(InputStream inputStream, String charset) throws IOException {
setLoaded();
MultipartRequestInputStream input = new MultipartRequestInputStream(inputStream);
input.readBoundary();
while (true) {
UploadFileHeader header = input.readDataHeader(charset);
if (header == null) {
break;
}
if (header.isFile == true) {
// 文件类型的表单项
String fileName = header.fileName;
if (fileName.length() > 0 && header.contentType.contains("application/x-macbinary")) {
input.skipBytes(128);
}
UploadFile newFile = new UploadFile(header, setting);
newFile.processStream(input);
putFile(header.formFieldName, newFile);
} else {
// 标准表单项
ByteArrayOutputStream fbos = new ByteArrayOutputStream(1024);
input.copy(fbos);
String value = (charset != null) ? new String(fbos.toByteArray(), charset) : new String(fbos.toByteArray());
putParameter(header.formFieldName, value);
}
input.skipBytes(1);
input.mark(1);
// read byte, but may be end of stream
int nextByte = input.read();
if (nextByte == -1 || nextByte == '-') {
input.reset();
break;
}
input.reset();
}
} | java | public void parseRequestStream(InputStream inputStream, String charset) throws IOException {
setLoaded();
MultipartRequestInputStream input = new MultipartRequestInputStream(inputStream);
input.readBoundary();
while (true) {
UploadFileHeader header = input.readDataHeader(charset);
if (header == null) {
break;
}
if (header.isFile == true) {
// 文件类型的表单项
String fileName = header.fileName;
if (fileName.length() > 0 && header.contentType.contains("application/x-macbinary")) {
input.skipBytes(128);
}
UploadFile newFile = new UploadFile(header, setting);
newFile.processStream(input);
putFile(header.formFieldName, newFile);
} else {
// 标准表单项
ByteArrayOutputStream fbos = new ByteArrayOutputStream(1024);
input.copy(fbos);
String value = (charset != null) ? new String(fbos.toByteArray(), charset) : new String(fbos.toByteArray());
putParameter(header.formFieldName, value);
}
input.skipBytes(1);
input.mark(1);
// read byte, but may be end of stream
int nextByte = input.read();
if (nextByte == -1 || nextByte == '-') {
input.reset();
break;
}
input.reset();
}
} | [
"public",
"void",
"parseRequestStream",
"(",
"InputStream",
"inputStream",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"setLoaded",
"(",
")",
";",
"MultipartRequestInputStream",
"input",
"=",
"new",
"MultipartRequestInputStream",
"(",
"inputStream",
"... | 提取上传的文件和表单数据
@param inputStream HttpRequest流
@param charset 编码
@throws IOException IO异常 | [
"提取上传的文件和表单数据"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/multipart/MultipartFormData.java#L68-L108 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/ChatApi.java | ChatApi.asyncResume | public ApiSuccessResponse asyncResume(String id, AsyncResumeData asyncResumeData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = asyncResumeWithHttpInfo(id, asyncResumeData);
return resp.getData();
} | java | public ApiSuccessResponse asyncResume(String id, AsyncResumeData asyncResumeData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = asyncResumeWithHttpInfo(id, asyncResumeData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"asyncResume",
"(",
"String",
"id",
",",
"AsyncResumeData",
"asyncResumeData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"asyncResumeWithHttpInfo",
"(",
"id",
",",
"asyncResumeData",
... | Resume async interaction chat
Resume for the specified chat.
@param id The ID of the chat interaction. (required)
@param asyncResumeData Request parameters. (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Resume",
"async",
"interaction",
"chat",
"Resume",
"for",
"the",
"specified",
"chat",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L281-L284 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/attribute/map/MapfishMapContext.java | MapfishMapContext.getRotatedBoundsAdjustedForPreciseRotatedMapSize | public MapBounds getRotatedBoundsAdjustedForPreciseRotatedMapSize() {
Rectangle2D.Double paintAreaPrecise = getRotatedMapSizePrecise();
Rectangle paintArea = new Rectangle(MapfishMapContext.rectangleDoubleToDimension(paintAreaPrecise));
return getRotatedBounds(paintAreaPrecise, paintArea);
} | java | public MapBounds getRotatedBoundsAdjustedForPreciseRotatedMapSize() {
Rectangle2D.Double paintAreaPrecise = getRotatedMapSizePrecise();
Rectangle paintArea = new Rectangle(MapfishMapContext.rectangleDoubleToDimension(paintAreaPrecise));
return getRotatedBounds(paintAreaPrecise, paintArea);
} | [
"public",
"MapBounds",
"getRotatedBoundsAdjustedForPreciseRotatedMapSize",
"(",
")",
"{",
"Rectangle2D",
".",
"Double",
"paintAreaPrecise",
"=",
"getRotatedMapSizePrecise",
"(",
")",
";",
"Rectangle",
"paintArea",
"=",
"new",
"Rectangle",
"(",
"MapfishMapContext",
".",
... | Return the map bounds rotated with the set rotation. The bounds are adapted to rounding changes of the
size of the set paint area.
@return Rotated bounds. | [
"Return",
"the",
"map",
"bounds",
"rotated",
"with",
"the",
"set",
"rotation",
".",
"The",
"bounds",
"are",
"adapted",
"to",
"rounding",
"changes",
"of",
"the",
"size",
"of",
"the",
"set",
"paint",
"area",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/attribute/map/MapfishMapContext.java#L180-L184 |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/simple/SimpleBase.java | SimpleBase.isInBounds | public boolean isInBounds(int row, int col) {
return row >= 0 && col >= 0 && row < mat.getNumRows() && col < mat.getNumCols();
} | java | public boolean isInBounds(int row, int col) {
return row >= 0 && col >= 0 && row < mat.getNumRows() && col < mat.getNumCols();
} | [
"public",
"boolean",
"isInBounds",
"(",
"int",
"row",
",",
"int",
"col",
")",
"{",
"return",
"row",
">=",
"0",
"&&",
"col",
">=",
"0",
"&&",
"row",
"<",
"mat",
".",
"getNumRows",
"(",
")",
"&&",
"col",
"<",
"mat",
".",
"getNumCols",
"(",
")",
";"... | Returns true of the specified matrix element is valid element inside this matrix.
@param row Row index.
@param col Column index.
@return true if it is a valid element in the matrix. | [
"Returns",
"true",
"of",
"the",
"specified",
"matrix",
"element",
"is",
"valid",
"element",
"inside",
"this",
"matrix",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleBase.java#L1331-L1333 |
haifengl/smile | math/src/main/java/smile/math/Math.java | Math.minus | public static void minus(double[] y, double[] x) {
if (x.length != y.length) {
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
}
for (int i = 0; i < x.length; i++) {
y[i] -= x[i];
}
} | java | public static void minus(double[] y, double[] x) {
if (x.length != y.length) {
throw new IllegalArgumentException(String.format("Arrays have different length: x[%d], y[%d]", x.length, y.length));
}
for (int i = 0; i < x.length; i++) {
y[i] -= x[i];
}
} | [
"public",
"static",
"void",
"minus",
"(",
"double",
"[",
"]",
"y",
",",
"double",
"[",
"]",
"x",
")",
"{",
"if",
"(",
"x",
".",
"length",
"!=",
"y",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
... | Element-wise subtraction of two arrays y = y - x.
@param y minuend matrix
@param x subtrahend matrix | [
"Element",
"-",
"wise",
"subtraction",
"of",
"two",
"arrays",
"y",
"=",
"y",
"-",
"x",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Math.java#L3775-L3783 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/RecoveryPointsInner.java | RecoveryPointsInner.getAsync | public Observable<RecoveryPointResourceInner> getAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId) {
return getWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointId).map(new Func1<ServiceResponse<RecoveryPointResourceInner>, RecoveryPointResourceInner>() {
@Override
public RecoveryPointResourceInner call(ServiceResponse<RecoveryPointResourceInner> response) {
return response.body();
}
});
} | java | public Observable<RecoveryPointResourceInner> getAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, String recoveryPointId) {
return getWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, recoveryPointId).map(new Func1<ServiceResponse<RecoveryPointResourceInner>, RecoveryPointResourceInner>() {
@Override
public RecoveryPointResourceInner call(ServiceResponse<RecoveryPointResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RecoveryPointResourceInner",
">",
"getAsync",
"(",
"String",
"vaultName",
",",
"String",
"resourceGroupName",
",",
"String",
"fabricName",
",",
"String",
"containerName",
",",
"String",
"protectedItemName",
",",
"String",
"recoveryPointId",... | Provides the backup data for the RecoveryPointID. This is an asynchronous operation. To learn the status of the operation, call the GetProtectedItemOperationResult API.
@param vaultName The name of the Recovery Services vault.
@param resourceGroupName The name of the resource group associated with the Recovery Services vault.
@param fabricName The fabric name associated with backup item.
@param containerName The container name associated with backup item.
@param protectedItemName The name of the backup item used in this GET operation.
@param recoveryPointId The RecoveryPointID associated with this GET operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RecoveryPointResourceInner object | [
"Provides",
"the",
"backup",
"data",
"for",
"the",
"RecoveryPointID",
".",
"This",
"is",
"an",
"asynchronous",
"operation",
".",
"To",
"learn",
"the",
"status",
"of",
"the",
"operation",
"call",
"the",
"GetProtectedItemOperationResult",
"API",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/RecoveryPointsInner.java#L112-L119 |
killbill/killbill | util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java | InternalCallContextFactory.createInternalCallContextWithoutAccountRecordId | public InternalCallContext createInternalCallContextWithoutAccountRecordId(final CallContext context) {
// If tenant id is null, this will default to the default tenant record id (multi-tenancy disabled)
final Long tenantRecordId = getTenantRecordIdSafe(context);
populateMDCContext(context.getUserToken(), null, tenantRecordId);
return new InternalCallContext(tenantRecordId, context, context.getCreatedDate());
} | java | public InternalCallContext createInternalCallContextWithoutAccountRecordId(final CallContext context) {
// If tenant id is null, this will default to the default tenant record id (multi-tenancy disabled)
final Long tenantRecordId = getTenantRecordIdSafe(context);
populateMDCContext(context.getUserToken(), null, tenantRecordId);
return new InternalCallContext(tenantRecordId, context, context.getCreatedDate());
} | [
"public",
"InternalCallContext",
"createInternalCallContextWithoutAccountRecordId",
"(",
"final",
"CallContext",
"context",
")",
"{",
"// If tenant id is null, this will default to the default tenant record id (multi-tenancy disabled)",
"final",
"Long",
"tenantRecordId",
"=",
"getTenantR... | Create an internal call callcontext without populating the account record id
<p/>
This is used for update/delete operations - we don't need the account id in that case - and
also when we don't have an account_record_id column (e.g. tenants, tag_definitions)
@param context original call callcontext
@return internal call callcontext | [
"Create",
"an",
"internal",
"call",
"callcontext",
"without",
"populating",
"the",
"account",
"record",
"id",
"<p",
"/",
">",
"This",
"is",
"used",
"for",
"update",
"/",
"delete",
"operations",
"-",
"we",
"don",
"t",
"need",
"the",
"account",
"id",
"in",
... | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java#L249-L254 |
brianwhu/xillium | base/src/main/java/org/xillium/base/util/Mathematical.java | Mathematical.ceiling | public static int ceiling(int n, int m) {
return n >= 0 ? ((n + m - 1) / m) * m : (n / m) * m;
} | java | public static int ceiling(int n, int m) {
return n >= 0 ? ((n + m - 1) / m) * m : (n / m) * m;
} | [
"public",
"static",
"int",
"ceiling",
"(",
"int",
"n",
",",
"int",
"m",
")",
"{",
"return",
"n",
">=",
"0",
"?",
"(",
"(",
"n",
"+",
"m",
"-",
"1",
")",
"/",
"m",
")",
"*",
"m",
":",
"(",
"n",
"/",
"m",
")",
"*",
"m",
";",
"}"
] | Rounds n up to the nearest multiple of m
@param n an integer
@param m an integer
@return the value after rounding {@code n} up to the nearest multiple of {@code m} | [
"Rounds",
"n",
"up",
"to",
"the",
"nearest",
"multiple",
"of",
"m"
] | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/util/Mathematical.java#L37-L39 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java | GregorianCalendar.getFixedDateJan1 | private long getFixedDateJan1(BaseCalendar.Date date, long fixedDate) {
assert date.getNormalizedYear() == gregorianCutoverYear ||
date.getNormalizedYear() == gregorianCutoverYearJulian;
if (gregorianCutoverYear != gregorianCutoverYearJulian) {
if (fixedDate >= gregorianCutoverDate) {
// Dates before the cutover date don't exist
// in the same (Gregorian) year. So, no
// January 1 exists in the year. Use the
// cutover date as the first day of the year.
return gregorianCutoverDate;
}
}
// January 1 of the normalized year should exist.
BaseCalendar juliancal = getJulianCalendarSystem();
return juliancal.getFixedDate(date.getNormalizedYear(), BaseCalendar.JANUARY, 1, null);
} | java | private long getFixedDateJan1(BaseCalendar.Date date, long fixedDate) {
assert date.getNormalizedYear() == gregorianCutoverYear ||
date.getNormalizedYear() == gregorianCutoverYearJulian;
if (gregorianCutoverYear != gregorianCutoverYearJulian) {
if (fixedDate >= gregorianCutoverDate) {
// Dates before the cutover date don't exist
// in the same (Gregorian) year. So, no
// January 1 exists in the year. Use the
// cutover date as the first day of the year.
return gregorianCutoverDate;
}
}
// January 1 of the normalized year should exist.
BaseCalendar juliancal = getJulianCalendarSystem();
return juliancal.getFixedDate(date.getNormalizedYear(), BaseCalendar.JANUARY, 1, null);
} | [
"private",
"long",
"getFixedDateJan1",
"(",
"BaseCalendar",
".",
"Date",
"date",
",",
"long",
"fixedDate",
")",
"{",
"assert",
"date",
".",
"getNormalizedYear",
"(",
")",
"==",
"gregorianCutoverYear",
"||",
"date",
".",
"getNormalizedYear",
"(",
")",
"==",
"gr... | Returns the fixed date of the first day of the year (usually
January 1) before the specified date.
@param date the date for which the first day of the year is
calculated. The date has to be in the cut-over year (Gregorian
or Julian).
@param fixedDate the fixed date representation of the date | [
"Returns",
"the",
"fixed",
"date",
"of",
"the",
"first",
"day",
"of",
"the",
"year",
"(",
"usually",
"January",
"1",
")",
"before",
"the",
"specified",
"date",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java#L3166-L3181 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/parametrics/independentsamples/StudentsIndependentSamples.java | StudentsIndependentSamples.checkCriticalValue | private static boolean checkCriticalValue(double score, int df, boolean is_twoTailed, double aLevel) {
double probability=ContinuousDistributions.studentsCdf(score,df);
boolean rejectH0=false;
double a=aLevel;
if(is_twoTailed) { //if to tailed test then split the statistical significance in half
a=aLevel/2;
}
if(probability<=a || probability>=(1-a)) {
rejectH0=true;
}
return rejectH0;
} | java | private static boolean checkCriticalValue(double score, int df, boolean is_twoTailed, double aLevel) {
double probability=ContinuousDistributions.studentsCdf(score,df);
boolean rejectH0=false;
double a=aLevel;
if(is_twoTailed) { //if to tailed test then split the statistical significance in half
a=aLevel/2;
}
if(probability<=a || probability>=(1-a)) {
rejectH0=true;
}
return rejectH0;
} | [
"private",
"static",
"boolean",
"checkCriticalValue",
"(",
"double",
"score",
",",
"int",
"df",
",",
"boolean",
"is_twoTailed",
",",
"double",
"aLevel",
")",
"{",
"double",
"probability",
"=",
"ContinuousDistributions",
".",
"studentsCdf",
"(",
"score",
",",
"df... | Checks the Critical Value to determine if the Hypothesis should be rejected
@param score
@param df
@param is_twoTailed
@param aLevel
@return | [
"Checks",
"the",
"Critical",
"Value",
"to",
"determine",
"if",
"the",
"Hypothesis",
"should",
"be",
"rejected"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/parametrics/independentsamples/StudentsIndependentSamples.java#L100-L114 |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.compileAssignment | private void compileAssignment(Sequence sequence, TokenList tokens, TokenList.Token t0) {
// see if it is assign or a range
List<Variable> range = parseAssignRange(sequence, tokens, t0);
TokenList.Token t1 = t0.next;
if (t1.getType() != Type.SYMBOL || t1.getSymbol() != Symbol.ASSIGN)
throw new ParseError("Expected assignment operator next");
// Parse the right side of the equation
TokenList tokensRight = tokens.extractSubList(t1.next, tokens.last);
compileTokens(sequence, tokensRight);
if (tokensRight.getLast().getType() != Type.VARIABLE)
throw new RuntimeException("BUG the last token must be a variable");
// copy the results into the output
Variable variableRight = tokensRight.getFirst().getVariable();
if (range == null) {
// no range, so copy results into the entire output matrix
sequence.output = createVariableInferred(t0, variableRight);
sequence.addOperation(Operation.copy(variableRight, sequence.output));
} else {
// a sub-matrix range is specified. Copy into that inner part
if (t0.getType() == Type.WORD) {
throw new ParseError("Can't do lazy variable initialization with submatrices. " + t0.getWord());
}
sequence.addOperation(Operation.copy(variableRight, t0.getVariable(), range));
}
} | java | private void compileAssignment(Sequence sequence, TokenList tokens, TokenList.Token t0) {
// see if it is assign or a range
List<Variable> range = parseAssignRange(sequence, tokens, t0);
TokenList.Token t1 = t0.next;
if (t1.getType() != Type.SYMBOL || t1.getSymbol() != Symbol.ASSIGN)
throw new ParseError("Expected assignment operator next");
// Parse the right side of the equation
TokenList tokensRight = tokens.extractSubList(t1.next, tokens.last);
compileTokens(sequence, tokensRight);
if (tokensRight.getLast().getType() != Type.VARIABLE)
throw new RuntimeException("BUG the last token must be a variable");
// copy the results into the output
Variable variableRight = tokensRight.getFirst().getVariable();
if (range == null) {
// no range, so copy results into the entire output matrix
sequence.output = createVariableInferred(t0, variableRight);
sequence.addOperation(Operation.copy(variableRight, sequence.output));
} else {
// a sub-matrix range is specified. Copy into that inner part
if (t0.getType() == Type.WORD) {
throw new ParseError("Can't do lazy variable initialization with submatrices. " + t0.getWord());
}
sequence.addOperation(Operation.copy(variableRight, t0.getVariable(), range));
}
} | [
"private",
"void",
"compileAssignment",
"(",
"Sequence",
"sequence",
",",
"TokenList",
"tokens",
",",
"TokenList",
".",
"Token",
"t0",
")",
"{",
"// see if it is assign or a range",
"List",
"<",
"Variable",
">",
"range",
"=",
"parseAssignRange",
"(",
"sequence",
"... | An assignment is being made to some output. looks something like: A = B | [
"An",
"assignment",
"is",
"being",
"made",
"to",
"some",
"output",
".",
"looks",
"something",
"like",
":",
"A",
"=",
"B"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L471-L498 |
jenkinsci/jenkins | core/src/main/java/hudson/Util.java | Util.tryParseNumber | @CheckForNull
public static Number tryParseNumber(@CheckForNull String numberStr, @CheckForNull Number defaultNumber) {
if ((numberStr == null) || (numberStr.length() == 0)) {
return defaultNumber;
}
try {
return NumberFormat.getNumberInstance().parse(numberStr);
} catch (ParseException e) {
return defaultNumber;
}
} | java | @CheckForNull
public static Number tryParseNumber(@CheckForNull String numberStr, @CheckForNull Number defaultNumber) {
if ((numberStr == null) || (numberStr.length() == 0)) {
return defaultNumber;
}
try {
return NumberFormat.getNumberInstance().parse(numberStr);
} catch (ParseException e) {
return defaultNumber;
}
} | [
"@",
"CheckForNull",
"public",
"static",
"Number",
"tryParseNumber",
"(",
"@",
"CheckForNull",
"String",
"numberStr",
",",
"@",
"CheckForNull",
"Number",
"defaultNumber",
")",
"{",
"if",
"(",
"(",
"numberStr",
"==",
"null",
")",
"||",
"(",
"numberStr",
".",
... | Returns the parsed string if parsed successful; otherwise returns the default number.
If the string is null, empty or a ParseException is thrown then the defaultNumber
is returned.
@param numberStr string to parse
@param defaultNumber number to return if the string can not be parsed
@return returns the parsed string; otherwise the default number | [
"Returns",
"the",
"parsed",
"string",
"if",
"parsed",
"successful",
";",
"otherwise",
"returns",
"the",
"default",
"number",
".",
"If",
"the",
"string",
"is",
"null",
"empty",
"or",
"a",
"ParseException",
"is",
"thrown",
"then",
"the",
"defaultNumber",
"is",
... | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L1320-L1330 |
infinispan/infinispan | core/src/main/java/org/infinispan/util/DependencyGraph.java | DependencyGraph.removeDependency | public void removeDependency(T from, T to) {
lock.writeLock().lock();
try {
Set<T> dependencies = outgoingEdges.get(from);
if (dependencies == null || !dependencies.contains(to)) {
throw new IllegalArgumentException("Inexistent dependency");
}
dependencies.remove(to);
incomingEdges.get(to).remove(from);
} finally {
lock.writeLock().unlock();
}
} | java | public void removeDependency(T from, T to) {
lock.writeLock().lock();
try {
Set<T> dependencies = outgoingEdges.get(from);
if (dependencies == null || !dependencies.contains(to)) {
throw new IllegalArgumentException("Inexistent dependency");
}
dependencies.remove(to);
incomingEdges.get(to).remove(from);
} finally {
lock.writeLock().unlock();
}
} | [
"public",
"void",
"removeDependency",
"(",
"T",
"from",
",",
"T",
"to",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Set",
"<",
"T",
">",
"dependencies",
"=",
"outgoingEdges",
".",
"get",
"(",
"from",
")",
... | Remove a dependency
@param from From element
@param to To element
@throws java.lang.IllegalArgumentException if either to or from don't exist | [
"Remove",
"a",
"dependency"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/DependencyGraph.java#L103-L115 |
knowm/XChange | xchange-bitmex/src/main/java/org/knowm/xchange/bitmex/service/BitmexTradeServiceRaw.java | BitmexTradeServiceRaw.getBitmexOrders | public List<BitmexPrivateOrder> getBitmexOrders() throws ExchangeException {
return getBitmexOrders(null, null, null, null, null);
} | java | public List<BitmexPrivateOrder> getBitmexOrders() throws ExchangeException {
return getBitmexOrders(null, null, null, null, null);
} | [
"public",
"List",
"<",
"BitmexPrivateOrder",
">",
"getBitmexOrders",
"(",
")",
"throws",
"ExchangeException",
"{",
"return",
"getBitmexOrders",
"(",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] | See {@link Bitmex#getOrders}
@return List of {@link BitmexPrivateOrder}s. | [
"See",
"{",
"@link",
"Bitmex#getOrders",
"}"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitmex/src/main/java/org/knowm/xchange/bitmex/service/BitmexTradeServiceRaw.java#L92-L94 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/XMLUtils.java | XMLUtils.getValue | public static String getValue(final Element elem, final String attrName) {
final Attr attr = elem.getAttributeNode(attrName);
if (attr != null && !attr.getValue().isEmpty()) {
return attr.getValue();
}
return null;
} | java | public static String getValue(final Element elem, final String attrName) {
final Attr attr = elem.getAttributeNode(attrName);
if (attr != null && !attr.getValue().isEmpty()) {
return attr.getValue();
}
return null;
} | [
"public",
"static",
"String",
"getValue",
"(",
"final",
"Element",
"elem",
",",
"final",
"String",
"attrName",
")",
"{",
"final",
"Attr",
"attr",
"=",
"elem",
".",
"getAttributeNode",
"(",
"attrName",
")",
";",
"if",
"(",
"attr",
"!=",
"null",
"&&",
"!",... | Get attribute value.
@param elem attribute parent element
@param attrName attribute name
@return attribute value, {@code null} if not set | [
"Get",
"attribute",
"value",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLUtils.java#L1005-L1011 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java | GrassLegacyUtilities.getRectangleAroundPoint | public static Window getRectangleAroundPoint( Window activeRegion, double x, double y ) {
double minx = activeRegion.getRectangle().getBounds2D().getMinX();
double ewres = activeRegion.getWEResolution();
double snapx = minx + (Math.round((x - minx) / ewres) * ewres);
double miny = activeRegion.getRectangle().getBounds2D().getMinY();
double nsres = activeRegion.getNSResolution();
double snapy = miny + (Math.round((y - miny) / nsres) * nsres);
double xmin = 0.0;
double xmax = 0.0;
double ymin = 0.0;
double ymax = 0.0;
if (x >= snapx) {
xmin = snapx;
xmax = xmin + ewres;
} else {
xmax = snapx;
xmin = xmax - ewres;
}
if (y <= snapy) {
ymax = snapy;
ymin = ymax - nsres;
} else {
ymin = snapy;
ymax = ymin + nsres;
}
// why do I have to put ymin, Rectangle requires the upper left
// corner?????!!!! Is it a BUG
// in the Rectangle2D class? or docu?
// Rectangle2D rect = new Rectangle2D.Double(xmin, ymin, ewres, nsres);
return new Window(xmin, xmax, ymin, ymax, 1, 1);
} | java | public static Window getRectangleAroundPoint( Window activeRegion, double x, double y ) {
double minx = activeRegion.getRectangle().getBounds2D().getMinX();
double ewres = activeRegion.getWEResolution();
double snapx = minx + (Math.round((x - minx) / ewres) * ewres);
double miny = activeRegion.getRectangle().getBounds2D().getMinY();
double nsres = activeRegion.getNSResolution();
double snapy = miny + (Math.round((y - miny) / nsres) * nsres);
double xmin = 0.0;
double xmax = 0.0;
double ymin = 0.0;
double ymax = 0.0;
if (x >= snapx) {
xmin = snapx;
xmax = xmin + ewres;
} else {
xmax = snapx;
xmin = xmax - ewres;
}
if (y <= snapy) {
ymax = snapy;
ymin = ymax - nsres;
} else {
ymin = snapy;
ymax = ymin + nsres;
}
// why do I have to put ymin, Rectangle requires the upper left
// corner?????!!!! Is it a BUG
// in the Rectangle2D class? or docu?
// Rectangle2D rect = new Rectangle2D.Double(xmin, ymin, ewres, nsres);
return new Window(xmin, xmax, ymin, ymax, 1, 1);
} | [
"public",
"static",
"Window",
"getRectangleAroundPoint",
"(",
"Window",
"activeRegion",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"double",
"minx",
"=",
"activeRegion",
".",
"getRectangle",
"(",
")",
".",
"getBounds2D",
"(",
")",
".",
"getMinX",
"(",... | return the rectangle of the cell of the active region, that surrounds the given coordinates
@param activeRegion
@param x the given easting coordinate
@param y given northing coordinate
@return the rectangle localizing the cell inside which the x and y stay | [
"return",
"the",
"rectangle",
"of",
"the",
"cell",
"of",
"the",
"active",
"region",
"that",
"surrounds",
"the",
"given",
"coordinates"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java#L357-L392 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java | RandomMatrices_DDRM.fillGaussian | public static void fillGaussian(DMatrixD1 mat , double mean , double stdev , Random rand )
{
double d[] = mat.getData();
int size = mat.getNumElements();
for( int i = 0; i < size; i++ ) {
d[i] = mean + stdev * (double)rand.nextGaussian();
}
} | java | public static void fillGaussian(DMatrixD1 mat , double mean , double stdev , Random rand )
{
double d[] = mat.getData();
int size = mat.getNumElements();
for( int i = 0; i < size; i++ ) {
d[i] = mean + stdev * (double)rand.nextGaussian();
}
} | [
"public",
"static",
"void",
"fillGaussian",
"(",
"DMatrixD1",
"mat",
",",
"double",
"mean",
",",
"double",
"stdev",
",",
"Random",
"rand",
")",
"{",
"double",
"d",
"[",
"]",
"=",
"mat",
".",
"getData",
"(",
")",
";",
"int",
"size",
"=",
"mat",
".",
... | <p>
Sets each element in the matrix to a value drawn from an Gaussian distribution with the specified mean and
standard deviation
</p>
@param mat The matrix who is to be randomized. Modified.
@param mean Mean value in the distribution
@param stdev Standard deviation in the distribution
@param rand Random number generator used to fill the matrix. | [
"<p",
">",
"Sets",
"each",
"element",
"in",
"the",
"matrix",
"to",
"a",
"value",
"drawn",
"from",
"an",
"Gaussian",
"distribution",
"with",
"the",
"specified",
"mean",
"and",
"standard",
"deviation",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L422-L430 |
ModeShape/modeshape | index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/CompareStringQuery.java | CompareStringQuery.createQueryForNodesWithFieldLike | protected static Query createQueryForNodesWithFieldLike(String likeExpression,
String fieldName,
Function<String, String> caseOperation) {
assert likeExpression != null;
assert likeExpression.length() > 0;
if (!QueryUtil.hasWildcardCharacters(likeExpression)) {
// This is not a like expression, so just do an equals ...
return createQueryForNodesWithFieldEqualTo(likeExpression, fieldName, caseOperation);
}
if (caseOperation == null) {
// We can just do a normal Wildcard query ...
// '%' matches 0 or more characters
// '_' matches any single character
// '\x' matches 'x'
// all other characters match themselves
// Wildcard queries are a better match, but they can be slow and should not be used
// if the first character of the expression is a '%' or '_' or '*' or '?' ...
char firstChar = likeExpression.charAt(0);
if (firstChar != '%' && firstChar != '_' && firstChar != '*' && firstChar != '?') {
// Create a wildcard query ...
return new WildcardQuery(new Term(fieldName, toWildcardExpression(likeExpression)));
}
}
// Create a regex query...
String regex = QueryUtil.toRegularExpression(likeExpression);
Pattern pattern = Pattern.compile(regex, Pattern.UNICODE_CASE);
return new RegexQuery(fieldName, pattern, caseOperation);
} | java | protected static Query createQueryForNodesWithFieldLike(String likeExpression,
String fieldName,
Function<String, String> caseOperation) {
assert likeExpression != null;
assert likeExpression.length() > 0;
if (!QueryUtil.hasWildcardCharacters(likeExpression)) {
// This is not a like expression, so just do an equals ...
return createQueryForNodesWithFieldEqualTo(likeExpression, fieldName, caseOperation);
}
if (caseOperation == null) {
// We can just do a normal Wildcard query ...
// '%' matches 0 or more characters
// '_' matches any single character
// '\x' matches 'x'
// all other characters match themselves
// Wildcard queries are a better match, but they can be slow and should not be used
// if the first character of the expression is a '%' or '_' or '*' or '?' ...
char firstChar = likeExpression.charAt(0);
if (firstChar != '%' && firstChar != '_' && firstChar != '*' && firstChar != '?') {
// Create a wildcard query ...
return new WildcardQuery(new Term(fieldName, toWildcardExpression(likeExpression)));
}
}
// Create a regex query...
String regex = QueryUtil.toRegularExpression(likeExpression);
Pattern pattern = Pattern.compile(regex, Pattern.UNICODE_CASE);
return new RegexQuery(fieldName, pattern, caseOperation);
} | [
"protected",
"static",
"Query",
"createQueryForNodesWithFieldLike",
"(",
"String",
"likeExpression",
",",
"String",
"fieldName",
",",
"Function",
"<",
"String",
",",
"String",
">",
"caseOperation",
")",
"{",
"assert",
"likeExpression",
"!=",
"null",
";",
"assert",
... | Construct a {@link Query} implementation that scores documents with a string field value that is LIKE the supplied
constraint value, where the LIKE expression contains the SQL wildcard characters '%' and '_' or the regular expression
wildcard characters '*' and '?'.
@param likeExpression the LIKE expression; may not be null
@param fieldName the name of the document field containing the value; may not be null
@param caseOperation the operation that should be performed on the indexed values before the constraint value is being
evaluated; may be null which indicates that no case conversion should be done
@return the query; never null | [
"Construct",
"a",
"{",
"@link",
"Query",
"}",
"implementation",
"that",
"scores",
"documents",
"with",
"a",
"string",
"field",
"value",
"that",
"is",
"LIKE",
"the",
"supplied",
"constraint",
"value",
"where",
"the",
"LIKE",
"expression",
"contains",
"the",
"SQ... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/CompareStringQuery.java#L198-L228 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_cholsol.java | Scs_cholsol.cs_cholsol | public static boolean cs_cholsol(int order, Scs A, float[] b) {
float x[];
Scss S;
Scsn N;
int n;
boolean ok;
if (!Scs_util.CS_CSC(A) || b == null)
return (false); /* check inputs */
n = A.n;
S = Scs_schol.cs_schol(order, A); /* ordering and symbolic analysis */
N = Scs_chol.cs_chol(A, S); /* numeric Cholesky factorization */
x = new float[n]; /* get workspace */
ok = (S != null && N != null);
if (ok) {
Scs_ipvec.cs_ipvec(S.pinv, b, x, n); /* x = P*b */
Scs_lsolve.cs_lsolve(N.L, x); /* x = L\x */
Scs_ltsolve.cs_ltsolve(N.L, x); /* x = L'\x */
Scs_pvec.cs_pvec(S.pinv, x, b, n); /* b = P'*x */
}
return (ok);
} | java | public static boolean cs_cholsol(int order, Scs A, float[] b) {
float x[];
Scss S;
Scsn N;
int n;
boolean ok;
if (!Scs_util.CS_CSC(A) || b == null)
return (false); /* check inputs */
n = A.n;
S = Scs_schol.cs_schol(order, A); /* ordering and symbolic analysis */
N = Scs_chol.cs_chol(A, S); /* numeric Cholesky factorization */
x = new float[n]; /* get workspace */
ok = (S != null && N != null);
if (ok) {
Scs_ipvec.cs_ipvec(S.pinv, b, x, n); /* x = P*b */
Scs_lsolve.cs_lsolve(N.L, x); /* x = L\x */
Scs_ltsolve.cs_ltsolve(N.L, x); /* x = L'\x */
Scs_pvec.cs_pvec(S.pinv, x, b, n); /* b = P'*x */
}
return (ok);
} | [
"public",
"static",
"boolean",
"cs_cholsol",
"(",
"int",
"order",
",",
"Scs",
"A",
",",
"float",
"[",
"]",
"b",
")",
"{",
"float",
"x",
"[",
"]",
";",
"Scss",
"S",
";",
"Scsn",
"N",
";",
"int",
"n",
";",
"boolean",
"ok",
";",
"if",
"(",
"!",
... | Solves Ax=b where A is symmetric positive definite; b is overwritten with
solution.
@param order
ordering method to use (0 or 1)
@param A
column-compressed matrix, symmetric positive definite, only
upper triangular part is used
@param b
right hand side, b is overwritten with solution
@return true if successful, false on error | [
"Solves",
"Ax",
"=",
"b",
"where",
"A",
"is",
"symmetric",
"positive",
"definite",
";",
"b",
"is",
"overwritten",
"with",
"solution",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_cholsol.java#L52-L72 |
knowm/XChart | xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTickCalculator_.java | AxisTickCalculator_.willLabelsFitInTickSpaceHint | boolean willLabelsFitInTickSpaceHint(List<String> tickLabels, int tickSpacingHint) {
// Assume that for Y-Axis the ticks will all fit based on their tickSpace hint because the text
// is usually horizontal and "short". This more applies to the X-Axis.
if (this.axisDirection == Direction.Y) {
return true;
}
String sampleLabel = " ";
// find the longest String in all the labels
for (String tickLabel : tickLabels) {
if (tickLabel != null && tickLabel.length() > sampleLabel.length()) {
sampleLabel = tickLabel;
}
}
// System.out.println("longestLabel: " + sampleLabel);
TextLayout textLayout =
new TextLayout(
sampleLabel, styler.getAxisTickLabelsFont(), new FontRenderContext(null, true, false));
AffineTransform rot =
styler.getXAxisLabelRotation() == 0
? null
: AffineTransform.getRotateInstance(
-1 * Math.toRadians(styler.getXAxisLabelRotation()));
Shape shape = textLayout.getOutline(rot);
Rectangle2D rectangle = shape.getBounds();
double largestLabelWidth = rectangle.getWidth();
// System.out.println("largestLabelWidth: " + largestLabelWidth);
// System.out.println("tickSpacingHint: " + tickSpacingHint);
// if (largestLabelWidth * 1.1 >= tickSpacingHint) {
// System.out.println("WILL NOT FIT!!!");
// }
return (largestLabelWidth * 1.1 < tickSpacingHint);
} | java | boolean willLabelsFitInTickSpaceHint(List<String> tickLabels, int tickSpacingHint) {
// Assume that for Y-Axis the ticks will all fit based on their tickSpace hint because the text
// is usually horizontal and "short". This more applies to the X-Axis.
if (this.axisDirection == Direction.Y) {
return true;
}
String sampleLabel = " ";
// find the longest String in all the labels
for (String tickLabel : tickLabels) {
if (tickLabel != null && tickLabel.length() > sampleLabel.length()) {
sampleLabel = tickLabel;
}
}
// System.out.println("longestLabel: " + sampleLabel);
TextLayout textLayout =
new TextLayout(
sampleLabel, styler.getAxisTickLabelsFont(), new FontRenderContext(null, true, false));
AffineTransform rot =
styler.getXAxisLabelRotation() == 0
? null
: AffineTransform.getRotateInstance(
-1 * Math.toRadians(styler.getXAxisLabelRotation()));
Shape shape = textLayout.getOutline(rot);
Rectangle2D rectangle = shape.getBounds();
double largestLabelWidth = rectangle.getWidth();
// System.out.println("largestLabelWidth: " + largestLabelWidth);
// System.out.println("tickSpacingHint: " + tickSpacingHint);
// if (largestLabelWidth * 1.1 >= tickSpacingHint) {
// System.out.println("WILL NOT FIT!!!");
// }
return (largestLabelWidth * 1.1 < tickSpacingHint);
} | [
"boolean",
"willLabelsFitInTickSpaceHint",
"(",
"List",
"<",
"String",
">",
"tickLabels",
",",
"int",
"tickSpacingHint",
")",
"{",
"// Assume that for Y-Axis the ticks will all fit based on their tickSpace hint because the text",
"// is usually horizontal and \"short\". This more applies... | Given the generated tickLabels, will they fit side-by-side without overlapping each other and
looking bad? Sometimes the given tickSpacingHint is simply too small.
@param tickLabels
@param tickSpacingHint
@return | [
"Given",
"the",
"generated",
"tickLabels",
"will",
"they",
"fit",
"side",
"-",
"by",
"-",
"side",
"without",
"overlapping",
"each",
"other",
"and",
"looking",
"bad?",
"Sometimes",
"the",
"given",
"tickSpacingHint",
"is",
"simply",
"too",
"small",
"."
] | train | https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTickCalculator_.java#L89-L125 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/utils/SqlHelper.java | SqlHelper.buildSqlINSERT | public static String buildSqlINSERT(String tableName, String[] columnNames, Object[] values) {
if (columnNames.length != values.length) {
throw new IllegalArgumentException(
"Number of columns must be equal to number of values.");
}
final String SQL_TEMPLATE = "INSERT INTO {0} ({1}) VALUES ({2})";
final String SQL_PART_COLUMNS = StringUtils.join(columnNames, ',');
final StringBuilder SQL_PART_VALUES = new StringBuilder();
for (int i = 0; i < values.length; i++) {
if (values[i] instanceof ParamExpression) {
SQL_PART_VALUES.append(((ParamExpression) values[i]).getExpression());
} else {
SQL_PART_VALUES.append('?');
}
if (i < values.length - 1) {
SQL_PART_VALUES.append(',');
}
}
return MessageFormat.format(SQL_TEMPLATE, tableName, SQL_PART_COLUMNS, SQL_PART_VALUES);
} | java | public static String buildSqlINSERT(String tableName, String[] columnNames, Object[] values) {
if (columnNames.length != values.length) {
throw new IllegalArgumentException(
"Number of columns must be equal to number of values.");
}
final String SQL_TEMPLATE = "INSERT INTO {0} ({1}) VALUES ({2})";
final String SQL_PART_COLUMNS = StringUtils.join(columnNames, ',');
final StringBuilder SQL_PART_VALUES = new StringBuilder();
for (int i = 0; i < values.length; i++) {
if (values[i] instanceof ParamExpression) {
SQL_PART_VALUES.append(((ParamExpression) values[i]).getExpression());
} else {
SQL_PART_VALUES.append('?');
}
if (i < values.length - 1) {
SQL_PART_VALUES.append(',');
}
}
return MessageFormat.format(SQL_TEMPLATE, tableName, SQL_PART_COLUMNS, SQL_PART_VALUES);
} | [
"public",
"static",
"String",
"buildSqlINSERT",
"(",
"String",
"tableName",
",",
"String",
"[",
"]",
"columnNames",
",",
"Object",
"[",
"]",
"values",
")",
"{",
"if",
"(",
"columnNames",
".",
"length",
"!=",
"values",
".",
"length",
")",
"{",
"throw",
"n... | Builds an INSERT statement (used for {@link PreparedStatement}).
@param tableName
@param columnNames
@param values
@return | [
"Builds",
"an",
"INSERT",
"statement",
"(",
"used",
"for",
"{",
"@link",
"PreparedStatement",
"}",
")",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/utils/SqlHelper.java#L67-L86 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.