repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Request.java
Request.text
public String text() { """ Fetches response content from server as String. @return response content from server as String. """ try { connect(); return responseCode() >= 400 ? read(connection.getErrorStream()) : read(connection.getInputStream()); } catch (IOException e) { throw new HttpException("Failed URL: " + url, e); }finally { dispose(); } }
java
public String text() { try { connect(); return responseCode() >= 400 ? read(connection.getErrorStream()) : read(connection.getInputStream()); } catch (IOException e) { throw new HttpException("Failed URL: " + url, e); }finally { dispose(); } }
[ "public", "String", "text", "(", ")", "{", "try", "{", "connect", "(", ")", ";", "return", "responseCode", "(", ")", ">=", "400", "?", "read", "(", "connection", ".", "getErrorStream", "(", ")", ")", ":", "read", "(", "connection", ".", "getInputStream", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "HttpException", "(", "\"Failed URL: \"", "+", "url", ",", "e", ")", ";", "}", "finally", "{", "dispose", "(", ")", ";", "}", "}" ]
Fetches response content from server as String. @return response content from server as String.
[ "Fetches", "response", "content", "from", "server", "as", "String", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Request.java#L163-L172
pushtorefresh/storio
storio-content-resolver/src/main/java/com/pushtorefresh/storio3/contentresolver/operations/put/PutResult.java
PutResult.newUpdateResult
@NonNull public static PutResult newUpdateResult(int numberOfRowsUpdated, @NonNull Uri affectedUri) { """ Creates {@link PutResult} for update. @param numberOfRowsUpdated number of rows that were updated, must be {@code >= 0}. @param affectedUri Uri that was affected by update. @return new {@link PutResult} instance. """ return new PutResult(null, numberOfRowsUpdated, affectedUri); }
java
@NonNull public static PutResult newUpdateResult(int numberOfRowsUpdated, @NonNull Uri affectedUri) { return new PutResult(null, numberOfRowsUpdated, affectedUri); }
[ "@", "NonNull", "public", "static", "PutResult", "newUpdateResult", "(", "int", "numberOfRowsUpdated", ",", "@", "NonNull", "Uri", "affectedUri", ")", "{", "return", "new", "PutResult", "(", "null", ",", "numberOfRowsUpdated", ",", "affectedUri", ")", ";", "}" ]
Creates {@link PutResult} for update. @param numberOfRowsUpdated number of rows that were updated, must be {@code >= 0}. @param affectedUri Uri that was affected by update. @return new {@link PutResult} instance.
[ "Creates", "{", "@link", "PutResult", "}", "for", "update", "." ]
train
https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-content-resolver/src/main/java/com/pushtorefresh/storio3/contentresolver/operations/put/PutResult.java#L55-L58
elki-project/elki
elki-core-dbids-int/src/main/java/de/lmu/ifi/dbs/elki/database/ids/integer/DoubleIntegerDBIDArrayList.java
DoubleIntegerDBIDArrayList.addInternal
protected void addInternal(double dist, int id) { """ Add an entry, consisting of distance and internal index. @param dist Distance @param id Internal index """ if(size == dists.length) { grow(); } dists[size] = dist; ids[size] = id; ++size; }
java
protected void addInternal(double dist, int id) { if(size == dists.length) { grow(); } dists[size] = dist; ids[size] = id; ++size; }
[ "protected", "void", "addInternal", "(", "double", "dist", ",", "int", "id", ")", "{", "if", "(", "size", "==", "dists", ".", "length", ")", "{", "grow", "(", ")", ";", "}", "dists", "[", "size", "]", "=", "dist", ";", "ids", "[", "size", "]", "=", "id", ";", "++", "size", ";", "}" ]
Add an entry, consisting of distance and internal index. @param dist Distance @param id Internal index
[ "Add", "an", "entry", "consisting", "of", "distance", "and", "internal", "index", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids-int/src/main/java/de/lmu/ifi/dbs/elki/database/ids/integer/DoubleIntegerDBIDArrayList.java#L132-L139
burberius/eve-esi
src/main/java/net/troja/eve/esi/api/UniverseApi.java
UniverseApi.getUniverseMoonsMoonId
public MoonResponse getUniverseMoonsMoonId(Integer moonId, String datasource, String ifNoneMatch) throws ApiException { """ Get moon information Get information on a moon --- This route expires daily at 11:05 @param moonId moon_id integer (required) @param datasource The server name you would like data from (optional, default to tranquility) @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional) @return MoonResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<MoonResponse> resp = getUniverseMoonsMoonIdWithHttpInfo(moonId, datasource, ifNoneMatch); return resp.getData(); }
java
public MoonResponse getUniverseMoonsMoonId(Integer moonId, String datasource, String ifNoneMatch) throws ApiException { ApiResponse<MoonResponse> resp = getUniverseMoonsMoonIdWithHttpInfo(moonId, datasource, ifNoneMatch); return resp.getData(); }
[ "public", "MoonResponse", "getUniverseMoonsMoonId", "(", "Integer", "moonId", ",", "String", "datasource", ",", "String", "ifNoneMatch", ")", "throws", "ApiException", "{", "ApiResponse", "<", "MoonResponse", ">", "resp", "=", "getUniverseMoonsMoonIdWithHttpInfo", "(", "moonId", ",", "datasource", ",", "ifNoneMatch", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Get moon information Get information on a moon --- This route expires daily at 11:05 @param moonId moon_id integer (required) @param datasource The server name you would like data from (optional, default to tranquility) @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional) @return MoonResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "moon", "information", "Get", "information", "on", "a", "moon", "---", "This", "route", "expires", "daily", "at", "11", ":", "05" ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/UniverseApi.java#L2020-L2024
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Utils.java
Utils.callConstructor
public static Object callConstructor(final Class<?> cls, final Object... args) { """ Construct a class object with the given arguments @param cls The class @param args The arguments @return Constructed Object """ return callConstructor(cls, getTypes(args), args); }
java
public static Object callConstructor(final Class<?> cls, final Object... args) { return callConstructor(cls, getTypes(args), args); }
[ "public", "static", "Object", "callConstructor", "(", "final", "Class", "<", "?", ">", "cls", ",", "final", "Object", "...", "args", ")", "{", "return", "callConstructor", "(", "cls", ",", "getTypes", "(", "args", ")", ",", "args", ")", ";", "}" ]
Construct a class object with the given arguments @param cls The class @param args The arguments @return Constructed Object
[ "Construct", "a", "class", "object", "with", "the", "given", "arguments" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/Utils.java#L277-L279
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2InboundLink.java
H2InboundLink.createNewInboundLink
public H2StreamProcessor createNewInboundLink(Integer streamID) { """ Create a new stream and add it to this link. If the stream ID is even, check to make sure this link has not exceeded the maximum number of concurrent streams (as set by the client); if too many streams are open, don't open a new one. @param streamID @return null if creating this stream would exceed the maximum number locally-opened streams """ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "createNewInboundLink entry: stream-id: " + streamID); } if ((streamID % 2 == 0) && (streamID != 0)) { synchronized (streamOpenCloseSync) { int maxPushStreams = getRemoteConnectionSettings().getMaxConcurrentStreams(); // if there are too many locally-open active streams, don't open a new one if (maxPushStreams >= 0 && openPushStreams > maxPushStreams) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "createNewInboundLink cannot open a new push stream; maximum number of open push streams reached" + openPushStreams); } return null; } openPushStreams++; } } H2VirtualConnectionImpl h2VC = new H2VirtualConnectionImpl(initialVC); // remove the HttpDispatcherLink from the map, so a new one will be created and used by this new H2 stream h2VC.getStateMap().remove(HttpDispatcherLink.LINK_ID); H2HttpInboundLinkWrap link = new H2HttpInboundLinkWrap(httpInboundChannel, h2VC, streamID, this); H2StreamProcessor stream = new H2StreamProcessor(streamID, link, this); // for now, assume parent stream ID is root, need to change soon writeQ.addNewNodeToQ(streamID, Node.ROOT_STREAM_ID, Node.DEFAULT_NODE_PRIORITY, false); streamTable.put(streamID, stream); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "createNewInboundLink exit: returning stream: " + streamID + " " + stream); } return stream; }
java
public H2StreamProcessor createNewInboundLink(Integer streamID) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "createNewInboundLink entry: stream-id: " + streamID); } if ((streamID % 2 == 0) && (streamID != 0)) { synchronized (streamOpenCloseSync) { int maxPushStreams = getRemoteConnectionSettings().getMaxConcurrentStreams(); // if there are too many locally-open active streams, don't open a new one if (maxPushStreams >= 0 && openPushStreams > maxPushStreams) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "createNewInboundLink cannot open a new push stream; maximum number of open push streams reached" + openPushStreams); } return null; } openPushStreams++; } } H2VirtualConnectionImpl h2VC = new H2VirtualConnectionImpl(initialVC); // remove the HttpDispatcherLink from the map, so a new one will be created and used by this new H2 stream h2VC.getStateMap().remove(HttpDispatcherLink.LINK_ID); H2HttpInboundLinkWrap link = new H2HttpInboundLinkWrap(httpInboundChannel, h2VC, streamID, this); H2StreamProcessor stream = new H2StreamProcessor(streamID, link, this); // for now, assume parent stream ID is root, need to change soon writeQ.addNewNodeToQ(streamID, Node.ROOT_STREAM_ID, Node.DEFAULT_NODE_PRIORITY, false); streamTable.put(streamID, stream); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "createNewInboundLink exit: returning stream: " + streamID + " " + stream); } return stream; }
[ "public", "H2StreamProcessor", "createNewInboundLink", "(", "Integer", "streamID", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"createNewInboundLink entry: stream-id: \"", "+", "streamID", ")", ";", "}", "if", "(", "(", "streamID", "%", "2", "==", "0", ")", "&&", "(", "streamID", "!=", "0", ")", ")", "{", "synchronized", "(", "streamOpenCloseSync", ")", "{", "int", "maxPushStreams", "=", "getRemoteConnectionSettings", "(", ")", ".", "getMaxConcurrentStreams", "(", ")", ";", "// if there are too many locally-open active streams, don't open a new one", "if", "(", "maxPushStreams", ">=", "0", "&&", "openPushStreams", ">", "maxPushStreams", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"createNewInboundLink cannot open a new push stream; maximum number of open push streams reached\"", "+", "openPushStreams", ")", ";", "}", "return", "null", ";", "}", "openPushStreams", "++", ";", "}", "}", "H2VirtualConnectionImpl", "h2VC", "=", "new", "H2VirtualConnectionImpl", "(", "initialVC", ")", ";", "// remove the HttpDispatcherLink from the map, so a new one will be created and used by this new H2 stream", "h2VC", ".", "getStateMap", "(", ")", ".", "remove", "(", "HttpDispatcherLink", ".", "LINK_ID", ")", ";", "H2HttpInboundLinkWrap", "link", "=", "new", "H2HttpInboundLinkWrap", "(", "httpInboundChannel", ",", "h2VC", ",", "streamID", ",", "this", ")", ";", "H2StreamProcessor", "stream", "=", "new", "H2StreamProcessor", "(", "streamID", ",", "link", ",", "this", ")", ";", "// for now, assume parent stream ID is root, need to change soon", "writeQ", ".", "addNewNodeToQ", "(", "streamID", ",", "Node", ".", "ROOT_STREAM_ID", ",", "Node", ".", "DEFAULT_NODE_PRIORITY", ",", "false", ")", ";", "streamTable", ".", "put", "(", "streamID", ",", "stream", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"createNewInboundLink exit: returning stream: \"", "+", "streamID", "+", "\" \"", "+", "stream", ")", ";", "}", "return", "stream", ";", "}" ]
Create a new stream and add it to this link. If the stream ID is even, check to make sure this link has not exceeded the maximum number of concurrent streams (as set by the client); if too many streams are open, don't open a new one. @param streamID @return null if creating this stream would exceed the maximum number locally-opened streams
[ "Create", "a", "new", "stream", "and", "add", "it", "to", "this", "link", ".", "If", "the", "stream", "ID", "is", "even", "check", "to", "make", "sure", "this", "link", "has", "not", "exceeded", "the", "maximum", "number", "of", "concurrent", "streams", "(", "as", "set", "by", "the", "client", ")", ";", "if", "too", "many", "streams", "are", "open", "don", "t", "open", "a", "new", "one", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2InboundLink.java#L219-L250
ops4j/org.ops4j.pax.logging
pax-logging-service/src/main/java/org/apache/log4j/receivers/db/DBReceiverJob.java
DBReceiverJob.getProperties
void getProperties(Connection connection, long id, LoggingEvent event) throws SQLException { """ Retrieve the event properties from the logging_event_property table. @param connection @param id @param event @throws SQLException """ PreparedStatement statement = connection.prepareStatement(sqlProperties); try { statement.setLong(1, id); ResultSet rs = statement.executeQuery(); while (rs.next()) { String key = rs.getString(1); String value = rs.getString(2); event.setProperty(key, value); } } finally { statement.close(); } }
java
void getProperties(Connection connection, long id, LoggingEvent event) throws SQLException { PreparedStatement statement = connection.prepareStatement(sqlProperties); try { statement.setLong(1, id); ResultSet rs = statement.executeQuery(); while (rs.next()) { String key = rs.getString(1); String value = rs.getString(2); event.setProperty(key, value); } } finally { statement.close(); } }
[ "void", "getProperties", "(", "Connection", "connection", ",", "long", "id", ",", "LoggingEvent", "event", ")", "throws", "SQLException", "{", "PreparedStatement", "statement", "=", "connection", ".", "prepareStatement", "(", "sqlProperties", ")", ";", "try", "{", "statement", ".", "setLong", "(", "1", ",", "id", ")", ";", "ResultSet", "rs", "=", "statement", ".", "executeQuery", "(", ")", ";", "while", "(", "rs", ".", "next", "(", ")", ")", "{", "String", "key", "=", "rs", ".", "getString", "(", "1", ")", ";", "String", "value", "=", "rs", ".", "getString", "(", "2", ")", ";", "event", ".", "setProperty", "(", "key", ",", "value", ")", ";", "}", "}", "finally", "{", "statement", ".", "close", "(", ")", ";", "}", "}" ]
Retrieve the event properties from the logging_event_property table. @param connection @param id @param event @throws SQLException
[ "Retrieve", "the", "event", "properties", "from", "the", "logging_event_property", "table", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/receivers/db/DBReceiverJob.java#L172-L188
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_orderable_feature_GET
public Boolean serviceName_orderable_feature_GET(String serviceName, OvhOrderableSysFeatureEnum feature) throws IOException { """ Is this feature orderable with your server REST: GET /dedicated/server/{serviceName}/orderable/feature @param feature [required] the feature @param serviceName [required] The internal name of your dedicated server """ String qPath = "/dedicated/server/{serviceName}/orderable/feature"; StringBuilder sb = path(qPath, serviceName); query(sb, "feature", feature); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, Boolean.class); }
java
public Boolean serviceName_orderable_feature_GET(String serviceName, OvhOrderableSysFeatureEnum feature) throws IOException { String qPath = "/dedicated/server/{serviceName}/orderable/feature"; StringBuilder sb = path(qPath, serviceName); query(sb, "feature", feature); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, Boolean.class); }
[ "public", "Boolean", "serviceName_orderable_feature_GET", "(", "String", "serviceName", ",", "OvhOrderableSysFeatureEnum", "feature", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/orderable/feature\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"feature\"", ",", "feature", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "Boolean", ".", "class", ")", ";", "}" ]
Is this feature orderable with your server REST: GET /dedicated/server/{serviceName}/orderable/feature @param feature [required] the feature @param serviceName [required] The internal name of your dedicated server
[ "Is", "this", "feature", "orderable", "with", "your", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L283-L289
HsiangLeekwok/hlklib
hlklib/src/main/java/com/hlk/hlklib/lib/emoji/EmojiUtility.java
EmojiUtility.dealExpression
private static void dealExpression(Context context, SpannableString spannableString, Pattern patten, int start, boolean adjustEmoji) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { """ 对spanableString进行正则判断,如果符合要求,则以表情图片代替 @param context context @param spannableString htmlstring @param patten patten @param start start index @param adjustEmoji 是否缩放表情图 @throws SecurityException @throws NoSuchFieldException @throws NumberFormatException @throws IllegalArgumentException @throws IllegalAccessException """ Matcher matcher = patten.matcher(spannableString); while (matcher.find()) { String key = matcher.group(); if (matcher.start() < start) { continue; } // 通过上面匹配得到的字符串来生成图片资源id EmojiItem item = getEmojiItem(key); if (null != item) { // 计算该图片名字的长度,也就是要替换的字符串的长度 int end = matcher.start() + key.length(); // 通过图片资源id来得到图像,用一个ImageSpan来包装 // 设置图片的大小为系统默认文字大小,以便文字图片对齐 Drawable drawable = context.getResources().getDrawable(item.getResId()); if (adjustEmoji && emojiSize > 0) { drawable.setBounds(0, 0, emojiSize, emojiSize); } else { // 不缩放时用默认的宽高 drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); } CenteredImageSpan imageSpan = new CenteredImageSpan(drawable, ImageSpan.ALIGN_BOTTOM); // 将该图片替换字符串中规定的位置中 spannableString.setSpan(imageSpan, matcher.start(), end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); if (end < spannableString.length()) { // 如果整个字符串还未验证完,则继续递归查询替换。。 dealExpression(context, spannableString, patten, end, adjustEmoji); } break; } } }
java
private static void dealExpression(Context context, SpannableString spannableString, Pattern patten, int start, boolean adjustEmoji) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Matcher matcher = patten.matcher(spannableString); while (matcher.find()) { String key = matcher.group(); if (matcher.start() < start) { continue; } // 通过上面匹配得到的字符串来生成图片资源id EmojiItem item = getEmojiItem(key); if (null != item) { // 计算该图片名字的长度,也就是要替换的字符串的长度 int end = matcher.start() + key.length(); // 通过图片资源id来得到图像,用一个ImageSpan来包装 // 设置图片的大小为系统默认文字大小,以便文字图片对齐 Drawable drawable = context.getResources().getDrawable(item.getResId()); if (adjustEmoji && emojiSize > 0) { drawable.setBounds(0, 0, emojiSize, emojiSize); } else { // 不缩放时用默认的宽高 drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); } CenteredImageSpan imageSpan = new CenteredImageSpan(drawable, ImageSpan.ALIGN_BOTTOM); // 将该图片替换字符串中规定的位置中 spannableString.setSpan(imageSpan, matcher.start(), end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); if (end < spannableString.length()) { // 如果整个字符串还未验证完,则继续递归查询替换。。 dealExpression(context, spannableString, patten, end, adjustEmoji); } break; } } }
[ "private", "static", "void", "dealExpression", "(", "Context", "context", ",", "SpannableString", "spannableString", ",", "Pattern", "patten", ",", "int", "start", ",", "boolean", "adjustEmoji", ")", "throws", "SecurityException", ",", "NoSuchFieldException", ",", "IllegalArgumentException", ",", "IllegalAccessException", "{", "Matcher", "matcher", "=", "patten", ".", "matcher", "(", "spannableString", ")", ";", "while", "(", "matcher", ".", "find", "(", ")", ")", "{", "String", "key", "=", "matcher", ".", "group", "(", ")", ";", "if", "(", "matcher", ".", "start", "(", ")", "<", "start", ")", "{", "continue", ";", "}", "// 通过上面匹配得到的字符串来生成图片资源id", "EmojiItem", "item", "=", "getEmojiItem", "(", "key", ")", ";", "if", "(", "null", "!=", "item", ")", "{", "// 计算该图片名字的长度,也就是要替换的字符串的长度", "int", "end", "=", "matcher", ".", "start", "(", ")", "+", "key", ".", "length", "(", ")", ";", "// 通过图片资源id来得到图像,用一个ImageSpan来包装", "// 设置图片的大小为系统默认文字大小,以便文字图片对齐", "Drawable", "drawable", "=", "context", ".", "getResources", "(", ")", ".", "getDrawable", "(", "item", ".", "getResId", "(", ")", ")", ";", "if", "(", "adjustEmoji", "&&", "emojiSize", ">", "0", ")", "{", "drawable", ".", "setBounds", "(", "0", ",", "0", ",", "emojiSize", ",", "emojiSize", ")", ";", "}", "else", "{", "// 不缩放时用默认的宽高", "drawable", ".", "setBounds", "(", "0", ",", "0", ",", "drawable", ".", "getIntrinsicWidth", "(", ")", ",", "drawable", ".", "getIntrinsicHeight", "(", ")", ")", ";", "}", "CenteredImageSpan", "imageSpan", "=", "new", "CenteredImageSpan", "(", "drawable", ",", "ImageSpan", ".", "ALIGN_BOTTOM", ")", ";", "// 将该图片替换字符串中规定的位置中", "spannableString", ".", "setSpan", "(", "imageSpan", ",", "matcher", ".", "start", "(", ")", ",", "end", ",", "Spannable", ".", "SPAN_INCLUSIVE_EXCLUSIVE", ")", ";", "if", "(", "end", "<", "spannableString", ".", "length", "(", ")", ")", "{", "// 如果整个字符串还未验证完,则继续递归查询替换。。", "dealExpression", "(", "context", ",", "spannableString", ",", "patten", ",", "end", ",", "adjustEmoji", ")", ";", "}", "break", ";", "}", "}", "}" ]
对spanableString进行正则判断,如果符合要求,则以表情图片代替 @param context context @param spannableString htmlstring @param patten patten @param start start index @param adjustEmoji 是否缩放表情图 @throws SecurityException @throws NoSuchFieldException @throws NumberFormatException @throws IllegalArgumentException @throws IllegalAccessException
[ "对spanableString进行正则判断,如果符合要求,则以表情图片代替" ]
train
https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/lib/emoji/EmojiUtility.java#L116-L148
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QRDecompositionHouseholderColumn_ZDRM.java
QRDecompositionHouseholderColumn_ZDRM.getQ
@Override public ZMatrixRMaj getQ(ZMatrixRMaj Q , boolean compact ) { """ Computes the Q matrix from the imformation stored in the QR matrix. This operation requires about 4(m<sup>2</sup>n-mn<sup>2</sup>+n<sup>3</sup>/3) flops. @param Q The orthogonal Q matrix. """ if( compact ) Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,minLength); else Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,numRows); for( int j = minLength-1; j >= 0; j-- ) { double u[] = dataQR[j]; double vvReal = u[j*2]; double vvImag = u[j*2+1]; u[j*2] = 1; u[j*2+1] = 0; double gammaReal = gammas[j]; QrHelperFunctions_ZDRM.rank1UpdateMultR(Q, u,0, gammaReal,j, j, numRows, v); u[j*2] = vvReal; u[j*2+1] = vvImag; } return Q; }
java
@Override public ZMatrixRMaj getQ(ZMatrixRMaj Q , boolean compact ) { if( compact ) Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,minLength); else Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,numRows); for( int j = minLength-1; j >= 0; j-- ) { double u[] = dataQR[j]; double vvReal = u[j*2]; double vvImag = u[j*2+1]; u[j*2] = 1; u[j*2+1] = 0; double gammaReal = gammas[j]; QrHelperFunctions_ZDRM.rank1UpdateMultR(Q, u,0, gammaReal,j, j, numRows, v); u[j*2] = vvReal; u[j*2+1] = vvImag; } return Q; }
[ "@", "Override", "public", "ZMatrixRMaj", "getQ", "(", "ZMatrixRMaj", "Q", ",", "boolean", "compact", ")", "{", "if", "(", "compact", ")", "Q", "=", "UtilDecompositons_ZDRM", ".", "checkIdentity", "(", "Q", ",", "numRows", ",", "minLength", ")", ";", "else", "Q", "=", "UtilDecompositons_ZDRM", ".", "checkIdentity", "(", "Q", ",", "numRows", ",", "numRows", ")", ";", "for", "(", "int", "j", "=", "minLength", "-", "1", ";", "j", ">=", "0", ";", "j", "--", ")", "{", "double", "u", "[", "]", "=", "dataQR", "[", "j", "]", ";", "double", "vvReal", "=", "u", "[", "j", "*", "2", "]", ";", "double", "vvImag", "=", "u", "[", "j", "*", "2", "+", "1", "]", ";", "u", "[", "j", "*", "2", "]", "=", "1", ";", "u", "[", "j", "*", "2", "+", "1", "]", "=", "0", ";", "double", "gammaReal", "=", "gammas", "[", "j", "]", ";", "QrHelperFunctions_ZDRM", ".", "rank1UpdateMultR", "(", "Q", ",", "u", ",", "0", ",", "gammaReal", ",", "j", ",", "j", ",", "numRows", ",", "v", ")", ";", "u", "[", "j", "*", "2", "]", "=", "vvReal", ";", "u", "[", "j", "*", "2", "+", "1", "]", "=", "vvImag", ";", "}", "return", "Q", ";", "}" ]
Computes the Q matrix from the imformation stored in the QR matrix. This operation requires about 4(m<sup>2</sup>n-mn<sup>2</sup>+n<sup>3</sup>/3) flops. @param Q The orthogonal Q matrix.
[ "Computes", "the", "Q", "matrix", "from", "the", "imformation", "stored", "in", "the", "QR", "matrix", ".", "This", "operation", "requires", "about", "4", "(", "m<sup", ">", "2<", "/", "sup", ">", "n", "-", "mn<sup", ">", "2<", "/", "sup", ">", "+", "n<sup", ">", "3<", "/", "sup", ">", "/", "3", ")", "flops", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QRDecompositionHouseholderColumn_ZDRM.java#L99-L123
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java
ErrorReportDialog.setIsStepEnabled
private void setIsStepEnabled(int step, boolean isEnabled) { """ Configure the steps that are enabled. @param step step to configure @param isEnabled if it is enabled """ try { Object oRoadmapItem = m_xRMIndexCont.getByIndex(step - 1); XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); xRMItemPSet.setPropertyValue("Enabled", new Boolean(isEnabled)); } catch (com.sun.star.uno.Exception e) { LOGGER.log(Level.SEVERE, "Error in setIsStepEnabled", e); throw new CogrooRuntimeException(e); } }
java
private void setIsStepEnabled(int step, boolean isEnabled) { try { Object oRoadmapItem = m_xRMIndexCont.getByIndex(step - 1); XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); xRMItemPSet.setPropertyValue("Enabled", new Boolean(isEnabled)); } catch (com.sun.star.uno.Exception e) { LOGGER.log(Level.SEVERE, "Error in setIsStepEnabled", e); throw new CogrooRuntimeException(e); } }
[ "private", "void", "setIsStepEnabled", "(", "int", "step", ",", "boolean", "isEnabled", ")", "{", "try", "{", "Object", "oRoadmapItem", "=", "m_xRMIndexCont", ".", "getByIndex", "(", "step", "-", "1", ")", ";", "XPropertySet", "xRMItemPSet", "=", "(", "XPropertySet", ")", "UnoRuntime", ".", "queryInterface", "(", "XPropertySet", ".", "class", ",", "oRoadmapItem", ")", ";", "xRMItemPSet", ".", "setPropertyValue", "(", "\"Enabled\"", ",", "new", "Boolean", "(", "isEnabled", ")", ")", ";", "}", "catch", "(", "com", ".", "sun", ".", "star", ".", "uno", ".", "Exception", "e", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Error in setIsStepEnabled\"", ",", "e", ")", ";", "throw", "new", "CogrooRuntimeException", "(", "e", ")", ";", "}", "}" ]
Configure the steps that are enabled. @param step step to configure @param isEnabled if it is enabled
[ "Configure", "the", "steps", "that", "are", "enabled", "." ]
train
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/ErrorReportDialog.java#L524-L533
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java
EventServiceSegment.addRegistration
public boolean addRegistration(String topic, Registration registration) { """ Adds a registration for the {@code topic} and notifies the listener and service of the listener registration. Returns if the registration was added. The registration might not be added if an equal instance is already registered. @param topic the event topic @param registration the listener registration @return if the registration is added """ Collection<Registration> registrations = getRegistrations(topic, true); if (registrations.add(registration)) { registrationIdMap.put(registration.getId(), registration); pingNotifiableEventListener(topic, registration, true); return true; } return false; }
java
public boolean addRegistration(String topic, Registration registration) { Collection<Registration> registrations = getRegistrations(topic, true); if (registrations.add(registration)) { registrationIdMap.put(registration.getId(), registration); pingNotifiableEventListener(topic, registration, true); return true; } return false; }
[ "public", "boolean", "addRegistration", "(", "String", "topic", ",", "Registration", "registration", ")", "{", "Collection", "<", "Registration", ">", "registrations", "=", "getRegistrations", "(", "topic", ",", "true", ")", ";", "if", "(", "registrations", ".", "add", "(", "registration", ")", ")", "{", "registrationIdMap", ".", "put", "(", "registration", ".", "getId", "(", ")", ",", "registration", ")", ";", "pingNotifiableEventListener", "(", "topic", ",", "registration", ",", "true", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Adds a registration for the {@code topic} and notifies the listener and service of the listener registration. Returns if the registration was added. The registration might not be added if an equal instance is already registered. @param topic the event topic @param registration the listener registration @return if the registration is added
[ "Adds", "a", "registration", "for", "the", "{", "@code", "topic", "}", "and", "notifies", "the", "listener", "and", "service", "of", "the", "listener", "registration", ".", "Returns", "if", "the", "registration", "was", "added", ".", "The", "registration", "might", "not", "be", "added", "if", "an", "equal", "instance", "is", "already", "registered", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java#L153-L161
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java
MailService.findMessages
public List<MailMessage> findMessages(final String accountReservationKey, final Predicate<MailMessage> condition, final long timeoutSeconds) { """ Tries to find messages for the mail account reserved under the specified {@code accountReservationKey} applying the specified {@code condition} until it times out using the specified {@code timeout} and {@link EmailConstants#MAIL_SLEEP_MILLIS}. @param accountReservationKey the key under which the account has been reserved @param condition the condition a message must meet @param timeoutSeconds the timeout in seconds @return an immutable list of mail messages """ return findMessages(accountReservationKey, condition, timeoutSeconds, defaultSleepMillis); }
java
public List<MailMessage> findMessages(final String accountReservationKey, final Predicate<MailMessage> condition, final long timeoutSeconds) { return findMessages(accountReservationKey, condition, timeoutSeconds, defaultSleepMillis); }
[ "public", "List", "<", "MailMessage", ">", "findMessages", "(", "final", "String", "accountReservationKey", ",", "final", "Predicate", "<", "MailMessage", ">", "condition", ",", "final", "long", "timeoutSeconds", ")", "{", "return", "findMessages", "(", "accountReservationKey", ",", "condition", ",", "timeoutSeconds", ",", "defaultSleepMillis", ")", ";", "}" ]
Tries to find messages for the mail account reserved under the specified {@code accountReservationKey} applying the specified {@code condition} until it times out using the specified {@code timeout} and {@link EmailConstants#MAIL_SLEEP_MILLIS}. @param accountReservationKey the key under which the account has been reserved @param condition the condition a message must meet @param timeoutSeconds the timeout in seconds @return an immutable list of mail messages
[ "Tries", "to", "find", "messages", "for", "the", "mail", "account", "reserved", "under", "the", "specified", "{", "@code", "accountReservationKey", "}", "applying", "the", "specified", "{", "@code", "condition", "}", "until", "it", "times", "out", "using", "the", "specified", "{", "@code", "timeout", "}", "and", "{", "@link", "EmailConstants#MAIL_SLEEP_MILLIS", "}", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java#L302-L305
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getNestingPageFlow
public static PageFlowController getNestingPageFlow( HttpServletRequest request, ServletContext servletContext ) { """ Get the {@link PageFlowController} that is nesting the current one. @param request the current HttpServletRequest. @param servletContext the current ServletContext. @return the nesting {@link PageFlowController}, or <code>null</code> if the current one is not being nested. """ PageFlowStack jpfStack = PageFlowStack.get( request, servletContext, false ); if ( jpfStack != null && ! jpfStack.isEmpty() ) { PageFlowController top = jpfStack.peek().getPageFlow(); return top; } return null; }
java
public static PageFlowController getNestingPageFlow( HttpServletRequest request, ServletContext servletContext ) { PageFlowStack jpfStack = PageFlowStack.get( request, servletContext, false ); if ( jpfStack != null && ! jpfStack.isEmpty() ) { PageFlowController top = jpfStack.peek().getPageFlow(); return top; } return null; }
[ "public", "static", "PageFlowController", "getNestingPageFlow", "(", "HttpServletRequest", "request", ",", "ServletContext", "servletContext", ")", "{", "PageFlowStack", "jpfStack", "=", "PageFlowStack", ".", "get", "(", "request", ",", "servletContext", ",", "false", ")", ";", "if", "(", "jpfStack", "!=", "null", "&&", "!", "jpfStack", ".", "isEmpty", "(", ")", ")", "{", "PageFlowController", "top", "=", "jpfStack", ".", "peek", "(", ")", ".", "getPageFlow", "(", ")", ";", "return", "top", ";", "}", "return", "null", ";", "}" ]
Get the {@link PageFlowController} that is nesting the current one. @param request the current HttpServletRequest. @param servletContext the current ServletContext. @return the nesting {@link PageFlowController}, or <code>null</code> if the current one is not being nested.
[ "Get", "the", "{", "@link", "PageFlowController", "}", "that", "is", "nesting", "the", "current", "one", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L231-L242
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Main.java
Main.run
public static int run(String[] args, PrintWriter out) { """ Entry point that does <i>not</i> call System.exit. @param args command line arguments @param out output stream @return an exit code. 0 means success, non-zero means an error occurred. """ JdepsTask t = new JdepsTask(); t.setLog(out); return t.run(args); }
java
public static int run(String[] args, PrintWriter out) { JdepsTask t = new JdepsTask(); t.setLog(out); return t.run(args); }
[ "public", "static", "int", "run", "(", "String", "[", "]", "args", ",", "PrintWriter", "out", ")", "{", "JdepsTask", "t", "=", "new", "JdepsTask", "(", ")", ";", "t", ".", "setLog", "(", "out", ")", ";", "return", "t", ".", "run", "(", "args", ")", ";", "}" ]
Entry point that does <i>not</i> call System.exit. @param args command line arguments @param out output stream @return an exit code. 0 means success, non-zero means an error occurred.
[ "Entry", "point", "that", "does", "<i", ">", "not<", "/", "i", ">", "call", "System", ".", "exit", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Main.java#L61-L65
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/CopticDate.java
CopticDate.ofYearDay
static CopticDate ofYearDay(int prolepticYear, int dayOfYear) { """ Obtains a {@code CopticDate} representing a date in the Coptic calendar system from the proleptic-year and day-of-year fields. <p> This returns a {@code CopticDate} with the specified fields. The day must be valid for the year, otherwise an exception will be thrown. @param prolepticYear the Coptic proleptic-year @param dayOfYear the Coptic day-of-year, from 1 to 366 @return the date in Coptic calendar system, not null @throws DateTimeException if the value of any field is out of range, or if the day-of-year is invalid for the year """ CopticChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR); DAY_OF_YEAR.range().checkValidValue(dayOfYear, DAY_OF_YEAR); if (dayOfYear == 366 && CopticChronology.INSTANCE.isLeapYear(prolepticYear) == false) { throw new DateTimeException("Invalid date 'Nasie 6' as '" + prolepticYear + "' is not a leap year"); } return new CopticDate(prolepticYear, (dayOfYear - 1) / 30 + 1, (dayOfYear - 1) % 30 + 1); }
java
static CopticDate ofYearDay(int prolepticYear, int dayOfYear) { CopticChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR); DAY_OF_YEAR.range().checkValidValue(dayOfYear, DAY_OF_YEAR); if (dayOfYear == 366 && CopticChronology.INSTANCE.isLeapYear(prolepticYear) == false) { throw new DateTimeException("Invalid date 'Nasie 6' as '" + prolepticYear + "' is not a leap year"); } return new CopticDate(prolepticYear, (dayOfYear - 1) / 30 + 1, (dayOfYear - 1) % 30 + 1); }
[ "static", "CopticDate", "ofYearDay", "(", "int", "prolepticYear", ",", "int", "dayOfYear", ")", "{", "CopticChronology", ".", "YEAR_RANGE", ".", "checkValidValue", "(", "prolepticYear", ",", "YEAR", ")", ";", "DAY_OF_YEAR", ".", "range", "(", ")", ".", "checkValidValue", "(", "dayOfYear", ",", "DAY_OF_YEAR", ")", ";", "if", "(", "dayOfYear", "==", "366", "&&", "CopticChronology", ".", "INSTANCE", ".", "isLeapYear", "(", "prolepticYear", ")", "==", "false", ")", "{", "throw", "new", "DateTimeException", "(", "\"Invalid date 'Nasie 6' as '\"", "+", "prolepticYear", "+", "\"' is not a leap year\"", ")", ";", "}", "return", "new", "CopticDate", "(", "prolepticYear", ",", "(", "dayOfYear", "-", "1", ")", "/", "30", "+", "1", ",", "(", "dayOfYear", "-", "1", ")", "%", "30", "+", "1", ")", ";", "}" ]
Obtains a {@code CopticDate} representing a date in the Coptic calendar system from the proleptic-year and day-of-year fields. <p> This returns a {@code CopticDate} with the specified fields. The day must be valid for the year, otherwise an exception will be thrown. @param prolepticYear the Coptic proleptic-year @param dayOfYear the Coptic day-of-year, from 1 to 366 @return the date in Coptic calendar system, not null @throws DateTimeException if the value of any field is out of range, or if the day-of-year is invalid for the year
[ "Obtains", "a", "{", "@code", "CopticDate", "}", "representing", "a", "date", "in", "the", "Coptic", "calendar", "system", "from", "the", "proleptic", "-", "year", "and", "day", "-", "of", "-", "year", "fields", ".", "<p", ">", "This", "returns", "a", "{", "@code", "CopticDate", "}", "with", "the", "specified", "fields", ".", "The", "day", "must", "be", "valid", "for", "the", "year", "otherwise", "an", "exception", "will", "be", "thrown", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/CopticDate.java#L201-L208
facebookarchive/hadoop-20
src/core/org/apache/hadoop/filecache/DistributedCache.java
DistributedCache.createAllSymlink
public static void createAllSymlink(Configuration conf, File jobCacheDir, File workDir) throws IOException { """ This method create symlinks for all files in a given dir in another directory @param conf the configuration @param jobCacheDir the target directory for creating symlinks @param workDir the directory in which the symlinks are created @throws IOException """ if ((jobCacheDir == null || !jobCacheDir.isDirectory()) || workDir == null || (!workDir.isDirectory())) { return; } boolean createSymlink = getSymlink(conf); if (createSymlink){ File[] list = jobCacheDir.listFiles(); for (int i=0; i < list.length; i++){ FileUtil.symLink(list[i].getAbsolutePath(), new File(workDir, list[i].getName()).toString()); } } }
java
public static void createAllSymlink(Configuration conf, File jobCacheDir, File workDir) throws IOException{ if ((jobCacheDir == null || !jobCacheDir.isDirectory()) || workDir == null || (!workDir.isDirectory())) { return; } boolean createSymlink = getSymlink(conf); if (createSymlink){ File[] list = jobCacheDir.listFiles(); for (int i=0; i < list.length; i++){ FileUtil.symLink(list[i].getAbsolutePath(), new File(workDir, list[i].getName()).toString()); } } }
[ "public", "static", "void", "createAllSymlink", "(", "Configuration", "conf", ",", "File", "jobCacheDir", ",", "File", "workDir", ")", "throws", "IOException", "{", "if", "(", "(", "jobCacheDir", "==", "null", "||", "!", "jobCacheDir", ".", "isDirectory", "(", ")", ")", "||", "workDir", "==", "null", "||", "(", "!", "workDir", ".", "isDirectory", "(", ")", ")", ")", "{", "return", ";", "}", "boolean", "createSymlink", "=", "getSymlink", "(", "conf", ")", ";", "if", "(", "createSymlink", ")", "{", "File", "[", "]", "list", "=", "jobCacheDir", ".", "listFiles", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "length", ";", "i", "++", ")", "{", "FileUtil", ".", "symLink", "(", "list", "[", "i", "]", ".", "getAbsolutePath", "(", ")", ",", "new", "File", "(", "workDir", ",", "list", "[", "i", "]", ".", "getName", "(", ")", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "}" ]
This method create symlinks for all files in a given dir in another directory @param conf the configuration @param jobCacheDir the target directory for creating symlinks @param workDir the directory in which the symlinks are created @throws IOException
[ "This", "method", "create", "symlinks", "for", "all", "files", "in", "a", "given", "dir", "in", "another", "directory" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/filecache/DistributedCache.java#L674-L689
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/Tesseract1.java
Tesseract1.createDocuments
@Override public void createDocuments(String filename, String outputbase, List<RenderedFormat> formats) throws TesseractException { """ Creates documents for given renderer. @param filename input image @param outputbase output filename without extension @param formats types of renderer @throws TesseractException """ createDocuments(new String[]{filename}, new String[]{outputbase}, formats); }
java
@Override public void createDocuments(String filename, String outputbase, List<RenderedFormat> formats) throws TesseractException { createDocuments(new String[]{filename}, new String[]{outputbase}, formats); }
[ "@", "Override", "public", "void", "createDocuments", "(", "String", "filename", ",", "String", "outputbase", ",", "List", "<", "RenderedFormat", ">", "formats", ")", "throws", "TesseractException", "{", "createDocuments", "(", "new", "String", "[", "]", "{", "filename", "}", ",", "new", "String", "[", "]", "{", "outputbase", "}", ",", "formats", ")", ";", "}" ]
Creates documents for given renderer. @param filename input image @param outputbase output filename without extension @param formats types of renderer @throws TesseractException
[ "Creates", "documents", "for", "given", "renderer", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/Tesseract1.java#L579-L582
tvesalainen/util
util/src/main/java/org/vesalainen/math/AbstractLine.java
AbstractLine.crossPoint
public static Point crossPoint(Line l1, Line l2, AbstractPoint p) { """ Returns the crosspoint of lines l1 and l2. If lines don't cross returns null. <p>Note returns null if lines are parallel and also when lines ate equal.! <p>If p != null returns populated p. <p>If returns null p is not updated. @param l1 @param l2 @param p @return """ if (Double.isInfinite(l1.getSlope())) { if (Double.isInfinite(l2.getSlope())) { return null; } else { return cyclePoint(p, l1.getA(), l2.getY(l1.getA())); } } if (Double.isInfinite(l2.getSlope())) { return cyclePoint(p, l2.getA(), l1.getY(l2.getA())); } double x1 = 0; double y1 = l1.getY(x1); double x2 = 10; double y2 = l1.getY(x2); double x3 = 0; double y3 = l2.getY(x3); double x4 = 10; double y4 = l2.getY(x4); double dd = det(x1-x2, y1-y2, x3-x4, y3-y4); if (dd == 0) { return null; } double x1y1x2y2 = det(x1, y1, x2, y2); double x3y3x4y4 = det(x3, y3, x4, y4); double xu = det(x1y1x2y2, x1-x2, x3y3x4y4, x3-x4); double yu = det(x1y1x2y2, y1-y2, x3y3x4y4, y3-y4); return cyclePoint(p, xu/dd, yu/dd); }
java
public static Point crossPoint(Line l1, Line l2, AbstractPoint p) { if (Double.isInfinite(l1.getSlope())) { if (Double.isInfinite(l2.getSlope())) { return null; } else { return cyclePoint(p, l1.getA(), l2.getY(l1.getA())); } } if (Double.isInfinite(l2.getSlope())) { return cyclePoint(p, l2.getA(), l1.getY(l2.getA())); } double x1 = 0; double y1 = l1.getY(x1); double x2 = 10; double y2 = l1.getY(x2); double x3 = 0; double y3 = l2.getY(x3); double x4 = 10; double y4 = l2.getY(x4); double dd = det(x1-x2, y1-y2, x3-x4, y3-y4); if (dd == 0) { return null; } double x1y1x2y2 = det(x1, y1, x2, y2); double x3y3x4y4 = det(x3, y3, x4, y4); double xu = det(x1y1x2y2, x1-x2, x3y3x4y4, x3-x4); double yu = det(x1y1x2y2, y1-y2, x3y3x4y4, y3-y4); return cyclePoint(p, xu/dd, yu/dd); }
[ "public", "static", "Point", "crossPoint", "(", "Line", "l1", ",", "Line", "l2", ",", "AbstractPoint", "p", ")", "{", "if", "(", "Double", ".", "isInfinite", "(", "l1", ".", "getSlope", "(", ")", ")", ")", "{", "if", "(", "Double", ".", "isInfinite", "(", "l2", ".", "getSlope", "(", ")", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return", "cyclePoint", "(", "p", ",", "l1", ".", "getA", "(", ")", ",", "l2", ".", "getY", "(", "l1", ".", "getA", "(", ")", ")", ")", ";", "}", "}", "if", "(", "Double", ".", "isInfinite", "(", "l2", ".", "getSlope", "(", ")", ")", ")", "{", "return", "cyclePoint", "(", "p", ",", "l2", ".", "getA", "(", ")", ",", "l1", ".", "getY", "(", "l2", ".", "getA", "(", ")", ")", ")", ";", "}", "double", "x1", "=", "0", ";", "double", "y1", "=", "l1", ".", "getY", "(", "x1", ")", ";", "double", "x2", "=", "10", ";", "double", "y2", "=", "l1", ".", "getY", "(", "x2", ")", ";", "double", "x3", "=", "0", ";", "double", "y3", "=", "l2", ".", "getY", "(", "x3", ")", ";", "double", "x4", "=", "10", ";", "double", "y4", "=", "l2", ".", "getY", "(", "x4", ")", ";", "double", "dd", "=", "det", "(", "x1", "-", "x2", ",", "y1", "-", "y2", ",", "x3", "-", "x4", ",", "y3", "-", "y4", ")", ";", "if", "(", "dd", "==", "0", ")", "{", "return", "null", ";", "}", "double", "x1y1x2y2", "=", "det", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ")", ";", "double", "x3y3x4y4", "=", "det", "(", "x3", ",", "y3", ",", "x4", ",", "y4", ")", ";", "double", "xu", "=", "det", "(", "x1y1x2y2", ",", "x1", "-", "x2", ",", "x3y3x4y4", ",", "x3", "-", "x4", ")", ";", "double", "yu", "=", "det", "(", "x1y1x2y2", ",", "y1", "-", "y2", ",", "x3y3x4y4", ",", "y3", "-", "y4", ")", ";", "return", "cyclePoint", "(", "p", ",", "xu", "/", "dd", ",", "yu", "/", "dd", ")", ";", "}" ]
Returns the crosspoint of lines l1 and l2. If lines don't cross returns null. <p>Note returns null if lines are parallel and also when lines ate equal.! <p>If p != null returns populated p. <p>If returns null p is not updated. @param l1 @param l2 @param p @return
[ "Returns", "the", "crosspoint", "of", "lines", "l1", "and", "l2", ".", "If", "lines", "don", "t", "cross", "returns", "null", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AbstractLine.java#L174-L214
mabe02/lanterna
src/main/java/com/googlecode/lanterna/TextCharacter.java
TextCharacter.withForegroundColor
public TextCharacter withForegroundColor(TextColor foregroundColor) { """ Returns a copy of this TextCharacter with a specified foreground color @param foregroundColor Foreground color the copy should have @return Copy of the TextCharacter with a different foreground color """ if(this.foregroundColor == foregroundColor || this.foregroundColor.equals(foregroundColor)) { return this; } return new TextCharacter(character, foregroundColor, backgroundColor, modifiers); }
java
public TextCharacter withForegroundColor(TextColor foregroundColor) { if(this.foregroundColor == foregroundColor || this.foregroundColor.equals(foregroundColor)) { return this; } return new TextCharacter(character, foregroundColor, backgroundColor, modifiers); }
[ "public", "TextCharacter", "withForegroundColor", "(", "TextColor", "foregroundColor", ")", "{", "if", "(", "this", ".", "foregroundColor", "==", "foregroundColor", "||", "this", ".", "foregroundColor", ".", "equals", "(", "foregroundColor", ")", ")", "{", "return", "this", ";", "}", "return", "new", "TextCharacter", "(", "character", ",", "foregroundColor", ",", "backgroundColor", ",", "modifiers", ")", ";", "}" ]
Returns a copy of this TextCharacter with a specified foreground color @param foregroundColor Foreground color the copy should have @return Copy of the TextCharacter with a different foreground color
[ "Returns", "a", "copy", "of", "this", "TextCharacter", "with", "a", "specified", "foreground", "color" ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/TextCharacter.java#L225-L230
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java
ElementFilter.methodsIn
public static List<ExecutableElement> methodsIn(Iterable<? extends Element> elements) { """ Returns a list of methods in {@code elements}. @return a list of methods in {@code elements} @param elements the elements to filter """ return listFilter(elements, METHOD_KIND, ExecutableElement.class); }
java
public static List<ExecutableElement> methodsIn(Iterable<? extends Element> elements) { return listFilter(elements, METHOD_KIND, ExecutableElement.class); }
[ "public", "static", "List", "<", "ExecutableElement", ">", "methodsIn", "(", "Iterable", "<", "?", "extends", "Element", ">", "elements", ")", "{", "return", "listFilter", "(", "elements", ",", "METHOD_KIND", ",", "ExecutableElement", ".", "class", ")", ";", "}" ]
Returns a list of methods in {@code elements}. @return a list of methods in {@code elements} @param elements the elements to filter
[ "Returns", "a", "list", "of", "methods", "in", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L132-L135
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/Stream.java
Stream.parallelConcat
public static <T> Stream<T> parallelConcat(final Collection<? extends Stream<? extends T>> c, final int readThreadNum) { """ Put the stream in try-catch to stop the back-end reading thread if error happens <br /> <code> try (Stream<Integer> stream = Stream.parallelConcat(a,b, ...)) { stream.forEach(N::println); } </code> @param c @param readThreadNum @return """ return parallelConcat(c, readThreadNum, calculateQueueSize(c.size())); }
java
public static <T> Stream<T> parallelConcat(final Collection<? extends Stream<? extends T>> c, final int readThreadNum) { return parallelConcat(c, readThreadNum, calculateQueueSize(c.size())); }
[ "public", "static", "<", "T", ">", "Stream", "<", "T", ">", "parallelConcat", "(", "final", "Collection", "<", "?", "extends", "Stream", "<", "?", "extends", "T", ">", ">", "c", ",", "final", "int", "readThreadNum", ")", "{", "return", "parallelConcat", "(", "c", ",", "readThreadNum", ",", "calculateQueueSize", "(", "c", ".", "size", "(", ")", ")", ")", ";", "}" ]
Put the stream in try-catch to stop the back-end reading thread if error happens <br /> <code> try (Stream<Integer> stream = Stream.parallelConcat(a,b, ...)) { stream.forEach(N::println); } </code> @param c @param readThreadNum @return
[ "Put", "the", "stream", "in", "try", "-", "catch", "to", "stop", "the", "back", "-", "end", "reading", "thread", "if", "error", "happens", "<br", "/", ">", "<code", ">", "try", "(", "Stream<Integer", ">", "stream", "=", "Stream", ".", "parallelConcat", "(", "a", "b", "...", "))", "{", "stream", ".", "forEach", "(", "N", "::", "println", ")", ";", "}", "<", "/", "code", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Stream.java#L4255-L4257
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java
CodepointHelper.wrapBidi
@Nullable public static String wrapBidi (@Nullable final String sStr, final char cChar) { """ Wrap the string with the specified bidi control @param sStr source string @param cChar source char @return The wrapped string """ switch (cChar) { case RLE: return _wrap (sStr, RLE, PDF); case RLO: return _wrap (sStr, RLO, PDF); case LRE: return _wrap (sStr, LRE, PDF); case LRO: return _wrap (sStr, LRO, PDF); case RLM: return _wrap (sStr, RLM, RLM); case LRM: return _wrap (sStr, LRM, LRM); default: return sStr; } }
java
@Nullable public static String wrapBidi (@Nullable final String sStr, final char cChar) { switch (cChar) { case RLE: return _wrap (sStr, RLE, PDF); case RLO: return _wrap (sStr, RLO, PDF); case LRE: return _wrap (sStr, LRE, PDF); case LRO: return _wrap (sStr, LRO, PDF); case RLM: return _wrap (sStr, RLM, RLM); case LRM: return _wrap (sStr, LRM, LRM); default: return sStr; } }
[ "@", "Nullable", "public", "static", "String", "wrapBidi", "(", "@", "Nullable", "final", "String", "sStr", ",", "final", "char", "cChar", ")", "{", "switch", "(", "cChar", ")", "{", "case", "RLE", ":", "return", "_wrap", "(", "sStr", ",", "RLE", ",", "PDF", ")", ";", "case", "RLO", ":", "return", "_wrap", "(", "sStr", ",", "RLO", ",", "PDF", ")", ";", "case", "LRE", ":", "return", "_wrap", "(", "sStr", ",", "LRE", ",", "PDF", ")", ";", "case", "LRO", ":", "return", "_wrap", "(", "sStr", ",", "LRO", ",", "PDF", ")", ";", "case", "RLM", ":", "return", "_wrap", "(", "sStr", ",", "RLM", ",", "RLM", ")", ";", "case", "LRM", ":", "return", "_wrap", "(", "sStr", ",", "LRM", ",", "LRM", ")", ";", "default", ":", "return", "sStr", ";", "}", "}" ]
Wrap the string with the specified bidi control @param sStr source string @param cChar source char @return The wrapped string
[ "Wrap", "the", "string", "with", "the", "specified", "bidi", "control" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java#L390-L410
roboconf/roboconf-platform
core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2IaasHandler.java
Ec2IaasHandler.prepareEC2RequestNode
private RunInstancesRequest prepareEC2RequestNode( Map<String,String> targetProperties, String userData ) throws UnsupportedEncodingException { """ Prepares the request. @param targetProperties the target properties @param userData the user data to pass @return a request @throws UnsupportedEncodingException """ RunInstancesRequest runInstancesRequest = new RunInstancesRequest(); String flavor = targetProperties.get(Ec2Constants.VM_INSTANCE_TYPE); if( Utils.isEmptyOrWhitespaces( flavor )) flavor = "t1.micro"; runInstancesRequest.setInstanceType( flavor ); runInstancesRequest.setImageId( targetProperties.get( Ec2Constants.AMI_VM_NODE )); runInstancesRequest.setMinCount( 1 ); runInstancesRequest.setMaxCount( 1 ); runInstancesRequest.setKeyName( targetProperties.get(Ec2Constants.SSH_KEY_NAME)); String secGroup = targetProperties.get(Ec2Constants.SECURITY_GROUP_NAME); if( Utils.isEmptyOrWhitespaces(secGroup)) secGroup = "default"; runInstancesRequest.setSecurityGroups(Collections.singletonList(secGroup)); String availabilityZone = targetProperties.get(Ec2Constants.AVAILABILITY_ZONE); if(! Utils.isEmptyOrWhitespaces(availabilityZone)) runInstancesRequest.setPlacement(new Placement(availabilityZone)); // The following part enables to transmit data to the VM. // When the VM is up, it will be able to read this data. String encodedUserData = new String( Base64.encodeBase64( userData.getBytes( StandardCharsets.UTF_8 )), "UTF-8" ); runInstancesRequest.setUserData( encodedUserData ); return runInstancesRequest; }
java
private RunInstancesRequest prepareEC2RequestNode( Map<String,String> targetProperties, String userData ) throws UnsupportedEncodingException { RunInstancesRequest runInstancesRequest = new RunInstancesRequest(); String flavor = targetProperties.get(Ec2Constants.VM_INSTANCE_TYPE); if( Utils.isEmptyOrWhitespaces( flavor )) flavor = "t1.micro"; runInstancesRequest.setInstanceType( flavor ); runInstancesRequest.setImageId( targetProperties.get( Ec2Constants.AMI_VM_NODE )); runInstancesRequest.setMinCount( 1 ); runInstancesRequest.setMaxCount( 1 ); runInstancesRequest.setKeyName( targetProperties.get(Ec2Constants.SSH_KEY_NAME)); String secGroup = targetProperties.get(Ec2Constants.SECURITY_GROUP_NAME); if( Utils.isEmptyOrWhitespaces(secGroup)) secGroup = "default"; runInstancesRequest.setSecurityGroups(Collections.singletonList(secGroup)); String availabilityZone = targetProperties.get(Ec2Constants.AVAILABILITY_ZONE); if(! Utils.isEmptyOrWhitespaces(availabilityZone)) runInstancesRequest.setPlacement(new Placement(availabilityZone)); // The following part enables to transmit data to the VM. // When the VM is up, it will be able to read this data. String encodedUserData = new String( Base64.encodeBase64( userData.getBytes( StandardCharsets.UTF_8 )), "UTF-8" ); runInstancesRequest.setUserData( encodedUserData ); return runInstancesRequest; }
[ "private", "RunInstancesRequest", "prepareEC2RequestNode", "(", "Map", "<", "String", ",", "String", ">", "targetProperties", ",", "String", "userData", ")", "throws", "UnsupportedEncodingException", "{", "RunInstancesRequest", "runInstancesRequest", "=", "new", "RunInstancesRequest", "(", ")", ";", "String", "flavor", "=", "targetProperties", ".", "get", "(", "Ec2Constants", ".", "VM_INSTANCE_TYPE", ")", ";", "if", "(", "Utils", ".", "isEmptyOrWhitespaces", "(", "flavor", ")", ")", "flavor", "=", "\"t1.micro\"", ";", "runInstancesRequest", ".", "setInstanceType", "(", "flavor", ")", ";", "runInstancesRequest", ".", "setImageId", "(", "targetProperties", ".", "get", "(", "Ec2Constants", ".", "AMI_VM_NODE", ")", ")", ";", "runInstancesRequest", ".", "setMinCount", "(", "1", ")", ";", "runInstancesRequest", ".", "setMaxCount", "(", "1", ")", ";", "runInstancesRequest", ".", "setKeyName", "(", "targetProperties", ".", "get", "(", "Ec2Constants", ".", "SSH_KEY_NAME", ")", ")", ";", "String", "secGroup", "=", "targetProperties", ".", "get", "(", "Ec2Constants", ".", "SECURITY_GROUP_NAME", ")", ";", "if", "(", "Utils", ".", "isEmptyOrWhitespaces", "(", "secGroup", ")", ")", "secGroup", "=", "\"default\"", ";", "runInstancesRequest", ".", "setSecurityGroups", "(", "Collections", ".", "singletonList", "(", "secGroup", ")", ")", ";", "String", "availabilityZone", "=", "targetProperties", ".", "get", "(", "Ec2Constants", ".", "AVAILABILITY_ZONE", ")", ";", "if", "(", "!", "Utils", ".", "isEmptyOrWhitespaces", "(", "availabilityZone", ")", ")", "runInstancesRequest", ".", "setPlacement", "(", "new", "Placement", "(", "availabilityZone", ")", ")", ";", "// The following part enables to transmit data to the VM.", "// When the VM is up, it will be able to read this data.", "String", "encodedUserData", "=", "new", "String", "(", "Base64", ".", "encodeBase64", "(", "userData", ".", "getBytes", "(", "StandardCharsets", ".", "UTF_8", ")", ")", ",", "\"UTF-8\"", ")", ";", "runInstancesRequest", ".", "setUserData", "(", "encodedUserData", ")", ";", "return", "runInstancesRequest", ";", "}" ]
Prepares the request. @param targetProperties the target properties @param userData the user data to pass @return a request @throws UnsupportedEncodingException
[ "Prepares", "the", "request", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2IaasHandler.java#L291-L322
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/tsdb/model/Datapoint.java
Datapoint.addTag
public Datapoint addTag(String tagKey, String tagValue) { """ Add tag for the datapoint. @param tagKey @param tagValue @return Datapoint """ initialTags(); tags.put(tagKey, tagValue); return this; }
java
public Datapoint addTag(String tagKey, String tagValue) { initialTags(); tags.put(tagKey, tagValue); return this; }
[ "public", "Datapoint", "addTag", "(", "String", "tagKey", ",", "String", "tagValue", ")", "{", "initialTags", "(", ")", ";", "tags", ".", "put", "(", "tagKey", ",", "tagValue", ")", ";", "return", "this", ";", "}" ]
Add tag for the datapoint. @param tagKey @param tagValue @return Datapoint
[ "Add", "tag", "for", "the", "datapoint", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/tsdb/model/Datapoint.java#L166-L170
bazaarvoice/jolt
jolt-core/src/main/java/com/bazaarvoice/jolt/modifier/spec/ModifierSpec.java
ModifierSpec.setData
@SuppressWarnings( "unchecked" ) protected static void setData(Object parent, MatchedElement matchedElement, Object value, OpMode opMode) { """ Static utility method for facilitating writes on input object @param parent the source object @param matchedElement the current spec (leaf) element that was matched with input @param value to write @param opMode to determine if write is applicable """ if(parent instanceof Map) { Map source = (Map) parent; String key = matchedElement.getRawKey(); if(opMode.isApplicable( source, key )) { source.put( key, value ); } } else if (parent instanceof List && matchedElement instanceof ArrayMatchedElement ) { List source = (List) parent; int origSize = ( (ArrayMatchedElement) matchedElement ).getOrigSize(); int reqIndex = ( (ArrayMatchedElement) matchedElement ).getRawIndex(); if(opMode.isApplicable( source, reqIndex, origSize )) { source.set( reqIndex, value ); } } else { throw new RuntimeException( "Should not come here!" ); } }
java
@SuppressWarnings( "unchecked" ) protected static void setData(Object parent, MatchedElement matchedElement, Object value, OpMode opMode) { if(parent instanceof Map) { Map source = (Map) parent; String key = matchedElement.getRawKey(); if(opMode.isApplicable( source, key )) { source.put( key, value ); } } else if (parent instanceof List && matchedElement instanceof ArrayMatchedElement ) { List source = (List) parent; int origSize = ( (ArrayMatchedElement) matchedElement ).getOrigSize(); int reqIndex = ( (ArrayMatchedElement) matchedElement ).getRawIndex(); if(opMode.isApplicable( source, reqIndex, origSize )) { source.set( reqIndex, value ); } } else { throw new RuntimeException( "Should not come here!" ); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "static", "void", "setData", "(", "Object", "parent", ",", "MatchedElement", "matchedElement", ",", "Object", "value", ",", "OpMode", "opMode", ")", "{", "if", "(", "parent", "instanceof", "Map", ")", "{", "Map", "source", "=", "(", "Map", ")", "parent", ";", "String", "key", "=", "matchedElement", ".", "getRawKey", "(", ")", ";", "if", "(", "opMode", ".", "isApplicable", "(", "source", ",", "key", ")", ")", "{", "source", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}", "else", "if", "(", "parent", "instanceof", "List", "&&", "matchedElement", "instanceof", "ArrayMatchedElement", ")", "{", "List", "source", "=", "(", "List", ")", "parent", ";", "int", "origSize", "=", "(", "(", "ArrayMatchedElement", ")", "matchedElement", ")", ".", "getOrigSize", "(", ")", ";", "int", "reqIndex", "=", "(", "(", "ArrayMatchedElement", ")", "matchedElement", ")", ".", "getRawIndex", "(", ")", ";", "if", "(", "opMode", ".", "isApplicable", "(", "source", ",", "reqIndex", ",", "origSize", ")", ")", "{", "source", ".", "set", "(", "reqIndex", ",", "value", ")", ";", "}", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"Should not come here!\"", ")", ";", "}", "}" ]
Static utility method for facilitating writes on input object @param parent the source object @param matchedElement the current spec (leaf) element that was matched with input @param value to write @param opMode to determine if write is applicable
[ "Static", "utility", "method", "for", "facilitating", "writes", "on", "input", "object" ]
train
https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/modifier/spec/ModifierSpec.java#L127-L147
Bernardo-MG/maven-site-fixer
src/main/java/com/bernardomg/velocity/tool/SiteTool.java
SiteTool.transformImagesToFigures
public final void transformImagesToFigures(final Element root) { """ Transforms simple {@code <img>} elements to {@code <figure>} elements. <p> This will wrap {@code <img>} elements with a {@code <figure>} element, and add a {@code <figcaption>} with the contents of the image's {@code alt} attribute, if said attribute exists. <p> Only {@code <img>} elements inside a {@code <section>} will be transformed. @param root root element with images to transform """ final Collection<Element> images; // Image elements from the <body> Element figure; // <figure> element Element caption; // <figcaption> element checkNotNull(root, "Received a null pointer as root element"); images = root.select("section img"); if (!images.isEmpty()) { for (final Element img : images) { figure = new Element(Tag.valueOf("figure"), ""); img.replaceWith(figure); figure.appendChild(img); if (img.hasAttr("alt")) { caption = new Element(Tag.valueOf("figcaption"), ""); caption.text(img.attr("alt")); figure.appendChild(caption); } } } }
java
public final void transformImagesToFigures(final Element root) { final Collection<Element> images; // Image elements from the <body> Element figure; // <figure> element Element caption; // <figcaption> element checkNotNull(root, "Received a null pointer as root element"); images = root.select("section img"); if (!images.isEmpty()) { for (final Element img : images) { figure = new Element(Tag.valueOf("figure"), ""); img.replaceWith(figure); figure.appendChild(img); if (img.hasAttr("alt")) { caption = new Element(Tag.valueOf("figcaption"), ""); caption.text(img.attr("alt")); figure.appendChild(caption); } } } }
[ "public", "final", "void", "transformImagesToFigures", "(", "final", "Element", "root", ")", "{", "final", "Collection", "<", "Element", ">", "images", ";", "// Image elements from the <body>", "Element", "figure", ";", "// <figure> element", "Element", "caption", ";", "// <figcaption> element", "checkNotNull", "(", "root", ",", "\"Received a null pointer as root element\"", ")", ";", "images", "=", "root", ".", "select", "(", "\"section img\"", ")", ";", "if", "(", "!", "images", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "final", "Element", "img", ":", "images", ")", "{", "figure", "=", "new", "Element", "(", "Tag", ".", "valueOf", "(", "\"figure\"", ")", ",", "\"\"", ")", ";", "img", ".", "replaceWith", "(", "figure", ")", ";", "figure", ".", "appendChild", "(", "img", ")", ";", "if", "(", "img", ".", "hasAttr", "(", "\"alt\"", ")", ")", "{", "caption", "=", "new", "Element", "(", "Tag", ".", "valueOf", "(", "\"figcaption\"", ")", ",", "\"\"", ")", ";", "caption", ".", "text", "(", "img", ".", "attr", "(", "\"alt\"", ")", ")", ";", "figure", ".", "appendChild", "(", "caption", ")", ";", "}", "}", "}", "}" ]
Transforms simple {@code <img>} elements to {@code <figure>} elements. <p> This will wrap {@code <img>} elements with a {@code <figure>} element, and add a {@code <figcaption>} with the contents of the image's {@code alt} attribute, if said attribute exists. <p> Only {@code <img>} elements inside a {@code <section>} will be transformed. @param root root element with images to transform
[ "Transforms", "simple", "{", "@code", "<img", ">", "}", "elements", "to", "{", "@code", "<figure", ">", "}", "elements", ".", "<p", ">", "This", "will", "wrap", "{", "@code", "<img", ">", "}", "elements", "with", "a", "{", "@code", "<figure", ">", "}", "element", "and", "add", "a", "{", "@code", "<figcaption", ">", "}", "with", "the", "contents", "of", "the", "image", "s", "{", "@code", "alt", "}", "attribute", "if", "said", "attribute", "exists", ".", "<p", ">", "Only", "{", "@code", "<img", ">", "}", "elements", "inside", "a", "{", "@code", "<section", ">", "}", "will", "be", "transformed", "." ]
train
https://github.com/Bernardo-MG/maven-site-fixer/blob/e064472faa7edb0fca11647a22d90ad72089baa3/src/main/java/com/bernardomg/velocity/tool/SiteTool.java#L294-L316
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/sequences/PlainTextDocumentReaderAndWriter.java
PlainTextDocumentReaderAndWriter.printAnswers
public void printAnswers(List<IN> list, PrintWriter out) { """ Print the classifications for the document to the given Writer. This method now checks the <code>outputFormat</code> property, and can print in slashTags, inlineXML, or xml (stand-Off XML). For both the XML output formats, it preserves spacing, while for the slashTags format, it prints tokenized (since preserveSpacing output is somewhat dysfunctional with the slashTags format). @param list List of tokens with classifier answers @param out Where to print the output to """ String style = null; if (flags != null) { style = flags.outputFormat; } if (style == null || "".equals(style)) { style = "slashTags"; } OutputStyle outputStyle = OutputStyle.fromShortName(style); printAnswers(list, out, outputStyle, !"slashTags".equals(style)); }
java
public void printAnswers(List<IN> list, PrintWriter out) { String style = null; if (flags != null) { style = flags.outputFormat; } if (style == null || "".equals(style)) { style = "slashTags"; } OutputStyle outputStyle = OutputStyle.fromShortName(style); printAnswers(list, out, outputStyle, !"slashTags".equals(style)); }
[ "public", "void", "printAnswers", "(", "List", "<", "IN", ">", "list", ",", "PrintWriter", "out", ")", "{", "String", "style", "=", "null", ";", "if", "(", "flags", "!=", "null", ")", "{", "style", "=", "flags", ".", "outputFormat", ";", "}", "if", "(", "style", "==", "null", "||", "\"\"", ".", "equals", "(", "style", ")", ")", "{", "style", "=", "\"slashTags\"", ";", "}", "OutputStyle", "outputStyle", "=", "OutputStyle", ".", "fromShortName", "(", "style", ")", ";", "printAnswers", "(", "list", ",", "out", ",", "outputStyle", ",", "!", "\"slashTags\"", ".", "equals", "(", "style", ")", ")", ";", "}" ]
Print the classifications for the document to the given Writer. This method now checks the <code>outputFormat</code> property, and can print in slashTags, inlineXML, or xml (stand-Off XML). For both the XML output formats, it preserves spacing, while for the slashTags format, it prints tokenized (since preserveSpacing output is somewhat dysfunctional with the slashTags format). @param list List of tokens with classifier answers @param out Where to print the output to
[ "Print", "the", "classifications", "for", "the", "document", "to", "the", "given", "Writer", ".", "This", "method", "now", "checks", "the", "<code", ">", "outputFormat<", "/", "code", ">", "property", "and", "can", "print", "in", "slashTags", "inlineXML", "or", "xml", "(", "stand", "-", "Off", "XML", ")", ".", "For", "both", "the", "XML", "output", "formats", "it", "preserves", "spacing", "while", "for", "the", "slashTags", "format", "it", "prints", "tokenized", "(", "since", "preserveSpacing", "output", "is", "somewhat", "dysfunctional", "with", "the", "slashTags", "format", ")", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/PlainTextDocumentReaderAndWriter.java#L194-L204
resilience4j/resilience4j
resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/CircuitBreakerExports.java
CircuitBreakerExports.ofIterable
public static CircuitBreakerExports ofIterable(String prefix, Iterable<CircuitBreaker> circuitBreakers) { """ Creates a new instance of {@link CircuitBreakerExports} with specified metrics names prefix and {@link Iterable} of circuit breakers. @param prefix the prefix of metrics names @param circuitBreakers the circuit breakers """ requireNonNull(prefix); requireNonNull(circuitBreakers); return new CircuitBreakerExports(prefix, circuitBreakers); }
java
public static CircuitBreakerExports ofIterable(String prefix, Iterable<CircuitBreaker> circuitBreakers) { requireNonNull(prefix); requireNonNull(circuitBreakers); return new CircuitBreakerExports(prefix, circuitBreakers); }
[ "public", "static", "CircuitBreakerExports", "ofIterable", "(", "String", "prefix", ",", "Iterable", "<", "CircuitBreaker", ">", "circuitBreakers", ")", "{", "requireNonNull", "(", "prefix", ")", ";", "requireNonNull", "(", "circuitBreakers", ")", ";", "return", "new", "CircuitBreakerExports", "(", "prefix", ",", "circuitBreakers", ")", ";", "}" ]
Creates a new instance of {@link CircuitBreakerExports} with specified metrics names prefix and {@link Iterable} of circuit breakers. @param prefix the prefix of metrics names @param circuitBreakers the circuit breakers
[ "Creates", "a", "new", "instance", "of", "{", "@link", "CircuitBreakerExports", "}", "with", "specified", "metrics", "names", "prefix", "and", "{", "@link", "Iterable", "}", "of", "circuit", "breakers", "." ]
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/CircuitBreakerExports.java#L127-L131
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java
SquareGraph.checkConnect
public void checkConnect( SquareNode a , int indexA , SquareNode b , int indexB , double distance ) { """ Checks to see if the two nodes can be connected. If one of the nodes is already connected to another it then checks to see if the proposed connection is more desirable. If it is the old connection is removed and a new one created. Otherwise nothing happens. """ if( a.edges[indexA] != null && a.edges[indexA].distance > distance ) { detachEdge(a.edges[indexA]); } if( b.edges[indexB] != null && b.edges[indexB].distance > distance ) { detachEdge(b.edges[indexB]); } if( a.edges[indexA] == null && b.edges[indexB] == null) { connect(a,indexA,b,indexB,distance); } }
java
public void checkConnect( SquareNode a , int indexA , SquareNode b , int indexB , double distance ) { if( a.edges[indexA] != null && a.edges[indexA].distance > distance ) { detachEdge(a.edges[indexA]); } if( b.edges[indexB] != null && b.edges[indexB].distance > distance ) { detachEdge(b.edges[indexB]); } if( a.edges[indexA] == null && b.edges[indexB] == null) { connect(a,indexA,b,indexB,distance); } }
[ "public", "void", "checkConnect", "(", "SquareNode", "a", ",", "int", "indexA", ",", "SquareNode", "b", ",", "int", "indexB", ",", "double", "distance", ")", "{", "if", "(", "a", ".", "edges", "[", "indexA", "]", "!=", "null", "&&", "a", ".", "edges", "[", "indexA", "]", ".", "distance", ">", "distance", ")", "{", "detachEdge", "(", "a", ".", "edges", "[", "indexA", "]", ")", ";", "}", "if", "(", "b", ".", "edges", "[", "indexB", "]", "!=", "null", "&&", "b", ".", "edges", "[", "indexB", "]", ".", "distance", ">", "distance", ")", "{", "detachEdge", "(", "b", ".", "edges", "[", "indexB", "]", ")", ";", "}", "if", "(", "a", ".", "edges", "[", "indexA", "]", "==", "null", "&&", "b", ".", "edges", "[", "indexB", "]", "==", "null", ")", "{", "connect", "(", "a", ",", "indexA", ",", "b", ",", "indexB", ",", "distance", ")", ";", "}", "}" ]
Checks to see if the two nodes can be connected. If one of the nodes is already connected to another it then checks to see if the proposed connection is more desirable. If it is the old connection is removed and a new one created. Otherwise nothing happens.
[ "Checks", "to", "see", "if", "the", "two", "nodes", "can", "be", "connected", ".", "If", "one", "of", "the", "nodes", "is", "already", "connected", "to", "another", "it", "then", "checks", "to", "see", "if", "the", "proposed", "connection", "is", "more", "desirable", ".", "If", "it", "is", "the", "old", "connection", "is", "removed", "and", "a", "new", "one", "created", ".", "Otherwise", "nothing", "happens", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareGraph.java#L98-L110
webmetrics/browsermob-proxy
src/main/java/org/xbill/DNS/TSIG.java
TSIG.fromString
static public TSIG fromString(String str) { """ Creates a new TSIG object with the hmac-md5 algorithm, which can be used to sign or verify a message. @param str The TSIG key, in the form name:secret, name/secret, alg:name:secret, or alg/name/secret. If an algorithm is specified, it must be "hmac-md5", "hmac-sha1", or "hmac-sha256". @throws IllegalArgumentException The string does not contain both a name and secret. @throws IllegalArgumentException The key name is an invalid name @throws IllegalArgumentException The key data is improperly encoded """ String [] parts = str.split("[:/]"); if (parts.length < 2 || parts.length > 3) throw new IllegalArgumentException("Invalid TSIG key " + "specification"); if (parts.length == 3) return new TSIG(parts[0], parts[1], parts[2]); else return new TSIG(HMAC_MD5, parts[0], parts[1]); }
java
static public TSIG fromString(String str) { String [] parts = str.split("[:/]"); if (parts.length < 2 || parts.length > 3) throw new IllegalArgumentException("Invalid TSIG key " + "specification"); if (parts.length == 3) return new TSIG(parts[0], parts[1], parts[2]); else return new TSIG(HMAC_MD5, parts[0], parts[1]); }
[ "static", "public", "TSIG", "fromString", "(", "String", "str", ")", "{", "String", "[", "]", "parts", "=", "str", ".", "split", "(", "\"[:/]\"", ")", ";", "if", "(", "parts", ".", "length", "<", "2", "||", "parts", ".", "length", ">", "3", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid TSIG key \"", "+", "\"specification\"", ")", ";", "if", "(", "parts", ".", "length", "==", "3", ")", "return", "new", "TSIG", "(", "parts", "[", "0", "]", ",", "parts", "[", "1", "]", ",", "parts", "[", "2", "]", ")", ";", "else", "return", "new", "TSIG", "(", "HMAC_MD5", ",", "parts", "[", "0", "]", ",", "parts", "[", "1", "]", ")", ";", "}" ]
Creates a new TSIG object with the hmac-md5 algorithm, which can be used to sign or verify a message. @param str The TSIG key, in the form name:secret, name/secret, alg:name:secret, or alg/name/secret. If an algorithm is specified, it must be "hmac-md5", "hmac-sha1", or "hmac-sha256". @throws IllegalArgumentException The string does not contain both a name and secret. @throws IllegalArgumentException The key name is an invalid name @throws IllegalArgumentException The key data is improperly encoded
[ "Creates", "a", "new", "TSIG", "object", "with", "the", "hmac", "-", "md5", "algorithm", "which", "can", "be", "used", "to", "sign", "or", "verify", "a", "message", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/xbill/DNS/TSIG.java#L151-L161
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/validate/Schema.java
Schema.performTypeValidation
protected void performTypeValidation(String path, Object type, Object value, List<ValidationResult> results) { """ Validates a given value to match specified type. The type can be defined as a Schema, type, a type name or TypeCode When type is a Schema, it executes validation recursively against that Schema. @param path a dot notation path to the value. @param type a type to match the value type @param value a value to be validated. @param results a list with validation results to add new results. @see #performValidation(String, Object, List) """ // If type it not defined then skip if (type == null) return; // Perform validation against schema if (type instanceof Schema) { Schema schema = (Schema) type; schema.performValidation(path, value, results); return; } // If value is null then skip value = ObjectReader.getValue(value); if (value == null) return; String name = path != null ? path : "value"; Class<?> valueType = value.getClass(); // Match types if (TypeMatcher.matchType(type, valueType)) return; // Generate type mismatch error results.add(new ValidationResult(path, ValidationResultType.Error, "TYPE_MISMATCH", name + " type must be " + type + " but found " + valueType, type, valueType)); }
java
protected void performTypeValidation(String path, Object type, Object value, List<ValidationResult> results) { // If type it not defined then skip if (type == null) return; // Perform validation against schema if (type instanceof Schema) { Schema schema = (Schema) type; schema.performValidation(path, value, results); return; } // If value is null then skip value = ObjectReader.getValue(value); if (value == null) return; String name = path != null ? path : "value"; Class<?> valueType = value.getClass(); // Match types if (TypeMatcher.matchType(type, valueType)) return; // Generate type mismatch error results.add(new ValidationResult(path, ValidationResultType.Error, "TYPE_MISMATCH", name + " type must be " + type + " but found " + valueType, type, valueType)); }
[ "protected", "void", "performTypeValidation", "(", "String", "path", ",", "Object", "type", ",", "Object", "value", ",", "List", "<", "ValidationResult", ">", "results", ")", "{", "// If type it not defined then skip", "if", "(", "type", "==", "null", ")", "return", ";", "// Perform validation against schema", "if", "(", "type", "instanceof", "Schema", ")", "{", "Schema", "schema", "=", "(", "Schema", ")", "type", ";", "schema", ".", "performValidation", "(", "path", ",", "value", ",", "results", ")", ";", "return", ";", "}", "// If value is null then skip", "value", "=", "ObjectReader", ".", "getValue", "(", "value", ")", ";", "if", "(", "value", "==", "null", ")", "return", ";", "String", "name", "=", "path", "!=", "null", "?", "path", ":", "\"value\"", ";", "Class", "<", "?", ">", "valueType", "=", "value", ".", "getClass", "(", ")", ";", "// Match types", "if", "(", "TypeMatcher", ".", "matchType", "(", "type", ",", "valueType", ")", ")", "return", ";", "// Generate type mismatch error", "results", ".", "add", "(", "new", "ValidationResult", "(", "path", ",", "ValidationResultType", ".", "Error", ",", "\"TYPE_MISMATCH\"", ",", "name", "+", "\" type must be \"", "+", "type", "+", "\" but found \"", "+", "valueType", ",", "type", ",", "valueType", ")", ")", ";", "}" ]
Validates a given value to match specified type. The type can be defined as a Schema, type, a type name or TypeCode When type is a Schema, it executes validation recursively against that Schema. @param path a dot notation path to the value. @param type a type to match the value type @param value a value to be validated. @param results a list with validation results to add new results. @see #performValidation(String, Object, List)
[ "Validates", "a", "given", "value", "to", "match", "specified", "type", ".", "The", "type", "can", "be", "defined", "as", "a", "Schema", "type", "a", "type", "name", "or", "TypeCode", "When", "type", "is", "a", "Schema", "it", "executes", "validation", "recursively", "against", "that", "Schema", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/validate/Schema.java#L162-L189
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.deleteSnippet
public void deleteSnippet(Object projectIdOrPath, Integer snippetId) throws GitLabApiException { """ /* Deletes an existing project snippet. This is an idempotent function and deleting a non-existent snippet does not cause an error. <pre><code>DELETE /projects/:id/snippets/:snippet_id</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param snippetId the ID of the project's snippet @throws GitLabApiException if any exception occurs """ delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId); }
java
public void deleteSnippet(Object projectIdOrPath, Integer snippetId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId); }
[ "public", "void", "deleteSnippet", "(", "Object", "projectIdOrPath", ",", "Integer", "snippetId", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"snippets\"", ",", "snippetId", ")", ";", "}" ]
/* Deletes an existing project snippet. This is an idempotent function and deleting a non-existent snippet does not cause an error. <pre><code>DELETE /projects/:id/snippets/:snippet_id</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param snippetId the ID of the project's snippet @throws GitLabApiException if any exception occurs
[ "/", "*", "Deletes", "an", "existing", "project", "snippet", ".", "This", "is", "an", "idempotent", "function", "and", "deleting", "a", "non", "-", "existent", "snippet", "does", "not", "cause", "an", "error", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2035-L2037
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.setOrthoSymmetricLH
public Matrix4d setOrthoSymmetricLH(double width, double height, double zNear, double zFar) { """ Set this matrix to be a symmetric orthographic projection transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> This method is equivalent to calling {@link #setOrthoLH(double, double, double, double, double, double) setOrthoLH()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetricLH(double, double, double, double) orthoSymmetricLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoSymmetricLH(double, double, double, double) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @return this """ return setOrthoSymmetricLH(width, height, zNear, zFar, false); }
java
public Matrix4d setOrthoSymmetricLH(double width, double height, double zNear, double zFar) { return setOrthoSymmetricLH(width, height, zNear, zFar, false); }
[ "public", "Matrix4d", "setOrthoSymmetricLH", "(", "double", "width", ",", "double", "height", ",", "double", "zNear", ",", "double", "zFar", ")", "{", "return", "setOrthoSymmetricLH", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "false", ")", ";", "}" ]
Set this matrix to be a symmetric orthographic projection transformation for a left-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code>. <p> This method is equivalent to calling {@link #setOrthoLH(double, double, double, double, double, double) setOrthoLH()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetricLH(double, double, double, double) orthoSymmetricLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoSymmetricLH(double, double, double, double) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", "..", "+", "1", "]", "<", "/", "code", ">", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#setOrthoLH", "(", "double", "double", "double", "double", "double", "double", ")", "setOrthoLH", "()", "}", "with", "<code", ">", "left", "=", "-", "width", "/", "2<", "/", "code", ">", "<code", ">", "right", "=", "+", "width", "/", "2<", "/", "code", ">", "<code", ">", "bottom", "=", "-", "height", "/", "2<", "/", "code", ">", "and", "<code", ">", "top", "=", "+", "height", "/", "2<", "/", "code", ">", ".", "<p", ">", "In", "order", "to", "apply", "the", "symmetric", "orthographic", "projection", "to", "an", "already", "existing", "transformation", "use", "{", "@link", "#orthoSymmetricLH", "(", "double", "double", "double", "double", ")", "orthoSymmetricLH", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "www", ".", "songho", ".", "ca", "/", "opengl", "/", "gl_projectionmatrix", ".", "html#ortho", ">", "http", ":", "//", "www", ".", "songho", ".", "ca<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L10525-L10527
looly/hutool
hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java
CaptchaUtil.createCircleCaptcha
public static CircleCaptcha createCircleCaptcha(int width, int height, int codeCount, int circleCount) { """ 创建圆圈干扰的验证码 @param width 图片宽 @param height 图片高 @param codeCount 字符个数 @param circleCount 干扰圆圈条数 @return {@link CircleCaptcha} @since 3.2.3 """ return new CircleCaptcha(width, height, codeCount, circleCount); }
java
public static CircleCaptcha createCircleCaptcha(int width, int height, int codeCount, int circleCount) { return new CircleCaptcha(width, height, codeCount, circleCount); }
[ "public", "static", "CircleCaptcha", "createCircleCaptcha", "(", "int", "width", ",", "int", "height", ",", "int", "codeCount", ",", "int", "circleCount", ")", "{", "return", "new", "CircleCaptcha", "(", "width", ",", "height", ",", "codeCount", ",", "circleCount", ")", ";", "}" ]
创建圆圈干扰的验证码 @param width 图片宽 @param height 图片高 @param codeCount 字符个数 @param circleCount 干扰圆圈条数 @return {@link CircleCaptcha} @since 3.2.3
[ "创建圆圈干扰的验证码" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-captcha/src/main/java/cn/hutool/captcha/CaptchaUtil.java#L57-L59
apache/groovy
src/main/java/org/codehaus/groovy/ast/tools/WideningCategories.java
WideningCategories.implementsInterfaceOrSubclassOf
public static boolean implementsInterfaceOrSubclassOf(final ClassNode source, final ClassNode targetType) { """ Determines if the source class implements an interface or subclasses the target type. This method takes the {@link org.codehaus.groovy.ast.tools.WideningCategories.LowestUpperBoundClassNode lowest upper bound class node} type into account, allowing to remove unnecessary casts. @param source the type of interest @param targetType the target type of interest """ if (source.isDerivedFrom(targetType) || source.implementsInterface(targetType)) return true; if (targetType instanceof WideningCategories.LowestUpperBoundClassNode) { WideningCategories.LowestUpperBoundClassNode lub = (WideningCategories.LowestUpperBoundClassNode) targetType; if (implementsInterfaceOrSubclassOf(source, lub.getSuperClass())) return true; for (ClassNode classNode : lub.getInterfaces()) { if (source.implementsInterface(classNode)) return true; } } return false; }
java
public static boolean implementsInterfaceOrSubclassOf(final ClassNode source, final ClassNode targetType) { if (source.isDerivedFrom(targetType) || source.implementsInterface(targetType)) return true; if (targetType instanceof WideningCategories.LowestUpperBoundClassNode) { WideningCategories.LowestUpperBoundClassNode lub = (WideningCategories.LowestUpperBoundClassNode) targetType; if (implementsInterfaceOrSubclassOf(source, lub.getSuperClass())) return true; for (ClassNode classNode : lub.getInterfaces()) { if (source.implementsInterface(classNode)) return true; } } return false; }
[ "public", "static", "boolean", "implementsInterfaceOrSubclassOf", "(", "final", "ClassNode", "source", ",", "final", "ClassNode", "targetType", ")", "{", "if", "(", "source", ".", "isDerivedFrom", "(", "targetType", ")", "||", "source", ".", "implementsInterface", "(", "targetType", ")", ")", "return", "true", ";", "if", "(", "targetType", "instanceof", "WideningCategories", ".", "LowestUpperBoundClassNode", ")", "{", "WideningCategories", ".", "LowestUpperBoundClassNode", "lub", "=", "(", "WideningCategories", ".", "LowestUpperBoundClassNode", ")", "targetType", ";", "if", "(", "implementsInterfaceOrSubclassOf", "(", "source", ",", "lub", ".", "getSuperClass", "(", ")", ")", ")", "return", "true", ";", "for", "(", "ClassNode", "classNode", ":", "lub", ".", "getInterfaces", "(", ")", ")", "{", "if", "(", "source", ".", "implementsInterface", "(", "classNode", ")", ")", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Determines if the source class implements an interface or subclasses the target type. This method takes the {@link org.codehaus.groovy.ast.tools.WideningCategories.LowestUpperBoundClassNode lowest upper bound class node} type into account, allowing to remove unnecessary casts. @param source the type of interest @param targetType the target type of interest
[ "Determines", "if", "the", "source", "class", "implements", "an", "interface", "or", "subclasses", "the", "target", "type", ".", "This", "method", "takes", "the", "{" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/WideningCategories.java#L736-L746
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java
Jsr250Utils.containsMethod
private static boolean containsMethod(Method method, List<Method> methods) { """ Checks if the passed in method already exists in the list of methods. Checks for equality by the name of the method. @param method @param methods @return """ if(methods != null) { for(Method aMethod : methods){ if(method.getName().equals(aMethod.getName())) { return true; } } } return false; }
java
private static boolean containsMethod(Method method, List<Method> methods) { if(methods != null) { for(Method aMethod : methods){ if(method.getName().equals(aMethod.getName())) { return true; } } } return false; }
[ "private", "static", "boolean", "containsMethod", "(", "Method", "method", ",", "List", "<", "Method", ">", "methods", ")", "{", "if", "(", "methods", "!=", "null", ")", "{", "for", "(", "Method", "aMethod", ":", "methods", ")", "{", "if", "(", "method", ".", "getName", "(", ")", ".", "equals", "(", "aMethod", ".", "getName", "(", ")", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Checks if the passed in method already exists in the list of methods. Checks for equality by the name of the method. @param method @param methods @return
[ "Checks", "if", "the", "passed", "in", "method", "already", "exists", "in", "the", "list", "of", "methods", ".", "Checks", "for", "equality", "by", "the", "name", "of", "the", "method", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java#L168-L177
bwkimmel/jdcp
jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java
JobStatus.asCancelled
public JobStatus asCancelled() { """ Creates a copy of this <code>JobStatus</code> with the state set to {@link JobState#CANCELLED}. @return A copy of this <code>JobStatus</code> with the state set to {@link JobState#CANCELLED}. """ return new JobStatus(jobId, description, JobState.CANCELLED, progress, status, eventId); }
java
public JobStatus asCancelled() { return new JobStatus(jobId, description, JobState.CANCELLED, progress, status, eventId); }
[ "public", "JobStatus", "asCancelled", "(", ")", "{", "return", "new", "JobStatus", "(", "jobId", ",", "description", ",", "JobState", ".", "CANCELLED", ",", "progress", ",", "status", ",", "eventId", ")", ";", "}" ]
Creates a copy of this <code>JobStatus</code> with the state set to {@link JobState#CANCELLED}. @return A copy of this <code>JobStatus</code> with the state set to {@link JobState#CANCELLED}.
[ "Creates", "a", "copy", "of", "this", "<code", ">", "JobStatus<", "/", "code", ">", "with", "the", "state", "set", "to", "{" ]
train
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-core/src/main/java/ca/eandb/jdcp/remote/JobStatus.java#L153-L155
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/SAXProcessor.java
SAXProcessor.timeToString
public static String timeToString(long start, long finish) { """ Generic method to convert the milliseconds into the elapsed time string. @param start Start timestamp. @param finish End timestamp. @return String representation of the elapsed time. """ Duration duration = new Duration(finish - start); // in milliseconds PeriodFormatter formatter = new PeriodFormatterBuilder().appendDays().appendSuffix("d") .appendHours().appendSuffix("h").appendMinutes().appendSuffix("m").appendSeconds() .appendSuffix("s").appendMillis().appendSuffix("ms").toFormatter(); return formatter.print(duration.toPeriod()); }
java
public static String timeToString(long start, long finish) { Duration duration = new Duration(finish - start); // in milliseconds PeriodFormatter formatter = new PeriodFormatterBuilder().appendDays().appendSuffix("d") .appendHours().appendSuffix("h").appendMinutes().appendSuffix("m").appendSeconds() .appendSuffix("s").appendMillis().appendSuffix("ms").toFormatter(); return formatter.print(duration.toPeriod()); }
[ "public", "static", "String", "timeToString", "(", "long", "start", ",", "long", "finish", ")", "{", "Duration", "duration", "=", "new", "Duration", "(", "finish", "-", "start", ")", ";", "// in milliseconds\r", "PeriodFormatter", "formatter", "=", "new", "PeriodFormatterBuilder", "(", ")", ".", "appendDays", "(", ")", ".", "appendSuffix", "(", "\"d\"", ")", ".", "appendHours", "(", ")", ".", "appendSuffix", "(", "\"h\"", ")", ".", "appendMinutes", "(", ")", ".", "appendSuffix", "(", "\"m\"", ")", ".", "appendSeconds", "(", ")", ".", "appendSuffix", "(", "\"s\"", ")", ".", "appendMillis", "(", ")", ".", "appendSuffix", "(", "\"ms\"", ")", ".", "toFormatter", "(", ")", ";", "return", "formatter", ".", "print", "(", "duration", ".", "toPeriod", "(", ")", ")", ";", "}" ]
Generic method to convert the milliseconds into the elapsed time string. @param start Start timestamp. @param finish End timestamp. @return String representation of the elapsed time.
[ "Generic", "method", "to", "convert", "the", "milliseconds", "into", "the", "elapsed", "time", "string", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/SAXProcessor.java#L589-L598
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java
GroovyScript2RestLoader.validateScript
public void validateScript(String name, InputStream script, SourceFolder[] src, SourceFile[] files) throws MalformedScriptException { """ Check is specified source <code>script</code> contains valid Groovy source code. @param name script name. This name will be used by GroovyClassLoader to identify script, e.g. specified name will be used in error message in compilation of Groovy fails. If this parameter is <code>null</code> then GroovyClassLoader will use automatically generated name @param script Groovy source stream @param src set of folders that contains Groovy source files that should be add in class-path when validate <code>script</code>, see {@link SourceFolder#getPath()}. <b>NOTE</b> To be able load Groovy source files from specified folders the following rules must be observed: <ul> <li>Groovy source files must be located in folder with respect to package structure</li> <li>Name of Groovy source files must be the same as name of class located in file</li> <li>Groovy source file must have extension '.groovy'</li> </ul> @param files set of groovy source files that should be add in class-path when validate <code>script</code>. Each item must point directly to file that contains Groovy source, see {@link SourceFile#getPath()} . Source file can have any name and extension @throws MalformedScriptException if <code>script</code> contains not valid source code @LevelAPI Provisional """ if (name != null && name.length() > 0 && name.startsWith("/")) { name = name.substring(1); } groovyPublisher.validateResource(script, name, src, files); }
java
public void validateScript(String name, InputStream script, SourceFolder[] src, SourceFile[] files) throws MalformedScriptException { if (name != null && name.length() > 0 && name.startsWith("/")) { name = name.substring(1); } groovyPublisher.validateResource(script, name, src, files); }
[ "public", "void", "validateScript", "(", "String", "name", ",", "InputStream", "script", ",", "SourceFolder", "[", "]", "src", ",", "SourceFile", "[", "]", "files", ")", "throws", "MalformedScriptException", "{", "if", "(", "name", "!=", "null", "&&", "name", ".", "length", "(", ")", ">", "0", "&&", "name", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "name", "=", "name", ".", "substring", "(", "1", ")", ";", "}", "groovyPublisher", ".", "validateResource", "(", "script", ",", "name", ",", "src", ",", "files", ")", ";", "}" ]
Check is specified source <code>script</code> contains valid Groovy source code. @param name script name. This name will be used by GroovyClassLoader to identify script, e.g. specified name will be used in error message in compilation of Groovy fails. If this parameter is <code>null</code> then GroovyClassLoader will use automatically generated name @param script Groovy source stream @param src set of folders that contains Groovy source files that should be add in class-path when validate <code>script</code>, see {@link SourceFolder#getPath()}. <b>NOTE</b> To be able load Groovy source files from specified folders the following rules must be observed: <ul> <li>Groovy source files must be located in folder with respect to package structure</li> <li>Name of Groovy source files must be the same as name of class located in file</li> <li>Groovy source file must have extension '.groovy'</li> </ul> @param files set of groovy source files that should be add in class-path when validate <code>script</code>. Each item must point directly to file that contains Groovy source, see {@link SourceFile#getPath()} . Source file can have any name and extension @throws MalformedScriptException if <code>script</code> contains not valid source code @LevelAPI Provisional
[ "Check", "is", "specified", "source", "<code", ">", "script<", "/", "code", ">", "contains", "valid", "Groovy", "source", "code", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/script/groovy/GroovyScript2RestLoader.java#L961-L969
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java
WebJBossASClient.getConnector
public ModelNode getConnector(String name) throws Exception { """ Returns the connector node with all its attributes. Will be null if it doesn't exist. @param name the name of the connector whose node is to be returned @return the node if there is a connector with the given name already in existence, null otherwise @throws Exception any error """ final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, name); return readResource(address, true); }
java
public ModelNode getConnector(String name) throws Exception { final Address address = Address.root().add(SUBSYSTEM, SUBSYSTEM_WEB, CONNECTOR, name); return readResource(address, true); }
[ "public", "ModelNode", "getConnector", "(", "String", "name", ")", "throws", "Exception", "{", "final", "Address", "address", "=", "Address", ".", "root", "(", ")", ".", "add", "(", "SUBSYSTEM", ",", "SUBSYSTEM_WEB", ",", "CONNECTOR", ",", "name", ")", ";", "return", "readResource", "(", "address", ",", "true", ")", ";", "}" ]
Returns the connector node with all its attributes. Will be null if it doesn't exist. @param name the name of the connector whose node is to be returned @return the node if there is a connector with the given name already in existence, null otherwise @throws Exception any error
[ "Returns", "the", "connector", "node", "with", "all", "its", "attributes", ".", "Will", "be", "null", "if", "it", "doesn", "t", "exist", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/WebJBossASClient.java#L90-L93
orbisgis/h2gis
h2gis-network/src/main/java/org/h2gis/network/functions/GraphCreator.java
GraphCreator.setEdgeWeight
private void setEdgeWeight(E edge, final double weight) throws SQLException { """ Set this edge's weight to the weight contained in the current row. @param edge Edge @throws SQLException If the weight cannot be retrieved """ if (edge != null && weightColumnIndex != -1) { edge.setWeight(weight); } }
java
private void setEdgeWeight(E edge, final double weight) throws SQLException { if (edge != null && weightColumnIndex != -1) { edge.setWeight(weight); } }
[ "private", "void", "setEdgeWeight", "(", "E", "edge", ",", "final", "double", "weight", ")", "throws", "SQLException", "{", "if", "(", "edge", "!=", "null", "&&", "weightColumnIndex", "!=", "-", "1", ")", "{", "edge", ".", "setWeight", "(", "weight", ")", ";", "}", "}" ]
Set this edge's weight to the weight contained in the current row. @param edge Edge @throws SQLException If the weight cannot be retrieved
[ "Set", "this", "edge", "s", "weight", "to", "the", "weight", "contained", "in", "the", "current", "row", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-network/src/main/java/org/h2gis/network/functions/GraphCreator.java#L278-L282
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Variable.java
Variable.execute
public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException { """ Dereference the variable, and return the reference value. Note that lazy evaluation will occur. If a variable within scope is not found, a warning will be sent to the error listener, and an empty nodeset will be returned. @param xctxt The runtime execution context. @return The evaluated variable, or an empty nodeset if not found. @throws javax.xml.transform.TransformerException """ org.apache.xml.utils.PrefixResolver xprefixResolver = xctxt.getNamespaceContext(); XObject result; // Is the variable fetched always the same? // XObject result = xctxt.getVariable(m_qname); if(m_fixUpWasCalled) { if(m_isGlobal) result = xctxt.getVarStack().getGlobalVariable(xctxt, m_index, destructiveOK); else result = xctxt.getVarStack().getLocalVariable(xctxt, m_index, destructiveOK); } else { result = xctxt.getVarStack().getVariableOrParam(xctxt,m_qname); } if (null == result) { // This should now never happen... warn(xctxt, XPATHErrorResources.WG_ILLEGAL_VARIABLE_REFERENCE, new Object[]{ m_qname.getLocalPart() }); //"VariableReference given for variable out "+ // (new RuntimeException()).printStackTrace(); // error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED, // new Object[]{ m_qname.getLocalPart() }); //"Could not get variable named "+varName); result = new XNodeSet(xctxt.getDTMManager()); } return result; // } // else // { // // Hack city... big time. This is needed to evaluate xpaths from extensions, // // pending some bright light going off in my head. Some sort of callback? // synchronized(this) // { // org.apache.xalan.templates.ElemVariable vvar= getElemVariable(); // if(null != vvar) // { // m_index = vvar.getIndex(); // m_isGlobal = vvar.getIsTopLevel(); // m_fixUpWasCalled = true; // return execute(xctxt); // } // } // throw new javax.xml.transform.TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VAR_NOT_RESOLVABLE, new Object[]{m_qname.toString()})); //"Variable not resolvable: "+m_qname); // } }
java
public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException { org.apache.xml.utils.PrefixResolver xprefixResolver = xctxt.getNamespaceContext(); XObject result; // Is the variable fetched always the same? // XObject result = xctxt.getVariable(m_qname); if(m_fixUpWasCalled) { if(m_isGlobal) result = xctxt.getVarStack().getGlobalVariable(xctxt, m_index, destructiveOK); else result = xctxt.getVarStack().getLocalVariable(xctxt, m_index, destructiveOK); } else { result = xctxt.getVarStack().getVariableOrParam(xctxt,m_qname); } if (null == result) { // This should now never happen... warn(xctxt, XPATHErrorResources.WG_ILLEGAL_VARIABLE_REFERENCE, new Object[]{ m_qname.getLocalPart() }); //"VariableReference given for variable out "+ // (new RuntimeException()).printStackTrace(); // error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED, // new Object[]{ m_qname.getLocalPart() }); //"Could not get variable named "+varName); result = new XNodeSet(xctxt.getDTMManager()); } return result; // } // else // { // // Hack city... big time. This is needed to evaluate xpaths from extensions, // // pending some bright light going off in my head. Some sort of callback? // synchronized(this) // { // org.apache.xalan.templates.ElemVariable vvar= getElemVariable(); // if(null != vvar) // { // m_index = vvar.getIndex(); // m_isGlobal = vvar.getIsTopLevel(); // m_fixUpWasCalled = true; // return execute(xctxt); // } // } // throw new javax.xml.transform.TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VAR_NOT_RESOLVABLE, new Object[]{m_qname.toString()})); //"Variable not resolvable: "+m_qname); // } }
[ "public", "XObject", "execute", "(", "XPathContext", "xctxt", ",", "boolean", "destructiveOK", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "org", ".", "apache", ".", "xml", ".", "utils", ".", "PrefixResolver", "xprefixResolver", "=", "xctxt", ".", "getNamespaceContext", "(", ")", ";", "XObject", "result", ";", "// Is the variable fetched always the same?", "// XObject result = xctxt.getVariable(m_qname);", "if", "(", "m_fixUpWasCalled", ")", "{", "if", "(", "m_isGlobal", ")", "result", "=", "xctxt", ".", "getVarStack", "(", ")", ".", "getGlobalVariable", "(", "xctxt", ",", "m_index", ",", "destructiveOK", ")", ";", "else", "result", "=", "xctxt", ".", "getVarStack", "(", ")", ".", "getLocalVariable", "(", "xctxt", ",", "m_index", ",", "destructiveOK", ")", ";", "}", "else", "{", "result", "=", "xctxt", ".", "getVarStack", "(", ")", ".", "getVariableOrParam", "(", "xctxt", ",", "m_qname", ")", ";", "}", "if", "(", "null", "==", "result", ")", "{", "// This should now never happen...", "warn", "(", "xctxt", ",", "XPATHErrorResources", ".", "WG_ILLEGAL_VARIABLE_REFERENCE", ",", "new", "Object", "[", "]", "{", "m_qname", ".", "getLocalPart", "(", ")", "}", ")", ";", "//\"VariableReference given for variable out \"+", "// (new RuntimeException()).printStackTrace();", "// error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED,", "// new Object[]{ m_qname.getLocalPart() }); //\"Could not get variable named \"+varName);", "result", "=", "new", "XNodeSet", "(", "xctxt", ".", "getDTMManager", "(", ")", ")", ";", "}", "return", "result", ";", "// }", "// else", "// {", "// // Hack city... big time. This is needed to evaluate xpaths from extensions, ", "// // pending some bright light going off in my head. Some sort of callback?", "// synchronized(this)", "// {", "// \torg.apache.xalan.templates.ElemVariable vvar= getElemVariable();", "// \tif(null != vvar)", "// \t{", "// m_index = vvar.getIndex();", "// m_isGlobal = vvar.getIsTopLevel();", "// m_fixUpWasCalled = true;", "// return execute(xctxt);", "// \t}", "// }", "// throw new javax.xml.transform.TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VAR_NOT_RESOLVABLE, new Object[]{m_qname.toString()})); //\"Variable not resolvable: \"+m_qname);", "// }", "}" ]
Dereference the variable, and return the reference value. Note that lazy evaluation will occur. If a variable within scope is not found, a warning will be sent to the error listener, and an empty nodeset will be returned. @param xctxt The runtime execution context. @return The evaluated variable, or an empty nodeset if not found. @throws javax.xml.transform.TransformerException
[ "Dereference", "the", "variable", "and", "return", "the", "reference", "value", ".", "Note", "that", "lazy", "evaluation", "will", "occur", ".", "If", "a", "variable", "within", "scope", "is", "not", "found", "a", "warning", "will", "be", "sent", "to", "the", "error", "listener", "and", "an", "empty", "nodeset", "will", "be", "returned", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Variable.java#L204-L253
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.deleteStaticExportPublishedResource
public void deleteStaticExportPublishedResource(String resourceName, int linkType, String linkParameter) throws CmsException { """ Deletes a published resource entry.<p> @param resourceName The name of the resource to be deleted in the static export @param linkType the type of resource deleted (0= non-parameter, 1=parameter) @param linkParameter the parameters of the resource @throws CmsException if something goes wrong """ m_securityManager.deleteStaticExportPublishedResource(m_context, resourceName, linkType, linkParameter); }
java
public void deleteStaticExportPublishedResource(String resourceName, int linkType, String linkParameter) throws CmsException { m_securityManager.deleteStaticExportPublishedResource(m_context, resourceName, linkType, linkParameter); }
[ "public", "void", "deleteStaticExportPublishedResource", "(", "String", "resourceName", ",", "int", "linkType", ",", "String", "linkParameter", ")", "throws", "CmsException", "{", "m_securityManager", ".", "deleteStaticExportPublishedResource", "(", "m_context", ",", "resourceName", ",", "linkType", ",", "linkParameter", ")", ";", "}" ]
Deletes a published resource entry.<p> @param resourceName The name of the resource to be deleted in the static export @param linkType the type of resource deleted (0= non-parameter, 1=parameter) @param linkParameter the parameters of the resource @throws CmsException if something goes wrong
[ "Deletes", "a", "published", "resource", "entry", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1084-L1088
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java
CmsGalleryController.saveTreeState
public void saveTreeState(final String treeName, final String siteRoot, final Set<CmsUUID> openItemIds) { """ Saves the tree state for a given tree on the server.<p> @param treeName the tree name @param siteRoot the site root @param openItemIds the structure ids of opened items """ CmsRpcAction<Void> treeStateAction = new CmsRpcAction<Void>() { @Override public void execute() { start(600, false); getGalleryService().saveTreeOpenState(treeName, getTreeToken(), siteRoot, openItemIds, this); } @Override protected void onResponse(Void result) { stop(false); } }; treeStateAction.execute(); }
java
public void saveTreeState(final String treeName, final String siteRoot, final Set<CmsUUID> openItemIds) { CmsRpcAction<Void> treeStateAction = new CmsRpcAction<Void>() { @Override public void execute() { start(600, false); getGalleryService().saveTreeOpenState(treeName, getTreeToken(), siteRoot, openItemIds, this); } @Override protected void onResponse(Void result) { stop(false); } }; treeStateAction.execute(); }
[ "public", "void", "saveTreeState", "(", "final", "String", "treeName", ",", "final", "String", "siteRoot", ",", "final", "Set", "<", "CmsUUID", ">", "openItemIds", ")", "{", "CmsRpcAction", "<", "Void", ">", "treeStateAction", "=", "new", "CmsRpcAction", "<", "Void", ">", "(", ")", "{", "@", "Override", "public", "void", "execute", "(", ")", "{", "start", "(", "600", ",", "false", ")", ";", "getGalleryService", "(", ")", ".", "saveTreeOpenState", "(", "treeName", ",", "getTreeToken", "(", ")", ",", "siteRoot", ",", "openItemIds", ",", "this", ")", ";", "}", "@", "Override", "protected", "void", "onResponse", "(", "Void", "result", ")", "{", "stop", "(", "false", ")", ";", "}", "}", ";", "treeStateAction", ".", "execute", "(", ")", ";", "}" ]
Saves the tree state for a given tree on the server.<p> @param treeName the tree name @param siteRoot the site root @param openItemIds the structure ids of opened items
[ "Saves", "the", "tree", "state", "for", "a", "given", "tree", "on", "the", "server", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java#L1181-L1200
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java
StatsConfigHelper.getTranslatedStatsName
public static String getTranslatedStatsName(String statsName, String statsType, Locale locale) { """ Method to translate the Stats instance/group name in the tree. Used by Admin Console """ String[] _stats = parseStatsType(statsType); for (int i = 0; i < _stats.length; i++) { PmiModuleConfig cfg = getTranslatedStatsConfig(_stats[i], locale); if (cfg != null) { NLS aNLS = getNLS(locale, cfg.getResourceBundle(), statsType); if (aNLS != null) { String trName; try { trName = aNLS.getString(statsName); } catch (MissingResourceException mre) { trName = statsName; } if (trName != null) return trName; } } } return statsName; }
java
public static String getTranslatedStatsName(String statsName, String statsType, Locale locale) { String[] _stats = parseStatsType(statsType); for (int i = 0; i < _stats.length; i++) { PmiModuleConfig cfg = getTranslatedStatsConfig(_stats[i], locale); if (cfg != null) { NLS aNLS = getNLS(locale, cfg.getResourceBundle(), statsType); if (aNLS != null) { String trName; try { trName = aNLS.getString(statsName); } catch (MissingResourceException mre) { trName = statsName; } if (trName != null) return trName; } } } return statsName; }
[ "public", "static", "String", "getTranslatedStatsName", "(", "String", "statsName", ",", "String", "statsType", ",", "Locale", "locale", ")", "{", "String", "[", "]", "_stats", "=", "parseStatsType", "(", "statsType", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_stats", ".", "length", ";", "i", "++", ")", "{", "PmiModuleConfig", "cfg", "=", "getTranslatedStatsConfig", "(", "_stats", "[", "i", "]", ",", "locale", ")", ";", "if", "(", "cfg", "!=", "null", ")", "{", "NLS", "aNLS", "=", "getNLS", "(", "locale", ",", "cfg", ".", "getResourceBundle", "(", ")", ",", "statsType", ")", ";", "if", "(", "aNLS", "!=", "null", ")", "{", "String", "trName", ";", "try", "{", "trName", "=", "aNLS", ".", "getString", "(", "statsName", ")", ";", "}", "catch", "(", "MissingResourceException", "mre", ")", "{", "trName", "=", "statsName", ";", "}", "if", "(", "trName", "!=", "null", ")", "return", "trName", ";", "}", "}", "}", "return", "statsName", ";", "}" ]
Method to translate the Stats instance/group name in the tree. Used by Admin Console
[ "Method", "to", "translate", "the", "Stats", "instance", "/", "group", "name", "in", "the", "tree", ".", "Used", "by", "Admin", "Console" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java#L162-L182
JodaOrg/joda-beans
src/main/java/org/joda/beans/impl/flexi/FlexiBean.java
FlexiBean.getInt
public int getInt(String propertyName, int defaultValue) { """ Gets the value of the property as a {@code int} using a default value. @param propertyName the property name, not empty @param defaultValue the default value for null or invalid property @return the value of the property @throws ClassCastException if the value is not compatible """ Object obj = get(propertyName); return obj != null ? ((Number) get(propertyName)).intValue() : defaultValue; }
java
public int getInt(String propertyName, int defaultValue) { Object obj = get(propertyName); return obj != null ? ((Number) get(propertyName)).intValue() : defaultValue; }
[ "public", "int", "getInt", "(", "String", "propertyName", ",", "int", "defaultValue", ")", "{", "Object", "obj", "=", "get", "(", "propertyName", ")", ";", "return", "obj", "!=", "null", "?", "(", "(", "Number", ")", "get", "(", "propertyName", ")", ")", ".", "intValue", "(", ")", ":", "defaultValue", ";", "}" ]
Gets the value of the property as a {@code int} using a default value. @param propertyName the property name, not empty @param defaultValue the default value for null or invalid property @return the value of the property @throws ClassCastException if the value is not compatible
[ "Gets", "the", "value", "of", "the", "property", "as", "a", "{", "@code", "int", "}", "using", "a", "default", "value", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/impl/flexi/FlexiBean.java#L197-L200
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_hunting_queue_queueId_GET
public OvhOvhPabxHuntingQueue billingAccount_ovhPabx_serviceName_hunting_queue_queueId_GET(String billingAccount, String serviceName, Long queueId) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param queueId [required] """ String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, queueId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxHuntingQueue.class); }
java
public OvhOvhPabxHuntingQueue billingAccount_ovhPabx_serviceName_hunting_queue_queueId_GET(String billingAccount, String serviceName, Long queueId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, queueId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxHuntingQueue.class); }
[ "public", "OvhOvhPabxHuntingQueue", "billingAccount_ovhPabx_serviceName_hunting_queue_queueId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "queueId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "queueId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOvhPabxHuntingQueue", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/queue/{queueId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param queueId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6701-L6706
keenlabs/KeenClient-Java
query/src/main/java/io/keen/client/java/KeenQueryClient.java
KeenQueryClient.standardDeviation
public double standardDeviation(String eventCollection, String targetProperty, Timeframe timeframe) throws IOException { """ Standard Deviation query with only the required arguments. Query API info here: https://keen.io/docs/api/#standard-deviation @param eventCollection The name of the event collection you are analyzing. @param targetProperty The name of the property you are analyzing. @param timeframe The {@link RelativeTimeframe} or {@link AbsoluteTimeframe}. @return The standard deviation query response. @throws IOException If there was an error communicating with the server or an error message received from the server. """ Query queryParams = new Query.Builder(QueryType.STANDARD_DEVIATION) .withEventCollection(eventCollection) .withTargetProperty(targetProperty) .withTimeframe(timeframe) .build(); return queryResultToDouble(execute(queryParams)); }
java
public double standardDeviation(String eventCollection, String targetProperty, Timeframe timeframe) throws IOException { Query queryParams = new Query.Builder(QueryType.STANDARD_DEVIATION) .withEventCollection(eventCollection) .withTargetProperty(targetProperty) .withTimeframe(timeframe) .build(); return queryResultToDouble(execute(queryParams)); }
[ "public", "double", "standardDeviation", "(", "String", "eventCollection", ",", "String", "targetProperty", ",", "Timeframe", "timeframe", ")", "throws", "IOException", "{", "Query", "queryParams", "=", "new", "Query", ".", "Builder", "(", "QueryType", ".", "STANDARD_DEVIATION", ")", ".", "withEventCollection", "(", "eventCollection", ")", ".", "withTargetProperty", "(", "targetProperty", ")", ".", "withTimeframe", "(", "timeframe", ")", ".", "build", "(", ")", ";", "return", "queryResultToDouble", "(", "execute", "(", "queryParams", ")", ")", ";", "}" ]
Standard Deviation query with only the required arguments. Query API info here: https://keen.io/docs/api/#standard-deviation @param eventCollection The name of the event collection you are analyzing. @param targetProperty The name of the property you are analyzing. @param timeframe The {@link RelativeTimeframe} or {@link AbsoluteTimeframe}. @return The standard deviation query response. @throws IOException If there was an error communicating with the server or an error message received from the server.
[ "Standard", "Deviation", "query", "with", "only", "the", "required", "arguments", ".", "Query", "API", "info", "here", ":", "https", ":", "//", "keen", ".", "io", "/", "docs", "/", "api", "/", "#standard", "-", "deviation" ]
train
https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/query/src/main/java/io/keen/client/java/KeenQueryClient.java#L264-L271
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/operations/OperationAnalyzer.java
OperationAnalyzer.isUndefined
public boolean isUndefined(final Field destination,final Field source) { """ This method analyzes the fields, calculates the info and returns true if operation is undefined. @param destination destination field @param source source field @return returns true if an operation between fields exists @see InfoOperation """ info = null; for (IOperationAnalyzer analyzer : analyzers) if(analyzer.verifyConditions(destination,source)) info = analyzer.getInfoOperation(destination, source); // if the operation has not been identified if(isNull(info)) info = undefinedOperation(); boolean conversionMethodExists = conversionAnalyzer.fieldsToCheck(destination,source); OperationType operationType = info.getOperationType(); if(operationType.isUndefined() && !conversionMethodExists)return true; if(conversionMethodExists) // explicit conversion between primitive types info.setInstructionType(operationType.isBasic()?OperationType.BASIC_CONVERSION // explicit conversion between complex types :OperationType.CONVERSION); return false; }
java
public boolean isUndefined(final Field destination,final Field source) { info = null; for (IOperationAnalyzer analyzer : analyzers) if(analyzer.verifyConditions(destination,source)) info = analyzer.getInfoOperation(destination, source); // if the operation has not been identified if(isNull(info)) info = undefinedOperation(); boolean conversionMethodExists = conversionAnalyzer.fieldsToCheck(destination,source); OperationType operationType = info.getOperationType(); if(operationType.isUndefined() && !conversionMethodExists)return true; if(conversionMethodExists) // explicit conversion between primitive types info.setInstructionType(operationType.isBasic()?OperationType.BASIC_CONVERSION // explicit conversion between complex types :OperationType.CONVERSION); return false; }
[ "public", "boolean", "isUndefined", "(", "final", "Field", "destination", ",", "final", "Field", "source", ")", "{", "info", "=", "null", ";", "for", "(", "IOperationAnalyzer", "analyzer", ":", "analyzers", ")", "if", "(", "analyzer", ".", "verifyConditions", "(", "destination", ",", "source", ")", ")", "info", "=", "analyzer", ".", "getInfoOperation", "(", "destination", ",", "source", ")", ";", "// if the operation has not been identified\r", "if", "(", "isNull", "(", "info", ")", ")", "info", "=", "undefinedOperation", "(", ")", ";", "boolean", "conversionMethodExists", "=", "conversionAnalyzer", ".", "fieldsToCheck", "(", "destination", ",", "source", ")", ";", "OperationType", "operationType", "=", "info", ".", "getOperationType", "(", ")", ";", "if", "(", "operationType", ".", "isUndefined", "(", ")", "&&", "!", "conversionMethodExists", ")", "return", "true", ";", "if", "(", "conversionMethodExists", ")", "// explicit conversion between primitive types\r", "info", ".", "setInstructionType", "(", "operationType", ".", "isBasic", "(", ")", "?", "OperationType", ".", "BASIC_CONVERSION", "// explicit conversion between complex types\r", ":", "OperationType", ".", "CONVERSION", ")", ";", "return", "false", ";", "}" ]
This method analyzes the fields, calculates the info and returns true if operation is undefined. @param destination destination field @param source source field @return returns true if an operation between fields exists @see InfoOperation
[ "This", "method", "analyzes", "the", "fields", "calculates", "the", "info", "and", "returns", "true", "if", "operation", "is", "undefined", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/OperationAnalyzer.java#L75-L97
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/InjectionClassLoader.java
InjectionClassLoader.defineClass
public Class<?> defineClass(String name, byte[] binaryRepresentation) throws ClassNotFoundException { """ Defines a new type to be loaded by this class loader. @param name The name of the type. @param binaryRepresentation The type's binary representation. @return The defined class or a previously defined class. @throws ClassNotFoundException If the class could not be loaded. """ return defineClasses(Collections.singletonMap(name, binaryRepresentation)).get(name); }
java
public Class<?> defineClass(String name, byte[] binaryRepresentation) throws ClassNotFoundException { return defineClasses(Collections.singletonMap(name, binaryRepresentation)).get(name); }
[ "public", "Class", "<", "?", ">", "defineClass", "(", "String", "name", ",", "byte", "[", "]", "binaryRepresentation", ")", "throws", "ClassNotFoundException", "{", "return", "defineClasses", "(", "Collections", ".", "singletonMap", "(", "name", ",", "binaryRepresentation", ")", ")", ".", "get", "(", "name", ")", ";", "}" ]
Defines a new type to be loaded by this class loader. @param name The name of the type. @param binaryRepresentation The type's binary representation. @return The defined class or a previously defined class. @throws ClassNotFoundException If the class could not be loaded.
[ "Defines", "a", "new", "type", "to", "be", "loaded", "by", "this", "class", "loader", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/InjectionClassLoader.java#L68-L70
ical4j/ical4j
src/main/java/net/fortuna/ical4j/transform/recurrence/AbstractDateExpansionRule.java
AbstractDateExpansionRule.getCalendarInstance
protected Calendar getCalendarInstance(final Date date, final boolean lenient) { """ Construct a Calendar object and sets the time. @param date @param lenient @return """ Calendar cal = Dates.getCalendarInstance(date); // A week should have at least 4 days to be considered as such per RFC5545 cal.setMinimalDaysInFirstWeek(4); cal.setFirstDayOfWeek(calendarWeekStartDay); cal.setLenient(lenient); cal.setTime(date); return cal; }
java
protected Calendar getCalendarInstance(final Date date, final boolean lenient) { Calendar cal = Dates.getCalendarInstance(date); // A week should have at least 4 days to be considered as such per RFC5545 cal.setMinimalDaysInFirstWeek(4); cal.setFirstDayOfWeek(calendarWeekStartDay); cal.setLenient(lenient); cal.setTime(date); return cal; }
[ "protected", "Calendar", "getCalendarInstance", "(", "final", "Date", "date", ",", "final", "boolean", "lenient", ")", "{", "Calendar", "cal", "=", "Dates", ".", "getCalendarInstance", "(", "date", ")", ";", "// A week should have at least 4 days to be considered as such per RFC5545", "cal", ".", "setMinimalDaysInFirstWeek", "(", "4", ")", ";", "cal", ".", "setFirstDayOfWeek", "(", "calendarWeekStartDay", ")", ";", "cal", ".", "setLenient", "(", "lenient", ")", ";", "cal", ".", "setTime", "(", "date", ")", ";", "return", "cal", ";", "}" ]
Construct a Calendar object and sets the time. @param date @param lenient @return
[ "Construct", "a", "Calendar", "object", "and", "sets", "the", "time", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/transform/recurrence/AbstractDateExpansionRule.java#L110-L119
cdk/cdk
storage/inchi/src/main/java/org/openscience/cdk/inchi/InChIGeneratorFactory.java
InChIGeneratorFactory.getInChIGenerator
public InChIGenerator getInChIGenerator(IAtomContainer container, List<INCHI_OPTION> options) throws CDKException { """ Gets InChI generator for CDK IAtomContainer. @param container AtomContainer to generate InChI for. @param options List of options (net.sf.jniinchi.INCHI_OPTION) for InChI generation. @return the InChI generator object @throws CDKException if the generator cannot be instantiated """ if (options == null) throw new IllegalArgumentException("Null options"); return (new InChIGenerator(container, options, ignoreAromaticBonds)); }
java
public InChIGenerator getInChIGenerator(IAtomContainer container, List<INCHI_OPTION> options) throws CDKException { if (options == null) throw new IllegalArgumentException("Null options"); return (new InChIGenerator(container, options, ignoreAromaticBonds)); }
[ "public", "InChIGenerator", "getInChIGenerator", "(", "IAtomContainer", "container", ",", "List", "<", "INCHI_OPTION", ">", "options", ")", "throws", "CDKException", "{", "if", "(", "options", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Null options\"", ")", ";", "return", "(", "new", "InChIGenerator", "(", "container", ",", "options", ",", "ignoreAromaticBonds", ")", ")", ";", "}" ]
Gets InChI generator for CDK IAtomContainer. @param container AtomContainer to generate InChI for. @param options List of options (net.sf.jniinchi.INCHI_OPTION) for InChI generation. @return the InChI generator object @throws CDKException if the generator cannot be instantiated
[ "Gets", "InChI", "generator", "for", "CDK", "IAtomContainer", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/inchi/src/main/java/org/openscience/cdk/inchi/InChIGeneratorFactory.java#L170-L173
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java
ESFilterBuilder.getOrFilterBuilder
private OrQueryBuilder getOrFilterBuilder(Expression logicalExp, EntityMetadata m) { """ Gets the or filter builder. @param logicalExp the logical exp @param m the m @param entity the entity @return the or filter builder """ OrExpression orExp = (OrExpression) logicalExp; Expression leftExpression = orExp.getLeftExpression(); Expression rightExpression = orExp.getRightExpression(); return new OrQueryBuilder(populateFilterBuilder(leftExpression, m), populateFilterBuilder(rightExpression, m)); }
java
private OrQueryBuilder getOrFilterBuilder(Expression logicalExp, EntityMetadata m) { OrExpression orExp = (OrExpression) logicalExp; Expression leftExpression = orExp.getLeftExpression(); Expression rightExpression = orExp.getRightExpression(); return new OrQueryBuilder(populateFilterBuilder(leftExpression, m), populateFilterBuilder(rightExpression, m)); }
[ "private", "OrQueryBuilder", "getOrFilterBuilder", "(", "Expression", "logicalExp", ",", "EntityMetadata", "m", ")", "{", "OrExpression", "orExp", "=", "(", "OrExpression", ")", "logicalExp", ";", "Expression", "leftExpression", "=", "orExp", ".", "getLeftExpression", "(", ")", ";", "Expression", "rightExpression", "=", "orExp", ".", "getRightExpression", "(", ")", ";", "return", "new", "OrQueryBuilder", "(", "populateFilterBuilder", "(", "leftExpression", ",", "m", ")", ",", "populateFilterBuilder", "(", "rightExpression", ",", "m", ")", ")", ";", "}" ]
Gets the or filter builder. @param logicalExp the logical exp @param m the m @param entity the entity @return the or filter builder
[ "Gets", "the", "or", "filter", "builder", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java#L378-L385
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java
MetadataStore.failAssignment
private void failAssignment(String streamSegmentName, Throwable reason) { """ Fails the assignment for the given StreamSegment Id with the given reason. """ finishPendingRequests(streamSegmentName, PendingRequest::completeExceptionally, reason); }
java
private void failAssignment(String streamSegmentName, Throwable reason) { finishPendingRequests(streamSegmentName, PendingRequest::completeExceptionally, reason); }
[ "private", "void", "failAssignment", "(", "String", "streamSegmentName", ",", "Throwable", "reason", ")", "{", "finishPendingRequests", "(", "streamSegmentName", ",", "PendingRequest", "::", "completeExceptionally", ",", "reason", ")", ";", "}" ]
Fails the assignment for the given StreamSegment Id with the given reason.
[ "Fails", "the", "assignment", "for", "the", "given", "StreamSegment", "Id", "with", "the", "given", "reason", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L447-L449
aws/aws-sdk-java
aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/ProjectSummary.java
ProjectSummary.withTags
public ProjectSummary withTags(java.util.Map<String, String> tags) { """ <p> The tags (metadata key/value pairs) associated with the project. </p> @param tags The tags (metadata key/value pairs) associated with the project. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public ProjectSummary withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "ProjectSummary", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags (metadata key/value pairs) associated with the project. </p> @param tags The tags (metadata key/value pairs) associated with the project. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "(", "metadata", "key", "/", "value", "pairs", ")", "associated", "with", "the", "project", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/ProjectSummary.java#L264-L267
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.findGridFSDBFile
private GridFSDBFile findGridFSDBFile(EntityMetadata entityMetadata, Object key) { """ Find GRIDFSDBFile. @param entityMetadata the entity metadata @param key the key @return the grid fsdb file """ String id = ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName(); DBObject query = new BasicDBObject("metadata." + id, key); KunderaGridFS gfs = new KunderaGridFS(mongoDb, entityMetadata.getTableName()); return gfs.findOne(query); }
java
private GridFSDBFile findGridFSDBFile(EntityMetadata entityMetadata, Object key) { String id = ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName(); DBObject query = new BasicDBObject("metadata." + id, key); KunderaGridFS gfs = new KunderaGridFS(mongoDb, entityMetadata.getTableName()); return gfs.findOne(query); }
[ "private", "GridFSDBFile", "findGridFSDBFile", "(", "EntityMetadata", "entityMetadata", ",", "Object", "key", ")", "{", "String", "id", "=", "(", "(", "AbstractAttribute", ")", "entityMetadata", ".", "getIdAttribute", "(", ")", ")", ".", "getJPAColumnName", "(", ")", ";", "DBObject", "query", "=", "new", "BasicDBObject", "(", "\"metadata.\"", "+", "id", ",", "key", ")", ";", "KunderaGridFS", "gfs", "=", "new", "KunderaGridFS", "(", "mongoDb", ",", "entityMetadata", ".", "getTableName", "(", ")", ")", ";", "return", "gfs", ".", "findOne", "(", "query", ")", ";", "}" ]
Find GRIDFSDBFile. @param entityMetadata the entity metadata @param key the key @return the grid fsdb file
[ "Find", "GRIDFSDBFile", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L426-L432
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java
SingularOps_DDRM.nullspaceQRP
public static DMatrixRMaj nullspaceQRP( DMatrixRMaj A , int totalSingular ) { """ Computes the null space using QRP decomposition. This is faster than using SVD but slower than QR. Much more stable than QR though. @param A (Input) Matrix @param totalSingular Number of singular values @return Null space """ SolveNullSpaceQRP_DDRM solver = new SolveNullSpaceQRP_DDRM(); DMatrixRMaj nullspace = new DMatrixRMaj(1,1); if( !solver.process(A,totalSingular,nullspace)) throw new RuntimeException("Solver failed. try SVD based method instead?"); return nullspace; }
java
public static DMatrixRMaj nullspaceQRP( DMatrixRMaj A , int totalSingular ) { SolveNullSpaceQRP_DDRM solver = new SolveNullSpaceQRP_DDRM(); DMatrixRMaj nullspace = new DMatrixRMaj(1,1); if( !solver.process(A,totalSingular,nullspace)) throw new RuntimeException("Solver failed. try SVD based method instead?"); return nullspace; }
[ "public", "static", "DMatrixRMaj", "nullspaceQRP", "(", "DMatrixRMaj", "A", ",", "int", "totalSingular", ")", "{", "SolveNullSpaceQRP_DDRM", "solver", "=", "new", "SolveNullSpaceQRP_DDRM", "(", ")", ";", "DMatrixRMaj", "nullspace", "=", "new", "DMatrixRMaj", "(", "1", ",", "1", ")", ";", "if", "(", "!", "solver", ".", "process", "(", "A", ",", "totalSingular", ",", "nullspace", ")", ")", "throw", "new", "RuntimeException", "(", "\"Solver failed. try SVD based method instead?\"", ")", ";", "return", "nullspace", ";", "}" ]
Computes the null space using QRP decomposition. This is faster than using SVD but slower than QR. Much more stable than QR though. @param A (Input) Matrix @param totalSingular Number of singular values @return Null space
[ "Computes", "the", "null", "space", "using", "QRP", "decomposition", ".", "This", "is", "faster", "than", "using", "SVD", "but", "slower", "than", "QR", ".", "Much", "more", "stable", "than", "QR", "though", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L452-L461
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/BinaryImageOps.java
BinaryImageOps.labelToBinary
public static GrayU8 labelToBinary(GrayS32 labelImage , GrayU8 binaryImage , int numLabels, int ...selected ) { """ Only converts the specified blobs over into the binary image. Easier to use version of {@link #labelToBinary(GrayS32, GrayU8, boolean[])}. @param labelImage Input image. Not modified. @param binaryImage Output image. If null a new one will be declared. Modified. @param numLabels Number of labels in the image. This is the number of found clusters + 1. @param selected The index of labels which will be marked as 1 in the output binary image. @return The binary image. """ boolean selectedBlobs[] = new boolean[numLabels]; for (int i = 0; i < selected.length; i++) { selectedBlobs[selected[i]] = true; } return labelToBinary(labelImage,binaryImage,selectedBlobs); }
java
public static GrayU8 labelToBinary(GrayS32 labelImage , GrayU8 binaryImage , int numLabels, int ...selected ) { boolean selectedBlobs[] = new boolean[numLabels]; for (int i = 0; i < selected.length; i++) { selectedBlobs[selected[i]] = true; } return labelToBinary(labelImage,binaryImage,selectedBlobs); }
[ "public", "static", "GrayU8", "labelToBinary", "(", "GrayS32", "labelImage", ",", "GrayU8", "binaryImage", ",", "int", "numLabels", ",", "int", "...", "selected", ")", "{", "boolean", "selectedBlobs", "[", "]", "=", "new", "boolean", "[", "numLabels", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "selected", ".", "length", ";", "i", "++", ")", "{", "selectedBlobs", "[", "selected", "[", "i", "]", "]", "=", "true", ";", "}", "return", "labelToBinary", "(", "labelImage", ",", "binaryImage", ",", "selectedBlobs", ")", ";", "}" ]
Only converts the specified blobs over into the binary image. Easier to use version of {@link #labelToBinary(GrayS32, GrayU8, boolean[])}. @param labelImage Input image. Not modified. @param binaryImage Output image. If null a new one will be declared. Modified. @param numLabels Number of labels in the image. This is the number of found clusters + 1. @param selected The index of labels which will be marked as 1 in the output binary image. @return The binary image.
[ "Only", "converts", "the", "specified", "blobs", "over", "into", "the", "binary", "image", ".", "Easier", "to", "use", "version", "of", "{", "@link", "#labelToBinary", "(", "GrayS32", "GrayU8", "boolean", "[]", ")", "}", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/BinaryImageOps.java#L569-L578
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentsInner.java
ComponentsInner.createOrUpdateAsync
public Observable<ApplicationInsightsComponentInner> createOrUpdateAsync(String resourceGroupName, String resourceName, ApplicationInsightsComponentInner insightProperties) { """ Creates (or updates) an Application Insights component. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param insightProperties Properties that need to be specified to create an Application Insights component. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationInsightsComponentInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, insightProperties).map(new Func1<ServiceResponse<ApplicationInsightsComponentInner>, ApplicationInsightsComponentInner>() { @Override public ApplicationInsightsComponentInner call(ServiceResponse<ApplicationInsightsComponentInner> response) { return response.body(); } }); }
java
public Observable<ApplicationInsightsComponentInner> createOrUpdateAsync(String resourceGroupName, String resourceName, ApplicationInsightsComponentInner insightProperties) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, insightProperties).map(new Func1<ServiceResponse<ApplicationInsightsComponentInner>, ApplicationInsightsComponentInner>() { @Override public ApplicationInsightsComponentInner call(ServiceResponse<ApplicationInsightsComponentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationInsightsComponentInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "ApplicationInsightsComponentInner", "insightProperties", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "insightProperties", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ApplicationInsightsComponentInner", ">", ",", "ApplicationInsightsComponentInner", ">", "(", ")", "{", "@", "Override", "public", "ApplicationInsightsComponentInner", "call", "(", "ServiceResponse", "<", "ApplicationInsightsComponentInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates (or updates) an Application Insights component. Note: You cannot specify a different value for InstrumentationKey nor AppId in the Put operation. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param insightProperties Properties that need to be specified to create an Application Insights component. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationInsightsComponentInner object
[ "Creates", "(", "or", "updates", ")", "an", "Application", "Insights", "component", ".", "Note", ":", "You", "cannot", "specify", "a", "different", "value", "for", "InstrumentationKey", "nor", "AppId", "in", "the", "Put", "operation", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentsInner.java#L546-L553
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentPersistenceImpl.java
CommerceShipmentPersistenceImpl.removeByG_S
@Override public void removeByG_S(long groupId, int status) { """ Removes all the commerce shipments where groupId = &#63; and status = &#63; from the database. @param groupId the group ID @param status the status """ for (CommerceShipment commerceShipment : findByG_S(groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceShipment); } }
java
@Override public void removeByG_S(long groupId, int status) { for (CommerceShipment commerceShipment : findByG_S(groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceShipment); } }
[ "@", "Override", "public", "void", "removeByG_S", "(", "long", "groupId", ",", "int", "status", ")", "{", "for", "(", "CommerceShipment", "commerceShipment", ":", "findByG_S", "(", "groupId", ",", "status", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "commerceShipment", ")", ";", "}", "}" ]
Removes all the commerce shipments where groupId = &#63; and status = &#63; from the database. @param groupId the group ID @param status the status
[ "Removes", "all", "the", "commerce", "shipments", "where", "groupId", "=", "&#63", ";", "and", "status", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentPersistenceImpl.java#L1080-L1086
otto-de/edison-hal
src/main/java/de/otto/edison/hal/traverson/Traverson.java
Traverson.followLink
public Traverson followLink(final String rel, final Predicate<Link> predicate) { """ Follow the first {@link Link} of the current resource that is matching the link-relation type and the {@link LinkPredicates predicate}. <p> Other than {@link #follow(String, Predicate)}, this method will ignore possibly embedded resources with the same link-relation type. Only if the link is missing, the embedded resource is used. </p> @param rel the link-relation type of the followed link @param predicate the predicate used to select the link to follow @return this @since 2.0.0 """ return followLink(rel, predicate, emptyMap()); }
java
public Traverson followLink(final String rel, final Predicate<Link> predicate) { return followLink(rel, predicate, emptyMap()); }
[ "public", "Traverson", "followLink", "(", "final", "String", "rel", ",", "final", "Predicate", "<", "Link", ">", "predicate", ")", "{", "return", "followLink", "(", "rel", ",", "predicate", ",", "emptyMap", "(", ")", ")", ";", "}" ]
Follow the first {@link Link} of the current resource that is matching the link-relation type and the {@link LinkPredicates predicate}. <p> Other than {@link #follow(String, Predicate)}, this method will ignore possibly embedded resources with the same link-relation type. Only if the link is missing, the embedded resource is used. </p> @param rel the link-relation type of the followed link @param predicate the predicate used to select the link to follow @return this @since 2.0.0
[ "Follow", "the", "first", "{", "@link", "Link", "}", "of", "the", "current", "resource", "that", "is", "matching", "the", "link", "-", "relation", "type", "and", "the", "{", "@link", "LinkPredicates", "predicate", "}", ".", "<p", ">", "Other", "than", "{", "@link", "#follow", "(", "String", "Predicate", ")", "}", "this", "method", "will", "ignore", "possibly", "embedded", "resources", "with", "the", "same", "link", "-", "relation", "type", ".", "Only", "if", "the", "link", "is", "missing", "the", "embedded", "resource", "is", "used", ".", "<", "/", "p", ">" ]
train
https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/traverson/Traverson.java#L408-L411
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/internal/rendering/writer/svg/geometry/GeometryCollectionWriter.java
GeometryCollectionWriter.writeObject
public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException { """ Writes a <code>GeometryCollection</code> object. @param o The <code>LineString</code> to be encoded. """ GeometryCollection coll = (GeometryCollection) o; document.writeElement("path", asChild); document.writeAttribute("fill-rule", "evenodd"); document.writeAttributeStart("d"); for (int i = 0; i < coll.getNumGeometries(); i++) { document.writeObject(coll.getGeometryN(i), true); // TODO delegate to appropriate writers, is this correct? } document.writeAttributeEnd(); }
java
public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException { GeometryCollection coll = (GeometryCollection) o; document.writeElement("path", asChild); document.writeAttribute("fill-rule", "evenodd"); document.writeAttributeStart("d"); for (int i = 0; i < coll.getNumGeometries(); i++) { document.writeObject(coll.getGeometryN(i), true); // TODO delegate to appropriate writers, is this correct? } document.writeAttributeEnd(); }
[ "public", "void", "writeObject", "(", "Object", "o", ",", "GraphicsDocument", "document", ",", "boolean", "asChild", ")", "throws", "RenderException", "{", "GeometryCollection", "coll", "=", "(", "GeometryCollection", ")", "o", ";", "document", ".", "writeElement", "(", "\"path\"", ",", "asChild", ")", ";", "document", ".", "writeAttribute", "(", "\"fill-rule\"", ",", "\"evenodd\"", ")", ";", "document", ".", "writeAttributeStart", "(", "\"d\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "coll", ".", "getNumGeometries", "(", ")", ";", "i", "++", ")", "{", "document", ".", "writeObject", "(", "coll", ".", "getGeometryN", "(", "i", ")", ",", "true", ")", ";", "// TODO delegate to appropriate writers, is this correct?", "}", "document", ".", "writeAttributeEnd", "(", ")", ";", "}" ]
Writes a <code>GeometryCollection</code> object. @param o The <code>LineString</code> to be encoded.
[ "Writes", "a", "<code", ">", "GeometryCollection<", "/", "code", ">", "object", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/writer/svg/geometry/GeometryCollectionWriter.java#L34-L43
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
MercatorProjection.pixelYToTileYWithScaleFactor
public static int pixelYToTileYWithScaleFactor(double pixelY, double scaleFactor, int tileSize) { """ Converts a pixel Y coordinate to the tile Y number. @param pixelY the pixel Y coordinate that should be converted. @param scaleFactor the scale factor at which the coordinate should be converted. @return the tile Y number. """ return (int) Math.min(Math.max(pixelY / tileSize, 0), scaleFactor - 1); }
java
public static int pixelYToTileYWithScaleFactor(double pixelY, double scaleFactor, int tileSize) { return (int) Math.min(Math.max(pixelY / tileSize, 0), scaleFactor - 1); }
[ "public", "static", "int", "pixelYToTileYWithScaleFactor", "(", "double", "pixelY", ",", "double", "scaleFactor", ",", "int", "tileSize", ")", "{", "return", "(", "int", ")", "Math", ".", "min", "(", "Math", ".", "max", "(", "pixelY", "/", "tileSize", ",", "0", ")", ",", "scaleFactor", "-", "1", ")", ";", "}" ]
Converts a pixel Y coordinate to the tile Y number. @param pixelY the pixel Y coordinate that should be converted. @param scaleFactor the scale factor at which the coordinate should be converted. @return the tile Y number.
[ "Converts", "a", "pixel", "Y", "coordinate", "to", "the", "tile", "Y", "number", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L422-L424
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java
CollectionExtensions.removeAll
@Inline(value="$3.$4removeAll($1, $2)", imported=Iterables.class) public static <T> boolean removeAll(Collection<T> collection, Collection<? extends T> elements) { """ Removes all of the specified elements from the specified collection. @param collection the collection from which the {@code elements} are to be removed. May not be <code>null</code>. @param elements the elements to remove from the {@code collection}. May not be <code>null</code> but may contain <code>null</code> entries if the {@code collection} allows that. @return <code>true</code> if the collection changed as a result of the call @since 2.4 """ return Iterables.removeAll(collection, elements); }
java
@Inline(value="$3.$4removeAll($1, $2)", imported=Iterables.class) public static <T> boolean removeAll(Collection<T> collection, Collection<? extends T> elements) { return Iterables.removeAll(collection, elements); }
[ "@", "Inline", "(", "value", "=", "\"$3.$4removeAll($1, $2)\"", ",", "imported", "=", "Iterables", ".", "class", ")", "public", "static", "<", "T", ">", "boolean", "removeAll", "(", "Collection", "<", "T", ">", "collection", ",", "Collection", "<", "?", "extends", "T", ">", "elements", ")", "{", "return", "Iterables", ".", "removeAll", "(", "collection", ",", "elements", ")", ";", "}" ]
Removes all of the specified elements from the specified collection. @param collection the collection from which the {@code elements} are to be removed. May not be <code>null</code>. @param elements the elements to remove from the {@code collection}. May not be <code>null</code> but may contain <code>null</code> entries if the {@code collection} allows that. @return <code>true</code> if the collection changed as a result of the call @since 2.4
[ "Removes", "all", "of", "the", "specified", "elements", "from", "the", "specified", "collection", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java#L300-L303
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java
QueueContainer.addAll
public Map<Long, Data> addAll(Collection<Data> dataList) { """ Adds all items from the {@code dataList} to the queue. The data will be stored in the queue store if configured and enabled. If the store is enabled, only {@link QueueStoreWrapper#getMemoryLimit()} item data will be stored in memory. Cancels the eviction if one is scheduled. @param dataList the items to be added to the queue and stored in the queue store @return map of item ID and items added """ Map<Long, Data> map = createHashMap(dataList.size()); List<QueueItem> list = new ArrayList<QueueItem>(dataList.size()); for (Data data : dataList) { QueueItem item = new QueueItem(this, nextId(), null); if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) { item.setData(data); } map.put(item.getItemId(), data); list.add(item); } if (store.isEnabled() && !map.isEmpty()) { try { store.storeAll(map); } catch (Exception e) { throw new HazelcastException(e); } } if (!list.isEmpty()) { getItemQueue().addAll(list); cancelEvictionIfExists(); } return map; }
java
public Map<Long, Data> addAll(Collection<Data> dataList) { Map<Long, Data> map = createHashMap(dataList.size()); List<QueueItem> list = new ArrayList<QueueItem>(dataList.size()); for (Data data : dataList) { QueueItem item = new QueueItem(this, nextId(), null); if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) { item.setData(data); } map.put(item.getItemId(), data); list.add(item); } if (store.isEnabled() && !map.isEmpty()) { try { store.storeAll(map); } catch (Exception e) { throw new HazelcastException(e); } } if (!list.isEmpty()) { getItemQueue().addAll(list); cancelEvictionIfExists(); } return map; }
[ "public", "Map", "<", "Long", ",", "Data", ">", "addAll", "(", "Collection", "<", "Data", ">", "dataList", ")", "{", "Map", "<", "Long", ",", "Data", ">", "map", "=", "createHashMap", "(", "dataList", ".", "size", "(", ")", ")", ";", "List", "<", "QueueItem", ">", "list", "=", "new", "ArrayList", "<", "QueueItem", ">", "(", "dataList", ".", "size", "(", ")", ")", ";", "for", "(", "Data", "data", ":", "dataList", ")", "{", "QueueItem", "item", "=", "new", "QueueItem", "(", "this", ",", "nextId", "(", ")", ",", "null", ")", ";", "if", "(", "!", "store", ".", "isEnabled", "(", ")", "||", "store", ".", "getMemoryLimit", "(", ")", ">", "getItemQueue", "(", ")", ".", "size", "(", ")", ")", "{", "item", ".", "setData", "(", "data", ")", ";", "}", "map", ".", "put", "(", "item", ".", "getItemId", "(", ")", ",", "data", ")", ";", "list", ".", "add", "(", "item", ")", ";", "}", "if", "(", "store", ".", "isEnabled", "(", ")", "&&", "!", "map", ".", "isEmpty", "(", ")", ")", "{", "try", "{", "store", ".", "storeAll", "(", "map", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "HazelcastException", "(", "e", ")", ";", "}", "}", "if", "(", "!", "list", ".", "isEmpty", "(", ")", ")", "{", "getItemQueue", "(", ")", ".", "addAll", "(", "list", ")", ";", "cancelEvictionIfExists", "(", ")", ";", "}", "return", "map", ";", "}" ]
Adds all items from the {@code dataList} to the queue. The data will be stored in the queue store if configured and enabled. If the store is enabled, only {@link QueueStoreWrapper#getMemoryLimit()} item data will be stored in memory. Cancels the eviction if one is scheduled. @param dataList the items to be added to the queue and stored in the queue store @return map of item ID and items added
[ "Adds", "all", "items", "from", "the", "{", "@code", "dataList", "}", "to", "the", "queue", ".", "The", "data", "will", "be", "stored", "in", "the", "queue", "store", "if", "configured", "and", "enabled", ".", "If", "the", "store", "is", "enabled", "only", "{", "@link", "QueueStoreWrapper#getMemoryLimit", "()", "}", "item", "data", "will", "be", "stored", "in", "memory", ".", "Cancels", "the", "eviction", "if", "one", "is", "scheduled", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java#L479-L502
datasift/datasift-java
src/main/java/com/datasift/client/ParamBuilder.java
ParamBuilder.put
public ParamBuilder put(String name, Object value) { """ /* Adds or replaces a parameter @param name the name of the parameter @param value the value to the parameter @return this builder for further re-use """ params.put(name, value); return this; }
java
public ParamBuilder put(String name, Object value) { params.put(name, value); return this; }
[ "public", "ParamBuilder", "put", "(", "String", "name", ",", "Object", "value", ")", "{", "params", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
/* Adds or replaces a parameter @param name the name of the parameter @param value the value to the parameter @return this builder for further re-use
[ "/", "*", "Adds", "or", "replaces", "a", "parameter" ]
train
https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/ParamBuilder.java#L23-L26
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFString.java
MFString.set1Value
public void set1Value(int index, String newValue) { """ Replace a single value at the appropriate location in the existing value array. @param index - location in the array list @param newValue - the new String """ try { value.set( index, newValue ); } catch (IndexOutOfBoundsException e) { Log.e(TAG, "X3D MFString set1Value(int index, ...) out of bounds." + e); } catch (Exception e) { Log.e(TAG, "X3D MFString set1Value(int index, ...) exception " + e); } }
java
public void set1Value(int index, String newValue) { try { value.set( index, newValue ); } catch (IndexOutOfBoundsException e) { Log.e(TAG, "X3D MFString set1Value(int index, ...) out of bounds." + e); } catch (Exception e) { Log.e(TAG, "X3D MFString set1Value(int index, ...) exception " + e); } }
[ "public", "void", "set1Value", "(", "int", "index", ",", "String", "newValue", ")", "{", "try", "{", "value", ".", "set", "(", "index", ",", "newValue", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"X3D MFString set1Value(int index, ...) out of bounds.\"", "+", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"X3D MFString set1Value(int index, ...) exception \"", "+", "e", ")", ";", "}", "}" ]
Replace a single value at the appropriate location in the existing value array. @param index - location in the array list @param newValue - the new String
[ "Replace", "a", "single", "value", "at", "the", "appropriate", "location", "in", "the", "existing", "value", "array", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFString.java#L128-L138
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java
IntentsClient.getIntent
public final Intent getIntent(String name, String languageCode) { """ Retrieves the specified intent. <p>Sample code: <pre><code> try (IntentsClient intentsClient = IntentsClient.create()) { IntentName name = IntentName.of("[PROJECT]", "[INTENT]"); String languageCode = ""; Intent response = intentsClient.getIntent(name.toString(), languageCode); } </code></pre> @param name Required. The name of the intent. Format: `projects/&lt;Project ID&gt;/agent/intents/&lt;Intent ID&gt;`. @param languageCode Optional. The language to retrieve training phrases, parameters and rich messages for. If not specified, the agent's default language is used. [Many languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are supported. Note: languages must be enabled in the agent before they can be used. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ GetIntentRequest request = GetIntentRequest.newBuilder().setName(name).setLanguageCode(languageCode).build(); return getIntent(request); }
java
public final Intent getIntent(String name, String languageCode) { GetIntentRequest request = GetIntentRequest.newBuilder().setName(name).setLanguageCode(languageCode).build(); return getIntent(request); }
[ "public", "final", "Intent", "getIntent", "(", "String", "name", ",", "String", "languageCode", ")", "{", "GetIntentRequest", "request", "=", "GetIntentRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", ")", ".", "setLanguageCode", "(", "languageCode", ")", ".", "build", "(", ")", ";", "return", "getIntent", "(", "request", ")", ";", "}" ]
Retrieves the specified intent. <p>Sample code: <pre><code> try (IntentsClient intentsClient = IntentsClient.create()) { IntentName name = IntentName.of("[PROJECT]", "[INTENT]"); String languageCode = ""; Intent response = intentsClient.getIntent(name.toString(), languageCode); } </code></pre> @param name Required. The name of the intent. Format: `projects/&lt;Project ID&gt;/agent/intents/&lt;Intent ID&gt;`. @param languageCode Optional. The language to retrieve training phrases, parameters and rich messages for. If not specified, the agent's default language is used. [Many languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are supported. Note: languages must be enabled in the agent before they can be used. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Retrieves", "the", "specified", "intent", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java#L496-L501
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Input.java
Input.isButtonPressed
public boolean isButtonPressed(int index, int controller) { """ Check if controller button is pressed @param controller The index of the controller to check @param index The index of the button to check @return True if the button is pressed """ if (controller >= getControllerCount()) { return false; } if (controller == ANY_CONTROLLER) { for (int i=0;i<controllers.size();i++) { if (isButtonPressed(index, i)) { return true; } } return false; } return ((Controller) controllers.get(controller)).isButtonPressed(index); }
java
public boolean isButtonPressed(int index, int controller) { if (controller >= getControllerCount()) { return false; } if (controller == ANY_CONTROLLER) { for (int i=0;i<controllers.size();i++) { if (isButtonPressed(index, i)) { return true; } } return false; } return ((Controller) controllers.get(controller)).isButtonPressed(index); }
[ "public", "boolean", "isButtonPressed", "(", "int", "index", ",", "int", "controller", ")", "{", "if", "(", "controller", ">=", "getControllerCount", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "controller", "==", "ANY_CONTROLLER", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "controllers", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "isButtonPressed", "(", "index", ",", "i", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "return", "(", "(", "Controller", ")", "controllers", ".", "get", "(", "controller", ")", ")", ".", "isButtonPressed", "(", "index", ")", ";", "}" ]
Check if controller button is pressed @param controller The index of the controller to check @param index The index of the button to check @return True if the button is pressed
[ "Check", "if", "controller", "button", "is", "pressed" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Input.java#L974-L990
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.refreshInstance
private void refreshInstance(Object cachedInstance, Identity oid, ClassDescriptor cld) { """ refresh all primitive typed attributes of a cached instance with the current values from the database. refreshing of reference and collection attributes is not done here. @param cachedInstance the cached instance to be refreshed @param oid the Identity of the cached instance @param cld the ClassDescriptor of cachedInstance """ // read in fresh copy from the db, but do not cache it Object freshInstance = getPlainDBObject(cld, oid); // update all primitive typed attributes FieldDescriptor[] fields = cld.getFieldDescriptions(); FieldDescriptor fmd; PersistentField fld; for (int i = 0; i < fields.length; i++) { fmd = fields[i]; fld = fmd.getPersistentField(); fld.set(cachedInstance, fld.get(freshInstance)); } }
java
private void refreshInstance(Object cachedInstance, Identity oid, ClassDescriptor cld) { // read in fresh copy from the db, but do not cache it Object freshInstance = getPlainDBObject(cld, oid); // update all primitive typed attributes FieldDescriptor[] fields = cld.getFieldDescriptions(); FieldDescriptor fmd; PersistentField fld; for (int i = 0; i < fields.length; i++) { fmd = fields[i]; fld = fmd.getPersistentField(); fld.set(cachedInstance, fld.get(freshInstance)); } }
[ "private", "void", "refreshInstance", "(", "Object", "cachedInstance", ",", "Identity", "oid", ",", "ClassDescriptor", "cld", ")", "{", "// read in fresh copy from the db, but do not cache it", "Object", "freshInstance", "=", "getPlainDBObject", "(", "cld", ",", "oid", ")", ";", "// update all primitive typed attributes", "FieldDescriptor", "[", "]", "fields", "=", "cld", ".", "getFieldDescriptions", "(", ")", ";", "FieldDescriptor", "fmd", ";", "PersistentField", "fld", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fields", ".", "length", ";", "i", "++", ")", "{", "fmd", "=", "fields", "[", "i", "]", ";", "fld", "=", "fmd", ".", "getPersistentField", "(", ")", ";", "fld", ".", "set", "(", "cachedInstance", ",", "fld", ".", "get", "(", "freshInstance", ")", ")", ";", "}", "}" ]
refresh all primitive typed attributes of a cached instance with the current values from the database. refreshing of reference and collection attributes is not done here. @param cachedInstance the cached instance to be refreshed @param oid the Identity of the cached instance @param cld the ClassDescriptor of cachedInstance
[ "refresh", "all", "primitive", "typed", "attributes", "of", "a", "cached", "instance", "with", "the", "current", "values", "from", "the", "database", ".", "refreshing", "of", "reference", "and", "collection", "attributes", "is", "not", "done", "here", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1743-L1758
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
JavacParser.variableDeclarator
JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc) { """ VariableDeclarator = Ident VariableDeclaratorRest ConstantDeclarator = Ident ConstantDeclaratorRest """ return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc); }
java
JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc) { return variableDeclaratorRest(token.pos, mods, type, ident(), reqInit, dc); }
[ "JCVariableDecl", "variableDeclarator", "(", "JCModifiers", "mods", ",", "JCExpression", "type", ",", "boolean", "reqInit", ",", "Comment", "dc", ")", "{", "return", "variableDeclaratorRest", "(", "token", ".", "pos", ",", "mods", ",", "type", ",", "ident", "(", ")", ",", "reqInit", ",", "dc", ")", ";", "}" ]
VariableDeclarator = Ident VariableDeclaratorRest ConstantDeclarator = Ident ConstantDeclaratorRest
[ "VariableDeclarator", "=", "Ident", "VariableDeclaratorRest", "ConstantDeclarator", "=", "Ident", "ConstantDeclaratorRest" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3007-L3009
grpc/grpc-java
core/src/main/java/io/grpc/internal/ConnectivityStateManager.java
ConnectivityStateManager.notifyWhenStateChanged
void notifyWhenStateChanged(Runnable callback, Executor executor, ConnectivityState source) { """ Adds a listener for state change event. <p>The {@code executor} must be one that can run RPC call listeners. """ checkNotNull(callback, "callback"); checkNotNull(executor, "executor"); checkNotNull(source, "source"); Listener stateChangeListener = new Listener(callback, executor); if (state != source) { stateChangeListener.runInExecutor(); } else { listeners.add(stateChangeListener); } }
java
void notifyWhenStateChanged(Runnable callback, Executor executor, ConnectivityState source) { checkNotNull(callback, "callback"); checkNotNull(executor, "executor"); checkNotNull(source, "source"); Listener stateChangeListener = new Listener(callback, executor); if (state != source) { stateChangeListener.runInExecutor(); } else { listeners.add(stateChangeListener); } }
[ "void", "notifyWhenStateChanged", "(", "Runnable", "callback", ",", "Executor", "executor", ",", "ConnectivityState", "source", ")", "{", "checkNotNull", "(", "callback", ",", "\"callback\"", ")", ";", "checkNotNull", "(", "executor", ",", "\"executor\"", ")", ";", "checkNotNull", "(", "source", ",", "\"source\"", ")", ";", "Listener", "stateChangeListener", "=", "new", "Listener", "(", "callback", ",", "executor", ")", ";", "if", "(", "state", "!=", "source", ")", "{", "stateChangeListener", ".", "runInExecutor", "(", ")", ";", "}", "else", "{", "listeners", ".", "add", "(", "stateChangeListener", ")", ";", "}", "}" ]
Adds a listener for state change event. <p>The {@code executor} must be one that can run RPC call listeners.
[ "Adds", "a", "listener", "for", "state", "change", "event", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ConnectivityStateManager.java#L45-L56
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java
MongoDBQuery.createMongoQuery
public BasicDBObject createMongoQuery(EntityMetadata m, Queue filterClauseQueue) { """ Creates the mongo query. @param m the m @param filterClauseQueue the filter clause queue @return the basic db object """ QueryComponent sq = getQueryComponent(filterClauseQueue); populateQueryComponents(m, sq); return sq.actualQuery == null ? new BasicDBObject() : sq.actualQuery; }
java
public BasicDBObject createMongoQuery(EntityMetadata m, Queue filterClauseQueue) { QueryComponent sq = getQueryComponent(filterClauseQueue); populateQueryComponents(m, sq); return sq.actualQuery == null ? new BasicDBObject() : sq.actualQuery; }
[ "public", "BasicDBObject", "createMongoQuery", "(", "EntityMetadata", "m", ",", "Queue", "filterClauseQueue", ")", "{", "QueryComponent", "sq", "=", "getQueryComponent", "(", "filterClauseQueue", ")", ";", "populateQueryComponents", "(", "m", ",", "sq", ")", ";", "return", "sq", ".", "actualQuery", "==", "null", "?", "new", "BasicDBObject", "(", ")", ":", "sq", ".", "actualQuery", ";", "}" ]
Creates the mongo query. @param m the m @param filterClauseQueue the filter clause queue @return the basic db object
[ "Creates", "the", "mongo", "query", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java#L442-L447
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/chunkblock/ChunkBlockHandler.java
ChunkBlockHandler.removeCoord
private void removeCoord(Chunk chunk, BlockPos pos) { """ Removes a coordinate from the specified {@link Chunk}. @param chunk the chunk @param pos the pos """ chunks(chunk).remove(chunk, pos); }
java
private void removeCoord(Chunk chunk, BlockPos pos) { chunks(chunk).remove(chunk, pos); }
[ "private", "void", "removeCoord", "(", "Chunk", "chunk", ",", "BlockPos", "pos", ")", "{", "chunks", "(", "chunk", ")", ".", "remove", "(", "chunk", ",", "pos", ")", ";", "}" ]
Removes a coordinate from the specified {@link Chunk}. @param chunk the chunk @param pos the pos
[ "Removes", "a", "coordinate", "from", "the", "specified", "{", "@link", "Chunk", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunkblock/ChunkBlockHandler.java#L182-L185
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java
ClasspathAction.createClasspathJar
private void createClasspathJar(File outputFile, String classpath) throws IOException { """ Writes a JAR with a MANIFEST.MF containing the Class-Path string. @param outputFile the output file to create @param classpath the Class-Path string @throws IOException if an error occurs creating the file """ FileOutputStream out = new FileOutputStream(outputFile); try { Manifest manifest = new Manifest(); Attributes attrs = manifest.getMainAttributes(); attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0"); attrs.put(Attributes.Name.CLASS_PATH, classpath); new JarOutputStream(out, manifest).close(); } finally { out.close(); } }
java
private void createClasspathJar(File outputFile, String classpath) throws IOException { FileOutputStream out = new FileOutputStream(outputFile); try { Manifest manifest = new Manifest(); Attributes attrs = manifest.getMainAttributes(); attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0"); attrs.put(Attributes.Name.CLASS_PATH, classpath); new JarOutputStream(out, manifest).close(); } finally { out.close(); } }
[ "private", "void", "createClasspathJar", "(", "File", "outputFile", ",", "String", "classpath", ")", "throws", "IOException", "{", "FileOutputStream", "out", "=", "new", "FileOutputStream", "(", "outputFile", ")", ";", "try", "{", "Manifest", "manifest", "=", "new", "Manifest", "(", ")", ";", "Attributes", "attrs", "=", "manifest", ".", "getMainAttributes", "(", ")", ";", "attrs", ".", "put", "(", "Attributes", ".", "Name", ".", "MANIFEST_VERSION", ",", "\"1.0\"", ")", ";", "attrs", ".", "put", "(", "Attributes", ".", "Name", ".", "CLASS_PATH", ",", "classpath", ")", ";", "new", "JarOutputStream", "(", "out", ",", "manifest", ")", ".", "close", "(", ")", ";", "}", "finally", "{", "out", ".", "close", "(", ")", ";", "}", "}" ]
Writes a JAR with a MANIFEST.MF containing the Class-Path string. @param outputFile the output file to create @param classpath the Class-Path string @throws IOException if an error occurs creating the file
[ "Writes", "a", "JAR", "with", "a", "MANIFEST", ".", "MF", "containing", "the", "Class", "-", "Path", "string", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java#L322-L333
jmxtrans/embedded-jmxtrans
src/main/java/org/jmxtrans/embedded/output/AbstractOutputWriter.java
AbstractOutputWriter.getStringSetting
protected String getStringSetting(String name, String defaultValue) { """ Return the value of the given property. If the property is not found, the <code>defaultValue</code> is returned. @param name name of the property @param defaultValue default value if the property is not defined. @return value of the property or <code>defaultValue</code> if the property is not defined. """ if (settings.containsKey(name)) { return settings.get(name).toString(); } else { return defaultValue; } }
java
protected String getStringSetting(String name, String defaultValue) { if (settings.containsKey(name)) { return settings.get(name).toString(); } else { return defaultValue; } }
[ "protected", "String", "getStringSetting", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "if", "(", "settings", ".", "containsKey", "(", "name", ")", ")", "{", "return", "settings", ".", "get", "(", "name", ")", ".", "toString", "(", ")", ";", "}", "else", "{", "return", "defaultValue", ";", "}", "}" ]
Return the value of the given property. If the property is not found, the <code>defaultValue</code> is returned. @param name name of the property @param defaultValue default value if the property is not defined. @return value of the property or <code>defaultValue</code> if the property is not defined.
[ "Return", "the", "value", "of", "the", "given", "property", "." ]
train
https://github.com/jmxtrans/embedded-jmxtrans/blob/17224389e7d8323284cabc2a5167fc03bed6d223/src/main/java/org/jmxtrans/embedded/output/AbstractOutputWriter.java#L190-L196
structr/structr
structr-ui/src/main/java/org/structr/web/common/FileHelper.java
FileHelper.setFileData
public static void setFileData(final File file, final InputStream fileStream, final String contentType) throws FrameworkException, IOException { """ Write image data from the given InputStream to the given file node and set checksum and size. @param file @param fileStream @param contentType if null, try to auto-detect content type @throws FrameworkException @throws IOException """ FileHelper.writeToFile(file, fileStream); setFileProperties(file, contentType); }
java
public static void setFileData(final File file, final InputStream fileStream, final String contentType) throws FrameworkException, IOException { FileHelper.writeToFile(file, fileStream); setFileProperties(file, contentType); }
[ "public", "static", "void", "setFileData", "(", "final", "File", "file", ",", "final", "InputStream", "fileStream", ",", "final", "String", "contentType", ")", "throws", "FrameworkException", ",", "IOException", "{", "FileHelper", ".", "writeToFile", "(", "file", ",", "fileStream", ")", ";", "setFileProperties", "(", "file", ",", "contentType", ")", ";", "}" ]
Write image data from the given InputStream to the given file node and set checksum and size. @param file @param fileStream @param contentType if null, try to auto-detect content type @throws FrameworkException @throws IOException
[ "Write", "image", "data", "from", "the", "given", "InputStream", "to", "the", "given", "file", "node", "and", "set", "checksum", "and", "size", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L293-L297
hector-client/hector
core/src/main/java/me/prettyprint/cassandra/service/template/SuperCfTemplate.java
SuperCfTemplate.countColumns
public int countColumns(K key, SN start, SN end, int max) { """ Counts columns in the specified range of a super column family @param key @param start @param end @param max @return """ SuperCountQuery<K, SN> query = HFactory.createSuperCountQuery(keyspace, keySerializer, topSerializer); query.setKey(key); query.setColumnFamily(columnFamily); query.setRange(start, end, max); return query.execute().get(); }
java
public int countColumns(K key, SN start, SN end, int max) { SuperCountQuery<K, SN> query = HFactory.createSuperCountQuery(keyspace, keySerializer, topSerializer); query.setKey(key); query.setColumnFamily(columnFamily); query.setRange(start, end, max); return query.execute().get(); }
[ "public", "int", "countColumns", "(", "K", "key", ",", "SN", "start", ",", "SN", "end", ",", "int", "max", ")", "{", "SuperCountQuery", "<", "K", ",", "SN", ">", "query", "=", "HFactory", ".", "createSuperCountQuery", "(", "keyspace", ",", "keySerializer", ",", "topSerializer", ")", ";", "query", ".", "setKey", "(", "key", ")", ";", "query", ".", "setColumnFamily", "(", "columnFamily", ")", ";", "query", ".", "setRange", "(", "start", ",", "end", ",", "max", ")", ";", "return", "query", ".", "execute", "(", ")", ".", "get", "(", ")", ";", "}" ]
Counts columns in the specified range of a super column family @param key @param start @param end @param max @return
[ "Counts", "columns", "in", "the", "specified", "range", "of", "a", "super", "column", "family" ]
train
https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/cassandra/service/template/SuperCfTemplate.java#L86-L93
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getSeasonInfo
public TVSeasonInfo getSeasonInfo(int tvID, int seasonNumber, String language, String... appendToResponse) throws MovieDbException { """ Get the primary information about a TV season by its season number. @param tvID tvID @param seasonNumber seasonNumber @param language language @param appendToResponse appendToResponse @return @throws MovieDbException exception """ return tmdbSeasons.getSeasonInfo(tvID, seasonNumber, language, appendToResponse); }
java
public TVSeasonInfo getSeasonInfo(int tvID, int seasonNumber, String language, String... appendToResponse) throws MovieDbException { return tmdbSeasons.getSeasonInfo(tvID, seasonNumber, language, appendToResponse); }
[ "public", "TVSeasonInfo", "getSeasonInfo", "(", "int", "tvID", ",", "int", "seasonNumber", ",", "String", "language", ",", "String", "...", "appendToResponse", ")", "throws", "MovieDbException", "{", "return", "tmdbSeasons", ".", "getSeasonInfo", "(", "tvID", ",", "seasonNumber", ",", "language", ",", "appendToResponse", ")", ";", "}" ]
Get the primary information about a TV season by its season number. @param tvID tvID @param seasonNumber seasonNumber @param language language @param appendToResponse appendToResponse @return @throws MovieDbException exception
[ "Get", "the", "primary", "information", "about", "a", "TV", "season", "by", "its", "season", "number", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1672-L1674
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.createMessageReceiverFromEntityPathAsync
public static CompletableFuture<IMessageReceiver> createMessageReceiverFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath) { """ Asynchronously creates a new message receiver to the entity on the messagingFactory. @param messagingFactory messaging factory (which represents a connection) on which receiver needs to be created. @param entityPath path of entity @return a CompletableFuture representing the pending creation of message receiver """ return createMessageReceiverFromEntityPathAsync(messagingFactory, entityPath, DEFAULTRECEIVEMODE); }
java
public static CompletableFuture<IMessageReceiver> createMessageReceiverFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath) { return createMessageReceiverFromEntityPathAsync(messagingFactory, entityPath, DEFAULTRECEIVEMODE); }
[ "public", "static", "CompletableFuture", "<", "IMessageReceiver", ">", "createMessageReceiverFromEntityPathAsync", "(", "MessagingFactory", "messagingFactory", ",", "String", "entityPath", ")", "{", "return", "createMessageReceiverFromEntityPathAsync", "(", "messagingFactory", ",", "entityPath", ",", "DEFAULTRECEIVEMODE", ")", ";", "}" ]
Asynchronously creates a new message receiver to the entity on the messagingFactory. @param messagingFactory messaging factory (which represents a connection) on which receiver needs to be created. @param entityPath path of entity @return a CompletableFuture representing the pending creation of message receiver
[ "Asynchronously", "creates", "a", "new", "message", "receiver", "to", "the", "entity", "on", "the", "messagingFactory", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L455-L457
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/localization/MessageInterpolator.java
MessageInterpolator.interpolate
public String interpolate(final String message, final Map<String, ?> vars, boolean recursive, final MessageResolver messageResolver) { """ メッセージを引数varsで指定した変数で補完する。 <p>{@link MessageResolver}を指定した場合、メッセージ中の変数をメッセージコードとして解決します。 @param message 対象のメッセージ。 @param vars メッセージ中の変数に対する値のマップ。 @param recursive 変換したメッセージに対しても再帰的に処理するかどうか @param messageResolver メッセージを解決するクラス。nullの場合、指定しないと同じ意味になります。 @return 補完したメッセージ。 """ return parse(message, vars, recursive, messageResolver); }
java
public String interpolate(final String message, final Map<String, ?> vars, boolean recursive, final MessageResolver messageResolver) { return parse(message, vars, recursive, messageResolver); }
[ "public", "String", "interpolate", "(", "final", "String", "message", ",", "final", "Map", "<", "String", ",", "?", ">", "vars", ",", "boolean", "recursive", ",", "final", "MessageResolver", "messageResolver", ")", "{", "return", "parse", "(", "message", ",", "vars", ",", "recursive", ",", "messageResolver", ")", ";", "}" ]
メッセージを引数varsで指定した変数で補完する。 <p>{@link MessageResolver}を指定した場合、メッセージ中の変数をメッセージコードとして解決します。 @param message 対象のメッセージ。 @param vars メッセージ中の変数に対する値のマップ。 @param recursive 変換したメッセージに対しても再帰的に処理するかどうか @param messageResolver メッセージを解決するクラス。nullの場合、指定しないと同じ意味になります。 @return 補完したメッセージ。
[ "メッセージを引数varsで指定した変数で補完する。", "<p", ">", "{", "@link", "MessageResolver", "}", "を指定した場合、メッセージ中の変数をメッセージコードとして解決します。" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/localization/MessageInterpolator.java#L100-L103
twotoasters/RecyclerViewLib
library/src/main/java/com/twotoasters/android/support/v7/widget/RecyclerView.java
RecyclerView.viewRangeUpdate
void viewRangeUpdate(int positionStart, int itemCount) { """ Rebind existing views for the given range, or create as needed. @param positionStart Adapter position to start at @param itemCount Number of views that must explicitly be rebound """ final int childCount = getChildCount(); final int positionEnd = positionStart + itemCount; for (int i = 0; i < childCount; i++) { final ViewHolder holder = getChildViewHolderInt(getChildAt(i)); if (holder == null) { continue; } final int position = holder.getPosition(); if (position >= positionStart && position < positionEnd) { holder.addFlags(ViewHolder.FLAG_UPDATE); // Binding an attached view will request a layout if needed. mAdapter.bindViewHolder(holder, holder.getPosition()); } } mRecycler.viewRangeUpdate(positionStart, itemCount); }
java
void viewRangeUpdate(int positionStart, int itemCount) { final int childCount = getChildCount(); final int positionEnd = positionStart + itemCount; for (int i = 0; i < childCount; i++) { final ViewHolder holder = getChildViewHolderInt(getChildAt(i)); if (holder == null) { continue; } final int position = holder.getPosition(); if (position >= positionStart && position < positionEnd) { holder.addFlags(ViewHolder.FLAG_UPDATE); // Binding an attached view will request a layout if needed. mAdapter.bindViewHolder(holder, holder.getPosition()); } } mRecycler.viewRangeUpdate(positionStart, itemCount); }
[ "void", "viewRangeUpdate", "(", "int", "positionStart", ",", "int", "itemCount", ")", "{", "final", "int", "childCount", "=", "getChildCount", "(", ")", ";", "final", "int", "positionEnd", "=", "positionStart", "+", "itemCount", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childCount", ";", "i", "++", ")", "{", "final", "ViewHolder", "holder", "=", "getChildViewHolderInt", "(", "getChildAt", "(", "i", ")", ")", ";", "if", "(", "holder", "==", "null", ")", "{", "continue", ";", "}", "final", "int", "position", "=", "holder", ".", "getPosition", "(", ")", ";", "if", "(", "position", ">=", "positionStart", "&&", "position", "<", "positionEnd", ")", "{", "holder", ".", "addFlags", "(", "ViewHolder", ".", "FLAG_UPDATE", ")", ";", "// Binding an attached view will request a layout if needed.", "mAdapter", ".", "bindViewHolder", "(", "holder", ",", "holder", ".", "getPosition", "(", ")", ")", ";", "}", "}", "mRecycler", ".", "viewRangeUpdate", "(", "positionStart", ",", "itemCount", ")", ";", "}" ]
Rebind existing views for the given range, or create as needed. @param positionStart Adapter position to start at @param itemCount Number of views that must explicitly be rebound
[ "Rebind", "existing", "views", "for", "the", "given", "range", "or", "create", "as", "needed", "." ]
train
https://github.com/twotoasters/RecyclerViewLib/blob/2379fd5bbf57d4dfc8b28046b7ace950905c75f0/library/src/main/java/com/twotoasters/android/support/v7/widget/RecyclerView.java#L1880-L1898
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java
Character.toChars
public static int toChars(int codePoint, char[] dst, int dstIndex) { """ Converts the specified character (Unicode code point) to its UTF-16 representation. If the specified code point is a BMP (Basic Multilingual Plane or Plane 0) value, the same value is stored in {@code dst[dstIndex]}, and 1 is returned. If the specified code point is a supplementary character, its surrogate values are stored in {@code dst[dstIndex]} (high-surrogate) and {@code dst[dstIndex+1]} (low-surrogate), and 2 is returned. @param codePoint the character (Unicode code point) to be converted. @param dst an array of {@code char} in which the {@code codePoint}'s UTF-16 value is stored. @param dstIndex the start index into the {@code dst} array where the converted value is stored. @return 1 if the code point is a BMP code point, 2 if the code point is a supplementary code point. @exception IllegalArgumentException if the specified {@code codePoint} is not a valid Unicode code point. @exception NullPointerException if the specified {@code dst} is null. @exception IndexOutOfBoundsException if {@code dstIndex} is negative or not less than {@code dst.length}, or if {@code dst} at {@code dstIndex} doesn't have enough array element(s) to store the resulting {@code char} value(s). (If {@code dstIndex} is equal to {@code dst.length-1} and the specified {@code codePoint} is a supplementary character, the high-surrogate value is not stored in {@code dst[dstIndex]}.) @since 1.5 """ if (isBmpCodePoint(codePoint)) { dst[dstIndex] = (char) codePoint; return 1; } else if (isValidCodePoint(codePoint)) { toSurrogates(codePoint, dst, dstIndex); return 2; } else { throw new IllegalArgumentException(); } }
java
public static int toChars(int codePoint, char[] dst, int dstIndex) { if (isBmpCodePoint(codePoint)) { dst[dstIndex] = (char) codePoint; return 1; } else if (isValidCodePoint(codePoint)) { toSurrogates(codePoint, dst, dstIndex); return 2; } else { throw new IllegalArgumentException(); } }
[ "public", "static", "int", "toChars", "(", "int", "codePoint", ",", "char", "[", "]", "dst", ",", "int", "dstIndex", ")", "{", "if", "(", "isBmpCodePoint", "(", "codePoint", ")", ")", "{", "dst", "[", "dstIndex", "]", "=", "(", "char", ")", "codePoint", ";", "return", "1", ";", "}", "else", "if", "(", "isValidCodePoint", "(", "codePoint", ")", ")", "{", "toSurrogates", "(", "codePoint", ",", "dst", ",", "dstIndex", ")", ";", "return", "2", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}" ]
Converts the specified character (Unicode code point) to its UTF-16 representation. If the specified code point is a BMP (Basic Multilingual Plane or Plane 0) value, the same value is stored in {@code dst[dstIndex]}, and 1 is returned. If the specified code point is a supplementary character, its surrogate values are stored in {@code dst[dstIndex]} (high-surrogate) and {@code dst[dstIndex+1]} (low-surrogate), and 2 is returned. @param codePoint the character (Unicode code point) to be converted. @param dst an array of {@code char} in which the {@code codePoint}'s UTF-16 value is stored. @param dstIndex the start index into the {@code dst} array where the converted value is stored. @return 1 if the code point is a BMP code point, 2 if the code point is a supplementary code point. @exception IllegalArgumentException if the specified {@code codePoint} is not a valid Unicode code point. @exception NullPointerException if the specified {@code dst} is null. @exception IndexOutOfBoundsException if {@code dstIndex} is negative or not less than {@code dst.length}, or if {@code dst} at {@code dstIndex} doesn't have enough array element(s) to store the resulting {@code char} value(s). (If {@code dstIndex} is equal to {@code dst.length-1} and the specified {@code codePoint} is a supplementary character, the high-surrogate value is not stored in {@code dst[dstIndex]}.) @since 1.5
[ "Converts", "the", "specified", "character", "(", "Unicode", "code", "point", ")", "to", "its", "UTF", "-", "16", "representation", ".", "If", "the", "specified", "code", "point", "is", "a", "BMP", "(", "Basic", "Multilingual", "Plane", "or", "Plane", "0", ")", "value", "the", "same", "value", "is", "stored", "in", "{", "@code", "dst", "[", "dstIndex", "]", "}", "and", "1", "is", "returned", ".", "If", "the", "specified", "code", "point", "is", "a", "supplementary", "character", "its", "surrogate", "values", "are", "stored", "in", "{", "@code", "dst", "[", "dstIndex", "]", "}", "(", "high", "-", "surrogate", ")", "and", "{", "@code", "dst", "[", "dstIndex", "+", "1", "]", "}", "(", "low", "-", "surrogate", ")", "and", "2", "is", "returned", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L5197-L5207
wisdom-framework/wisdom
extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java
RamlControllerVisitor.addResponsesToAction
private void addResponsesToAction(ControllerRouteModel<Raml> elem, Action action) { """ Add the response specification to the given action. @param elem The ControllerRouteModel that contains the response specification. @param action The Action on which to add the response specification. """ // get all mimeTypes defined in @Route.produces LOGGER.debug("responsesMimes.size:"+elem.getResponseMimes().size()); List<String> mimes = new ArrayList<>(); mimes.addAll(elem.getResponseMimes()); // if no mimeTypes defined, no response specifications if(mimes.isEmpty()){ return; } int i=0; // iterate over @response.code javadoc annotation for (String code : elem.getResponseCodes()) { LOGGER.debug("code:"+code); // get mimeType in order of declaration, else get first String mime; if(mimes.size()>i){ mime = mimes.get(i); } else { mime = mimes.get(0); } Response resp = new Response(); // add @response.description javadoc annotation if exist if(elem.getResponseDescriptions().size()>i){ resp.setDescription(elem.getResponseDescriptions().get(i)); } // add @response.body javadoc annotation if exist if(elem.getResponseBodies().size()>i){ MimeType mimeType = new MimeType(mime); mimeType.setExample(elem.getResponseBodies().get(i).toString()); resp.setBody(Collections.singletonMap(mime, mimeType)); } action.getResponses().put(code, resp); i++; } }
java
private void addResponsesToAction(ControllerRouteModel<Raml> elem, Action action) { // get all mimeTypes defined in @Route.produces LOGGER.debug("responsesMimes.size:"+elem.getResponseMimes().size()); List<String> mimes = new ArrayList<>(); mimes.addAll(elem.getResponseMimes()); // if no mimeTypes defined, no response specifications if(mimes.isEmpty()){ return; } int i=0; // iterate over @response.code javadoc annotation for (String code : elem.getResponseCodes()) { LOGGER.debug("code:"+code); // get mimeType in order of declaration, else get first String mime; if(mimes.size()>i){ mime = mimes.get(i); } else { mime = mimes.get(0); } Response resp = new Response(); // add @response.description javadoc annotation if exist if(elem.getResponseDescriptions().size()>i){ resp.setDescription(elem.getResponseDescriptions().get(i)); } // add @response.body javadoc annotation if exist if(elem.getResponseBodies().size()>i){ MimeType mimeType = new MimeType(mime); mimeType.setExample(elem.getResponseBodies().get(i).toString()); resp.setBody(Collections.singletonMap(mime, mimeType)); } action.getResponses().put(code, resp); i++; } }
[ "private", "void", "addResponsesToAction", "(", "ControllerRouteModel", "<", "Raml", ">", "elem", ",", "Action", "action", ")", "{", "// get all mimeTypes defined in @Route.produces", "LOGGER", ".", "debug", "(", "\"responsesMimes.size:\"", "+", "elem", ".", "getResponseMimes", "(", ")", ".", "size", "(", ")", ")", ";", "List", "<", "String", ">", "mimes", "=", "new", "ArrayList", "<>", "(", ")", ";", "mimes", ".", "addAll", "(", "elem", ".", "getResponseMimes", "(", ")", ")", ";", "// if no mimeTypes defined, no response specifications", "if", "(", "mimes", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "int", "i", "=", "0", ";", "// iterate over @response.code javadoc annotation", "for", "(", "String", "code", ":", "elem", ".", "getResponseCodes", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"code:\"", "+", "code", ")", ";", "// get mimeType in order of declaration, else get first", "String", "mime", ";", "if", "(", "mimes", ".", "size", "(", ")", ">", "i", ")", "{", "mime", "=", "mimes", ".", "get", "(", "i", ")", ";", "}", "else", "{", "mime", "=", "mimes", ".", "get", "(", "0", ")", ";", "}", "Response", "resp", "=", "new", "Response", "(", ")", ";", "// add @response.description javadoc annotation if exist", "if", "(", "elem", ".", "getResponseDescriptions", "(", ")", ".", "size", "(", ")", ">", "i", ")", "{", "resp", ".", "setDescription", "(", "elem", ".", "getResponseDescriptions", "(", ")", ".", "get", "(", "i", ")", ")", ";", "}", "// add @response.body javadoc annotation if exist", "if", "(", "elem", ".", "getResponseBodies", "(", ")", ".", "size", "(", ")", ">", "i", ")", "{", "MimeType", "mimeType", "=", "new", "MimeType", "(", "mime", ")", ";", "mimeType", ".", "setExample", "(", "elem", ".", "getResponseBodies", "(", ")", ".", "get", "(", "i", ")", ".", "toString", "(", ")", ")", ";", "resp", ".", "setBody", "(", "Collections", ".", "singletonMap", "(", "mime", ",", "mimeType", ")", ")", ";", "}", "action", ".", "getResponses", "(", ")", ".", "put", "(", "code", ",", "resp", ")", ";", "i", "++", ";", "}", "}" ]
Add the response specification to the given action. @param elem The ControllerRouteModel that contains the response specification. @param action The Action on which to add the response specification.
[ "Add", "the", "response", "specification", "to", "the", "given", "action", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java#L294-L337
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubObjectPropertyOfAxiomImpl_CustomFieldSerializer.java
OWLSubObjectPropertyOfAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLSubObjectPropertyOfAxiomImpl instance) throws SerializationException { """ Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful """ deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLSubObjectPropertyOfAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLSubObjectPropertyOfAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubObjectPropertyOfAxiomImpl_CustomFieldSerializer.java#L97-L100
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/cache/image/ImageLoader.java
ImageLoader.initialize
public static synchronized void initialize(Context context) { """ This method must be called before any other method is invoked on this class. Please note that when using ImageLoader as part of {@link WebImageView} or {@link WebGalleryAdapter}, then there is no need to call this method, since those classes will already do that for you. This method is idempotent. You may call it multiple times without any side effects. @param context the current context """ if (executor == null) { executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(DEFAULT_POOL_SIZE); } if (imageCache == null) { imageCache = new ImageCache(25, expirationInMinutes, DEFAULT_POOL_SIZE); imageCache.enableDiskCache(context, ImageCache.DISK_CACHE_SDCARD); } }
java
public static synchronized void initialize(Context context) { if (executor == null) { executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(DEFAULT_POOL_SIZE); } if (imageCache == null) { imageCache = new ImageCache(25, expirationInMinutes, DEFAULT_POOL_SIZE); imageCache.enableDiskCache(context, ImageCache.DISK_CACHE_SDCARD); } }
[ "public", "static", "synchronized", "void", "initialize", "(", "Context", "context", ")", "{", "if", "(", "executor", "==", "null", ")", "{", "executor", "=", "(", "ThreadPoolExecutor", ")", "Executors", ".", "newFixedThreadPool", "(", "DEFAULT_POOL_SIZE", ")", ";", "}", "if", "(", "imageCache", "==", "null", ")", "{", "imageCache", "=", "new", "ImageCache", "(", "25", ",", "expirationInMinutes", ",", "DEFAULT_POOL_SIZE", ")", ";", "imageCache", ".", "enableDiskCache", "(", "context", ",", "ImageCache", ".", "DISK_CACHE_SDCARD", ")", ";", "}", "}" ]
This method must be called before any other method is invoked on this class. Please note that when using ImageLoader as part of {@link WebImageView} or {@link WebGalleryAdapter}, then there is no need to call this method, since those classes will already do that for you. This method is idempotent. You may call it multiple times without any side effects. @param context the current context
[ "This", "method", "must", "be", "called", "before", "any", "other", "method", "is", "invoked", "on", "this", "class", ".", "Please", "note", "that", "when", "using", "ImageLoader", "as", "part", "of", "{", "@link", "WebImageView", "}", "or", "{", "@link", "WebGalleryAdapter", "}", "then", "there", "is", "no", "need", "to", "call", "this", "method", "since", "those", "classes", "will", "already", "do", "that", "for", "you", ".", "This", "method", "is", "idempotent", ".", "You", "may", "call", "it", "multiple", "times", "without", "any", "side", "effects", "." ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/cache/image/ImageLoader.java#L74-L82
Waxolunist/bittwiddling
src/main/java/com/vcollaborate/bitwise/BinaryStringUtils.java
BinaryStringUtils.zeroPadString
public static final String zeroPadString(final String binaryString) { """ Same as {@link #zeroPadString(String, int)}, but determines {@code minLength} automatically. """ int minLength = (int) Math.ceil(binaryString.length() / 4.) * 4; return zeroPadString(binaryString, minLength); }
java
public static final String zeroPadString(final String binaryString) { int minLength = (int) Math.ceil(binaryString.length() / 4.) * 4; return zeroPadString(binaryString, minLength); }
[ "public", "static", "final", "String", "zeroPadString", "(", "final", "String", "binaryString", ")", "{", "int", "minLength", "=", "(", "int", ")", "Math", ".", "ceil", "(", "binaryString", ".", "length", "(", ")", "/", "4.", ")", "*", "4", ";", "return", "zeroPadString", "(", "binaryString", ",", "minLength", ")", ";", "}" ]
Same as {@link #zeroPadString(String, int)}, but determines {@code minLength} automatically.
[ "Same", "as", "{" ]
train
https://github.com/Waxolunist/bittwiddling/blob/2c36342add73aab1223292d12fcff453aa3c07cd/src/main/java/com/vcollaborate/bitwise/BinaryStringUtils.java#L76-L79
sockeqwe/mosby
presentermanager/src/main/java/com/hannesdorfmann/mosby3/PresenterManager.java
PresenterManager.getPresenter
@Nullable public static <P> P getPresenter(@NonNull Activity activity, @NonNull String viewId) { """ Get the presenter for the View with the given (Mosby - internal) view Id or <code>null</code> if no presenter for the given view (via view id) exists. @param activity The Activity (used for scoping) @param viewId The mosby internal View Id (unique among all {@link MvpView} @param <P> The Presenter type @return The Presenter or <code>null</code> """ if (activity == null) { throw new NullPointerException("Activity is null"); } if (viewId == null) { throw new NullPointerException("View id is null"); } ActivityScopedCache scopedCache = getActivityScope(activity); return scopedCache == null ? null : (P) scopedCache.getPresenter(viewId); }
java
@Nullable public static <P> P getPresenter(@NonNull Activity activity, @NonNull String viewId) { if (activity == null) { throw new NullPointerException("Activity is null"); } if (viewId == null) { throw new NullPointerException("View id is null"); } ActivityScopedCache scopedCache = getActivityScope(activity); return scopedCache == null ? null : (P) scopedCache.getPresenter(viewId); }
[ "@", "Nullable", "public", "static", "<", "P", ">", "P", "getPresenter", "(", "@", "NonNull", "Activity", "activity", ",", "@", "NonNull", "String", "viewId", ")", "{", "if", "(", "activity", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Activity is null\"", ")", ";", "}", "if", "(", "viewId", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"View id is null\"", ")", ";", "}", "ActivityScopedCache", "scopedCache", "=", "getActivityScope", "(", "activity", ")", ";", "return", "scopedCache", "==", "null", "?", "null", ":", "(", "P", ")", "scopedCache", ".", "getPresenter", "(", "viewId", ")", ";", "}" ]
Get the presenter for the View with the given (Mosby - internal) view Id or <code>null</code> if no presenter for the given view (via view id) exists. @param activity The Activity (used for scoping) @param viewId The mosby internal View Id (unique among all {@link MvpView} @param <P> The Presenter type @return The Presenter or <code>null</code>
[ "Get", "the", "presenter", "for", "the", "View", "with", "the", "given", "(", "Mosby", "-", "internal", ")", "view", "Id", "or", "<code", ">", "null<", "/", "code", ">", "if", "no", "presenter", "for", "the", "given", "view", "(", "via", "view", "id", ")", "exists", "." ]
train
https://github.com/sockeqwe/mosby/blob/7f22118c950b5e6fbba0ec42d8e97586dfb08940/presentermanager/src/main/java/com/hannesdorfmann/mosby3/PresenterManager.java#L172-L183
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicy_binding.java
appfwpolicy_binding.get
public static appfwpolicy_binding get(nitro_service service, String name) throws Exception { """ Use this API to fetch appfwpolicy_binding resource of given name . """ appfwpolicy_binding obj = new appfwpolicy_binding(); obj.set_name(name); appfwpolicy_binding response = (appfwpolicy_binding) obj.get_resource(service); return response; }
java
public static appfwpolicy_binding get(nitro_service service, String name) throws Exception{ appfwpolicy_binding obj = new appfwpolicy_binding(); obj.set_name(name); appfwpolicy_binding response = (appfwpolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "appfwpolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "appfwpolicy_binding", "obj", "=", "new", "appfwpolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "appfwpolicy_binding", "response", "=", "(", "appfwpolicy_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch appfwpolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "appfwpolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicy_binding.java#L136-L141
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.evaluateFunction
public Object evaluateFunction(String functionName, Object[] arguments) throws Exception { """ Evaluates a function defined in ink. @param functionName The name of the function as declared in ink. @param arguments The arguments that the ink function takes, if any. Note that we don't (can't) do any validation on the number of arguments right now, so make sure you get it right! @return The return value as returned from the ink function with `~ return myValue`, or null if nothing is returned. @throws Exception """ return evaluateFunction(functionName, null, arguments); }
java
public Object evaluateFunction(String functionName, Object[] arguments) throws Exception { return evaluateFunction(functionName, null, arguments); }
[ "public", "Object", "evaluateFunction", "(", "String", "functionName", ",", "Object", "[", "]", "arguments", ")", "throws", "Exception", "{", "return", "evaluateFunction", "(", "functionName", ",", "null", ",", "arguments", ")", ";", "}" ]
Evaluates a function defined in ink. @param functionName The name of the function as declared in ink. @param arguments The arguments that the ink function takes, if any. Note that we don't (can't) do any validation on the number of arguments right now, so make sure you get it right! @return The return value as returned from the ink function with `~ return myValue`, or null if nothing is returned. @throws Exception
[ "Evaluates", "a", "function", "defined", "in", "ink", "." ]
train
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L2378-L2380
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.pack
public static void pack(File sourceDir, OutputStream os) { """ Compresses the given directory and all of its sub-directories into the passed in stream. It is the responsibility of the caller to close the passed in stream properly. @param sourceDir root directory. @param os output stream (will be buffered in this method). @since 1.10 """ pack(sourceDir, os, IdentityNameMapper.INSTANCE, DEFAULT_COMPRESSION_LEVEL); }
java
public static void pack(File sourceDir, OutputStream os) { pack(sourceDir, os, IdentityNameMapper.INSTANCE, DEFAULT_COMPRESSION_LEVEL); }
[ "public", "static", "void", "pack", "(", "File", "sourceDir", ",", "OutputStream", "os", ")", "{", "pack", "(", "sourceDir", ",", "os", ",", "IdentityNameMapper", ".", "INSTANCE", ",", "DEFAULT_COMPRESSION_LEVEL", ")", ";", "}" ]
Compresses the given directory and all of its sub-directories into the passed in stream. It is the responsibility of the caller to close the passed in stream properly. @param sourceDir root directory. @param os output stream (will be buffered in this method). @since 1.10
[ "Compresses", "the", "given", "directory", "and", "all", "of", "its", "sub", "-", "directories", "into", "the", "passed", "in", "stream", ".", "It", "is", "the", "responsibility", "of", "the", "caller", "to", "close", "the", "passed", "in", "stream", "properly", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1634-L1636
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java
RandomUtil.randomEle
public static <T> T randomEle(List<T> list, int limit) { """ 随机获得列表中的元素 @param <T> 元素类型 @param list 列表 @param limit 限制列表的前N项 @return 随机元素 """ return list.get(randomInt(limit)); }
java
public static <T> T randomEle(List<T> list, int limit) { return list.get(randomInt(limit)); }
[ "public", "static", "<", "T", ">", "T", "randomEle", "(", "List", "<", "T", ">", "list", ",", "int", "limit", ")", "{", "return", "list", ".", "get", "(", "randomInt", "(", "limit", ")", ")", ";", "}" ]
随机获得列表中的元素 @param <T> 元素类型 @param list 列表 @param limit 限制列表的前N项 @return 随机元素
[ "随机获得列表中的元素" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L274-L276
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java
LSSerializerImpl.canSetParameter
public boolean canSetParameter(String name, Object value) { """ Checks if setting a parameter to a specific value is supported. @see org.w3c.dom.DOMConfiguration#canSetParameter(java.lang.String, java.lang.Object) @since DOM Level 3 @param name A String containing the DOMConfiguration parameter name. @param value An Object specifying the value of the corresponding parameter. """ if (value instanceof Boolean){ if ( name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS) || name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS) || name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES) || name.equalsIgnoreCase(DOMConstants.DOM_INFOSET) || name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS) || name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA) || name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED) || name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT) || name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT) || name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)){ // both values supported return true; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) ) { // true is not supported return !((Boolean)value).booleanValue(); } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { // false is not supported return ((Boolean)value).booleanValue(); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER) && value == null || value instanceof DOMErrorHandler){ return true; } return false; }
java
public boolean canSetParameter(String name, Object value) { if (value instanceof Boolean){ if ( name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS) || name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS) || name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES) || name.equalsIgnoreCase(DOMConstants.DOM_INFOSET) || name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES) || name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS) || name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA) || name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED) || name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT) || name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT) || name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)){ // both values supported return true; } else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE) // || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS) ) { // true is not supported return !((Boolean)value).booleanValue(); } else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) { // false is not supported return ((Boolean)value).booleanValue(); } } else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER) && value == null || value instanceof DOMErrorHandler){ return true; } return false; }
[ "public", "boolean", "canSetParameter", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "Boolean", ")", "{", "if", "(", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_CDATA_SECTIONS", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_COMMENTS", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_ENTITIES", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_INFOSET", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_ELEMENT_CONTENT_WHITESPACE", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_NAMESPACES", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_NAMESPACE_DECLARATIONS", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_SPLIT_CDATA", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_WELLFORMED", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_DISCARD_DEFAULT_CONTENT", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_FORMAT_PRETTY_PRINT", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_XMLDECL", ")", ")", "{", "// both values supported", "return", "true", ";", "}", "else", "if", "(", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_CANONICAL_FORM", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_CHECK_CHAR_NORMALIZATION", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_DATATYPE_NORMALIZATION", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_VALIDATE_IF_SCHEMA", ")", "||", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_VALIDATE", ")", "// || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS)", ")", "{", "// true is not supported", "return", "!", "(", "(", "Boolean", ")", "value", ")", ".", "booleanValue", "(", ")", ";", "}", "else", "if", "(", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS", ")", ")", "{", "// false is not supported", "return", "(", "(", "Boolean", ")", "value", ")", ".", "booleanValue", "(", ")", ";", "}", "}", "else", "if", "(", "name", ".", "equalsIgnoreCase", "(", "DOMConstants", ".", "DOM_ERROR_HANDLER", ")", "&&", "value", "==", "null", "||", "value", "instanceof", "DOMErrorHandler", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Checks if setting a parameter to a specific value is supported. @see org.w3c.dom.DOMConfiguration#canSetParameter(java.lang.String, java.lang.Object) @since DOM Level 3 @param name A String containing the DOMConfiguration parameter name. @param value An Object specifying the value of the corresponding parameter.
[ "Checks", "if", "setting", "a", "parameter", "to", "a", "specific", "value", "is", "supported", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java#L390-L427
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/event/MapEventPublishingService.java
MapEventPublishingService.dispatchLocalEventData
private void dispatchLocalEventData(EventData eventData, ListenerAdapter listener) { """ Dispatches an event-data to {@link com.hazelcast.map.QueryCache QueryCache} listeners on this local node. @param eventData {@link EventData} to be dispatched @param listener the listener which the event will be dispatched from """ IMapEvent event = createIMapEvent(eventData, null, nodeEngine.getLocalMember(), serializationService); listener.onEvent(event); }
java
private void dispatchLocalEventData(EventData eventData, ListenerAdapter listener) { IMapEvent event = createIMapEvent(eventData, null, nodeEngine.getLocalMember(), serializationService); listener.onEvent(event); }
[ "private", "void", "dispatchLocalEventData", "(", "EventData", "eventData", ",", "ListenerAdapter", "listener", ")", "{", "IMapEvent", "event", "=", "createIMapEvent", "(", "eventData", ",", "null", ",", "nodeEngine", ".", "getLocalMember", "(", ")", ",", "serializationService", ")", ";", "listener", ".", "onEvent", "(", "event", ")", ";", "}" ]
Dispatches an event-data to {@link com.hazelcast.map.QueryCache QueryCache} listeners on this local node. @param eventData {@link EventData} to be dispatched @param listener the listener which the event will be dispatched from
[ "Dispatches", "an", "event", "-", "data", "to", "{", "@link", "com", ".", "hazelcast", ".", "map", ".", "QueryCache", "QueryCache", "}", "listeners", "on", "this", "local", "node", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/event/MapEventPublishingService.java#L156-L159
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Connection.java
JDBC4Connection.prepareCall
@Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { """ Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. """ if (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY) return prepareCall(sql); checkClosed(); throw SQLError.noSupport(); }
java
@Override public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { if (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY) return prepareCall(sql); checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "CallableStatement", "prepareCall", "(", "String", "sql", ",", "int", "resultSetType", ",", "int", "resultSetConcurrency", ")", "throws", "SQLException", "{", "if", "(", "resultSetType", "==", "ResultSet", ".", "TYPE_SCROLL_INSENSITIVE", "&&", "resultSetConcurrency", "==", "ResultSet", ".", "CONCUR_READ_ONLY", ")", "return", "prepareCall", "(", "sql", ")", ";", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.
[ "Creates", "a", "CallableStatement", "object", "that", "will", "generate", "ResultSet", "objects", "with", "the", "given", "type", "and", "concurrency", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Connection.java#L344-L351
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java
VirtualMachineScaleSetVMsInner.getAsync
public Observable<VirtualMachineScaleSetVMInner> getAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { """ Gets a virtual machine from a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceId The instance ID of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineScaleSetVMInner object """ return getWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1<ServiceResponse<VirtualMachineScaleSetVMInner>, VirtualMachineScaleSetVMInner>() { @Override public VirtualMachineScaleSetVMInner call(ServiceResponse<VirtualMachineScaleSetVMInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineScaleSetVMInner> getAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { return getWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1<ServiceResponse<VirtualMachineScaleSetVMInner>, VirtualMachineScaleSetVMInner>() { @Override public VirtualMachineScaleSetVMInner call(ServiceResponse<VirtualMachineScaleSetVMInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineScaleSetVMInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "String", "instanceId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ",", "instanceId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualMachineScaleSetVMInner", ">", ",", "VirtualMachineScaleSetVMInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualMachineScaleSetVMInner", "call", "(", "ServiceResponse", "<", "VirtualMachineScaleSetVMInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a virtual machine from a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceId The instance ID of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineScaleSetVMInner object
[ "Gets", "a", "virtual", "machine", "from", "a", "VM", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java#L1068-L1075
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CreateSyntheticOverheadViewPL.java
CreateSyntheticOverheadViewPL.process
public void process(Planar<T> input, Planar<T> output) { """ Computes overhead view of input image. All pixels in input image are assumed to be on the ground plane. @param input (Input) Camera image. @param output (Output) Image containing overhead view. """ int N = input.getNumBands(); for( int i = 0; i < N; i++ ) { this.output[i] = FactoryGImageGray.wrap(output.getBand(i),this.output[i]); interp[i].setImage(input.getBand(i)); } int indexMap = 0; for( int i = 0; i < output.height; i++ ) { int indexOut = output.startIndex + i*output.stride; for( int j = 0; j < output.width; j++ , indexOut++,indexMap++ ) { Point2D_F32 p = mapPixels[indexMap]; if( p != null ) { for( int k = 0; k < N; k++ ) { this.output[k].set(indexOut, interp[k].get( p.x, p.y)); } } } } }
java
public void process(Planar<T> input, Planar<T> output) { int N = input.getNumBands(); for( int i = 0; i < N; i++ ) { this.output[i] = FactoryGImageGray.wrap(output.getBand(i),this.output[i]); interp[i].setImage(input.getBand(i)); } int indexMap = 0; for( int i = 0; i < output.height; i++ ) { int indexOut = output.startIndex + i*output.stride; for( int j = 0; j < output.width; j++ , indexOut++,indexMap++ ) { Point2D_F32 p = mapPixels[indexMap]; if( p != null ) { for( int k = 0; k < N; k++ ) { this.output[k].set(indexOut, interp[k].get( p.x, p.y)); } } } } }
[ "public", "void", "process", "(", "Planar", "<", "T", ">", "input", ",", "Planar", "<", "T", ">", "output", ")", "{", "int", "N", "=", "input", ".", "getNumBands", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "N", ";", "i", "++", ")", "{", "this", ".", "output", "[", "i", "]", "=", "FactoryGImageGray", ".", "wrap", "(", "output", ".", "getBand", "(", "i", ")", ",", "this", ".", "output", "[", "i", "]", ")", ";", "interp", "[", "i", "]", ".", "setImage", "(", "input", ".", "getBand", "(", "i", ")", ")", ";", "}", "int", "indexMap", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "output", ".", "height", ";", "i", "++", ")", "{", "int", "indexOut", "=", "output", ".", "startIndex", "+", "i", "*", "output", ".", "stride", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "output", ".", "width", ";", "j", "++", ",", "indexOut", "++", ",", "indexMap", "++", ")", "{", "Point2D_F32", "p", "=", "mapPixels", "[", "indexMap", "]", ";", "if", "(", "p", "!=", "null", ")", "{", "for", "(", "int", "k", "=", "0", ";", "k", "<", "N", ";", "k", "++", ")", "{", "this", ".", "output", "[", "k", "]", ".", "set", "(", "indexOut", ",", "interp", "[", "k", "]", ".", "get", "(", "p", ".", "x", ",", "p", ".", "y", ")", ")", ";", "}", "}", "}", "}", "}" ]
Computes overhead view of input image. All pixels in input image are assumed to be on the ground plane. @param input (Input) Camera image. @param output (Output) Image containing overhead view.
[ "Computes", "overhead", "view", "of", "input", "image", ".", "All", "pixels", "in", "input", "image", "are", "assumed", "to", "be", "on", "the", "ground", "plane", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CreateSyntheticOverheadViewPL.java#L77-L97
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Convert.java
Convert.toBigDecimal
public static BigDecimal toBigDecimal(Object value) { """ Converts value to BigDecimal if it can. If value is a BigDecimal, it is returned, if it is a BigDecimal, it is promoted to BigDecimal and then returned, in all other cases, it converts the value to String, then tries to parse BigDecimal from it. @param value value to be converted to Integer. @return value converted to Integer. """ if (value == null) { return null; } else if (value instanceof BigDecimal) { return (BigDecimal) value; } else { try { return new BigDecimal(value.toString().trim()); } catch (NumberFormatException e) { throw new ConversionException("failed to convert: '" + value + "' to BigDecimal", e); } } }
java
public static BigDecimal toBigDecimal(Object value) { if (value == null) { return null; } else if (value instanceof BigDecimal) { return (BigDecimal) value; } else { try { return new BigDecimal(value.toString().trim()); } catch (NumberFormatException e) { throw new ConversionException("failed to convert: '" + value + "' to BigDecimal", e); } } }
[ "public", "static", "BigDecimal", "toBigDecimal", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "value", "instanceof", "BigDecimal", ")", "{", "return", "(", "BigDecimal", ")", "value", ";", "}", "else", "{", "try", "{", "return", "new", "BigDecimal", "(", "value", ".", "toString", "(", ")", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "ConversionException", "(", "\"failed to convert: '\"", "+", "value", "+", "\"' to BigDecimal\"", ",", "e", ")", ";", "}", "}", "}" ]
Converts value to BigDecimal if it can. If value is a BigDecimal, it is returned, if it is a BigDecimal, it is promoted to BigDecimal and then returned, in all other cases, it converts the value to String, then tries to parse BigDecimal from it. @param value value to be converted to Integer. @return value converted to Integer.
[ "Converts", "value", "to", "BigDecimal", "if", "it", "can", ".", "If", "value", "is", "a", "BigDecimal", "it", "is", "returned", "if", "it", "is", "a", "BigDecimal", "it", "is", "promoted", "to", "BigDecimal", "and", "then", "returned", "in", "all", "other", "cases", "it", "converts", "the", "value", "to", "String", "then", "tries", "to", "parse", "BigDecimal", "from", "it", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L397-L409
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java
BeanDefinitionParserUtils.setConstructorArgValue
public static void setConstructorArgValue(BeanDefinitionBuilder builder, String propertyValue) { """ Sets the property value on bean definition as constructor argument in case value is not null. @param builder the bean definition to be configured @param propertyValue the property value """ if (StringUtils.hasText(propertyValue)) { builder.addConstructorArgValue(propertyValue); } }
java
public static void setConstructorArgValue(BeanDefinitionBuilder builder, String propertyValue) { if (StringUtils.hasText(propertyValue)) { builder.addConstructorArgValue(propertyValue); } }
[ "public", "static", "void", "setConstructorArgValue", "(", "BeanDefinitionBuilder", "builder", ",", "String", "propertyValue", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "propertyValue", ")", ")", "{", "builder", ".", "addConstructorArgValue", "(", "propertyValue", ")", ";", "}", "}" ]
Sets the property value on bean definition as constructor argument in case value is not null. @param builder the bean definition to be configured @param propertyValue the property value
[ "Sets", "the", "property", "value", "on", "bean", "definition", "as", "constructor", "argument", "in", "case", "value", "is", "not", "null", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java#L61-L65