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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
SeleniumHQ/selenium
java/server/src/org/openqa/grid/internal/utils/SelfRegisteringRemote.java
SelfRegisteringRemote.addBrowser
public void addBrowser(DesiredCapabilities cap, int instances) { """ Adding the browser described by the capability, automatically finding out what platform the node is launched from @param cap describing the browser @param instances number of times this browser can be started on the node. """ String s = cap.getBrowserName(); if (s == null || "".equals(s)) { throw new InvalidParameterException(cap + " does seems to be a valid browser."); } if (cap.getPlatform() == null) { cap.setPlatform(Platform.getCurrent()); } cap.setCapability(RegistrationRequest.MAX_INSTANCES, instances); registrationRequest.getConfiguration().capabilities.add(cap); registrationRequest.getConfiguration().fixUpCapabilities(); }
java
public void addBrowser(DesiredCapabilities cap, int instances) { String s = cap.getBrowserName(); if (s == null || "".equals(s)) { throw new InvalidParameterException(cap + " does seems to be a valid browser."); } if (cap.getPlatform() == null) { cap.setPlatform(Platform.getCurrent()); } cap.setCapability(RegistrationRequest.MAX_INSTANCES, instances); registrationRequest.getConfiguration().capabilities.add(cap); registrationRequest.getConfiguration().fixUpCapabilities(); }
[ "public", "void", "addBrowser", "(", "DesiredCapabilities", "cap", ",", "int", "instances", ")", "{", "String", "s", "=", "cap", ".", "getBrowserName", "(", ")", ";", "if", "(", "s", "==", "null", "||", "\"\"", ".", "equals", "(", "s", ")", ")", "{", "throw", "new", "InvalidParameterException", "(", "cap", "+", "\" does seems to be a valid browser.\"", ")", ";", "}", "if", "(", "cap", ".", "getPlatform", "(", ")", "==", "null", ")", "{", "cap", ".", "setPlatform", "(", "Platform", ".", "getCurrent", "(", ")", ")", ";", "}", "cap", ".", "setCapability", "(", "RegistrationRequest", ".", "MAX_INSTANCES", ",", "instances", ")", ";", "registrationRequest", ".", "getConfiguration", "(", ")", ".", "capabilities", ".", "add", "(", "cap", ")", ";", "registrationRequest", ".", "getConfiguration", "(", ")", ".", "fixUpCapabilities", "(", ")", ";", "}" ]
Adding the browser described by the capability, automatically finding out what platform the node is launched from @param cap describing the browser @param instances number of times this browser can be started on the node.
[ "Adding", "the", "browser", "described", "by", "the", "capability", "automatically", "finding", "out", "what", "platform", "the", "node", "is", "launched", "from" ]
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/utils/SelfRegisteringRemote.java#L139-L150
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/utils/OpenAPIUtils.java
OpenAPIUtils.mapToString
public static String mapToString(Map<String, ?> map) { """ Print map to string @param map - the map to be printed to String """ StringBuilder sb = new StringBuilder(); sb.append("{\n"); for (String key : map.keySet()) { if (map.get(key) != null) { sb.append(key + ": " + map.get(key) + "\n "); } else { continue; } } sb.append("}"); return sb.toString(); }
java
public static String mapToString(Map<String, ?> map) { StringBuilder sb = new StringBuilder(); sb.append("{\n"); for (String key : map.keySet()) { if (map.get(key) != null) { sb.append(key + ": " + map.get(key) + "\n "); } else { continue; } } sb.append("}"); return sb.toString(); }
[ "public", "static", "String", "mapToString", "(", "Map", "<", "String", ",", "?", ">", "map", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"{\\n\"", ")", ";", "for", "(", "String", "key", ":", "map", ".", "keySet", "(", ")", ")", "{", "if", "(", "map", ".", "get", "(", "key", ")", "!=", "null", ")", "{", "sb", ".", "append", "(", "key", "+", "\": \"", "+", "map", ".", "get", "(", "key", ")", "+", "\"\\n \"", ")", ";", "}", "else", "{", "continue", ";", "}", "}", "sb", ".", "append", "(", "\"}\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Print map to string @param map - the map to be printed to String
[ "Print", "map", "to", "string" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/utils/OpenAPIUtils.java#L170-L182
apache/flink
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java
KinesisDataFetcher.registerShardMetrics
private static ShardMetricsReporter registerShardMetrics(MetricGroup metricGroup, KinesisStreamShardState shardState) { """ Registers a metric group associated with the shard id of the provided {@link KinesisStreamShardState shardState}. @return a {@link ShardMetricsReporter} that can be used to update metric values """ ShardMetricsReporter shardMetrics = new ShardMetricsReporter(); MetricGroup streamShardMetricGroup = metricGroup .addGroup( KinesisConsumerMetricConstants.STREAM_METRICS_GROUP, shardState.getStreamShardHandle().getStreamName()) .addGroup( KinesisConsumerMetricConstants.SHARD_METRICS_GROUP, shardState.getStreamShardHandle().getShard().getShardId()); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.MILLIS_BEHIND_LATEST_GAUGE, shardMetrics::getMillisBehindLatest); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.MAX_RECORDS_PER_FETCH, shardMetrics::getMaxNumberOfRecordsPerFetch); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.NUM_AGGREGATED_RECORDS_PER_FETCH, shardMetrics::getNumberOfAggregatedRecords); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.NUM_DEAGGREGATED_RECORDS_PER_FETCH, shardMetrics::getNumberOfDeaggregatedRecords); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.AVG_RECORD_SIZE_BYTES, shardMetrics::getAverageRecordSizeBytes); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.BYTES_PER_READ, shardMetrics::getBytesPerRead); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.RUNTIME_LOOP_NANOS, shardMetrics::getRunLoopTimeNanos); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.LOOP_FREQUENCY_HZ, shardMetrics::getLoopFrequencyHz); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.SLEEP_TIME_MILLIS, shardMetrics::getSleepTimeMillis); return shardMetrics; }
java
private static ShardMetricsReporter registerShardMetrics(MetricGroup metricGroup, KinesisStreamShardState shardState) { ShardMetricsReporter shardMetrics = new ShardMetricsReporter(); MetricGroup streamShardMetricGroup = metricGroup .addGroup( KinesisConsumerMetricConstants.STREAM_METRICS_GROUP, shardState.getStreamShardHandle().getStreamName()) .addGroup( KinesisConsumerMetricConstants.SHARD_METRICS_GROUP, shardState.getStreamShardHandle().getShard().getShardId()); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.MILLIS_BEHIND_LATEST_GAUGE, shardMetrics::getMillisBehindLatest); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.MAX_RECORDS_PER_FETCH, shardMetrics::getMaxNumberOfRecordsPerFetch); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.NUM_AGGREGATED_RECORDS_PER_FETCH, shardMetrics::getNumberOfAggregatedRecords); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.NUM_DEAGGREGATED_RECORDS_PER_FETCH, shardMetrics::getNumberOfDeaggregatedRecords); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.AVG_RECORD_SIZE_BYTES, shardMetrics::getAverageRecordSizeBytes); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.BYTES_PER_READ, shardMetrics::getBytesPerRead); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.RUNTIME_LOOP_NANOS, shardMetrics::getRunLoopTimeNanos); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.LOOP_FREQUENCY_HZ, shardMetrics::getLoopFrequencyHz); streamShardMetricGroup.gauge(KinesisConsumerMetricConstants.SLEEP_TIME_MILLIS, shardMetrics::getSleepTimeMillis); return shardMetrics; }
[ "private", "static", "ShardMetricsReporter", "registerShardMetrics", "(", "MetricGroup", "metricGroup", ",", "KinesisStreamShardState", "shardState", ")", "{", "ShardMetricsReporter", "shardMetrics", "=", "new", "ShardMetricsReporter", "(", ")", ";", "MetricGroup", "streamShardMetricGroup", "=", "metricGroup", ".", "addGroup", "(", "KinesisConsumerMetricConstants", ".", "STREAM_METRICS_GROUP", ",", "shardState", ".", "getStreamShardHandle", "(", ")", ".", "getStreamName", "(", ")", ")", ".", "addGroup", "(", "KinesisConsumerMetricConstants", ".", "SHARD_METRICS_GROUP", ",", "shardState", ".", "getStreamShardHandle", "(", ")", ".", "getShard", "(", ")", ".", "getShardId", "(", ")", ")", ";", "streamShardMetricGroup", ".", "gauge", "(", "KinesisConsumerMetricConstants", ".", "MILLIS_BEHIND_LATEST_GAUGE", ",", "shardMetrics", "::", "getMillisBehindLatest", ")", ";", "streamShardMetricGroup", ".", "gauge", "(", "KinesisConsumerMetricConstants", ".", "MAX_RECORDS_PER_FETCH", ",", "shardMetrics", "::", "getMaxNumberOfRecordsPerFetch", ")", ";", "streamShardMetricGroup", ".", "gauge", "(", "KinesisConsumerMetricConstants", ".", "NUM_AGGREGATED_RECORDS_PER_FETCH", ",", "shardMetrics", "::", "getNumberOfAggregatedRecords", ")", ";", "streamShardMetricGroup", ".", "gauge", "(", "KinesisConsumerMetricConstants", ".", "NUM_DEAGGREGATED_RECORDS_PER_FETCH", ",", "shardMetrics", "::", "getNumberOfDeaggregatedRecords", ")", ";", "streamShardMetricGroup", ".", "gauge", "(", "KinesisConsumerMetricConstants", ".", "AVG_RECORD_SIZE_BYTES", ",", "shardMetrics", "::", "getAverageRecordSizeBytes", ")", ";", "streamShardMetricGroup", ".", "gauge", "(", "KinesisConsumerMetricConstants", ".", "BYTES_PER_READ", ",", "shardMetrics", "::", "getBytesPerRead", ")", ";", "streamShardMetricGroup", ".", "gauge", "(", "KinesisConsumerMetricConstants", ".", "RUNTIME_LOOP_NANOS", ",", "shardMetrics", "::", "getRunLoopTimeNanos", ")", ";", "streamShardMetricGroup", ".", "gauge", "(", "KinesisConsumerMetricConstants", ".", "LOOP_FREQUENCY_HZ", ",", "shardMetrics", "::", "getLoopFrequencyHz", ")", ";", "streamShardMetricGroup", ".", "gauge", "(", "KinesisConsumerMetricConstants", ".", "SLEEP_TIME_MILLIS", ",", "shardMetrics", "::", "getSleepTimeMillis", ")", ";", "return", "shardMetrics", ";", "}" ]
Registers a metric group associated with the shard id of the provided {@link KinesisStreamShardState shardState}. @return a {@link ShardMetricsReporter} that can be used to update metric values
[ "Registers", "a", "metric", "group", "associated", "with", "the", "shard", "id", "of", "the", "provided", "{", "@link", "KinesisStreamShardState", "shardState", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java#L793-L814
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/object/StubObject.java
StubObject.createForCurrentUserAndID
@Nonnull public static StubObject createForCurrentUserAndID (@Nonnull @Nonempty final String sID, @Nullable final Map <String, String> aCustomAttrs) { """ Create a {@link StubObject} using the current user ID and the provided object ID @param sID Object ID @param aCustomAttrs Custom attributes. May be <code>null</code>. @return Never <code>null</code>. """ return new StubObject (sID, LoggedInUserManager.getInstance ().getCurrentUserID (), aCustomAttrs); }
java
@Nonnull public static StubObject createForCurrentUserAndID (@Nonnull @Nonempty final String sID, @Nullable final Map <String, String> aCustomAttrs) { return new StubObject (sID, LoggedInUserManager.getInstance ().getCurrentUserID (), aCustomAttrs); }
[ "@", "Nonnull", "public", "static", "StubObject", "createForCurrentUserAndID", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sID", ",", "@", "Nullable", "final", "Map", "<", "String", ",", "String", ">", "aCustomAttrs", ")", "{", "return", "new", "StubObject", "(", "sID", ",", "LoggedInUserManager", ".", "getInstance", "(", ")", ".", "getCurrentUserID", "(", ")", ",", "aCustomAttrs", ")", ";", "}" ]
Create a {@link StubObject} using the current user ID and the provided object ID @param sID Object ID @param aCustomAttrs Custom attributes. May be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "{", "@link", "StubObject", "}", "using", "the", "current", "user", "ID", "and", "the", "provided", "object", "ID" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/object/StubObject.java#L159-L164
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Byte.java
Byte.valueOf
public static Byte valueOf(String s, int radix) throws NumberFormatException { """ Returns a {@code Byte} object holding the value extracted from the specified {@code String} when parsed with the radix given by the second argument. The first argument is interpreted as representing a signed {@code byte} in the radix specified by the second argument, exactly as if the argument were given to the {@link #parseByte(java.lang.String, int)} method. The result is a {@code Byte} object that represents the {@code byte} value specified by the string. <p> In other words, this method returns a {@code Byte} object equal to the value of: <blockquote> {@code new Byte(Byte.parseByte(s, radix))} </blockquote> @param s the string to be parsed @param radix the radix to be used in interpreting {@code s} @return a {@code Byte} object holding the value represented by the string argument in the specified radix. @throws NumberFormatException If the {@code String} does not contain a parsable {@code byte}. """ return valueOf(parseByte(s, radix)); }
java
public static Byte valueOf(String s, int radix) throws NumberFormatException { return valueOf(parseByte(s, radix)); }
[ "public", "static", "Byte", "valueOf", "(", "String", "s", ",", "int", "radix", ")", "throws", "NumberFormatException", "{", "return", "valueOf", "(", "parseByte", "(", "s", ",", "radix", ")", ")", ";", "}" ]
Returns a {@code Byte} object holding the value extracted from the specified {@code String} when parsed with the radix given by the second argument. The first argument is interpreted as representing a signed {@code byte} in the radix specified by the second argument, exactly as if the argument were given to the {@link #parseByte(java.lang.String, int)} method. The result is a {@code Byte} object that represents the {@code byte} value specified by the string. <p> In other words, this method returns a {@code Byte} object equal to the value of: <blockquote> {@code new Byte(Byte.parseByte(s, radix))} </blockquote> @param s the string to be parsed @param radix the radix to be used in interpreting {@code s} @return a {@code Byte} object holding the value represented by the string argument in the specified radix. @throws NumberFormatException If the {@code String} does not contain a parsable {@code byte}.
[ "Returns", "a", "{", "@code", "Byte", "}", "object", "holding", "the", "value", "extracted", "from", "the", "specified", "{", "@code", "String", "}", "when", "parsed", "with", "the", "radix", "given", "by", "the", "second", "argument", ".", "The", "first", "argument", "is", "interpreted", "as", "representing", "a", "signed", "{", "@code", "byte", "}", "in", "the", "radix", "specified", "by", "the", "second", "argument", "exactly", "as", "if", "the", "argument", "were", "given", "to", "the", "{", "@link", "#parseByte", "(", "java", ".", "lang", ".", "String", "int", ")", "}", "method", ".", "The", "result", "is", "a", "{", "@code", "Byte", "}", "object", "that", "represents", "the", "{", "@code", "byte", "}", "value", "specified", "by", "the", "string", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Byte.java#L215-L218
tractionsoftware/gwt-traction
src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java
SingleListBox.findValueInListBox
public static final int findValueInListBox(ListBox list, String value) { """ Utility function to find the first index of a value in a ListBox. """ for (int i=0; i<list.getItemCount(); i++) { if (value.equals(list.getValue(i))) { return i; } } return -1; }
java
public static final int findValueInListBox(ListBox list, String value) { for (int i=0; i<list.getItemCount(); i++) { if (value.equals(list.getValue(i))) { return i; } } return -1; }
[ "public", "static", "final", "int", "findValueInListBox", "(", "ListBox", "list", ",", "String", "value", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "getItemCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "value", ".", "equals", "(", "list", ".", "getValue", "(", "i", ")", ")", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Utility function to find the first index of a value in a ListBox.
[ "Utility", "function", "to", "find", "the", "first", "index", "of", "a", "value", "in", "a", "ListBox", "." ]
train
https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/ui/SingleListBox.java#L163-L170
agapsys/embedded-servlet-container
src/main/java/com/agapsys/jee/ServletContainer.java
ServletContainer.registerServlet
public SC registerServlet(Class<? extends HttpServlet> servletClass, String urlPattern) { """ Registers a servlet. @param servletClass class to be registered. @param urlPattern url pattern to be associated with given class. @return this """ __throwIfInitialized(); if (servletMap.containsKey(urlPattern) && servletMap.get(urlPattern) != servletClass) throw new IllegalArgumentException(String.format("URL pattern is already associated with another servlet class: %s => %s", urlPattern, servletMap.get(urlPattern))); servletMap.put(urlPattern, servletClass); return (SC) this; }
java
public SC registerServlet(Class<? extends HttpServlet> servletClass, String urlPattern) { __throwIfInitialized(); if (servletMap.containsKey(urlPattern) && servletMap.get(urlPattern) != servletClass) throw new IllegalArgumentException(String.format("URL pattern is already associated with another servlet class: %s => %s", urlPattern, servletMap.get(urlPattern))); servletMap.put(urlPattern, servletClass); return (SC) this; }
[ "public", "SC", "registerServlet", "(", "Class", "<", "?", "extends", "HttpServlet", ">", "servletClass", ",", "String", "urlPattern", ")", "{", "__throwIfInitialized", "(", ")", ";", "if", "(", "servletMap", ".", "containsKey", "(", "urlPattern", ")", "&&", "servletMap", ".", "get", "(", "urlPattern", ")", "!=", "servletClass", ")", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"URL pattern is already associated with another servlet class: %s => %s\"", ",", "urlPattern", ",", "servletMap", ".", "get", "(", "urlPattern", ")", ")", ")", ";", "servletMap", ".", "put", "(", "urlPattern", ",", "servletClass", ")", ";", "return", "(", "SC", ")", "this", ";", "}" ]
Registers a servlet. @param servletClass class to be registered. @param urlPattern url pattern to be associated with given class. @return this
[ "Registers", "a", "servlet", "." ]
train
https://github.com/agapsys/embedded-servlet-container/blob/28314a2600ad8550ed2c901d8e35d86583c26bb0/src/main/java/com/agapsys/jee/ServletContainer.java#L344-L352
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/notification/MithraNotificationEventManagerImpl.java
MithraNotificationEventManagerImpl.getRegistrationEntryList
private RegistrationEntryList getRegistrationEntryList(String subject, RelatedFinder finder) { """ Must only be called from the thread which is used for registration """ RegistrationEntryList registrationEntryList; RegistrationKey key = new RegistrationKey(subject, finder.getFinderClassName()); if (logger.isDebugEnabled()) { logger.debug("**************Adding application notification registration with key: " + key.toString()); } registrationEntryList = mithraApplicationNotificationSubscriber.get(key); if (registrationEntryList == null) { registrationEntryList = new RegistrationEntryList(); mithraApplicationNotificationSubscriber.put(key, registrationEntryList); } return registrationEntryList; }
java
private RegistrationEntryList getRegistrationEntryList(String subject, RelatedFinder finder) { RegistrationEntryList registrationEntryList; RegistrationKey key = new RegistrationKey(subject, finder.getFinderClassName()); if (logger.isDebugEnabled()) { logger.debug("**************Adding application notification registration with key: " + key.toString()); } registrationEntryList = mithraApplicationNotificationSubscriber.get(key); if (registrationEntryList == null) { registrationEntryList = new RegistrationEntryList(); mithraApplicationNotificationSubscriber.put(key, registrationEntryList); } return registrationEntryList; }
[ "private", "RegistrationEntryList", "getRegistrationEntryList", "(", "String", "subject", ",", "RelatedFinder", "finder", ")", "{", "RegistrationEntryList", "registrationEntryList", ";", "RegistrationKey", "key", "=", "new", "RegistrationKey", "(", "subject", ",", "finder", ".", "getFinderClassName", "(", ")", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"**************Adding application notification registration with key: \"", "+", "key", ".", "toString", "(", ")", ")", ";", "}", "registrationEntryList", "=", "mithraApplicationNotificationSubscriber", ".", "get", "(", "key", ")", ";", "if", "(", "registrationEntryList", "==", "null", ")", "{", "registrationEntryList", "=", "new", "RegistrationEntryList", "(", ")", ";", "mithraApplicationNotificationSubscriber", ".", "put", "(", "key", ",", "registrationEntryList", ")", ";", "}", "return", "registrationEntryList", ";", "}" ]
Must only be called from the thread which is used for registration
[ "Must", "only", "be", "called", "from", "the", "thread", "which", "is", "used", "for", "registration" ]
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/notification/MithraNotificationEventManagerImpl.java#L486-L501
rampatra/jbot
jbot-example/src/main/java/example/jbot/slack/SlackBot.java
SlackBot.confirmTiming
@Controller(next = "askTimeForMeeting") public void confirmTiming(WebSocketSession session, Event event) { """ This method will be invoked after {@link SlackBot#setupMeeting(WebSocketSession, Event)}. @param session @param event """ reply(session, event, "Your meeting is set at " + event.getText() + ". Would you like to repeat it tomorrow?"); nextConversation(event); // jump to next question in conversation }
java
@Controller(next = "askTimeForMeeting") public void confirmTiming(WebSocketSession session, Event event) { reply(session, event, "Your meeting is set at " + event.getText() + ". Would you like to repeat it tomorrow?"); nextConversation(event); // jump to next question in conversation }
[ "@", "Controller", "(", "next", "=", "\"askTimeForMeeting\"", ")", "public", "void", "confirmTiming", "(", "WebSocketSession", "session", ",", "Event", "event", ")", "{", "reply", "(", "session", ",", "event", ",", "\"Your meeting is set at \"", "+", "event", ".", "getText", "(", ")", "+", "\". Would you like to repeat it tomorrow?\"", ")", ";", "nextConversation", "(", "event", ")", ";", "// jump to next question in conversation", "}" ]
This method will be invoked after {@link SlackBot#setupMeeting(WebSocketSession, Event)}. @param session @param event
[ "This", "method", "will", "be", "invoked", "after", "{", "@link", "SlackBot#setupMeeting", "(", "WebSocketSession", "Event", ")", "}", "." ]
train
https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/slack/SlackBot.java#L125-L130
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java
FileSystem.createTempDirectory
public static File createTempDirectory(String prefix, String suffix) throws IOException { """ Create an empty directory in the default temporary-file directory, using the given prefix and suffix to generate its name. Invoking this method is equivalent to invoking <code>{@link #createTempDirectory(java.lang.String, java.lang.String, java.io.File) createTempDirectory(prefix,&nbsp;suffix,&nbsp;null)}</code>. @param prefix is the prefix string to be used in generating the file's name; must be at least three characters long @param suffix is the suffix string to be used in generating the file's name; may be <code>null</code>, in which case the suffix <code>".tmp"</code> will be used @return An abstract pathname denoting a newly-created empty file @throws IllegalArgumentException If the <code>prefix</code> argument contains fewer than three characters @throws IOException If a file could not be created @throws SecurityException If a security manager exists and its <code>{@link java.lang.SecurityManager#checkWrite(java.lang.String)}</code> method does not allow a file to be created @since 6.2 """ return createTempDirectory(prefix, suffix, null); }
java
public static File createTempDirectory(String prefix, String suffix) throws IOException { return createTempDirectory(prefix, suffix, null); }
[ "public", "static", "File", "createTempDirectory", "(", "String", "prefix", ",", "String", "suffix", ")", "throws", "IOException", "{", "return", "createTempDirectory", "(", "prefix", ",", "suffix", ",", "null", ")", ";", "}" ]
Create an empty directory in the default temporary-file directory, using the given prefix and suffix to generate its name. Invoking this method is equivalent to invoking <code>{@link #createTempDirectory(java.lang.String, java.lang.String, java.io.File) createTempDirectory(prefix,&nbsp;suffix,&nbsp;null)}</code>. @param prefix is the prefix string to be used in generating the file's name; must be at least three characters long @param suffix is the suffix string to be used in generating the file's name; may be <code>null</code>, in which case the suffix <code>".tmp"</code> will be used @return An abstract pathname denoting a newly-created empty file @throws IllegalArgumentException If the <code>prefix</code> argument contains fewer than three characters @throws IOException If a file could not be created @throws SecurityException If a security manager exists and its <code>{@link java.lang.SecurityManager#checkWrite(java.lang.String)}</code> method does not allow a file to be created @since 6.2
[ "Create", "an", "empty", "directory", "in", "the", "default", "temporary", "-", "file", "directory", "using", "the", "given", "prefix", "and", "suffix", "to", "generate", "its", "name", ".", "Invoking", "this", "method", "is", "equivalent", "to", "invoking", "<code", ">", "{", "@link", "#createTempDirectory", "(", "java", ".", "lang", ".", "String", "java", ".", "lang", ".", "String", "java", ".", "io", ".", "File", ")", "createTempDirectory", "(", "prefix", "&nbsp", ";", "suffix", "&nbsp", ";", "null", ")", "}", "<", "/", "code", ">", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L3070-L3072
CenturyLinkCloud/mdw
mdw-workflow/src/com/centurylink/mdw/workflow/activity/template/VelocityTemplateActivity.java
VelocityTemplateActivity.createVelocityContext
protected VelocityContext createVelocityContext() throws ActivityException { """ Creates the velocity context, adding process variables as parameters. """ try { VelocityContext context = null; String toolboxFile = getAttributeValueSmart(VELOCITY_TOOLBOX_FILE); if (toolboxFile != null && FileHelper.fileExistsOnClasspath(toolboxFile)) { throw new ActivityException("TODO: Velocity Toolbox Support"); // XMLToolboxManager toolboxManager = new XMLToolboxManager(); // toolboxManager.load(FileHelper.fileInputStreamFromClasspath(toolboxFile)); // context = new VelocityContext(toolboxManager.getToolbox(toolboxFile)); } else { context = new VelocityContext(); } Process processVO = getMainProcessDefinition(); List<Variable> varVOs = processVO.getVariables(); for (Variable variableVO : varVOs) { String variableName = variableVO.getName(); Object variableValue = getVariableValue(variableName); context.put(variableName, variableValue); } return context; } catch (Exception ex) { throw new ActivityException(-1, ex.getMessage(), ex); } }
java
protected VelocityContext createVelocityContext() throws ActivityException { try { VelocityContext context = null; String toolboxFile = getAttributeValueSmart(VELOCITY_TOOLBOX_FILE); if (toolboxFile != null && FileHelper.fileExistsOnClasspath(toolboxFile)) { throw new ActivityException("TODO: Velocity Toolbox Support"); // XMLToolboxManager toolboxManager = new XMLToolboxManager(); // toolboxManager.load(FileHelper.fileInputStreamFromClasspath(toolboxFile)); // context = new VelocityContext(toolboxManager.getToolbox(toolboxFile)); } else { context = new VelocityContext(); } Process processVO = getMainProcessDefinition(); List<Variable> varVOs = processVO.getVariables(); for (Variable variableVO : varVOs) { String variableName = variableVO.getName(); Object variableValue = getVariableValue(variableName); context.put(variableName, variableValue); } return context; } catch (Exception ex) { throw new ActivityException(-1, ex.getMessage(), ex); } }
[ "protected", "VelocityContext", "createVelocityContext", "(", ")", "throws", "ActivityException", "{", "try", "{", "VelocityContext", "context", "=", "null", ";", "String", "toolboxFile", "=", "getAttributeValueSmart", "(", "VELOCITY_TOOLBOX_FILE", ")", ";", "if", "(", "toolboxFile", "!=", "null", "&&", "FileHelper", ".", "fileExistsOnClasspath", "(", "toolboxFile", ")", ")", "{", "throw", "new", "ActivityException", "(", "\"TODO: Velocity Toolbox Support\"", ")", ";", "// XMLToolboxManager toolboxManager = new XMLToolboxManager();", "// toolboxManager.load(FileHelper.fileInputStreamFromClasspath(toolboxFile));", "// context = new VelocityContext(toolboxManager.getToolbox(toolboxFile));", "}", "else", "{", "context", "=", "new", "VelocityContext", "(", ")", ";", "}", "Process", "processVO", "=", "getMainProcessDefinition", "(", ")", ";", "List", "<", "Variable", ">", "varVOs", "=", "processVO", ".", "getVariables", "(", ")", ";", "for", "(", "Variable", "variableVO", ":", "varVOs", ")", "{", "String", "variableName", "=", "variableVO", ".", "getName", "(", ")", ";", "Object", "variableValue", "=", "getVariableValue", "(", "variableName", ")", ";", "context", ".", "put", "(", "variableName", ",", "variableValue", ")", ";", "}", "return", "context", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "ActivityException", "(", "-", "1", ",", "ex", ".", "getMessage", "(", ")", ",", "ex", ")", ";", "}", "}" ]
Creates the velocity context, adding process variables as parameters.
[ "Creates", "the", "velocity", "context", "adding", "process", "variables", "as", "parameters", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/src/com/centurylink/mdw/workflow/activity/template/VelocityTemplateActivity.java#L162-L189
cdk/cdk
tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomTetrahedralLigandPlacer3D.java
AtomTetrahedralLigandPlacer3D.getDistanceValue
private double getDistanceValue(String id1, String id2) { """ Gets the distance between two atoms out of the parameter set. @param id1 id of the parameter set for atom1 (atom1.getAtomTypeName()) @param id2 id of the parameter set for atom2 @return The distanceValue value @exception Exception Description of the Exception """ String dkey = ""; if (pSet.containsKey(("bond" + id1 + ";" + id2))) { dkey = "bond" + id1 + ";" + id2; } else if (pSet.containsKey(("bond" + id2 + ";" + id1))) { dkey = "bond" + id2 + ";" + id1; } else { // logger.debug("DistanceKEYError:pSet has no key:" + id2 + " ; " + id1 + " take default bond length:" + DEFAULT_BOND_LENGTH_H); return DEFAULT_BOND_LENGTH_H; } return ((Double) (((List) pSet.get(dkey)).get(0))).doubleValue(); }
java
private double getDistanceValue(String id1, String id2) { String dkey = ""; if (pSet.containsKey(("bond" + id1 + ";" + id2))) { dkey = "bond" + id1 + ";" + id2; } else if (pSet.containsKey(("bond" + id2 + ";" + id1))) { dkey = "bond" + id2 + ";" + id1; } else { // logger.debug("DistanceKEYError:pSet has no key:" + id2 + " ; " + id1 + " take default bond length:" + DEFAULT_BOND_LENGTH_H); return DEFAULT_BOND_LENGTH_H; } return ((Double) (((List) pSet.get(dkey)).get(0))).doubleValue(); }
[ "private", "double", "getDistanceValue", "(", "String", "id1", ",", "String", "id2", ")", "{", "String", "dkey", "=", "\"\"", ";", "if", "(", "pSet", ".", "containsKey", "(", "(", "\"bond\"", "+", "id1", "+", "\";\"", "+", "id2", ")", ")", ")", "{", "dkey", "=", "\"bond\"", "+", "id1", "+", "\";\"", "+", "id2", ";", "}", "else", "if", "(", "pSet", ".", "containsKey", "(", "(", "\"bond\"", "+", "id2", "+", "\";\"", "+", "id1", ")", ")", ")", "{", "dkey", "=", "\"bond\"", "+", "id2", "+", "\";\"", "+", "id1", ";", "}", "else", "{", "//\t\t\tlogger.debug(\"DistanceKEYError:pSet has no key:\" + id2 + \" ; \" + id1 + \" take default bond length:\" + DEFAULT_BOND_LENGTH_H);", "return", "DEFAULT_BOND_LENGTH_H", ";", "}", "return", "(", "(", "Double", ")", "(", "(", "(", "List", ")", "pSet", ".", "get", "(", "dkey", ")", ")", ".", "get", "(", "0", ")", ")", ")", ".", "doubleValue", "(", ")", ";", "}" ]
Gets the distance between two atoms out of the parameter set. @param id1 id of the parameter set for atom1 (atom1.getAtomTypeName()) @param id2 id of the parameter set for atom2 @return The distanceValue value @exception Exception Description of the Exception
[ "Gets", "the", "distance", "between", "two", "atoms", "out", "of", "the", "parameter", "set", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomTetrahedralLigandPlacer3D.java#L680-L691
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/MapsInner.java
MapsInner.createOrUpdate
public IntegrationAccountMapInner createOrUpdate(String resourceGroupName, String integrationAccountName, String mapName, IntegrationAccountMapInner map) { """ Creates or updates an integration account map. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param mapName The integration account map name. @param map The integration account map. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the IntegrationAccountMapInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, mapName, map).toBlocking().single().body(); }
java
public IntegrationAccountMapInner createOrUpdate(String resourceGroupName, String integrationAccountName, String mapName, IntegrationAccountMapInner map) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, mapName, map).toBlocking().single().body(); }
[ "public", "IntegrationAccountMapInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "mapName", ",", "IntegrationAccountMapInner", "map", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "integrationAccountName", ",", "mapName", ",", "map", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates an integration account map. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param mapName The integration account map name. @param map The integration account map. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the IntegrationAccountMapInner object if successful.
[ "Creates", "or", "updates", "an", "integration", "account", "map", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/MapsInner.java#L448-L450
jirkapinkas/jsitemapgenerator
src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractGenerator.java
AbstractGenerator.addPageNames
public <T> I addPageNames(Supplier<Collection<T>> webPagesSupplier, Function<T, String> mapper) { """ Add collection of pages to sitemap @param <T> This is the type parameter @param webPagesSupplier Collection of pages supplier @param mapper Mapper function which transforms some object to String. This will be passed to WebPage.of(name) @return this """ for (T element : webPagesSupplier.get()) { addPage(WebPage.of(mapper.apply(element))); } return getThis(); }
java
public <T> I addPageNames(Supplier<Collection<T>> webPagesSupplier, Function<T, String> mapper) { for (T element : webPagesSupplier.get()) { addPage(WebPage.of(mapper.apply(element))); } return getThis(); }
[ "public", "<", "T", ">", "I", "addPageNames", "(", "Supplier", "<", "Collection", "<", "T", ">", ">", "webPagesSupplier", ",", "Function", "<", "T", ",", "String", ">", "mapper", ")", "{", "for", "(", "T", "element", ":", "webPagesSupplier", ".", "get", "(", ")", ")", "{", "addPage", "(", "WebPage", ".", "of", "(", "mapper", ".", "apply", "(", "element", ")", ")", ")", ";", "}", "return", "getThis", "(", ")", ";", "}" ]
Add collection of pages to sitemap @param <T> This is the type parameter @param webPagesSupplier Collection of pages supplier @param mapper Mapper function which transforms some object to String. This will be passed to WebPage.of(name) @return this
[ "Add", "collection", "of", "pages", "to", "sitemap" ]
train
https://github.com/jirkapinkas/jsitemapgenerator/blob/42e1f57bd936e21fe9df642e722726e71f667442/src/main/java/cz/jiripinkas/jsitemapgenerator/AbstractGenerator.java#L181-L186
JodaOrg/joda-beans
src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java
MsgPackOutput.writePositiveExtensionInt
void writePositiveExtensionInt(int extensionType, int reference) throws IOException { """ Writes an extension reference of a positive integer using FIX_EXT data types. @param extensionType the type @param reference the positive integer reference to write as the data @throws IOException if an error occurs """ if (reference < 0) { throw new IllegalArgumentException("Can only serialize positive references: " + reference); } if (reference < 0xFF) { output.write(FIX_EXT_1); output.write(extensionType); output.writeByte((byte) reference); } else if (reference < 0xFFFF) { output.writeByte(FIX_EXT_2); output.write(extensionType); output.writeShort((short) reference); } else { output.writeByte(FIX_EXT_4); output.write(extensionType); output.writeInt(reference); } }
java
void writePositiveExtensionInt(int extensionType, int reference) throws IOException { if (reference < 0) { throw new IllegalArgumentException("Can only serialize positive references: " + reference); } if (reference < 0xFF) { output.write(FIX_EXT_1); output.write(extensionType); output.writeByte((byte) reference); } else if (reference < 0xFFFF) { output.writeByte(FIX_EXT_2); output.write(extensionType); output.writeShort((short) reference); } else { output.writeByte(FIX_EXT_4); output.write(extensionType); output.writeInt(reference); } }
[ "void", "writePositiveExtensionInt", "(", "int", "extensionType", ",", "int", "reference", ")", "throws", "IOException", "{", "if", "(", "reference", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can only serialize positive references: \"", "+", "reference", ")", ";", "}", "if", "(", "reference", "<", "0xFF", ")", "{", "output", ".", "write", "(", "FIX_EXT_1", ")", ";", "output", ".", "write", "(", "extensionType", ")", ";", "output", ".", "writeByte", "(", "(", "byte", ")", "reference", ")", ";", "}", "else", "if", "(", "reference", "<", "0xFFFF", ")", "{", "output", ".", "writeByte", "(", "FIX_EXT_2", ")", ";", "output", ".", "write", "(", "extensionType", ")", ";", "output", ".", "writeShort", "(", "(", "short", ")", "reference", ")", ";", "}", "else", "{", "output", ".", "writeByte", "(", "FIX_EXT_4", ")", ";", "output", ".", "write", "(", "extensionType", ")", ";", "output", ".", "writeInt", "(", "reference", ")", ";", "}", "}" ]
Writes an extension reference of a positive integer using FIX_EXT data types. @param extensionType the type @param reference the positive integer reference to write as the data @throws IOException if an error occurs
[ "Writes", "an", "extension", "reference", "of", "a", "positive", "integer", "using", "FIX_EXT", "data", "types", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java#L310-L327
lucee/Lucee
core/src/main/java/lucee/runtime/converter/XMLConverter.java
XMLConverter._serializeArray
private String _serializeArray(Array array, Map<Object, String> done, String id) throws ConverterException { """ serialize a Array @param array Array to serialize @param done @return serialized array @throws ConverterException """ return _serializeList(array.toList(), done, id); }
java
private String _serializeArray(Array array, Map<Object, String> done, String id) throws ConverterException { return _serializeList(array.toList(), done, id); }
[ "private", "String", "_serializeArray", "(", "Array", "array", ",", "Map", "<", "Object", ",", "String", ">", "done", ",", "String", "id", ")", "throws", "ConverterException", "{", "return", "_serializeList", "(", "array", ".", "toList", "(", ")", ",", "done", ",", "id", ")", ";", "}" ]
serialize a Array @param array Array to serialize @param done @return serialized array @throws ConverterException
[ "serialize", "a", "Array" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/XMLConverter.java#L136-L138
trellis-ldp-archive/trellis-io-jena
src/main/java/org/trellisldp/io/impl/HtmlSerializer.java
HtmlSerializer.write
public void write(final OutputStream out, final Stream<? extends Triple> triples, final IRI subject) { """ Send the content to an output stream @param out the output stream @param triples the triples @param subject the subject """ final Writer writer = new OutputStreamWriter(out, UTF_8); try { template .execute(writer, new HtmlData(namespaceService, subject, triples.collect(toList()), properties)) .flush(); } catch (final IOException ex) { throw new UncheckedIOException(ex); } }
java
public void write(final OutputStream out, final Stream<? extends Triple> triples, final IRI subject) { final Writer writer = new OutputStreamWriter(out, UTF_8); try { template .execute(writer, new HtmlData(namespaceService, subject, triples.collect(toList()), properties)) .flush(); } catch (final IOException ex) { throw new UncheckedIOException(ex); } }
[ "public", "void", "write", "(", "final", "OutputStream", "out", ",", "final", "Stream", "<", "?", "extends", "Triple", ">", "triples", ",", "final", "IRI", "subject", ")", "{", "final", "Writer", "writer", "=", "new", "OutputStreamWriter", "(", "out", ",", "UTF_8", ")", ";", "try", "{", "template", ".", "execute", "(", "writer", ",", "new", "HtmlData", "(", "namespaceService", ",", "subject", ",", "triples", ".", "collect", "(", "toList", "(", ")", ")", ",", "properties", ")", ")", ".", "flush", "(", ")", ";", "}", "catch", "(", "final", "IOException", "ex", ")", "{", "throw", "new", "UncheckedIOException", "(", "ex", ")", ";", "}", "}" ]
Send the content to an output stream @param out the output stream @param triples the triples @param subject the subject
[ "Send", "the", "content", "to", "an", "output", "stream" ]
train
https://github.com/trellis-ldp-archive/trellis-io-jena/blob/3a06f8f8e7b6fc83fb659cb61217810f813967e8/src/main/java/org/trellisldp/io/impl/HtmlSerializer.java#L80-L89
danidemi/jlubricant
jlubricant-spring-batch/src/main/java/org/springframework/jdbc/core/namedparam/ExposedParsedSql.java
ExposedParsedSql.addNamedParameter
public void addNamedParameter(String parameterName, int startIndex, int endIndex) { """ Add a named parameter parsed from this SQL statement. @param parameterName the name of the parameter @param startIndex the start index in the original SQL String @param endIndex the end index in the original SQL String """ delegate.addNamedParameter(parameterName, startIndex, endIndex); }
java
public void addNamedParameter(String parameterName, int startIndex, int endIndex) { delegate.addNamedParameter(parameterName, startIndex, endIndex); }
[ "public", "void", "addNamedParameter", "(", "String", "parameterName", ",", "int", "startIndex", ",", "int", "endIndex", ")", "{", "delegate", ".", "addNamedParameter", "(", "parameterName", ",", "startIndex", ",", "endIndex", ")", ";", "}" ]
Add a named parameter parsed from this SQL statement. @param parameterName the name of the parameter @param startIndex the start index in the original SQL String @param endIndex the end index in the original SQL String
[ "Add", "a", "named", "parameter", "parsed", "from", "this", "SQL", "statement", "." ]
train
https://github.com/danidemi/jlubricant/blob/a9937c141c69ec34b768bd603b8093e496329b3a/jlubricant-spring-batch/src/main/java/org/springframework/jdbc/core/namedparam/ExposedParsedSql.java#L41-L43
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.listQueryResultsForResource
public PolicyStatesQueryResultsInner listQueryResultsForResource(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { """ Queries policy states for the resource. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param resourceId Resource ID. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PolicyStatesQueryResultsInner object if successful. """ return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions).toBlocking().single().body(); }
java
public PolicyStatesQueryResultsInner listQueryResultsForResource(PolicyStatesResource policyStatesResource, String resourceId, QueryOptions queryOptions) { return listQueryResultsForResourceWithServiceResponseAsync(policyStatesResource, resourceId, queryOptions).toBlocking().single().body(); }
[ "public", "PolicyStatesQueryResultsInner", "listQueryResultsForResource", "(", "PolicyStatesResource", "policyStatesResource", ",", "String", "resourceId", ",", "QueryOptions", "queryOptions", ")", "{", "return", "listQueryResultsForResourceWithServiceResponseAsync", "(", "policyStatesResource", ",", "resourceId", ",", "queryOptions", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Queries policy states for the resource. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param resourceId Resource ID. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PolicyStatesQueryResultsInner object if successful.
[ "Queries", "policy", "states", "for", "the", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L1375-L1377
vigna/Sux4J
src/it/unimi/dsi/sux4j/mph/solve/Modulo2SparseSystem.java
Modulo2Equation.scalarProduct
public static long scalarProduct(final Modulo2Equation e, long[] solution) { """ Returns the modulo-2 scalar product of the two provided bit vectors. @return the modulo-2 scalar product of {@code e} and {code f}. """ long sum = 0; for(final IntListIterator iterator = e.variables.iterator(); iterator.hasNext();) sum ^= solution[iterator.nextInt()]; return sum; }
java
public static long scalarProduct(final Modulo2Equation e, long[] solution) { long sum = 0; for(final IntListIterator iterator = e.variables.iterator(); iterator.hasNext();) sum ^= solution[iterator.nextInt()]; return sum; }
[ "public", "static", "long", "scalarProduct", "(", "final", "Modulo2Equation", "e", ",", "long", "[", "]", "solution", ")", "{", "long", "sum", "=", "0", ";", "for", "(", "final", "IntListIterator", "iterator", "=", "e", ".", "variables", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "sum", "^=", "solution", "[", "iterator", ".", "nextInt", "(", ")", "]", ";", "return", "sum", ";", "}" ]
Returns the modulo-2 scalar product of the two provided bit vectors. @return the modulo-2 scalar product of {@code e} and {code f}.
[ "Returns", "the", "modulo", "-", "2", "scalar", "product", "of", "the", "two", "provided", "bit", "vectors", "." ]
train
https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/solve/Modulo2SparseSystem.java#L137-L142
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.createSlug
public Slug createSlug(String appName, Map<String, String> processTypes) { """ Gets the slug info for an existing slug @param appName See {@link #listApps} for a list of apps that can be used. @param processTypes hash mapping process type names to their respective command """ return connection.execute(new SlugCreate(appName, processTypes), apiKey); }
java
public Slug createSlug(String appName, Map<String, String> processTypes) { return connection.execute(new SlugCreate(appName, processTypes), apiKey); }
[ "public", "Slug", "createSlug", "(", "String", "appName", ",", "Map", "<", "String", ",", "String", ">", "processTypes", ")", "{", "return", "connection", ".", "execute", "(", "new", "SlugCreate", "(", "appName", ",", "processTypes", ")", ",", "apiKey", ")", ";", "}" ]
Gets the slug info for an existing slug @param appName See {@link #listApps} for a list of apps that can be used. @param processTypes hash mapping process type names to their respective command
[ "Gets", "the", "slug", "info", "for", "an", "existing", "slug" ]
train
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L413-L415
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java
Director.installFeatureNoResolve
public void installFeatureNoResolve(String esaLocation, String toExtension, boolean acceptLicense) throws InstallException { """ Installs the feature found in the given esa location without resolving dependencies @param esaLocation location of esa @param toExtension location of a product extension @param acceptLicense if license is accepted @throws InstallException """ fireProgressEvent(InstallProgressEvent.CHECK, 1, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_CHECKING")); ArrayList<InstallAsset> singleFeatureInstall = new ArrayList<InstallAsset>(); InstallAsset esa = null; try { esa = new ESAAsset(new File(esaLocation), toExtension, false); } catch (ZipException e) { throw ExceptionUtils.create(Messages.PROVISIONER_MESSAGES.getLogMessage("tool.install.download.esa", esaLocation, e.getMessage()), InstallException.BAD_ARGUMENT); } catch (IOException e) { throw ExceptionUtils.create(Messages.PROVISIONER_MESSAGES.getLogMessage("tool.install.download.esa", esaLocation, e.getMessage()), InstallException.BAD_ARGUMENT); } singleFeatureInstall.add(esa); this.installAssets = new ArrayList<List<InstallAsset>>(1); this.installAssets.add(singleFeatureInstall); }
java
public void installFeatureNoResolve(String esaLocation, String toExtension, boolean acceptLicense) throws InstallException { fireProgressEvent(InstallProgressEvent.CHECK, 1, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_CHECKING")); ArrayList<InstallAsset> singleFeatureInstall = new ArrayList<InstallAsset>(); InstallAsset esa = null; try { esa = new ESAAsset(new File(esaLocation), toExtension, false); } catch (ZipException e) { throw ExceptionUtils.create(Messages.PROVISIONER_MESSAGES.getLogMessage("tool.install.download.esa", esaLocation, e.getMessage()), InstallException.BAD_ARGUMENT); } catch (IOException e) { throw ExceptionUtils.create(Messages.PROVISIONER_MESSAGES.getLogMessage("tool.install.download.esa", esaLocation, e.getMessage()), InstallException.BAD_ARGUMENT); } singleFeatureInstall.add(esa); this.installAssets = new ArrayList<List<InstallAsset>>(1); this.installAssets.add(singleFeatureInstall); }
[ "public", "void", "installFeatureNoResolve", "(", "String", "esaLocation", ",", "String", "toExtension", ",", "boolean", "acceptLicense", ")", "throws", "InstallException", "{", "fireProgressEvent", "(", "InstallProgressEvent", ".", "CHECK", ",", "1", ",", "Messages", ".", "INSTALL_KERNEL_MESSAGES", ".", "getLogMessage", "(", "\"STATE_CHECKING\"", ")", ")", ";", "ArrayList", "<", "InstallAsset", ">", "singleFeatureInstall", "=", "new", "ArrayList", "<", "InstallAsset", ">", "(", ")", ";", "InstallAsset", "esa", "=", "null", ";", "try", "{", "esa", "=", "new", "ESAAsset", "(", "new", "File", "(", "esaLocation", ")", ",", "toExtension", ",", "false", ")", ";", "}", "catch", "(", "ZipException", "e", ")", "{", "throw", "ExceptionUtils", ".", "create", "(", "Messages", ".", "PROVISIONER_MESSAGES", ".", "getLogMessage", "(", "\"tool.install.download.esa\"", ",", "esaLocation", ",", "e", ".", "getMessage", "(", ")", ")", ",", "InstallException", ".", "BAD_ARGUMENT", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "ExceptionUtils", ".", "create", "(", "Messages", ".", "PROVISIONER_MESSAGES", ".", "getLogMessage", "(", "\"tool.install.download.esa\"", ",", "esaLocation", ",", "e", ".", "getMessage", "(", ")", ")", ",", "InstallException", ".", "BAD_ARGUMENT", ")", ";", "}", "singleFeatureInstall", ".", "add", "(", "esa", ")", ";", "this", ".", "installAssets", "=", "new", "ArrayList", "<", "List", "<", "InstallAsset", ">", ">", "(", "1", ")", ";", "this", ".", "installAssets", ".", "add", "(", "singleFeatureInstall", ")", ";", "}" ]
Installs the feature found in the given esa location without resolving dependencies @param esaLocation location of esa @param toExtension location of a product extension @param acceptLicense if license is accepted @throws InstallException
[ "Installs", "the", "feature", "found", "in", "the", "given", "esa", "location", "without", "resolving", "dependencies" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L393-L409
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/support/ReflectionUtils.java
ReflectionUtils.invokeMethod
public static Object invokeMethod(Method method, Object target, Object... args) { """ Invoke the specified {@link Method} against the supplied target object with the supplied arguments. The target object can be {@code null} when invoking a static {@link Method}. <p> Thrown exceptions are handled via a call to {@link #handleReflectionException}. @param method the method to invoke @param target the target object to invoke the method on @param args the invocation arguments (may be {@code null}) @return the invocation result, if any """ try { return method.invoke(target, args); } catch (Exception ex) { handleReflectionException(ex); } throw new IllegalStateException("Should never get here"); }
java
public static Object invokeMethod(Method method, Object target, Object... args) { try { return method.invoke(target, args); } catch (Exception ex) { handleReflectionException(ex); } throw new IllegalStateException("Should never get here"); }
[ "public", "static", "Object", "invokeMethod", "(", "Method", "method", ",", "Object", "target", ",", "Object", "...", "args", ")", "{", "try", "{", "return", "method", ".", "invoke", "(", "target", ",", "args", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "handleReflectionException", "(", "ex", ")", ";", "}", "throw", "new", "IllegalStateException", "(", "\"Should never get here\"", ")", ";", "}" ]
Invoke the specified {@link Method} against the supplied target object with the supplied arguments. The target object can be {@code null} when invoking a static {@link Method}. <p> Thrown exceptions are handled via a call to {@link #handleReflectionException}. @param method the method to invoke @param target the target object to invoke the method on @param args the invocation arguments (may be {@code null}) @return the invocation result, if any
[ "Invoke", "the", "specified", "{", "@link", "Method", "}", "against", "the", "supplied", "target", "object", "with", "the", "supplied", "arguments", ".", "The", "target", "object", "can", "be", "{", "@code", "null", "}", "when", "invoking", "a", "static", "{", "@link", "Method", "}", ".", "<p", ">", "Thrown", "exceptions", "are", "handled", "via", "a", "call", "to", "{", "@link", "#handleReflectionException", "}", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ReflectionUtils.java#L122-L129
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwfieldtype.java
appfwfieldtype.get
public static appfwfieldtype get(nitro_service service, String name) throws Exception { """ Use this API to fetch appfwfieldtype resource of given name . """ appfwfieldtype obj = new appfwfieldtype(); obj.set_name(name); appfwfieldtype response = (appfwfieldtype) obj.get_resource(service); return response; }
java
public static appfwfieldtype get(nitro_service service, String name) throws Exception{ appfwfieldtype obj = new appfwfieldtype(); obj.set_name(name); appfwfieldtype response = (appfwfieldtype) obj.get_resource(service); return response; }
[ "public", "static", "appfwfieldtype", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "appfwfieldtype", "obj", "=", "new", "appfwfieldtype", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "appfwfieldtype", "response", "=", "(", "appfwfieldtype", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch appfwfieldtype resource of given name .
[ "Use", "this", "API", "to", "fetch", "appfwfieldtype", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwfieldtype.java#L308-L313
jenkinsci/jenkins
core/src/main/java/hudson/EnvVars.java
EnvVars.getRemote
public static EnvVars getRemote(VirtualChannel channel) throws IOException, InterruptedException { """ Obtains the environment variables of a remote peer. @param channel Can be null, in which case the map indicating "N/A" will be returned. @return A fresh copy that can be owned and modified by the caller. """ if(channel==null) return new EnvVars("N/A","N/A"); return channel.call(new GetEnvVars()); }
java
public static EnvVars getRemote(VirtualChannel channel) throws IOException, InterruptedException { if(channel==null) return new EnvVars("N/A","N/A"); return channel.call(new GetEnvVars()); }
[ "public", "static", "EnvVars", "getRemote", "(", "VirtualChannel", "channel", ")", "throws", "IOException", ",", "InterruptedException", "{", "if", "(", "channel", "==", "null", ")", "return", "new", "EnvVars", "(", "\"N/A\"", ",", "\"N/A\"", ")", ";", "return", "channel", ".", "call", "(", "new", "GetEnvVars", "(", ")", ")", ";", "}" ]
Obtains the environment variables of a remote peer. @param channel Can be null, in which case the map indicating "N/A" will be returned. @return A fresh copy that can be owned and modified by the caller.
[ "Obtains", "the", "environment", "variables", "of", "a", "remote", "peer", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/EnvVars.java#L424-L428
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.addShutdownHook
public static void addShutdownHook(Object self, Closure closure) { """ Allows the usage of addShutdownHook without getting the runtime first. @param self the object the method is called on (ignored) @param closure the shutdown hook action @since 1.5.0 """ Runtime.getRuntime().addShutdownHook(new Thread(closure)); }
java
public static void addShutdownHook(Object self, Closure closure) { Runtime.getRuntime().addShutdownHook(new Thread(closure)); }
[ "public", "static", "void", "addShutdownHook", "(", "Object", "self", ",", "Closure", "closure", ")", "{", "Runtime", ".", "getRuntime", "(", ")", ".", "addShutdownHook", "(", "new", "Thread", "(", "closure", ")", ")", ";", "}" ]
Allows the usage of addShutdownHook without getting the runtime first. @param self the object the method is called on (ignored) @param closure the shutdown hook action @since 1.5.0
[ "Allows", "the", "usage", "of", "addShutdownHook", "without", "getting", "the", "runtime", "first", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L659-L661
atomix/atomix
cluster/src/main/java/io/atomix/cluster/AtomixClusterBuilder.java
AtomixClusterBuilder.withProperty
public AtomixClusterBuilder withProperty(String key, String value) { """ Sets a property of the member. <p> The properties are arbitrary settings that will be replicated along with this node's member information. Properties can be used to enable other nodes to determine metadata about this node. @param key the property key to set @param value the property value to set @return the cluster builder @throws NullPointerException if the property is null """ config.getNodeConfig().setProperty(key, value); return this; }
java
public AtomixClusterBuilder withProperty(String key, String value) { config.getNodeConfig().setProperty(key, value); return this; }
[ "public", "AtomixClusterBuilder", "withProperty", "(", "String", "key", ",", "String", "value", ")", "{", "config", ".", "getNodeConfig", "(", ")", ".", "setProperty", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets a property of the member. <p> The properties are arbitrary settings that will be replicated along with this node's member information. Properties can be used to enable other nodes to determine metadata about this node. @param key the property key to set @param value the property value to set @return the cluster builder @throws NullPointerException if the property is null
[ "Sets", "a", "property", "of", "the", "member", ".", "<p", ">", "The", "properties", "are", "arbitrary", "settings", "that", "will", "be", "replicated", "along", "with", "this", "node", "s", "member", "information", ".", "Properties", "can", "be", "used", "to", "enable", "other", "nodes", "to", "determine", "metadata", "about", "this", "node", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/cluster/src/main/java/io/atomix/cluster/AtomixClusterBuilder.java#L295-L298
apereo/cas
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java
SamlProfileSamlNameIdBuilder.buildNameId
private NameID buildNameId(final RequestAbstractType authnRequest, final Object assertion, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final MessageContext messageContext) throws SamlException { """ Build name id. If there are no explicitly defined NameIDFormats, include the default format. see: http://saml2int.org/profile/current/#section92 @param authnRequest the authn request @param assertion the assertion @param service the service @param adaptor the adaptor @return the name id @throws SamlException the saml exception """ val supportedNameFormats = getSupportedNameIdFormats(service, adaptor); val requiredNameFormat = getRequiredNameIdFormatIfAny(authnRequest); validateRequiredNameIdFormatIfAny(authnRequest, adaptor, supportedNameFormats, requiredNameFormat); val nameid = determineNameId(authnRequest, assertion, supportedNameFormats, service, adaptor); return finalizeNameId(nameid, authnRequest, assertion, supportedNameFormats, service, adaptor); }
java
private NameID buildNameId(final RequestAbstractType authnRequest, final Object assertion, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final MessageContext messageContext) throws SamlException { val supportedNameFormats = getSupportedNameIdFormats(service, adaptor); val requiredNameFormat = getRequiredNameIdFormatIfAny(authnRequest); validateRequiredNameIdFormatIfAny(authnRequest, adaptor, supportedNameFormats, requiredNameFormat); val nameid = determineNameId(authnRequest, assertion, supportedNameFormats, service, adaptor); return finalizeNameId(nameid, authnRequest, assertion, supportedNameFormats, service, adaptor); }
[ "private", "NameID", "buildNameId", "(", "final", "RequestAbstractType", "authnRequest", ",", "final", "Object", "assertion", ",", "final", "SamlRegisteredService", "service", ",", "final", "SamlRegisteredServiceServiceProviderMetadataFacade", "adaptor", ",", "final", "MessageContext", "messageContext", ")", "throws", "SamlException", "{", "val", "supportedNameFormats", "=", "getSupportedNameIdFormats", "(", "service", ",", "adaptor", ")", ";", "val", "requiredNameFormat", "=", "getRequiredNameIdFormatIfAny", "(", "authnRequest", ")", ";", "validateRequiredNameIdFormatIfAny", "(", "authnRequest", ",", "adaptor", ",", "supportedNameFormats", ",", "requiredNameFormat", ")", ";", "val", "nameid", "=", "determineNameId", "(", "authnRequest", ",", "assertion", ",", "supportedNameFormats", ",", "service", ",", "adaptor", ")", ";", "return", "finalizeNameId", "(", "nameid", ",", "authnRequest", ",", "assertion", ",", "supportedNameFormats", ",", "service", ",", "adaptor", ")", ";", "}" ]
Build name id. If there are no explicitly defined NameIDFormats, include the default format. see: http://saml2int.org/profile/current/#section92 @param authnRequest the authn request @param assertion the assertion @param service the service @param adaptor the adaptor @return the name id @throws SamlException the saml exception
[ "Build", "name", "id", ".", "If", "there", "are", "no", "explicitly", "defined", "NameIDFormats", "include", "the", "default", "format", ".", "see", ":", "http", ":", "//", "saml2int", ".", "org", "/", "profile", "/", "current", "/", "#section92" ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java#L135-L145
denisneuling/cctrl.jar
cctrl-maven-plugin/src/main/java/com/cloudcontrolled/cctrl/maven/plugin/CloudControlSupport.java
CloudControlSupport.createUpdateDeploymentRequest
public static UpdateDeploymentRequest createUpdateDeploymentRequest(String applicationName, String deploymentName, String commitId) { """ <p> createUpdateDeploymentRequest. </p> @param applicationName a {@link java.lang.String} object. @param deploymentName a {@link java.lang.String} object. @param commitId a {@link java.lang.String} object. @return a {@link com.cloudcontrolled.api.request.UpdateDeploymentRequest} object. """ UpdateDeploymentRequest updateDeploymentRequest = new UpdateDeploymentRequest(); updateDeploymentRequest.setApplicationName(applicationName); updateDeploymentRequest.setDeploymentName(deploymentName); updateDeploymentRequest.setVersion(commitId); return updateDeploymentRequest; }
java
public static UpdateDeploymentRequest createUpdateDeploymentRequest(String applicationName, String deploymentName, String commitId) { UpdateDeploymentRequest updateDeploymentRequest = new UpdateDeploymentRequest(); updateDeploymentRequest.setApplicationName(applicationName); updateDeploymentRequest.setDeploymentName(deploymentName); updateDeploymentRequest.setVersion(commitId); return updateDeploymentRequest; }
[ "public", "static", "UpdateDeploymentRequest", "createUpdateDeploymentRequest", "(", "String", "applicationName", ",", "String", "deploymentName", ",", "String", "commitId", ")", "{", "UpdateDeploymentRequest", "updateDeploymentRequest", "=", "new", "UpdateDeploymentRequest", "(", ")", ";", "updateDeploymentRequest", ".", "setApplicationName", "(", "applicationName", ")", ";", "updateDeploymentRequest", ".", "setDeploymentName", "(", "deploymentName", ")", ";", "updateDeploymentRequest", ".", "setVersion", "(", "commitId", ")", ";", "return", "updateDeploymentRequest", ";", "}" ]
<p> createUpdateDeploymentRequest. </p> @param applicationName a {@link java.lang.String} object. @param deploymentName a {@link java.lang.String} object. @param commitId a {@link java.lang.String} object. @return a {@link com.cloudcontrolled.api.request.UpdateDeploymentRequest} object.
[ "<p", ">", "createUpdateDeploymentRequest", ".", "<", "/", "p", ">" ]
train
https://github.com/denisneuling/cctrl.jar/blob/37450d824f4dc5ecbcc81c61e48f1ec876ca2de8/cctrl-maven-plugin/src/main/java/com/cloudcontrolled/cctrl/maven/plugin/CloudControlSupport.java#L96-L103
alkacon/opencms-core
src/org/opencms/util/CmsFileUtil.java
CmsFileUtil.readFile
@SuppressWarnings("resource") public static byte[] readFile(File file) throws IOException { """ Reads a file from the RFS and returns the file content.<p> @param file the file to read @return the read file content @throws IOException in case of file access errors """ // create input and output stream FileInputStream in = new FileInputStream(file); // read the content return readFully(in, (int)file.length()); }
java
@SuppressWarnings("resource") public static byte[] readFile(File file) throws IOException { // create input and output stream FileInputStream in = new FileInputStream(file); // read the content return readFully(in, (int)file.length()); }
[ "@", "SuppressWarnings", "(", "\"resource\"", ")", "public", "static", "byte", "[", "]", "readFile", "(", "File", "file", ")", "throws", "IOException", "{", "// create input and output stream", "FileInputStream", "in", "=", "new", "FileInputStream", "(", "file", ")", ";", "// read the content", "return", "readFully", "(", "in", ",", "(", "int", ")", "file", ".", "length", "(", ")", ")", ";", "}" ]
Reads a file from the RFS and returns the file content.<p> @param file the file to read @return the read file content @throws IOException in case of file access errors
[ "Reads", "a", "file", "from", "the", "RFS", "and", "returns", "the", "file", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L590-L598
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java
AbstractMojoInterceptor.setField
protected static void setField(String fieldName, Object mojo, Object value) throws Exception { """ Sets the given field to the given value. This is an alternative to invoking a set method. @param fieldName Name of the field to set @param mojo Mojo @param value New value for the field @throws Exception If setting the field using reflection goes wrong """ Field field = null; try { field = mojo.getClass().getDeclaredField(fieldName); } catch (NoSuchFieldException ex) { // Ignore exception and try superclass. field = mojo.getClass().getSuperclass().getDeclaredField(fieldName); } field.setAccessible(true); field.set(mojo, value); }
java
protected static void setField(String fieldName, Object mojo, Object value) throws Exception { Field field = null; try { field = mojo.getClass().getDeclaredField(fieldName); } catch (NoSuchFieldException ex) { // Ignore exception and try superclass. field = mojo.getClass().getSuperclass().getDeclaredField(fieldName); } field.setAccessible(true); field.set(mojo, value); }
[ "protected", "static", "void", "setField", "(", "String", "fieldName", ",", "Object", "mojo", ",", "Object", "value", ")", "throws", "Exception", "{", "Field", "field", "=", "null", ";", "try", "{", "field", "=", "mojo", ".", "getClass", "(", ")", ".", "getDeclaredField", "(", "fieldName", ")", ";", "}", "catch", "(", "NoSuchFieldException", "ex", ")", "{", "// Ignore exception and try superclass.", "field", "=", "mojo", ".", "getClass", "(", ")", ".", "getSuperclass", "(", ")", ".", "getDeclaredField", "(", "fieldName", ")", ";", "}", "field", ".", "setAccessible", "(", "true", ")", ";", "field", ".", "set", "(", "mojo", ",", "value", ")", ";", "}" ]
Sets the given field to the given value. This is an alternative to invoking a set method. @param fieldName Name of the field to set @param mojo Mojo @param value New value for the field @throws Exception If setting the field using reflection goes wrong
[ "Sets", "the", "given", "field", "to", "the", "given", "value", ".", "This", "is", "an", "alternative", "to", "invoking", "a", "set", "method", "." ]
train
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/maven/AbstractMojoInterceptor.java#L144-L154
ios-driver/ios-driver
server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java
SimulatorSettings.setKeyboardOptions
public void setKeyboardOptions() { """ the default keyboard options aren't good for automation. For instance it automatically capitalize the first letter of sentences etc. Getting rid of all that to have the keyboard execute requests without changing them. """ File folder = new File(contentAndSettingsFolder + "/Library/Preferences/"); File preferenceFile = new File(folder, "com.apple.Preferences.plist"); try { JSONObject preferences = new JSONObject(); preferences.put("KeyboardAutocapitalization", false); preferences.put("KeyboardAutocorrection", false); preferences.put("KeyboardCapsLock", false); preferences.put("KeyboardCheckSpelling", false); writeOnDisk(preferences, preferenceFile); } catch (Exception e) { throw new WebDriverException("cannot set options in " + preferenceFile.getAbsolutePath(), e); } }
java
public void setKeyboardOptions() { File folder = new File(contentAndSettingsFolder + "/Library/Preferences/"); File preferenceFile = new File(folder, "com.apple.Preferences.plist"); try { JSONObject preferences = new JSONObject(); preferences.put("KeyboardAutocapitalization", false); preferences.put("KeyboardAutocorrection", false); preferences.put("KeyboardCapsLock", false); preferences.put("KeyboardCheckSpelling", false); writeOnDisk(preferences, preferenceFile); } catch (Exception e) { throw new WebDriverException("cannot set options in " + preferenceFile.getAbsolutePath(), e); } }
[ "public", "void", "setKeyboardOptions", "(", ")", "{", "File", "folder", "=", "new", "File", "(", "contentAndSettingsFolder", "+", "\"/Library/Preferences/\"", ")", ";", "File", "preferenceFile", "=", "new", "File", "(", "folder", ",", "\"com.apple.Preferences.plist\"", ")", ";", "try", "{", "JSONObject", "preferences", "=", "new", "JSONObject", "(", ")", ";", "preferences", ".", "put", "(", "\"KeyboardAutocapitalization\"", ",", "false", ")", ";", "preferences", ".", "put", "(", "\"KeyboardAutocorrection\"", ",", "false", ")", ";", "preferences", ".", "put", "(", "\"KeyboardCapsLock\"", ",", "false", ")", ";", "preferences", ".", "put", "(", "\"KeyboardCheckSpelling\"", ",", "false", ")", ";", "writeOnDisk", "(", "preferences", ",", "preferenceFile", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "WebDriverException", "(", "\"cannot set options in \"", "+", "preferenceFile", ".", "getAbsolutePath", "(", ")", ",", "e", ")", ";", "}", "}" ]
the default keyboard options aren't good for automation. For instance it automatically capitalize the first letter of sentences etc. Getting rid of all that to have the keyboard execute requests without changing them.
[ "the", "default", "keyboard", "options", "aren", "t", "good", "for", "automation", ".", "For", "instance", "it", "automatically", "capitalize", "the", "first", "letter", "of", "sentences", "etc", ".", "Getting", "rid", "of", "all", "that", "to", "have", "the", "keyboard", "execute", "requests", "without", "changing", "them", "." ]
train
https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java#L97-L111
google/flatbuffers
java/com/google/flatbuffers/Table.java
Table.__has_identifier
protected static boolean __has_identifier(ByteBuffer bb, String ident) { """ Check if a {@link ByteBuffer} contains a file identifier. @param bb A {@code ByteBuffer} to check if it contains the identifier `ident`. @param ident A `String` identifier of the FlatBuffer file. @return True if the buffer contains the file identifier """ if (ident.length() != FILE_IDENTIFIER_LENGTH) throw new AssertionError("FlatBuffers: file identifier must be length " + FILE_IDENTIFIER_LENGTH); for (int i = 0; i < FILE_IDENTIFIER_LENGTH; i++) { if (ident.charAt(i) != (char)bb.get(bb.position() + SIZEOF_INT + i)) return false; } return true; }
java
protected static boolean __has_identifier(ByteBuffer bb, String ident) { if (ident.length() != FILE_IDENTIFIER_LENGTH) throw new AssertionError("FlatBuffers: file identifier must be length " + FILE_IDENTIFIER_LENGTH); for (int i = 0; i < FILE_IDENTIFIER_LENGTH; i++) { if (ident.charAt(i) != (char)bb.get(bb.position() + SIZEOF_INT + i)) return false; } return true; }
[ "protected", "static", "boolean", "__has_identifier", "(", "ByteBuffer", "bb", ",", "String", "ident", ")", "{", "if", "(", "ident", ".", "length", "(", ")", "!=", "FILE_IDENTIFIER_LENGTH", ")", "throw", "new", "AssertionError", "(", "\"FlatBuffers: file identifier must be length \"", "+", "FILE_IDENTIFIER_LENGTH", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "FILE_IDENTIFIER_LENGTH", ";", "i", "++", ")", "{", "if", "(", "ident", ".", "charAt", "(", "i", ")", "!=", "(", "char", ")", "bb", ".", "get", "(", "bb", ".", "position", "(", ")", "+", "SIZEOF_INT", "+", "i", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}" ]
Check if a {@link ByteBuffer} contains a file identifier. @param bb A {@code ByteBuffer} to check if it contains the identifier `ident`. @param ident A `String` identifier of the FlatBuffer file. @return True if the buffer contains the file identifier
[ "Check", "if", "a", "{", "@link", "ByteBuffer", "}", "contains", "a", "file", "identifier", "." ]
train
https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L188-L196
Azure/azure-sdk-for-java
redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/LinkedServersInner.java
LinkedServersInner.beginCreate
public RedisLinkedServerWithPropertiesInner beginCreate(String resourceGroupName, String name, String linkedServerName, RedisLinkedServerCreateParameters parameters) { """ Adds a linked server to the Redis cache (requires Premium SKU). @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param linkedServerName The name of the linked server that is being added to the Redis cache. @param parameters Parameters supplied to the Create Linked server operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RedisLinkedServerWithPropertiesInner object if successful. """ return beginCreateWithServiceResponseAsync(resourceGroupName, name, linkedServerName, parameters).toBlocking().single().body(); }
java
public RedisLinkedServerWithPropertiesInner beginCreate(String resourceGroupName, String name, String linkedServerName, RedisLinkedServerCreateParameters parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, name, linkedServerName, parameters).toBlocking().single().body(); }
[ "public", "RedisLinkedServerWithPropertiesInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "linkedServerName", ",", "RedisLinkedServerCreateParameters", "parameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "linkedServerName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Adds a linked server to the Redis cache (requires Premium SKU). @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param linkedServerName The name of the linked server that is being added to the Redis cache. @param parameters Parameters supplied to the Create Linked server operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RedisLinkedServerWithPropertiesInner object if successful.
[ "Adds", "a", "linked", "server", "to", "the", "Redis", "cache", "(", "requires", "Premium", "SKU", ")", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/LinkedServersInner.java#L187-L189
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java
MatrixFeatures_ZDRM.isUpperTriangle
public static boolean isUpperTriangle(ZMatrixRMaj A , int hessenberg , double tol ) { """ <p> Checks to see if a matrix is upper triangular or Hessenberg. A Hessenberg matrix of degree N has the following property:<br> <br> a<sub>ij</sub> &le; 0 for all i &lt; j+N<br> <br> A triangular matrix is a Hessenberg matrix of degree 0. </p> @param A Matrix being tested. Not modified. @param hessenberg The degree of being hessenberg. @param tol How close to zero the lower left elements need to be. @return If it is an upper triangular/hessenberg matrix or not. """ tol *= tol; for( int i = hessenberg+1; i < A.numRows; i++ ) { int maxCol = Math.min(i-hessenberg, A.numCols); for( int j = 0; j < maxCol; j++ ) { int index = (i*A.numCols+j)*2; double real = A.data[index]; double imag = A.data[index+1]; double mag = real*real + imag*imag; if( !(mag <= tol) ) { return false; } } } return true; }
java
public static boolean isUpperTriangle(ZMatrixRMaj A , int hessenberg , double tol ) { tol *= tol; for( int i = hessenberg+1; i < A.numRows; i++ ) { int maxCol = Math.min(i-hessenberg, A.numCols); for( int j = 0; j < maxCol; j++ ) { int index = (i*A.numCols+j)*2; double real = A.data[index]; double imag = A.data[index+1]; double mag = real*real + imag*imag; if( !(mag <= tol) ) { return false; } } } return true; }
[ "public", "static", "boolean", "isUpperTriangle", "(", "ZMatrixRMaj", "A", ",", "int", "hessenberg", ",", "double", "tol", ")", "{", "tol", "*=", "tol", ";", "for", "(", "int", "i", "=", "hessenberg", "+", "1", ";", "i", "<", "A", ".", "numRows", ";", "i", "++", ")", "{", "int", "maxCol", "=", "Math", ".", "min", "(", "i", "-", "hessenberg", ",", "A", ".", "numCols", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "maxCol", ";", "j", "++", ")", "{", "int", "index", "=", "(", "i", "*", "A", ".", "numCols", "+", "j", ")", "*", "2", ";", "double", "real", "=", "A", ".", "data", "[", "index", "]", ";", "double", "imag", "=", "A", ".", "data", "[", "index", "+", "1", "]", ";", "double", "mag", "=", "real", "*", "real", "+", "imag", "*", "imag", ";", "if", "(", "!", "(", "mag", "<=", "tol", ")", ")", "{", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}" ]
<p> Checks to see if a matrix is upper triangular or Hessenberg. A Hessenberg matrix of degree N has the following property:<br> <br> a<sub>ij</sub> &le; 0 for all i &lt; j+N<br> <br> A triangular matrix is a Hessenberg matrix of degree 0. </p> @param A Matrix being tested. Not modified. @param hessenberg The degree of being hessenberg. @param tol How close to zero the lower left elements need to be. @return If it is an upper triangular/hessenberg matrix or not.
[ "<p", ">", "Checks", "to", "see", "if", "a", "matrix", "is", "upper", "triangular", "or", "Hessenberg", ".", "A", "Hessenberg", "matrix", "of", "degree", "N", "has", "the", "following", "property", ":", "<br", ">", "<br", ">", "a<sub", ">", "ij<", "/", "sub", ">", "&le", ";", "0", "for", "all", "i", "&lt", ";", "j", "+", "N<br", ">", "<br", ">", "A", "triangular", "matrix", "is", "a", "Hessenberg", "matrix", "of", "degree", "0", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java#L366-L383
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java
SameDiff.execBackwards
public void execBackwards(Map<String,INDArray> placeholders) { """ Create (if required) and then calculate the variable gradients (backward pass) for this graph.<br> After execution, the gradient arrays can be accessed using {@code myVariable.getGradient().getArr()}<br> <b>Note</b>: This method by default calculates VARIABLE type SDVariable gradients only (as well as any other gradients needed to calculate the variable gradients). That is, placeholder, constant, etc gradients are not calculated. If these gradients are required, they can be calculated using {@link #execBackwards(Map, List)} instead, which allows specifying the set of SDVariables to calculate the gradients for. For example, {@code execBackwards(placeholders, Arrays.asList(myPlaceholder.gradient().getVarName())}. In some cases, {@link #createGradFunction()} may need to be called first @param placeholders Values for the placeholder variables in the graph. For graphs without placeholders, use null or an empty map """ if (getFunction("grad") == null) { createGradFunction(); } //Collect (unique) list of gradient names... Set<String> varGradNames = new HashSet<>(); for(Variable v : variables.values()){ if(v.getVariable().getVariableType() == VariableType.VARIABLE){ SDVariable g = v.getVariable().gradient(); if(g != null) { //Not all variables can have gradients... for example: suppose graph has 2 independent loss functions, // optimizing only 1 might not require changing all variables varGradNames.add(g.getVarName()); } } } //Edge case: if no variables, no variable gradients to calculate... if(varGradNames.isEmpty()){ log.warn("Skipping gradient execution (backward pass) - no variables to be calculated (graph does not contain any VARIABLE type SDVariables).\n" + "If gradients for other variables (such as placeholders) are required, use execBackwards(Map, List) instead"); return; } List<String> vargradNamesList = new ArrayList<>(varGradNames); execBackwards(placeholders, vargradNamesList); }
java
public void execBackwards(Map<String,INDArray> placeholders){ if (getFunction("grad") == null) { createGradFunction(); } //Collect (unique) list of gradient names... Set<String> varGradNames = new HashSet<>(); for(Variable v : variables.values()){ if(v.getVariable().getVariableType() == VariableType.VARIABLE){ SDVariable g = v.getVariable().gradient(); if(g != null) { //Not all variables can have gradients... for example: suppose graph has 2 independent loss functions, // optimizing only 1 might not require changing all variables varGradNames.add(g.getVarName()); } } } //Edge case: if no variables, no variable gradients to calculate... if(varGradNames.isEmpty()){ log.warn("Skipping gradient execution (backward pass) - no variables to be calculated (graph does not contain any VARIABLE type SDVariables).\n" + "If gradients for other variables (such as placeholders) are required, use execBackwards(Map, List) instead"); return; } List<String> vargradNamesList = new ArrayList<>(varGradNames); execBackwards(placeholders, vargradNamesList); }
[ "public", "void", "execBackwards", "(", "Map", "<", "String", ",", "INDArray", ">", "placeholders", ")", "{", "if", "(", "getFunction", "(", "\"grad\"", ")", "==", "null", ")", "{", "createGradFunction", "(", ")", ";", "}", "//Collect (unique) list of gradient names...", "Set", "<", "String", ">", "varGradNames", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "Variable", "v", ":", "variables", ".", "values", "(", ")", ")", "{", "if", "(", "v", ".", "getVariable", "(", ")", ".", "getVariableType", "(", ")", "==", "VariableType", ".", "VARIABLE", ")", "{", "SDVariable", "g", "=", "v", ".", "getVariable", "(", ")", ".", "gradient", "(", ")", ";", "if", "(", "g", "!=", "null", ")", "{", "//Not all variables can have gradients... for example: suppose graph has 2 independent loss functions,", "// optimizing only 1 might not require changing all variables", "varGradNames", ".", "add", "(", "g", ".", "getVarName", "(", ")", ")", ";", "}", "}", "}", "//Edge case: if no variables, no variable gradients to calculate...", "if", "(", "varGradNames", ".", "isEmpty", "(", ")", ")", "{", "log", ".", "warn", "(", "\"Skipping gradient execution (backward pass) - no variables to be calculated (graph does not contain any VARIABLE type SDVariables).\\n\"", "+", "\"If gradients for other variables (such as placeholders) are required, use execBackwards(Map, List) instead\"", ")", ";", "return", ";", "}", "List", "<", "String", ">", "vargradNamesList", "=", "new", "ArrayList", "<>", "(", "varGradNames", ")", ";", "execBackwards", "(", "placeholders", ",", "vargradNamesList", ")", ";", "}" ]
Create (if required) and then calculate the variable gradients (backward pass) for this graph.<br> After execution, the gradient arrays can be accessed using {@code myVariable.getGradient().getArr()}<br> <b>Note</b>: This method by default calculates VARIABLE type SDVariable gradients only (as well as any other gradients needed to calculate the variable gradients). That is, placeholder, constant, etc gradients are not calculated. If these gradients are required, they can be calculated using {@link #execBackwards(Map, List)} instead, which allows specifying the set of SDVariables to calculate the gradients for. For example, {@code execBackwards(placeholders, Arrays.asList(myPlaceholder.gradient().getVarName())}. In some cases, {@link #createGradFunction()} may need to be called first @param placeholders Values for the placeholder variables in the graph. For graphs without placeholders, use null or an empty map
[ "Create", "(", "if", "required", ")", "and", "then", "calculate", "the", "variable", "gradients", "(", "backward", "pass", ")", "for", "this", "graph", ".", "<br", ">", "After", "execution", "the", "gradient", "arrays", "can", "be", "accessed", "using", "{", "@code", "myVariable", ".", "getGradient", "()", ".", "getArr", "()", "}", "<br", ">", "<b", ">", "Note<", "/", "b", ">", ":", "This", "method", "by", "default", "calculates", "VARIABLE", "type", "SDVariable", "gradients", "only", "(", "as", "well", "as", "any", "other", "gradients", "needed", "to", "calculate", "the", "variable", "gradients", ")", ".", "That", "is", "placeholder", "constant", "etc", "gradients", "are", "not", "calculated", ".", "If", "these", "gradients", "are", "required", "they", "can", "be", "calculated", "using", "{", "@link", "#execBackwards", "(", "Map", "List", ")", "}", "instead", "which", "allows", "specifying", "the", "set", "of", "SDVariables", "to", "calculate", "the", "gradients", "for", ".", "For", "example", "{", "@code", "execBackwards", "(", "placeholders", "Arrays", ".", "asList", "(", "myPlaceholder", ".", "gradient", "()", ".", "getVarName", "()", ")", "}", ".", "In", "some", "cases", "{", "@link", "#createGradFunction", "()", "}", "may", "need", "to", "be", "called", "first" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L3208-L3235
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/scatterplot/AbstractScatterplotVisualization.java
AbstractScatterplotVisualization.setupCanvas
public static Element setupCanvas(SVGPlot svgp, Projection2D proj, double margin, double width, double height) { """ Utility function to setup a canvas element for the visualization. @param svgp Plot element @param proj Projection to use @param margin Margin to use @param width Width @param height Height @return wrapper element with appropriate view box. """ final CanvasSize canvas = proj.estimateViewport(); final double sizex = canvas.getDiffX(); final double sizey = canvas.getDiffY(); String transform = SVGUtil.makeMarginTransform(width, height, sizex, sizey, margin) + " translate(" + SVGUtil.fmt(sizex * .5) + " " + SVGUtil.fmt(sizey * .5) + ")"; final Element layer = SVGUtil.svgElement(svgp.getDocument(), SVGConstants.SVG_G_TAG); SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform); return layer; }
java
public static Element setupCanvas(SVGPlot svgp, Projection2D proj, double margin, double width, double height) { final CanvasSize canvas = proj.estimateViewport(); final double sizex = canvas.getDiffX(); final double sizey = canvas.getDiffY(); String transform = SVGUtil.makeMarginTransform(width, height, sizex, sizey, margin) + " translate(" + SVGUtil.fmt(sizex * .5) + " " + SVGUtil.fmt(sizey * .5) + ")"; final Element layer = SVGUtil.svgElement(svgp.getDocument(), SVGConstants.SVG_G_TAG); SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform); return layer; }
[ "public", "static", "Element", "setupCanvas", "(", "SVGPlot", "svgp", ",", "Projection2D", "proj", ",", "double", "margin", ",", "double", "width", ",", "double", "height", ")", "{", "final", "CanvasSize", "canvas", "=", "proj", ".", "estimateViewport", "(", ")", ";", "final", "double", "sizex", "=", "canvas", ".", "getDiffX", "(", ")", ";", "final", "double", "sizey", "=", "canvas", ".", "getDiffY", "(", ")", ";", "String", "transform", "=", "SVGUtil", ".", "makeMarginTransform", "(", "width", ",", "height", ",", "sizex", ",", "sizey", ",", "margin", ")", "+", "\" translate(\"", "+", "SVGUtil", ".", "fmt", "(", "sizex", "*", ".5", ")", "+", "\" \"", "+", "SVGUtil", ".", "fmt", "(", "sizey", "*", ".5", ")", "+", "\")\"", ";", "final", "Element", "layer", "=", "SVGUtil", ".", "svgElement", "(", "svgp", ".", "getDocument", "(", ")", ",", "SVGConstants", ".", "SVG_G_TAG", ")", ";", "SVGUtil", ".", "setAtt", "(", "layer", ",", "SVGConstants", ".", "SVG_TRANSFORM_ATTRIBUTE", ",", "transform", ")", ";", "return", "layer", ";", "}" ]
Utility function to setup a canvas element for the visualization. @param svgp Plot element @param proj Projection to use @param margin Margin to use @param width Width @param height Height @return wrapper element with appropriate view box.
[ "Utility", "function", "to", "setup", "a", "canvas", "element", "for", "the", "visualization", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/scatterplot/AbstractScatterplotVisualization.java#L105-L114
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/common/Base64.java
Base64.encodeToByte
public final byte[] encodeToByte(byte[] sArr, boolean lineSep) { """ Encodes a raw byte array into a BASE64 <code>byte[]</code> representation i accordance with RFC 2045. @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned. @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br> No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a little faster. @return A BASE64 encoded array. Never <code>null</code>. """ // Check special case int sLen = sArr != null ? sArr.length : 0; if (sLen == 0) { return new byte[0]; } int eLen = (sLen / 3) * 3; // Length of even 24-bits. int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array byte[] dArr = new byte[dLen]; // Encode even 24-bits for (int s = 0, d = 0, cc = 0; s < eLen;) { // Copy next three bytes into lower 24 bits of int, paying attension to sign. int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff); // Encode the int into four chars dArr[d++] = (byte) CA[(i >>> 18) & 0x3f]; dArr[d++] = (byte) CA[(i >>> 12) & 0x3f]; dArr[d++] = (byte) CA[(i >>> 6) & 0x3f]; dArr[d++] = (byte) CA[i & 0x3f]; // Add optional line separator if (lineSep && ++cc == 19 && d < dLen - 2) { dArr[d++] = '\r'; dArr[d++] = '\n'; cc = 0; } } // Pad and encode last bits if source isn't an even 24 bits. int left = sLen - eLen; // 0 - 2. if (left > 0) { // Prepare the int int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0); // Set last four chars dArr[dLen - 4] = (byte) CA[i >> 12]; dArr[dLen - 3] = (byte) CA[(i >>> 6) & 0x3f]; dArr[dLen - 2] = left == 2 ? (byte) CA[i & 0x3f] : (byte) fillChar; dArr[dLen - 1] = (byte) fillChar; } return dArr; }
java
public final byte[] encodeToByte(byte[] sArr, boolean lineSep) { // Check special case int sLen = sArr != null ? sArr.length : 0; if (sLen == 0) { return new byte[0]; } int eLen = (sLen / 3) * 3; // Length of even 24-bits. int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array byte[] dArr = new byte[dLen]; // Encode even 24-bits for (int s = 0, d = 0, cc = 0; s < eLen;) { // Copy next three bytes into lower 24 bits of int, paying attension to sign. int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8 | (sArr[s++] & 0xff); // Encode the int into four chars dArr[d++] = (byte) CA[(i >>> 18) & 0x3f]; dArr[d++] = (byte) CA[(i >>> 12) & 0x3f]; dArr[d++] = (byte) CA[(i >>> 6) & 0x3f]; dArr[d++] = (byte) CA[i & 0x3f]; // Add optional line separator if (lineSep && ++cc == 19 && d < dLen - 2) { dArr[d++] = '\r'; dArr[d++] = '\n'; cc = 0; } } // Pad and encode last bits if source isn't an even 24 bits. int left = sLen - eLen; // 0 - 2. if (left > 0) { // Prepare the int int i = ((sArr[eLen] & 0xff) << 10) | (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0); // Set last four chars dArr[dLen - 4] = (byte) CA[i >> 12]; dArr[dLen - 3] = (byte) CA[(i >>> 6) & 0x3f]; dArr[dLen - 2] = left == 2 ? (byte) CA[i & 0x3f] : (byte) fillChar; dArr[dLen - 1] = (byte) fillChar; } return dArr; }
[ "public", "final", "byte", "[", "]", "encodeToByte", "(", "byte", "[", "]", "sArr", ",", "boolean", "lineSep", ")", "{", "// Check special case", "int", "sLen", "=", "sArr", "!=", "null", "?", "sArr", ".", "length", ":", "0", ";", "if", "(", "sLen", "==", "0", ")", "{", "return", "new", "byte", "[", "0", "]", ";", "}", "int", "eLen", "=", "(", "sLen", "/", "3", ")", "*", "3", ";", "// Length of even 24-bits.", "int", "cCnt", "=", "(", "(", "sLen", "-", "1", ")", "/", "3", "+", "1", ")", "<<", "2", ";", "// Returned character count", "int", "dLen", "=", "cCnt", "+", "(", "lineSep", "?", "(", "cCnt", "-", "1", ")", "/", "76", "<<", "1", ":", "0", ")", ";", "// Length of returned array", "byte", "[", "]", "dArr", "=", "new", "byte", "[", "dLen", "]", ";", "// Encode even 24-bits", "for", "(", "int", "s", "=", "0", ",", "d", "=", "0", ",", "cc", "=", "0", ";", "s", "<", "eLen", ";", ")", "{", "// Copy next three bytes into lower 24 bits of int, paying attension to sign.", "int", "i", "=", "(", "sArr", "[", "s", "++", "]", "&", "0xff", ")", "<<", "16", "|", "(", "sArr", "[", "s", "++", "]", "&", "0xff", ")", "<<", "8", "|", "(", "sArr", "[", "s", "++", "]", "&", "0xff", ")", ";", "// Encode the int into four chars", "dArr", "[", "d", "++", "]", "=", "(", "byte", ")", "CA", "[", "(", "i", ">>>", "18", ")", "&", "0x3f", "]", ";", "dArr", "[", "d", "++", "]", "=", "(", "byte", ")", "CA", "[", "(", "i", ">>>", "12", ")", "&", "0x3f", "]", ";", "dArr", "[", "d", "++", "]", "=", "(", "byte", ")", "CA", "[", "(", "i", ">>>", "6", ")", "&", "0x3f", "]", ";", "dArr", "[", "d", "++", "]", "=", "(", "byte", ")", "CA", "[", "i", "&", "0x3f", "]", ";", "// Add optional line separator", "if", "(", "lineSep", "&&", "++", "cc", "==", "19", "&&", "d", "<", "dLen", "-", "2", ")", "{", "dArr", "[", "d", "++", "]", "=", "'", "'", ";", "dArr", "[", "d", "++", "]", "=", "'", "'", ";", "cc", "=", "0", ";", "}", "}", "// Pad and encode last bits if source isn't an even 24 bits.", "int", "left", "=", "sLen", "-", "eLen", ";", "// 0 - 2.", "if", "(", "left", ">", "0", ")", "{", "// Prepare the int", "int", "i", "=", "(", "(", "sArr", "[", "eLen", "]", "&", "0xff", ")", "<<", "10", ")", "|", "(", "left", "==", "2", "?", "(", "(", "sArr", "[", "sLen", "-", "1", "]", "&", "0xff", ")", "<<", "2", ")", ":", "0", ")", ";", "// Set last four chars", "dArr", "[", "dLen", "-", "4", "]", "=", "(", "byte", ")", "CA", "[", "i", ">>", "12", "]", ";", "dArr", "[", "dLen", "-", "3", "]", "=", "(", "byte", ")", "CA", "[", "(", "i", ">>>", "6", ")", "&", "0x3f", "]", ";", "dArr", "[", "dLen", "-", "2", "]", "=", "left", "==", "2", "?", "(", "byte", ")", "CA", "[", "i", "&", "0x3f", "]", ":", "(", "byte", ")", "fillChar", ";", "dArr", "[", "dLen", "-", "1", "]", "=", "(", "byte", ")", "fillChar", ";", "}", "return", "dArr", ";", "}" ]
Encodes a raw byte array into a BASE64 <code>byte[]</code> representation i accordance with RFC 2045. @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned. @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br> No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a little faster. @return A BASE64 encoded array. Never <code>null</code>.
[ "Encodes", "a", "raw", "byte", "array", "into", "a", "BASE64", "<code", ">", "byte", "[]", "<", "/", "code", ">", "representation", "i", "accordance", "with", "RFC", "2045", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Base64.java#L547-L591
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getOneLoginAppsBatch
public OneLoginResponse<OneLoginApp> getOneLoginAppsBatch(int batchSize, String afterCursor) throws OAuthSystemException, OAuthProblemException, URISyntaxException { """ Get a batch of OneLoginApps. @param batchSize Size of the Batch @param afterCursor Reference to continue collecting items of next page @return OneLoginResponse of OneLoginApp (Batch) @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.OneLoginApp @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/apps/get-apps">Get Apps documentation</a> """ return getOneLoginAppsBatch(new HashMap<String, String>(), batchSize, afterCursor); }
java
public OneLoginResponse<OneLoginApp> getOneLoginAppsBatch(int batchSize, String afterCursor) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getOneLoginAppsBatch(new HashMap<String, String>(), batchSize, afterCursor); }
[ "public", "OneLoginResponse", "<", "OneLoginApp", ">", "getOneLoginAppsBatch", "(", "int", "batchSize", ",", "String", "afterCursor", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "return", "getOneLoginAppsBatch", "(", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ",", "batchSize", ",", "afterCursor", ")", ";", "}" ]
Get a batch of OneLoginApps. @param batchSize Size of the Batch @param afterCursor Reference to continue collecting items of next page @return OneLoginResponse of OneLoginApp (Batch) @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.OneLoginApp @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/apps/get-apps">Get Apps documentation</a>
[ "Get", "a", "batch", "of", "OneLoginApps", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L1584-L1587
amaembo/streamex
src/main/java/one/util/streamex/StreamEx.java
StreamEx.zipWith
public <V> EntryStream<T, V> zipWith(Stream<V> other) { """ Creates a new {@link EntryStream} which keys are elements of this stream and values are the corresponding elements of the supplied other stream. The resulting stream is ordered if both of the input streams are ordered, and parallel if either of the input streams is parallel. When the resulting stream is closed, the close handlers for both input streams are invoked. <p> This is a <a href="package-summary.html#StreamOps">quasi-intermediate operation</a>. <p> The resulting stream finishes when either of the input streams finish: the rest of the longer stream is discarded. It's unspecified whether the rest elements of the longer stream are actually consumed. <p> The stream created by this operation may have poor characteristics and parallelize badly, so it should be used only when there's no other choice. If both input streams are random-access lists or arrays, consider using {@link EntryStream#zip(List, List)} or {@link EntryStream#zip(Object[], Object[])} respectively. If you want to zip the stream with the stream of indices, consider using {@link EntryStream#of(List)} instead. @param <V> the type of the other stream elements @param other the stream to zip this stream with @return the new stream @see #zipWith(Stream, BiFunction) @since 0.5.5 """ return zipWith((BaseStream<V, ?>)other); }
java
public <V> EntryStream<T, V> zipWith(Stream<V> other) { return zipWith((BaseStream<V, ?>)other); }
[ "public", "<", "V", ">", "EntryStream", "<", "T", ",", "V", ">", "zipWith", "(", "Stream", "<", "V", ">", "other", ")", "{", "return", "zipWith", "(", "(", "BaseStream", "<", "V", ",", "?", ">", ")", "other", ")", ";", "}" ]
Creates a new {@link EntryStream} which keys are elements of this stream and values are the corresponding elements of the supplied other stream. The resulting stream is ordered if both of the input streams are ordered, and parallel if either of the input streams is parallel. When the resulting stream is closed, the close handlers for both input streams are invoked. <p> This is a <a href="package-summary.html#StreamOps">quasi-intermediate operation</a>. <p> The resulting stream finishes when either of the input streams finish: the rest of the longer stream is discarded. It's unspecified whether the rest elements of the longer stream are actually consumed. <p> The stream created by this operation may have poor characteristics and parallelize badly, so it should be used only when there's no other choice. If both input streams are random-access lists or arrays, consider using {@link EntryStream#zip(List, List)} or {@link EntryStream#zip(Object[], Object[])} respectively. If you want to zip the stream with the stream of indices, consider using {@link EntryStream#of(List)} instead. @param <V> the type of the other stream elements @param other the stream to zip this stream with @return the new stream @see #zipWith(Stream, BiFunction) @since 0.5.5
[ "Creates", "a", "new", "{", "@link", "EntryStream", "}", "which", "keys", "are", "elements", "of", "this", "stream", "and", "values", "are", "the", "corresponding", "elements", "of", "the", "supplied", "other", "stream", ".", "The", "resulting", "stream", "is", "ordered", "if", "both", "of", "the", "input", "streams", "are", "ordered", "and", "parallel", "if", "either", "of", "the", "input", "streams", "is", "parallel", ".", "When", "the", "resulting", "stream", "is", "closed", "the", "close", "handlers", "for", "both", "input", "streams", "are", "invoked", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1914-L1916
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java
JdbcCpoAdapter.deleteObject
@Override public <T> long deleteObject(String name, T obj) throws CpoException { """ Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method stores the object in the datasource <p/> <pre>Example: <code> <p/> class SomeObject so = new SomeObject(); class CpoAdapter cpo = null; <p/> try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p/> if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.deleteObject("DeleteById",so); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the DELETE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown. @return The number of objects deleted from the datasource @throws CpoException Thrown if there are errors accessing the datasource """ return processUpdateGroup(obj, JdbcCpoAdapter.DELETE_GROUP, name, null, null, null); }
java
@Override public <T> long deleteObject(String name, T obj) throws CpoException { return processUpdateGroup(obj, JdbcCpoAdapter.DELETE_GROUP, name, null, null, null); }
[ "@", "Override", "public", "<", "T", ">", "long", "deleteObject", "(", "String", "name", ",", "T", "obj", ")", "throws", "CpoException", "{", "return", "processUpdateGroup", "(", "obj", ",", "JdbcCpoAdapter", ".", "DELETE_GROUP", ",", "name", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method stores the object in the datasource <p/> <pre>Example: <code> <p/> class SomeObject so = new SomeObject(); class CpoAdapter cpo = null; <p/> try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p/> if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ cpo.deleteObject("DeleteById",so); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the DELETE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown. @return The number of objects deleted from the datasource @throws CpoException Thrown if there are errors accessing the datasource
[ "Removes", "the", "Object", "from", "the", "datasource", ".", "The", "assumption", "is", "that", "the", "object", "exists", "in", "the", "datasource", ".", "This", "method", "stores", "the", "object", "in", "the", "datasource", "<p", "/", ">", "<pre", ">", "Example", ":", "<code", ">", "<p", "/", ">", "class", "SomeObject", "so", "=", "new", "SomeObject", "()", ";", "class", "CpoAdapter", "cpo", "=", "null", ";", "<p", "/", ">", "try", "{", "cpo", "=", "new", "JdbcCpoAdapter", "(", "new", "JdbcDataSourceInfo", "(", "driver", "url", "user", "password", "1", "1", "false", "))", ";", "}", "catch", "(", "CpoException", "ce", ")", "{", "//", "Handle", "the", "error", "cpo", "=", "null", ";", "}", "<p", "/", ">", "if", "(", "cpo!", "=", "null", ")", "{", "so", ".", "setId", "(", "1", ")", ";", "so", ".", "setName", "(", "SomeName", ")", ";", "try", "{", "cpo", ".", "deleteObject", "(", "DeleteById", "so", ")", ";", "}", "catch", "(", "CpoException", "ce", ")", "{", "//", "Handle", "the", "error", "}", "}", "<", "/", "code", ">", "<", "/", "pre", ">" ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L538-L541
thinkaurelius/titan
titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/BackendTransaction.java
BackendTransaction.mutateEdges
public void mutateEdges(StaticBuffer key, List<Entry> additions, List<Entry> deletions) throws BackendException { """ Applies the specified insertion and deletion mutations on the edge store to the provided key. Both, the list of additions or deletions, may be empty or NULL if there is nothing to be added and/or deleted. @param key Key @param additions List of entries (column + value) to be added @param deletions List of columns to be removed """ edgeStore.mutateEntries(key, additions, deletions, storeTx); }
java
public void mutateEdges(StaticBuffer key, List<Entry> additions, List<Entry> deletions) throws BackendException { edgeStore.mutateEntries(key, additions, deletions, storeTx); }
[ "public", "void", "mutateEdges", "(", "StaticBuffer", "key", ",", "List", "<", "Entry", ">", "additions", ",", "List", "<", "Entry", ">", "deletions", ")", "throws", "BackendException", "{", "edgeStore", ".", "mutateEntries", "(", "key", ",", "additions", ",", "deletions", ",", "storeTx", ")", ";", "}" ]
Applies the specified insertion and deletion mutations on the edge store to the provided key. Both, the list of additions or deletions, may be empty or NULL if there is nothing to be added and/or deleted. @param key Key @param additions List of entries (column + value) to be added @param deletions List of columns to be removed
[ "Applies", "the", "specified", "insertion", "and", "deletion", "mutations", "on", "the", "edge", "store", "to", "the", "provided", "key", ".", "Both", "the", "list", "of", "additions", "or", "deletions", "may", "be", "empty", "or", "NULL", "if", "there", "is", "nothing", "to", "be", "added", "and", "/", "or", "deleted", "." ]
train
https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/diskstorage/BackendTransaction.java#L184-L186
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java
ArrayFunctions.arrayPut
public static Expression arrayPut(String expression, Expression value) { """ Returned expression results in new array with value appended, if value is not already present, otherwise the unmodified input array. """ return arrayPut(x(expression), value); }
java
public static Expression arrayPut(String expression, Expression value) { return arrayPut(x(expression), value); }
[ "public", "static", "Expression", "arrayPut", "(", "String", "expression", ",", "Expression", "value", ")", "{", "return", "arrayPut", "(", "x", "(", "expression", ")", ",", "value", ")", ";", "}" ]
Returned expression results in new array with value appended, if value is not already present, otherwise the unmodified input array.
[ "Returned", "expression", "results", "in", "new", "array", "with", "value", "appended", "if", "value", "is", "not", "already", "present", "otherwise", "the", "unmodified", "input", "array", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L312-L314
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineItineraryTemplateBuilder.java
AirlineItineraryTemplateBuilder.addQuickReply
public AirlineItineraryTemplateBuilder addQuickReply(String title, String payload) { """ Adds a {@link QuickReply} to the current object. @param title the quick reply button label. It can't be empty. @param payload the payload sent back when the button is pressed. It can't be empty. @return this builder. @see <a href= "https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies" >Facebook's Messenger Platform Quick Replies Documentation</a> """ this.messageBuilder.addQuickReply(title, payload); return this; }
java
public AirlineItineraryTemplateBuilder addQuickReply(String title, String payload) { this.messageBuilder.addQuickReply(title, payload); return this; }
[ "public", "AirlineItineraryTemplateBuilder", "addQuickReply", "(", "String", "title", ",", "String", "payload", ")", "{", "this", ".", "messageBuilder", ".", "addQuickReply", "(", "title", ",", "payload", ")", ";", "return", "this", ";", "}" ]
Adds a {@link QuickReply} to the current object. @param title the quick reply button label. It can't be empty. @param payload the payload sent back when the button is pressed. It can't be empty. @return this builder. @see <a href= "https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies" >Facebook's Messenger Platform Quick Replies Documentation</a>
[ "Adds", "a", "{", "@link", "QuickReply", "}", "to", "the", "current", "object", "." ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AirlineItineraryTemplateBuilder.java#L338-L342
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java
Ftp.upload
public boolean upload(String path, String fileName, File file) { """ 上传文件到指定目录,可选: <pre> 1. path为null或""上传到当前路径 2. path为相对路径则相对于当前路径的子路径 3. path为绝对路径则上传到此路径 </pre> @param file 文件 @param path 服务端路径,可以为{@code null} 或者相对路径或绝对路径 @param fileName 自定义在服务端保存的文件名 @return 是否上传成功 """ try (InputStream in = FileUtil.getInputStream(file)) { return upload(path, fileName, in); } catch (IOException e) { throw new FtpException(e); } }
java
public boolean upload(String path, String fileName, File file) { try (InputStream in = FileUtil.getInputStream(file)) { return upload(path, fileName, in); } catch (IOException e) { throw new FtpException(e); } }
[ "public", "boolean", "upload", "(", "String", "path", ",", "String", "fileName", ",", "File", "file", ")", "{", "try", "(", "InputStream", "in", "=", "FileUtil", ".", "getInputStream", "(", "file", ")", ")", "{", "return", "upload", "(", "path", ",", "fileName", ",", "in", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "FtpException", "(", "e", ")", ";", "}", "}" ]
上传文件到指定目录,可选: <pre> 1. path为null或""上传到当前路径 2. path为相对路径则相对于当前路径的子路径 3. path为绝对路径则上传到此路径 </pre> @param file 文件 @param path 服务端路径,可以为{@code null} 或者相对路径或绝对路径 @param fileName 自定义在服务端保存的文件名 @return 是否上传成功
[ "上传文件到指定目录,可选:" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ftp/Ftp.java#L382-L388
ehcache/ehcache3
core/src/main/java/org/ehcache/core/config/DefaultConfiguration.java
DefaultConfiguration.replaceCacheConfiguration
public <K, V> void replaceCacheConfiguration(final String alias, final CacheConfiguration<K, V> config, final CacheRuntimeConfiguration<K, V> runtimeConfiguration) { """ Replaces a {@link CacheConfiguration} with a {@link CacheRuntimeConfiguration} for the provided alias. @param alias the alias of the cache @param config the existing configuration @param runtimeConfiguration the new configuration @param <K> the key type @param <V> the value type @throws IllegalStateException if the replace fails """ if (!caches.replace(alias, config, runtimeConfiguration)) { throw new IllegalStateException("The expected configuration doesn't match!"); } }
java
public <K, V> void replaceCacheConfiguration(final String alias, final CacheConfiguration<K, V> config, final CacheRuntimeConfiguration<K, V> runtimeConfiguration) { if (!caches.replace(alias, config, runtimeConfiguration)) { throw new IllegalStateException("The expected configuration doesn't match!"); } }
[ "public", "<", "K", ",", "V", ">", "void", "replaceCacheConfiguration", "(", "final", "String", "alias", ",", "final", "CacheConfiguration", "<", "K", ",", "V", ">", "config", ",", "final", "CacheRuntimeConfiguration", "<", "K", ",", "V", ">", "runtimeConfiguration", ")", "{", "if", "(", "!", "caches", ".", "replace", "(", "alias", ",", "config", ",", "runtimeConfiguration", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The expected configuration doesn't match!\"", ")", ";", "}", "}" ]
Replaces a {@link CacheConfiguration} with a {@link CacheRuntimeConfiguration} for the provided alias. @param alias the alias of the cache @param config the existing configuration @param runtimeConfiguration the new configuration @param <K> the key type @param <V> the value type @throws IllegalStateException if the replace fails
[ "Replaces", "a", "{", "@link", "CacheConfiguration", "}", "with", "a", "{", "@link", "CacheRuntimeConfiguration", "}", "for", "the", "provided", "alias", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/config/DefaultConfiguration.java#L147-L151
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.getRunnersWithPagination
public List<GitlabRunner> getRunnersWithPagination(GitlabRunner.RunnerScope scope, int page, int perPage) throws IOException { """ Returns a list of runners with perPage elements on the page number specified. @param scope Can be null. Defines type of Runner to retrieve. @param page Page to get perPage number of Runners from. @param perPage Number of elements to get per page. @return List of GitlabRunners @throws IOException on Gitlab API call error """ Pagination pagination = new Pagination() .withPage(page) .withPerPage(perPage); return getRunnersWithPagination(scope, pagination); }
java
public List<GitlabRunner> getRunnersWithPagination(GitlabRunner.RunnerScope scope, int page, int perPage) throws IOException { Pagination pagination = new Pagination() .withPage(page) .withPerPage(perPage); return getRunnersWithPagination(scope, pagination); }
[ "public", "List", "<", "GitlabRunner", ">", "getRunnersWithPagination", "(", "GitlabRunner", ".", "RunnerScope", "scope", ",", "int", "page", ",", "int", "perPage", ")", "throws", "IOException", "{", "Pagination", "pagination", "=", "new", "Pagination", "(", ")", ".", "withPage", "(", "page", ")", ".", "withPerPage", "(", "perPage", ")", ";", "return", "getRunnersWithPagination", "(", "scope", ",", "pagination", ")", ";", "}" ]
Returns a list of runners with perPage elements on the page number specified. @param scope Can be null. Defines type of Runner to retrieve. @param page Page to get perPage number of Runners from. @param perPage Number of elements to get per page. @return List of GitlabRunners @throws IOException on Gitlab API call error
[ "Returns", "a", "list", "of", "runners", "with", "perPage", "elements", "on", "the", "page", "number", "specified", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3967-L3972
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java
MapComposedElement.setPointAt
public final boolean setPointAt(int index, Point2D<?, ?> point, boolean canonize) { """ Set the specified point at the given index. <p>If the <var>index</var> is negative, it will corresponds to an index starting from the end of the list. @param index is the index of the desired point @param point is the new value of the point @param canonize indicates if the function {@link #canonize(int)} must be called. @return <code>true</code> if the point was set, <code>false</code> if the specified coordinates correspond to the already existing point. @throws IndexOutOfBoundsException in case of error. """ return setPointAt(index, point.getX(), point.getY(), canonize); }
java
public final boolean setPointAt(int index, Point2D<?, ?> point, boolean canonize) { return setPointAt(index, point.getX(), point.getY(), canonize); }
[ "public", "final", "boolean", "setPointAt", "(", "int", "index", ",", "Point2D", "<", "?", ",", "?", ">", "point", ",", "boolean", "canonize", ")", "{", "return", "setPointAt", "(", "index", ",", "point", ".", "getX", "(", ")", ",", "point", ".", "getY", "(", ")", ",", "canonize", ")", ";", "}" ]
Set the specified point at the given index. <p>If the <var>index</var> is negative, it will corresponds to an index starting from the end of the list. @param index is the index of the desired point @param point is the new value of the point @param canonize indicates if the function {@link #canonize(int)} must be called. @return <code>true</code> if the point was set, <code>false</code> if the specified coordinates correspond to the already existing point. @throws IndexOutOfBoundsException in case of error.
[ "Set", "the", "specified", "point", "at", "the", "given", "index", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L994-L996
structr/structr
structr-db-driver-api/src/main/java/org/structr/api/service/Command.java
Command.setArgument
public final void setArgument(final String key, final Object value) { """ Sets an argument for this command. @param key the key @param value the value """ if (key != null && value != null) { this.arguments.put(key, value); } }
java
public final void setArgument(final String key, final Object value) { if (key != null && value != null) { this.arguments.put(key, value); } }
[ "public", "final", "void", "setArgument", "(", "final", "String", "key", ",", "final", "Object", "value", ")", "{", "if", "(", "key", "!=", "null", "&&", "value", "!=", "null", ")", "{", "this", ".", "arguments", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}" ]
Sets an argument for this command. @param key the key @param value the value
[ "Sets", "an", "argument", "for", "this", "command", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-db-driver-api/src/main/java/org/structr/api/service/Command.java#L75-L80
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuStringUtil.java
GosuStringUtil.containsAny
public static boolean containsAny(String str, char[] searchChars) { """ <p>Checks if the String contains any character in the given set of characters.</p> <p>A <code>null</code> String will return <code>false</code>. A <code>null</code> or zero length search array will return <code>false</code>.</p> <pre> GosuStringUtil.containsAny(null, *) = false GosuStringUtil.containsAny("", *) = false GosuStringUtil.containsAny(*, null) = false GosuStringUtil.containsAny(*, []) = false GosuStringUtil.containsAny("zzabyycdxx",['z','a']) = true GosuStringUtil.containsAny("zzabyycdxx",['b','y']) = true GosuStringUtil.containsAny("aba", ['z']) = false </pre> @param str the String to check, may be null @param searchChars the chars to search for, may be null @return the <code>true</code> if any of the chars are found, <code>false</code> if no match or null input @since 2.4 """ if (str == null || str.length() == 0 || searchChars == null || searchChars.length == 0) { return false; } for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); for (int j = 0; j < searchChars.length; j++) { if (searchChars[j] == ch) { return true; } } } return false; }
java
public static boolean containsAny(String str, char[] searchChars) { if (str == null || str.length() == 0 || searchChars == null || searchChars.length == 0) { return false; } for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); for (int j = 0; j < searchChars.length; j++) { if (searchChars[j] == ch) { return true; } } } return false; }
[ "public", "static", "boolean", "containsAny", "(", "String", "str", ",", "char", "[", "]", "searchChars", ")", "{", "if", "(", "str", "==", "null", "||", "str", ".", "length", "(", ")", "==", "0", "||", "searchChars", "==", "null", "||", "searchChars", ".", "length", "==", "0", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "str", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "ch", "=", "str", ".", "charAt", "(", "i", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "searchChars", ".", "length", ";", "j", "++", ")", "{", "if", "(", "searchChars", "[", "j", "]", "==", "ch", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
<p>Checks if the String contains any character in the given set of characters.</p> <p>A <code>null</code> String will return <code>false</code>. A <code>null</code> or zero length search array will return <code>false</code>.</p> <pre> GosuStringUtil.containsAny(null, *) = false GosuStringUtil.containsAny("", *) = false GosuStringUtil.containsAny(*, null) = false GosuStringUtil.containsAny(*, []) = false GosuStringUtil.containsAny("zzabyycdxx",['z','a']) = true GosuStringUtil.containsAny("zzabyycdxx",['b','y']) = true GosuStringUtil.containsAny("aba", ['z']) = false </pre> @param str the String to check, may be null @param searchChars the chars to search for, may be null @return the <code>true</code> if any of the chars are found, <code>false</code> if no match or null input @since 2.4
[ "<p", ">", "Checks", "if", "the", "String", "contains", "any", "character", "in", "the", "given", "set", "of", "characters", ".", "<", "/", "p", ">" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L1136-L1149
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java
WebUtils.putWarnCookieIfRequestParameterPresent
public static void putWarnCookieIfRequestParameterPresent(final CasCookieBuilder warnCookieGenerator, final RequestContext context) { """ Put warn cookie if request parameter present. @param warnCookieGenerator the warn cookie generator @param context the context """ if (warnCookieGenerator != null) { LOGGER.trace("Evaluating request to determine if warning cookie should be generated"); val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); if (StringUtils.isNotBlank(context.getExternalContext().getRequestParameterMap().get("warn"))) { warnCookieGenerator.addCookie(response, "true"); } } else { LOGGER.trace("No warning cookie generator is defined"); } }
java
public static void putWarnCookieIfRequestParameterPresent(final CasCookieBuilder warnCookieGenerator, final RequestContext context) { if (warnCookieGenerator != null) { LOGGER.trace("Evaluating request to determine if warning cookie should be generated"); val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context); if (StringUtils.isNotBlank(context.getExternalContext().getRequestParameterMap().get("warn"))) { warnCookieGenerator.addCookie(response, "true"); } } else { LOGGER.trace("No warning cookie generator is defined"); } }
[ "public", "static", "void", "putWarnCookieIfRequestParameterPresent", "(", "final", "CasCookieBuilder", "warnCookieGenerator", ",", "final", "RequestContext", "context", ")", "{", "if", "(", "warnCookieGenerator", "!=", "null", ")", "{", "LOGGER", ".", "trace", "(", "\"Evaluating request to determine if warning cookie should be generated\"", ")", ";", "val", "response", "=", "WebUtils", ".", "getHttpServletResponseFromExternalWebflowContext", "(", "context", ")", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "context", ".", "getExternalContext", "(", ")", ".", "getRequestParameterMap", "(", ")", ".", "get", "(", "\"warn\"", ")", ")", ")", "{", "warnCookieGenerator", ".", "addCookie", "(", "response", ",", "\"true\"", ")", ";", "}", "}", "else", "{", "LOGGER", ".", "trace", "(", "\"No warning cookie generator is defined\"", ")", ";", "}", "}" ]
Put warn cookie if request parameter present. @param warnCookieGenerator the warn cookie generator @param context the context
[ "Put", "warn", "cookie", "if", "request", "parameter", "present", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L448-L458
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/utils/thresholds/ThresholdsEvaluatorBuilder.java
ThresholdsEvaluatorBuilder.withLegacyThreshold
public final ThresholdsEvaluatorBuilder withLegacyThreshold(final String metric, final String okRange, final String warnRange, final String critRange) throws BadThresholdException { """ This method allows to specify thresholds using the old format. @param metric The metric for which this threshold must be configured @param okRange The ok range (can be null) @param warnRange The warning range (can be null) @param critRange The critical range (can be null). @return this @throws BadThresholdException If the threshold can't be parsed. """ LegacyRange ok = null, warn = null, crit = null; if (okRange != null) { ok = new LegacyRange(okRange); } if (warnRange != null) { warn = new LegacyRange(warnRange); } if (critRange != null) { crit = new LegacyRange(critRange); } thresholds.addThreshold(new LegacyThreshold(metric, ok, warn, crit)); return this; }
java
public final ThresholdsEvaluatorBuilder withLegacyThreshold(final String metric, final String okRange, final String warnRange, final String critRange) throws BadThresholdException { LegacyRange ok = null, warn = null, crit = null; if (okRange != null) { ok = new LegacyRange(okRange); } if (warnRange != null) { warn = new LegacyRange(warnRange); } if (critRange != null) { crit = new LegacyRange(critRange); } thresholds.addThreshold(new LegacyThreshold(metric, ok, warn, crit)); return this; }
[ "public", "final", "ThresholdsEvaluatorBuilder", "withLegacyThreshold", "(", "final", "String", "metric", ",", "final", "String", "okRange", ",", "final", "String", "warnRange", ",", "final", "String", "critRange", ")", "throws", "BadThresholdException", "{", "LegacyRange", "ok", "=", "null", ",", "warn", "=", "null", ",", "crit", "=", "null", ";", "if", "(", "okRange", "!=", "null", ")", "{", "ok", "=", "new", "LegacyRange", "(", "okRange", ")", ";", "}", "if", "(", "warnRange", "!=", "null", ")", "{", "warn", "=", "new", "LegacyRange", "(", "warnRange", ")", ";", "}", "if", "(", "critRange", "!=", "null", ")", "{", "crit", "=", "new", "LegacyRange", "(", "critRange", ")", ";", "}", "thresholds", ".", "addThreshold", "(", "new", "LegacyThreshold", "(", "metric", ",", "ok", ",", "warn", ",", "crit", ")", ")", ";", "return", "this", ";", "}" ]
This method allows to specify thresholds using the old format. @param metric The metric for which this threshold must be configured @param okRange The ok range (can be null) @param warnRange The warning range (can be null) @param critRange The critical range (can be null). @return this @throws BadThresholdException If the threshold can't be parsed.
[ "This", "method", "allows", "to", "specify", "thresholds", "using", "the", "old", "format", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/utils/thresholds/ThresholdsEvaluatorBuilder.java#L71-L87
apache/groovy
src/main/groovy/groovy/util/FactoryBuilderSupport.java
FactoryBuilderSupport.createNode
protected Object createNode(Object name, Map attributes, Object value) { """ This method is responsible for instantiating a node and configure its properties. @param name the name of the node @param attributes the attributes for the node @param value the value arguments for the node @return the object return from the factory """ Object node; Factory factory = getProxyBuilder().resolveFactory(name, attributes, value); if (factory == null) { LOG.log(Level.WARNING, "Could not find match for name '" + name + "'"); throw new MissingMethodExceptionNoStack((String) name, Object.class, new Object[]{attributes, value}); //return null; } getProxyBuilder().getContext().put(CURRENT_FACTORY, factory); getProxyBuilder().getContext().put(CURRENT_NAME, String.valueOf(name)); getProxyBuilder().preInstantiate(name, attributes, value); try { node = factory.newInstance(getProxyBuilder().getChildBuilder(), name, value, attributes); if (node == null) { LOG.log(Level.WARNING, "Factory for name '" + name + "' returned null"); return null; } if (LOG.isLoggable(Level.FINE)) { LOG.fine("For name: " + name + " created node: " + node); } } catch (Exception e) { throw new RuntimeException("Failed to create component for '" + name + "' reason: " + e, e); } getProxyBuilder().postInstantiate(name, attributes, node); getProxyBuilder().handleNodeAttributes(node, attributes); return node; }
java
protected Object createNode(Object name, Map attributes, Object value) { Object node; Factory factory = getProxyBuilder().resolveFactory(name, attributes, value); if (factory == null) { LOG.log(Level.WARNING, "Could not find match for name '" + name + "'"); throw new MissingMethodExceptionNoStack((String) name, Object.class, new Object[]{attributes, value}); //return null; } getProxyBuilder().getContext().put(CURRENT_FACTORY, factory); getProxyBuilder().getContext().put(CURRENT_NAME, String.valueOf(name)); getProxyBuilder().preInstantiate(name, attributes, value); try { node = factory.newInstance(getProxyBuilder().getChildBuilder(), name, value, attributes); if (node == null) { LOG.log(Level.WARNING, "Factory for name '" + name + "' returned null"); return null; } if (LOG.isLoggable(Level.FINE)) { LOG.fine("For name: " + name + " created node: " + node); } } catch (Exception e) { throw new RuntimeException("Failed to create component for '" + name + "' reason: " + e, e); } getProxyBuilder().postInstantiate(name, attributes, node); getProxyBuilder().handleNodeAttributes(node, attributes); return node; }
[ "protected", "Object", "createNode", "(", "Object", "name", ",", "Map", "attributes", ",", "Object", "value", ")", "{", "Object", "node", ";", "Factory", "factory", "=", "getProxyBuilder", "(", ")", ".", "resolveFactory", "(", "name", ",", "attributes", ",", "value", ")", ";", "if", "(", "factory", "==", "null", ")", "{", "LOG", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Could not find match for name '\"", "+", "name", "+", "\"'\"", ")", ";", "throw", "new", "MissingMethodExceptionNoStack", "(", "(", "String", ")", "name", ",", "Object", ".", "class", ",", "new", "Object", "[", "]", "{", "attributes", ",", "value", "}", ")", ";", "//return null;", "}", "getProxyBuilder", "(", ")", ".", "getContext", "(", ")", ".", "put", "(", "CURRENT_FACTORY", ",", "factory", ")", ";", "getProxyBuilder", "(", ")", ".", "getContext", "(", ")", ".", "put", "(", "CURRENT_NAME", ",", "String", ".", "valueOf", "(", "name", ")", ")", ";", "getProxyBuilder", "(", ")", ".", "preInstantiate", "(", "name", ",", "attributes", ",", "value", ")", ";", "try", "{", "node", "=", "factory", ".", "newInstance", "(", "getProxyBuilder", "(", ")", ".", "getChildBuilder", "(", ")", ",", "name", ",", "value", ",", "attributes", ")", ";", "if", "(", "node", "==", "null", ")", "{", "LOG", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Factory for name '\"", "+", "name", "+", "\"' returned null\"", ")", ";", "return", "null", ";", "}", "if", "(", "LOG", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "LOG", ".", "fine", "(", "\"For name: \"", "+", "name", "+", "\" created node: \"", "+", "node", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Failed to create component for '\"", "+", "name", "+", "\"' reason: \"", "+", "e", ",", "e", ")", ";", "}", "getProxyBuilder", "(", ")", ".", "postInstantiate", "(", "name", ",", "attributes", ",", "node", ")", ";", "getProxyBuilder", "(", ")", ".", "handleNodeAttributes", "(", "node", ",", "attributes", ")", ";", "return", "node", ";", "}" ]
This method is responsible for instantiating a node and configure its properties. @param name the name of the node @param attributes the attributes for the node @param value the value arguments for the node @return the object return from the factory
[ "This", "method", "is", "responsible", "for", "instantiating", "a", "node", "and", "configure", "its", "properties", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L705-L734
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setBaselineWork
public void setBaselineWork(int baselineNumber, Duration value) { """ Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value """ set(selectField(AssignmentFieldLists.BASELINE_WORKS, baselineNumber), value); }
java
public void setBaselineWork(int baselineNumber, Duration value) { set(selectField(AssignmentFieldLists.BASELINE_WORKS, baselineNumber), value); }
[ "public", "void", "setBaselineWork", "(", "int", "baselineNumber", ",", "Duration", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "BASELINE_WORKS", ",", "baselineNumber", ")", ",", "value", ")", ";", "}" ]
Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value
[ "Set", "a", "baseline", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1397-L1400
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.setPerspectiveRect
public Matrix4d setPerspectiveRect(double width, double height, double zNear, double zFar, boolean zZeroToOne) { """ Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range. <p> In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveRect(double, double, double, double, boolean) perspectiveRect()}. @see #perspectiveRect(double, double, double, double, boolean) @param width the width of the near frustum plane @param height the height of the near frustum plane @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this """ this.zero(); this._m00((zNear + zNear) / width); this._m11((zNear + zNear) / height); boolean farInf = zFar > 0 && Double.isInfinite(zFar); boolean nearInf = zNear > 0 && Double.isInfinite(zNear); if (farInf) { // See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf) double e = 1E-6; this._m22(e - 1.0); this._m32((e - (zZeroToOne ? 1.0 : 2.0)) * zNear); } else if (nearInf) { double e = 1E-6f; this._m22((zZeroToOne ? 0.0 : 1.0) - e); this._m32(((zZeroToOne ? 1.0 : 2.0) - e) * zFar); } else { this._m22((zZeroToOne ? zFar : zFar + zNear) / (zNear - zFar)); this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar)); } this._m23(-1.0); properties = PROPERTY_PERSPECTIVE; return this; }
java
public Matrix4d setPerspectiveRect(double width, double height, double zNear, double zFar, boolean zZeroToOne) { this.zero(); this._m00((zNear + zNear) / width); this._m11((zNear + zNear) / height); boolean farInf = zFar > 0 && Double.isInfinite(zFar); boolean nearInf = zNear > 0 && Double.isInfinite(zNear); if (farInf) { // See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf) double e = 1E-6; this._m22(e - 1.0); this._m32((e - (zZeroToOne ? 1.0 : 2.0)) * zNear); } else if (nearInf) { double e = 1E-6f; this._m22((zZeroToOne ? 0.0 : 1.0) - e); this._m32(((zZeroToOne ? 1.0 : 2.0) - e) * zFar); } else { this._m22((zZeroToOne ? zFar : zFar + zNear) / (zNear - zFar)); this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar)); } this._m23(-1.0); properties = PROPERTY_PERSPECTIVE; return this; }
[ "public", "Matrix4d", "setPerspectiveRect", "(", "double", "width", ",", "double", "height", ",", "double", "zNear", ",", "double", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "this", ".", "zero", "(", ")", ";", "this", ".", "_m00", "(", "(", "zNear", "+", "zNear", ")", "/", "width", ")", ";", "this", ".", "_m11", "(", "(", "zNear", "+", "zNear", ")", "/", "height", ")", ";", "boolean", "farInf", "=", "zFar", ">", "0", "&&", "Double", ".", "isInfinite", "(", "zFar", ")", ";", "boolean", "nearInf", "=", "zNear", ">", "0", "&&", "Double", ".", "isInfinite", "(", "zNear", ")", ";", "if", "(", "farInf", ")", "{", "// See: \"Infinite Projection Matrix\" (http://www.terathon.com/gdc07_lengyel.pdf)", "double", "e", "=", "1E-6", ";", "this", ".", "_m22", "(", "e", "-", "1.0", ")", ";", "this", ".", "_m32", "(", "(", "e", "-", "(", "zZeroToOne", "?", "1.0", ":", "2.0", ")", ")", "*", "zNear", ")", ";", "}", "else", "if", "(", "nearInf", ")", "{", "double", "e", "=", "1E-6f", ";", "this", ".", "_m22", "(", "(", "zZeroToOne", "?", "0.0", ":", "1.0", ")", "-", "e", ")", ";", "this", ".", "_m32", "(", "(", "(", "zZeroToOne", "?", "1.0", ":", "2.0", ")", "-", "e", ")", "*", "zFar", ")", ";", "}", "else", "{", "this", ".", "_m22", "(", "(", "zZeroToOne", "?", "zFar", ":", "zFar", "+", "zNear", ")", "/", "(", "zNear", "-", "zFar", ")", ")", ";", "this", ".", "_m32", "(", "(", "zZeroToOne", "?", "zFar", ":", "zFar", "+", "zFar", ")", "*", "zNear", "/", "(", "zNear", "-", "zFar", ")", ")", ";", "}", "this", ".", "_m23", "(", "-", "1.0", ")", ";", "properties", "=", "PROPERTY_PERSPECTIVE", ";", "return", "this", ";", "}" ]
Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range. <p> In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveRect(double, double, double, double, boolean) perspectiveRect()}. @see #perspectiveRect(double, double, double, double, boolean) @param width the width of the near frustum plane @param height the height of the near frustum plane @param zNear near clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", ".", "<p", ">", "In", "order", "to", "apply", "the", "perspective", "projection", "transformation", "to", "an", "existing", "transformation", "use", "{", "@link", "#perspectiveRect", "(", "double", "double", "double", "double", "boolean", ")", "perspectiveRect", "()", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L12656-L12678
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.getInternalState
@SuppressWarnings("unchecked") public static <T> T getInternalState(Object object, Class<T> fieldType, Class<?> where) { """ Get the value of a field using reflection. Use this method when you need to specify in which class the field is declared. The first field matching the <tt>fieldType</tt> in <tt>where</tt> will is the field whose value will be returned. @param <T> the expected type of the field @param object the object to modify @param fieldType the type of the field @param where which class the field is defined @return the internal state """ if (object == null) { throw new IllegalArgumentException("object and type are not allowed to be null"); } try { return (T) findFieldOrThrowException(fieldType, where).get(object); } catch (IllegalAccessException e) { throw new RuntimeException("Internal error: Failed to get field in method getInternalState.", e); } }
java
@SuppressWarnings("unchecked") public static <T> T getInternalState(Object object, Class<T> fieldType, Class<?> where) { if (object == null) { throw new IllegalArgumentException("object and type are not allowed to be null"); } try { return (T) findFieldOrThrowException(fieldType, where).get(object); } catch (IllegalAccessException e) { throw new RuntimeException("Internal error: Failed to get field in method getInternalState.", e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getInternalState", "(", "Object", "object", ",", "Class", "<", "T", ">", "fieldType", ",", "Class", "<", "?", ">", "where", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"object and type are not allowed to be null\"", ")", ";", "}", "try", "{", "return", "(", "T", ")", "findFieldOrThrowException", "(", "fieldType", ",", "where", ")", ".", "get", "(", "object", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Internal error: Failed to get field in method getInternalState.\"", ",", "e", ")", ";", "}", "}" ]
Get the value of a field using reflection. Use this method when you need to specify in which class the field is declared. The first field matching the <tt>fieldType</tt> in <tt>where</tt> will is the field whose value will be returned. @param <T> the expected type of the field @param object the object to modify @param fieldType the type of the field @param where which class the field is defined @return the internal state
[ "Get", "the", "value", "of", "a", "field", "using", "reflection", ".", "Use", "this", "method", "when", "you", "need", "to", "specify", "in", "which", "class", "the", "field", "is", "declared", ".", "The", "first", "field", "matching", "the", "<tt", ">", "fieldType<", "/", "tt", ">", "in", "<tt", ">", "where<", "/", "tt", ">", "will", "is", "the", "field", "whose", "value", "will", "be", "returned", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L587-L598
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/spi/OverviewDocumentExtension.java
OverviewDocumentExtension.levelOffset
protected int levelOffset(Context context) { """ Returns title level offset from 1 to apply to content @param context context @return title level offset """ //TODO: Unused method, make sure this is never used and then remove it. int levelOffset; switch (context.position) { case DOCUMENT_BEFORE: case DOCUMENT_AFTER: levelOffset = 0; break; case DOCUMENT_BEGIN: case DOCUMENT_END: levelOffset = 1; break; default: throw new RuntimeException(String.format("Unknown position '%s'", context.position)); } return levelOffset; }
java
protected int levelOffset(Context context) { //TODO: Unused method, make sure this is never used and then remove it. int levelOffset; switch (context.position) { case DOCUMENT_BEFORE: case DOCUMENT_AFTER: levelOffset = 0; break; case DOCUMENT_BEGIN: case DOCUMENT_END: levelOffset = 1; break; default: throw new RuntimeException(String.format("Unknown position '%s'", context.position)); } return levelOffset; }
[ "protected", "int", "levelOffset", "(", "Context", "context", ")", "{", "//TODO: Unused method, make sure this is never used and then remove it.", "int", "levelOffset", ";", "switch", "(", "context", ".", "position", ")", "{", "case", "DOCUMENT_BEFORE", ":", "case", "DOCUMENT_AFTER", ":", "levelOffset", "=", "0", ";", "break", ";", "case", "DOCUMENT_BEGIN", ":", "case", "DOCUMENT_END", ":", "levelOffset", "=", "1", ";", "break", ";", "default", ":", "throw", "new", "RuntimeException", "(", "String", ".", "format", "(", "\"Unknown position '%s'\"", ",", "context", ".", "position", ")", ")", ";", "}", "return", "levelOffset", ";", "}" ]
Returns title level offset from 1 to apply to content @param context context @return title level offset
[ "Returns", "title", "level", "offset", "from", "1", "to", "apply", "to", "content" ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/spi/OverviewDocumentExtension.java#L35-L52
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/PaxChronology.java
PaxChronology.dateYearDay
@Override public PaxDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { """ Obtains a local date in Pax calendar system from the era, year-of-era and day-of-year fields. @param era the Pax era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the Pax local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code PaxEra} """ return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
java
@Override public PaxDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
[ "@", "Override", "public", "PaxDate", "dateYearDay", "(", "Era", "era", ",", "int", "yearOfEra", ",", "int", "dayOfYear", ")", "{", "return", "dateYearDay", "(", "prolepticYear", "(", "era", ",", "yearOfEra", ")", ",", "dayOfYear", ")", ";", "}" ]
Obtains a local date in Pax calendar system from the era, year-of-era and day-of-year fields. @param era the Pax era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the Pax local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code PaxEra}
[ "Obtains", "a", "local", "date", "in", "Pax", "calendar", "system", "from", "the", "era", "year", "-", "of", "-", "era", "and", "day", "-", "of", "-", "year", "fields", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/PaxChronology.java#L237-L240
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java
CPMeasurementUnitPersistenceImpl.findByGroupId
@Override public List<CPMeasurementUnit> findByGroupId(long groupId) { """ Returns all the cp measurement units where groupId = &#63;. @param groupId the group ID @return the matching cp measurement units """ return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CPMeasurementUnit> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CPMeasurementUnit", ">", "findByGroupId", "(", "long", "groupId", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the cp measurement units where groupId = &#63;. @param groupId the group ID @return the matching cp measurement units
[ "Returns", "all", "the", "cp", "measurement", "units", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L1516-L1519
FitLayout/tools
src/main/java/org/fit/layout/tools/io/HTMLOutputOperator.java
HTMLOutputOperator.dumpTo
public void dumpTo(Page page, PrintWriter out) { """ Formats the complete box tree to an output stream. @param tree the area tree to be printed @param out a writer to be used for output """ if (produceHeader) { out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>" + page.getTitle() + "</title>"); out.println("<meta charset=\"utf-8\">"); out.println("<meta name=\"generator\" content=\"FITLayout - box tree dump\">"); out.println("</head>"); out.println("<body>"); } recursiveDumpBoxes(page.getRoot(), 1, out); if (produceHeader) { out.println("</body>"); out.println("</html>"); } }
java
public void dumpTo(Page page, PrintWriter out) { if (produceHeader) { out.println("<!DOCTYPE html>"); out.println("<html>"); out.println("<head>"); out.println("<title>" + page.getTitle() + "</title>"); out.println("<meta charset=\"utf-8\">"); out.println("<meta name=\"generator\" content=\"FITLayout - box tree dump\">"); out.println("</head>"); out.println("<body>"); } recursiveDumpBoxes(page.getRoot(), 1, out); if (produceHeader) { out.println("</body>"); out.println("</html>"); } }
[ "public", "void", "dumpTo", "(", "Page", "page", ",", "PrintWriter", "out", ")", "{", "if", "(", "produceHeader", ")", "{", "out", ".", "println", "(", "\"<!DOCTYPE html>\"", ")", ";", "out", ".", "println", "(", "\"<html>\"", ")", ";", "out", ".", "println", "(", "\"<head>\"", ")", ";", "out", ".", "println", "(", "\"<title>\"", "+", "page", ".", "getTitle", "(", ")", "+", "\"</title>\"", ")", ";", "out", ".", "println", "(", "\"<meta charset=\\\"utf-8\\\">\"", ")", ";", "out", ".", "println", "(", "\"<meta name=\\\"generator\\\" content=\\\"FITLayout - box tree dump\\\">\"", ")", ";", "out", ".", "println", "(", "\"</head>\"", ")", ";", "out", ".", "println", "(", "\"<body>\"", ")", ";", "}", "recursiveDumpBoxes", "(", "page", ".", "getRoot", "(", ")", ",", "1", ",", "out", ")", ";", "if", "(", "produceHeader", ")", "{", "out", ".", "println", "(", "\"</body>\"", ")", ";", "out", ".", "println", "(", "\"</html>\"", ")", ";", "}", "}" ]
Formats the complete box tree to an output stream. @param tree the area tree to be printed @param out a writer to be used for output
[ "Formats", "the", "complete", "box", "tree", "to", "an", "output", "stream", "." ]
train
https://github.com/FitLayout/tools/blob/43a8e3f4ddf21a031d3ab7247b8d37310bda4856/src/main/java/org/fit/layout/tools/io/HTMLOutputOperator.java#L184-L203
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GanttChartView12.java
GanttChartView12.getGridLines
private GridLines getGridLines(byte[] data, int offset) { """ Creates a new GridLines instance. @param data data block @param offset offset into data block @return new GridLines instance """ Color normalLineColor = ColorType.getInstance(data[offset]).getColor(); LineStyle normalLineStyle = LineStyle.getInstance(data[offset + 3]); int intervalNumber = data[offset + 4]; LineStyle intervalLineStyle = LineStyle.getInstance(data[offset + 5]); Color intervalLineColor = ColorType.getInstance(data[offset + 6]).getColor(); return new GridLines(normalLineColor, normalLineStyle, intervalNumber, intervalLineStyle, intervalLineColor); }
java
private GridLines getGridLines(byte[] data, int offset) { Color normalLineColor = ColorType.getInstance(data[offset]).getColor(); LineStyle normalLineStyle = LineStyle.getInstance(data[offset + 3]); int intervalNumber = data[offset + 4]; LineStyle intervalLineStyle = LineStyle.getInstance(data[offset + 5]); Color intervalLineColor = ColorType.getInstance(data[offset + 6]).getColor(); return new GridLines(normalLineColor, normalLineStyle, intervalNumber, intervalLineStyle, intervalLineColor); }
[ "private", "GridLines", "getGridLines", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "Color", "normalLineColor", "=", "ColorType", ".", "getInstance", "(", "data", "[", "offset", "]", ")", ".", "getColor", "(", ")", ";", "LineStyle", "normalLineStyle", "=", "LineStyle", ".", "getInstance", "(", "data", "[", "offset", "+", "3", "]", ")", ";", "int", "intervalNumber", "=", "data", "[", "offset", "+", "4", "]", ";", "LineStyle", "intervalLineStyle", "=", "LineStyle", ".", "getInstance", "(", "data", "[", "offset", "+", "5", "]", ")", ";", "Color", "intervalLineColor", "=", "ColorType", ".", "getInstance", "(", "data", "[", "offset", "+", "6", "]", ")", ".", "getColor", "(", ")", ";", "return", "new", "GridLines", "(", "normalLineColor", ",", "normalLineStyle", ",", "intervalNumber", ",", "intervalLineStyle", ",", "intervalLineColor", ")", ";", "}" ]
Creates a new GridLines instance. @param data data block @param offset offset into data block @return new GridLines instance
[ "Creates", "a", "new", "GridLines", "instance", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView12.java#L229-L237
LearnLib/automatalib
commons/util/src/main/java/net/automatalib/commons/util/comparison/CmpUtil.java
CmpUtil.lexCompare
public static <U extends Comparable<? super U>> int lexCompare(Iterable<? extends U> o1, Iterable<? extends U> o2) { """ Lexicographically compares two {@link Iterable}s, whose element types are comparable. """ Iterator<? extends U> it1 = o1.iterator(), it2 = o2.iterator(); while (it1.hasNext() && it2.hasNext()) { int cmp = it1.next().compareTo(it2.next()); if (cmp != 0) { return cmp; } } if (it1.hasNext()) { return 1; } else if (it2.hasNext()) { return -1; } return 0; }
java
public static <U extends Comparable<? super U>> int lexCompare(Iterable<? extends U> o1, Iterable<? extends U> o2) { Iterator<? extends U> it1 = o1.iterator(), it2 = o2.iterator(); while (it1.hasNext() && it2.hasNext()) { int cmp = it1.next().compareTo(it2.next()); if (cmp != 0) { return cmp; } } if (it1.hasNext()) { return 1; } else if (it2.hasNext()) { return -1; } return 0; }
[ "public", "static", "<", "U", "extends", "Comparable", "<", "?", "super", "U", ">", ">", "int", "lexCompare", "(", "Iterable", "<", "?", "extends", "U", ">", "o1", ",", "Iterable", "<", "?", "extends", "U", ">", "o2", ")", "{", "Iterator", "<", "?", "extends", "U", ">", "it1", "=", "o1", ".", "iterator", "(", ")", ",", "it2", "=", "o2", ".", "iterator", "(", ")", ";", "while", "(", "it1", ".", "hasNext", "(", ")", "&&", "it2", ".", "hasNext", "(", ")", ")", "{", "int", "cmp", "=", "it1", ".", "next", "(", ")", ".", "compareTo", "(", "it2", ".", "next", "(", ")", ")", ";", "if", "(", "cmp", "!=", "0", ")", "{", "return", "cmp", ";", "}", "}", "if", "(", "it1", ".", "hasNext", "(", ")", ")", "{", "return", "1", ";", "}", "else", "if", "(", "it2", ".", "hasNext", "(", ")", ")", "{", "return", "-", "1", ";", "}", "return", "0", ";", "}" ]
Lexicographically compares two {@link Iterable}s, whose element types are comparable.
[ "Lexicographically", "compares", "two", "{" ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/comparison/CmpUtil.java#L145-L161
linkedin/dexmaker
dexmaker/src/main/java/com/android/dx/Code.java
Code.sput
public <V> void sput(FieldId<?, V> fieldId, Local<? extends V> source) { """ Copies the value in {@code source} to the static field {@code fieldId}. """ addInstruction(new ThrowingCstInsn(Rops.opPutStatic(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec()), catches, fieldId.constant)); }
java
public <V> void sput(FieldId<?, V> fieldId, Local<? extends V> source) { addInstruction(new ThrowingCstInsn(Rops.opPutStatic(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec()), catches, fieldId.constant)); }
[ "public", "<", "V", ">", "void", "sput", "(", "FieldId", "<", "?", ",", "V", ">", "fieldId", ",", "Local", "<", "?", "extends", "V", ">", "source", ")", "{", "addInstruction", "(", "new", "ThrowingCstInsn", "(", "Rops", ".", "opPutStatic", "(", "source", ".", "type", ".", "ropType", ")", ",", "sourcePosition", ",", "RegisterSpecList", ".", "make", "(", "source", ".", "spec", "(", ")", ")", ",", "catches", ",", "fieldId", ".", "constant", ")", ")", ";", "}" ]
Copies the value in {@code source} to the static field {@code fieldId}.
[ "Copies", "the", "value", "in", "{" ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L617-L620
i-net-software/jlessc
src/com/inet/lib/less/Operation.java
Operation.doubleValueRightColor
private double doubleValueRightColor( double left, double color ) { """ Calculate a number on left with a color on the right side. The calculation occur for every color channel. @param left the left @param color the color @return color value as long """ return rgba( doubleValue( left, red( color ) ), // doubleValue( left, green( color ) ), // doubleValue( left, blue( color ) ), 1 ); }
java
private double doubleValueRightColor( double left, double color ) { return rgba( doubleValue( left, red( color ) ), // doubleValue( left, green( color ) ), // doubleValue( left, blue( color ) ), 1 ); }
[ "private", "double", "doubleValueRightColor", "(", "double", "left", ",", "double", "color", ")", "{", "return", "rgba", "(", "doubleValue", "(", "left", ",", "red", "(", "color", ")", ")", ",", "//", "doubleValue", "(", "left", ",", "green", "(", "color", ")", ")", ",", "//", "doubleValue", "(", "left", ",", "blue", "(", "color", ")", ")", ",", "1", ")", ";", "}" ]
Calculate a number on left with a color on the right side. The calculation occur for every color channel. @param left the left @param color the color @return color value as long
[ "Calculate", "a", "number", "on", "left", "with", "a", "color", "on", "the", "right", "side", ".", "The", "calculation", "occur", "for", "every", "color", "channel", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L393-L397
epam/parso
src/main/java/com/epam/parso/impl/AbstractCSVWriter.java
AbstractCSVWriter.checkSurroundByQuotesAndWrite
static void checkSurroundByQuotesAndWrite(Writer writer, String delimiter, String trimmedText) throws IOException { """ The method to write a text represented by an array of bytes using writer. If the text contains the delimiter, line breaks, tabulation characters, and double quotes, the text is stropped. @param writer the variable to output data. @param delimiter if trimmedText contains this delimiter it will be stropped. @param trimmedText the array of bytes that contains the text to output. @throws java.io.IOException appears if the output into writer is impossible. """ writer.write(checkSurroundByQuotes(delimiter, trimmedText)); }
java
static void checkSurroundByQuotesAndWrite(Writer writer, String delimiter, String trimmedText) throws IOException { writer.write(checkSurroundByQuotes(delimiter, trimmedText)); }
[ "static", "void", "checkSurroundByQuotesAndWrite", "(", "Writer", "writer", ",", "String", "delimiter", ",", "String", "trimmedText", ")", "throws", "IOException", "{", "writer", ".", "write", "(", "checkSurroundByQuotes", "(", "delimiter", ",", "trimmedText", ")", ")", ";", "}" ]
The method to write a text represented by an array of bytes using writer. If the text contains the delimiter, line breaks, tabulation characters, and double quotes, the text is stropped. @param writer the variable to output data. @param delimiter if trimmedText contains this delimiter it will be stropped. @param trimmedText the array of bytes that contains the text to output. @throws java.io.IOException appears if the output into writer is impossible.
[ "The", "method", "to", "write", "a", "text", "represented", "by", "an", "array", "of", "bytes", "using", "writer", ".", "If", "the", "text", "contains", "the", "delimiter", "line", "breaks", "tabulation", "characters", "and", "double", "quotes", "the", "text", "is", "stropped", "." ]
train
https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/AbstractCSVWriter.java#L120-L122
Netflix/ribbon
ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/RetryRule.java
RetryRule.choose
public Server choose(ILoadBalancer lb, Object key) { """ /* Loop if necessary. Note that the time CAN be exceeded depending on the subRule, because we're not spawning additional threads and returning early. """ long requestTime = System.currentTimeMillis(); long deadline = requestTime + maxRetryMillis; Server answer = null; answer = subRule.choose(key); if (((answer == null) || (!answer.isAlive())) && (System.currentTimeMillis() < deadline)) { InterruptTask task = new InterruptTask(deadline - System.currentTimeMillis()); while (!Thread.interrupted()) { answer = subRule.choose(key); if (((answer == null) || (!answer.isAlive())) && (System.currentTimeMillis() < deadline)) { /* pause and retry hoping it's transient */ Thread.yield(); } else { break; } } task.cancel(); } if ((answer == null) || (!answer.isAlive())) { return null; } else { return answer; } }
java
public Server choose(ILoadBalancer lb, Object key) { long requestTime = System.currentTimeMillis(); long deadline = requestTime + maxRetryMillis; Server answer = null; answer = subRule.choose(key); if (((answer == null) || (!answer.isAlive())) && (System.currentTimeMillis() < deadline)) { InterruptTask task = new InterruptTask(deadline - System.currentTimeMillis()); while (!Thread.interrupted()) { answer = subRule.choose(key); if (((answer == null) || (!answer.isAlive())) && (System.currentTimeMillis() < deadline)) { /* pause and retry hoping it's transient */ Thread.yield(); } else { break; } } task.cancel(); } if ((answer == null) || (!answer.isAlive())) { return null; } else { return answer; } }
[ "public", "Server", "choose", "(", "ILoadBalancer", "lb", ",", "Object", "key", ")", "{", "long", "requestTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "long", "deadline", "=", "requestTime", "+", "maxRetryMillis", ";", "Server", "answer", "=", "null", ";", "answer", "=", "subRule", ".", "choose", "(", "key", ")", ";", "if", "(", "(", "(", "answer", "==", "null", ")", "||", "(", "!", "answer", ".", "isAlive", "(", ")", ")", ")", "&&", "(", "System", ".", "currentTimeMillis", "(", ")", "<", "deadline", ")", ")", "{", "InterruptTask", "task", "=", "new", "InterruptTask", "(", "deadline", "-", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "while", "(", "!", "Thread", ".", "interrupted", "(", ")", ")", "{", "answer", "=", "subRule", ".", "choose", "(", "key", ")", ";", "if", "(", "(", "(", "answer", "==", "null", ")", "||", "(", "!", "answer", ".", "isAlive", "(", ")", ")", ")", "&&", "(", "System", ".", "currentTimeMillis", "(", ")", "<", "deadline", ")", ")", "{", "/* pause and retry hoping it's transient */", "Thread", ".", "yield", "(", ")", ";", "}", "else", "{", "break", ";", "}", "}", "task", ".", "cancel", "(", ")", ";", "}", "if", "(", "(", "answer", "==", "null", ")", "||", "(", "!", "answer", ".", "isAlive", "(", ")", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return", "answer", ";", "}", "}" ]
/* Loop if necessary. Note that the time CAN be exceeded depending on the subRule, because we're not spawning additional threads and returning early.
[ "/", "*", "Loop", "if", "necessary", ".", "Note", "that", "the", "time", "CAN", "be", "exceeded", "depending", "on", "the", "subRule", "because", "we", "re", "not", "spawning", "additional", "threads", "and", "returning", "early", "." ]
train
https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/RetryRule.java#L78-L112
alkacon/opencms-core
src/org/opencms/search/documents/A_CmsVfsDocument.java
A_CmsVfsDocument.readFile
protected CmsFile readFile(CmsObject cms, CmsResource resource) throws CmsException, CmsIndexNoContentException { """ Upgrades the given resource to a {@link CmsFile} with content.<p> @param cms the current users OpenCms context @param resource the resource to upgrade @return the given resource upgraded to a {@link CmsFile} with content @throws CmsException if the resource could not be read @throws CmsIndexNoContentException if the resource has no content """ CmsFile file = cms.readFile(resource); if (file.getLength() <= 0) { throw new CmsIndexNoContentException( Messages.get().container(Messages.ERR_NO_CONTENT_1, resource.getRootPath())); } return file; }
java
protected CmsFile readFile(CmsObject cms, CmsResource resource) throws CmsException, CmsIndexNoContentException { CmsFile file = cms.readFile(resource); if (file.getLength() <= 0) { throw new CmsIndexNoContentException( Messages.get().container(Messages.ERR_NO_CONTENT_1, resource.getRootPath())); } return file; }
[ "protected", "CmsFile", "readFile", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "throws", "CmsException", ",", "CmsIndexNoContentException", "{", "CmsFile", "file", "=", "cms", ".", "readFile", "(", "resource", ")", ";", "if", "(", "file", ".", "getLength", "(", ")", "<=", "0", ")", "{", "throw", "new", "CmsIndexNoContentException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_NO_CONTENT_1", ",", "resource", ".", "getRootPath", "(", ")", ")", ")", ";", "}", "return", "file", ";", "}" ]
Upgrades the given resource to a {@link CmsFile} with content.<p> @param cms the current users OpenCms context @param resource the resource to upgrade @return the given resource upgraded to a {@link CmsFile} with content @throws CmsException if the resource could not be read @throws CmsIndexNoContentException if the resource has no content
[ "Upgrades", "the", "given", "resource", "to", "a", "{", "@link", "CmsFile", "}", "with", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/A_CmsVfsDocument.java#L250-L258
tvesalainen/util
util/src/main/java/org/vesalainen/util/CollectionHelp.java
CollectionHelp.quickSort
public static final <T> void quickSort(List<T> list, Comparator<T> comparator) { """ Sort list using quick-sort algorithm <p>Needs a big list to have any benefit to ArrayList.sort! @param <T> @param list @param comparator @see java.util.ArrayList#sort(java.util.Comparator) """ quickSort(list, 0, list.size()-1, comparator); }
java
public static final <T> void quickSort(List<T> list, Comparator<T> comparator) { quickSort(list, 0, list.size()-1, comparator); }
[ "public", "static", "final", "<", "T", ">", "void", "quickSort", "(", "List", "<", "T", ">", "list", ",", "Comparator", "<", "T", ">", "comparator", ")", "{", "quickSort", "(", "list", ",", "0", ",", "list", ".", "size", "(", ")", "-", "1", ",", "comparator", ")", ";", "}" ]
Sort list using quick-sort algorithm <p>Needs a big list to have any benefit to ArrayList.sort! @param <T> @param list @param comparator @see java.util.ArrayList#sort(java.util.Comparator)
[ "Sort", "list", "using", "quick", "-", "sort", "algorithm", "<p", ">", "Needs", "a", "big", "list", "to", "have", "any", "benefit", "to", "ArrayList", ".", "sort!" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CollectionHelp.java#L381-L384
awin/rabbiteasy
rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/MessageConsumer.java
MessageConsumer.handleDelivery
public void handleDelivery(String consumerTag, Envelope envelope, BasicProperties properties, byte[] body) throws IOException { """ <p>Handles a message delivery from the broker by converting the received message parts to a {@link com.zanox.rabbiteasy.Message} which provides convenient access to the message parts and hands it over to the {@link #handleMessage(com.zanox.rabbiteasy.Message)} method.</p> """ LOGGER.debug("Consumer {}: Received handle delivery", consumerTag); Message message = new Message(properties) .exchange(envelope.getExchange()) .routingKey(envelope.getRoutingKey()) .deliveryTag(envelope.getDeliveryTag()) .body(body); try { LOGGER.info("Consumer {}: Received message {}", consumerTag, envelope.getDeliveryTag()); handleMessage(message); } catch (Throwable t) { if (!getConfiguration().isAutoAck()) { LOGGER.error("Consumer {}: Message {} could not be handled due to an exception during message processing", new Object[] { consumerTag, envelope.getDeliveryTag(), t }); getChannel().basicNack(envelope.getDeliveryTag(), false, false); LOGGER.warn("Consumer {}: Nacked message {}", new Object[] { consumerTag, envelope.getDeliveryTag(), t }); } return; } if (!getConfiguration().isAutoAck()) { try { getChannel().basicAck(envelope.getDeliveryTag(), false); LOGGER.debug("Consumer {}: Acked message {}", consumerTag, envelope.getDeliveryTag() ); } catch(IOException e) { LOGGER.error("Consumer {}: Message {} was processed but could not be acknowledged due to an exception when sending the acknowledgement", new Object[] { consumerTag, envelope.getDeliveryTag(), e }); throw e; } } }
java
public void handleDelivery(String consumerTag, Envelope envelope, BasicProperties properties, byte[] body) throws IOException { LOGGER.debug("Consumer {}: Received handle delivery", consumerTag); Message message = new Message(properties) .exchange(envelope.getExchange()) .routingKey(envelope.getRoutingKey()) .deliveryTag(envelope.getDeliveryTag()) .body(body); try { LOGGER.info("Consumer {}: Received message {}", consumerTag, envelope.getDeliveryTag()); handleMessage(message); } catch (Throwable t) { if (!getConfiguration().isAutoAck()) { LOGGER.error("Consumer {}: Message {} could not be handled due to an exception during message processing", new Object[] { consumerTag, envelope.getDeliveryTag(), t }); getChannel().basicNack(envelope.getDeliveryTag(), false, false); LOGGER.warn("Consumer {}: Nacked message {}", new Object[] { consumerTag, envelope.getDeliveryTag(), t }); } return; } if (!getConfiguration().isAutoAck()) { try { getChannel().basicAck(envelope.getDeliveryTag(), false); LOGGER.debug("Consumer {}: Acked message {}", consumerTag, envelope.getDeliveryTag() ); } catch(IOException e) { LOGGER.error("Consumer {}: Message {} was processed but could not be acknowledged due to an exception when sending the acknowledgement", new Object[] { consumerTag, envelope.getDeliveryTag(), e }); throw e; } } }
[ "public", "void", "handleDelivery", "(", "String", "consumerTag", ",", "Envelope", "envelope", ",", "BasicProperties", "properties", ",", "byte", "[", "]", "body", ")", "throws", "IOException", "{", "LOGGER", ".", "debug", "(", "\"Consumer {}: Received handle delivery\"", ",", "consumerTag", ")", ";", "Message", "message", "=", "new", "Message", "(", "properties", ")", ".", "exchange", "(", "envelope", ".", "getExchange", "(", ")", ")", ".", "routingKey", "(", "envelope", ".", "getRoutingKey", "(", ")", ")", ".", "deliveryTag", "(", "envelope", ".", "getDeliveryTag", "(", ")", ")", ".", "body", "(", "body", ")", ";", "try", "{", "LOGGER", ".", "info", "(", "\"Consumer {}: Received message {}\"", ",", "consumerTag", ",", "envelope", ".", "getDeliveryTag", "(", ")", ")", ";", "handleMessage", "(", "message", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "if", "(", "!", "getConfiguration", "(", ")", ".", "isAutoAck", "(", ")", ")", "{", "LOGGER", ".", "error", "(", "\"Consumer {}: Message {} could not be handled due to an exception during message processing\"", ",", "new", "Object", "[", "]", "{", "consumerTag", ",", "envelope", ".", "getDeliveryTag", "(", ")", ",", "t", "}", ")", ";", "getChannel", "(", ")", ".", "basicNack", "(", "envelope", ".", "getDeliveryTag", "(", ")", ",", "false", ",", "false", ")", ";", "LOGGER", ".", "warn", "(", "\"Consumer {}: Nacked message {}\"", ",", "new", "Object", "[", "]", "{", "consumerTag", ",", "envelope", ".", "getDeliveryTag", "(", ")", ",", "t", "}", ")", ";", "}", "return", ";", "}", "if", "(", "!", "getConfiguration", "(", ")", ".", "isAutoAck", "(", ")", ")", "{", "try", "{", "getChannel", "(", ")", ".", "basicAck", "(", "envelope", ".", "getDeliveryTag", "(", ")", ",", "false", ")", ";", "LOGGER", ".", "debug", "(", "\"Consumer {}: Acked message {}\"", ",", "consumerTag", ",", "envelope", ".", "getDeliveryTag", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"Consumer {}: Message {} was processed but could not be acknowledged due to an exception when sending the acknowledgement\"", ",", "new", "Object", "[", "]", "{", "consumerTag", ",", "envelope", ".", "getDeliveryTag", "(", ")", ",", "e", "}", ")", ";", "throw", "e", ";", "}", "}", "}" ]
<p>Handles a message delivery from the broker by converting the received message parts to a {@link com.zanox.rabbiteasy.Message} which provides convenient access to the message parts and hands it over to the {@link #handleMessage(com.zanox.rabbiteasy.Message)} method.</p>
[ "<p", ">", "Handles", "a", "message", "delivery", "from", "the", "broker", "by", "converting", "the", "received", "message", "parts", "to", "a", "{", "@link", "com", ".", "zanox", ".", "rabbiteasy", ".", "Message", "}", "which", "provides", "convenient", "access", "to", "the", "message", "parts", "and", "hands", "it", "over", "to", "the", "{", "@link", "#handleMessage", "(", "com", ".", "zanox", ".", "rabbiteasy", ".", "Message", ")", "}", "method", ".", "<", "/", "p", ">" ]
train
https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/MessageConsumer.java#L68-L99
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/BufferedImageFactory.java
BufferedImageFactory.get
public static BufferedImage get(Image img, int imgType) { """ Creates a new BufferedImage of the specified imgType and same size as the provided image and draws the provided Image onto the new BufferedImage. @param img to be copied to BufferedImage @param imgType of the BufferedImage. See {@link BufferedImage#BufferedImage(int, int, int)} for details on the available imgTypes. @return a BufferedImage copy of the provided Image @since 1.0 """ Function<Integer, ImageObserver> obs = flags->{ return (image, infoflags, x, y, width, height)->(infoflags & flags)!=flags; }; BufferedImage bimg = new BufferedImage( img.getWidth(obs.apply(ImageObserver.WIDTH)), img.getHeight(obs.apply(ImageObserver.HEIGHT)), imgType); Graphics2D gr2D = bimg.createGraphics(); gr2D.drawImage(img, 0, 0, obs.apply(ImageObserver.ALLBITS)); gr2D.dispose(); return bimg; }
java
public static BufferedImage get(Image img, int imgType){ Function<Integer, ImageObserver> obs = flags->{ return (image, infoflags, x, y, width, height)->(infoflags & flags)!=flags; }; BufferedImage bimg = new BufferedImage( img.getWidth(obs.apply(ImageObserver.WIDTH)), img.getHeight(obs.apply(ImageObserver.HEIGHT)), imgType); Graphics2D gr2D = bimg.createGraphics(); gr2D.drawImage(img, 0, 0, obs.apply(ImageObserver.ALLBITS)); gr2D.dispose(); return bimg; }
[ "public", "static", "BufferedImage", "get", "(", "Image", "img", ",", "int", "imgType", ")", "{", "Function", "<", "Integer", ",", "ImageObserver", ">", "obs", "=", "flags", "->", "{", "return", "(", "image", ",", "infoflags", ",", "x", ",", "y", ",", "width", ",", "height", ")", "->", "(", "infoflags", "&", "flags", ")", "!=", "flags", ";", "}", ";", "BufferedImage", "bimg", "=", "new", "BufferedImage", "(", "img", ".", "getWidth", "(", "obs", ".", "apply", "(", "ImageObserver", ".", "WIDTH", ")", ")", ",", "img", ".", "getHeight", "(", "obs", ".", "apply", "(", "ImageObserver", ".", "HEIGHT", ")", ")", ",", "imgType", ")", ";", "Graphics2D", "gr2D", "=", "bimg", ".", "createGraphics", "(", ")", ";", "gr2D", ".", "drawImage", "(", "img", ",", "0", ",", "0", ",", "obs", ".", "apply", "(", "ImageObserver", ".", "ALLBITS", ")", ")", ";", "gr2D", ".", "dispose", "(", ")", ";", "return", "bimg", ";", "}" ]
Creates a new BufferedImage of the specified imgType and same size as the provided image and draws the provided Image onto the new BufferedImage. @param img to be copied to BufferedImage @param imgType of the BufferedImage. See {@link BufferedImage#BufferedImage(int, int, int)} for details on the available imgTypes. @return a BufferedImage copy of the provided Image @since 1.0
[ "Creates", "a", "new", "BufferedImage", "of", "the", "specified", "imgType", "and", "same", "size", "as", "the", "provided", "image", "and", "draws", "the", "provided", "Image", "onto", "the", "new", "BufferedImage", "." ]
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/BufferedImageFactory.java#L60-L74
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/qe/FilteringScore.java
FilteringScore.getHandledFilter
public Filter<S> getHandledFilter() { """ Returns the composite handled filter, or null if no matches at all. """ Filter<S> identity = getIdentityFilter(); Filter<S> rangeStart = buildCompositeFilter(getRangeStartFilters()); Filter<S> rangeEnd = buildCompositeFilter(getRangeEndFilters()); return and(and(identity, rangeStart), rangeEnd); }
java
public Filter<S> getHandledFilter() { Filter<S> identity = getIdentityFilter(); Filter<S> rangeStart = buildCompositeFilter(getRangeStartFilters()); Filter<S> rangeEnd = buildCompositeFilter(getRangeEndFilters()); return and(and(identity, rangeStart), rangeEnd); }
[ "public", "Filter", "<", "S", ">", "getHandledFilter", "(", ")", "{", "Filter", "<", "S", ">", "identity", "=", "getIdentityFilter", "(", ")", ";", "Filter", "<", "S", ">", "rangeStart", "=", "buildCompositeFilter", "(", "getRangeStartFilters", "(", ")", ")", ";", "Filter", "<", "S", ">", "rangeEnd", "=", "buildCompositeFilter", "(", "getRangeEndFilters", "(", ")", ")", ";", "return", "and", "(", "and", "(", "identity", ",", "rangeStart", ")", ",", "rangeEnd", ")", ";", "}" ]
Returns the composite handled filter, or null if no matches at all.
[ "Returns", "the", "composite", "handled", "filter", "or", "null", "if", "no", "matches", "at", "all", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/qe/FilteringScore.java#L485-L491
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/builder/JNDIContentRepositoryBuilder.java
JNDIContentRepositoryBuilder.withContextProperty
public JNDIContentRepositoryBuilder withContextProperty(final String name, final Object value) { """ Adds a new context property to the environment for the JNDI lookup context @param name the name of the environment variable @param value the value to assign to the variable @return this test rule """ contextProperties.put(name, value); return this; }
java
public JNDIContentRepositoryBuilder withContextProperty(final String name, final Object value) { contextProperties.put(name, value); return this; }
[ "public", "JNDIContentRepositoryBuilder", "withContextProperty", "(", "final", "String", "name", ",", "final", "Object", "value", ")", "{", "contextProperties", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a new context property to the environment for the JNDI lookup context @param name the name of the environment variable @param value the value to assign to the variable @return this test rule
[ "Adds", "a", "new", "context", "property", "to", "the", "environment", "for", "the", "JNDI", "lookup", "context" ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/builder/JNDIContentRepositoryBuilder.java#L131-L135
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ResourceLoader.java
ResourceLoader.getResourceAsDocument
public static Document getResourceAsDocument(Class<?> requestingClass, String resource) throws ResourceMissingException, IOException, ParserConfigurationException, SAXException { """ Get the contents of a URL as an XML Document, first trying to read the Document with validation turned on, and falling back to reading it with validation turned off. @param requestingClass the java.lang.Class object of the class that is attempting to load the resource @param resource a String describing the full or partial URL of the resource whose contents to load @return the actual contents of the resource as an XML Document @throws ResourceMissingException @throws java.io.IOException @throws javax.xml.parsers.ParserConfigurationException @throws org.xml.sax.SAXException """ // Default is non-validating... return getResourceAsDocument(requestingClass, resource, false); }
java
public static Document getResourceAsDocument(Class<?> requestingClass, String resource) throws ResourceMissingException, IOException, ParserConfigurationException, SAXException { // Default is non-validating... return getResourceAsDocument(requestingClass, resource, false); }
[ "public", "static", "Document", "getResourceAsDocument", "(", "Class", "<", "?", ">", "requestingClass", ",", "String", "resource", ")", "throws", "ResourceMissingException", ",", "IOException", ",", "ParserConfigurationException", ",", "SAXException", "{", "// Default is non-validating...", "return", "getResourceAsDocument", "(", "requestingClass", ",", "resource", ",", "false", ")", ";", "}" ]
Get the contents of a URL as an XML Document, first trying to read the Document with validation turned on, and falling back to reading it with validation turned off. @param requestingClass the java.lang.Class object of the class that is attempting to load the resource @param resource a String describing the full or partial URL of the resource whose contents to load @return the actual contents of the resource as an XML Document @throws ResourceMissingException @throws java.io.IOException @throws javax.xml.parsers.ParserConfigurationException @throws org.xml.sax.SAXException
[ "Get", "the", "contents", "of", "a", "URL", "as", "an", "XML", "Document", "first", "trying", "to", "read", "the", "Document", "with", "validation", "turned", "on", "and", "falling", "back", "to", "reading", "it", "with", "validation", "turned", "off", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ResourceLoader.java#L293-L299
facebookarchive/hadoop-20
src/contrib/streaming/src/java/org/apache/hadoop/streaming/PipeMapRed.java
PipeMapRed.splitKeyVal
void splitKeyVal(byte[] line, int length, Text key, Text val) throws IOException { """ Split a line into key and value. @param line: a byte array of line containing UTF-8 bytes @param key: key of a record @param val: value of a record @throws IOException """ int numKeyFields = getNumOfKeyFields(); byte[] separator = getFieldSeparator(); // Need to find numKeyFields separators int pos = UTF8ByteArrayUtils.findBytes(line, 0, length, separator); for(int k=1; k<numKeyFields && pos!=-1; k++) { pos = UTF8ByteArrayUtils.findBytes(line, pos + separator.length, length, separator); } try { if (pos == -1) { key.set(line, 0, length); val.set(""); } else { StreamKeyValUtil.splitKeyVal(line, 0, length, key, val, pos, separator.length); } } catch (CharacterCodingException e) { LOG.warn(StringUtils.stringifyException(e)); } }
java
void splitKeyVal(byte[] line, int length, Text key, Text val) throws IOException { int numKeyFields = getNumOfKeyFields(); byte[] separator = getFieldSeparator(); // Need to find numKeyFields separators int pos = UTF8ByteArrayUtils.findBytes(line, 0, length, separator); for(int k=1; k<numKeyFields && pos!=-1; k++) { pos = UTF8ByteArrayUtils.findBytes(line, pos + separator.length, length, separator); } try { if (pos == -1) { key.set(line, 0, length); val.set(""); } else { StreamKeyValUtil.splitKeyVal(line, 0, length, key, val, pos, separator.length); } } catch (CharacterCodingException e) { LOG.warn(StringUtils.stringifyException(e)); } }
[ "void", "splitKeyVal", "(", "byte", "[", "]", "line", ",", "int", "length", ",", "Text", "key", ",", "Text", "val", ")", "throws", "IOException", "{", "int", "numKeyFields", "=", "getNumOfKeyFields", "(", ")", ";", "byte", "[", "]", "separator", "=", "getFieldSeparator", "(", ")", ";", "// Need to find numKeyFields separators", "int", "pos", "=", "UTF8ByteArrayUtils", ".", "findBytes", "(", "line", ",", "0", ",", "length", ",", "separator", ")", ";", "for", "(", "int", "k", "=", "1", ";", "k", "<", "numKeyFields", "&&", "pos", "!=", "-", "1", ";", "k", "++", ")", "{", "pos", "=", "UTF8ByteArrayUtils", ".", "findBytes", "(", "line", ",", "pos", "+", "separator", ".", "length", ",", "length", ",", "separator", ")", ";", "}", "try", "{", "if", "(", "pos", "==", "-", "1", ")", "{", "key", ".", "set", "(", "line", ",", "0", ",", "length", ")", ";", "val", ".", "set", "(", "\"\"", ")", ";", "}", "else", "{", "StreamKeyValUtil", ".", "splitKeyVal", "(", "line", ",", "0", ",", "length", ",", "key", ",", "val", ",", "pos", ",", "separator", ".", "length", ")", ";", "}", "}", "catch", "(", "CharacterCodingException", "e", ")", "{", "LOG", ".", "warn", "(", "StringUtils", ".", "stringifyException", "(", "e", ")", ")", ";", "}", "}" ]
Split a line into key and value. @param line: a byte array of line containing UTF-8 bytes @param key: key of a record @param val: value of a record @throws IOException
[ "Split", "a", "line", "into", "key", "and", "value", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/streaming/src/java/org/apache/hadoop/streaming/PipeMapRed.java#L375-L396
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ling/WordLemmaTagFactory.java
WordLemmaTagFactory.newLabelFromString
public Label newLabelFromString(String labelStr) { """ Create a new word, where the label is formed from the <code>String</code> passed in. The String is divided according to the divider character. We assume that we can always just divide on the rightmost divider character, rather than trying to parse up escape sequences. If the divider character isn't found in the word, then the whole string becomes the word, and lemma and tag are <code>null</code>. We assume that if only one divider character is found, word and tag are presents in the String, and lemma will be computed. @param labelStr The word that will go into the <code>Word</code> @return The new WordLemmaTag """ int first = labelStr.indexOf(divider); int second = labelStr.lastIndexOf(divider); if (first == second) { return new WordLemmaTag(labelStr.substring(0, first), Morphology.stemStatic(labelStr.substring(0, first), labelStr.substring(first + 1)).word(), labelStr.substring(first + 1)); } else if (first >= 0) { return new WordLemmaTag(labelStr.substring(0, first), labelStr.substring(first + 1, second), labelStr.substring(second + 1)); } else { return new WordLemmaTag(labelStr); } }
java
public Label newLabelFromString(String labelStr) { int first = labelStr.indexOf(divider); int second = labelStr.lastIndexOf(divider); if (first == second) { return new WordLemmaTag(labelStr.substring(0, first), Morphology.stemStatic(labelStr.substring(0, first), labelStr.substring(first + 1)).word(), labelStr.substring(first + 1)); } else if (first >= 0) { return new WordLemmaTag(labelStr.substring(0, first), labelStr.substring(first + 1, second), labelStr.substring(second + 1)); } else { return new WordLemmaTag(labelStr); } }
[ "public", "Label", "newLabelFromString", "(", "String", "labelStr", ")", "{", "int", "first", "=", "labelStr", ".", "indexOf", "(", "divider", ")", ";", "int", "second", "=", "labelStr", ".", "lastIndexOf", "(", "divider", ")", ";", "if", "(", "first", "==", "second", ")", "{", "return", "new", "WordLemmaTag", "(", "labelStr", ".", "substring", "(", "0", ",", "first", ")", ",", "Morphology", ".", "stemStatic", "(", "labelStr", ".", "substring", "(", "0", ",", "first", ")", ",", "labelStr", ".", "substring", "(", "first", "+", "1", ")", ")", ".", "word", "(", ")", ",", "labelStr", ".", "substring", "(", "first", "+", "1", ")", ")", ";", "}", "else", "if", "(", "first", ">=", "0", ")", "{", "return", "new", "WordLemmaTag", "(", "labelStr", ".", "substring", "(", "0", ",", "first", ")", ",", "labelStr", ".", "substring", "(", "first", "+", "1", ",", "second", ")", ",", "labelStr", ".", "substring", "(", "second", "+", "1", ")", ")", ";", "}", "else", "{", "return", "new", "WordLemmaTag", "(", "labelStr", ")", ";", "}", "}" ]
Create a new word, where the label is formed from the <code>String</code> passed in. The String is divided according to the divider character. We assume that we can always just divide on the rightmost divider character, rather than trying to parse up escape sequences. If the divider character isn't found in the word, then the whole string becomes the word, and lemma and tag are <code>null</code>. We assume that if only one divider character is found, word and tag are presents in the String, and lemma will be computed. @param labelStr The word that will go into the <code>Word</code> @return The new WordLemmaTag
[ "Create", "a", "new", "word", "where", "the", "label", "is", "formed", "from", "the", "<code", ">", "String<", "/", "code", ">", "passed", "in", ".", "The", "String", "is", "divided", "according", "to", "the", "divider", "character", ".", "We", "assume", "that", "we", "can", "always", "just", "divide", "on", "the", "rightmost", "divider", "character", "rather", "than", "trying", "to", "parse", "up", "escape", "sequences", ".", "If", "the", "divider", "character", "isn", "t", "found", "in", "the", "word", "then", "the", "whole", "string", "becomes", "the", "word", "and", "lemma", "and", "tag", "are", "<code", ">", "null<", "/", "code", ">", ".", "We", "assume", "that", "if", "only", "one", "divider", "character", "is", "found", "word", "and", "tag", "are", "presents", "in", "the", "String", "and", "lemma", "will", "be", "computed", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ling/WordLemmaTagFactory.java#L87-L97
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteGatewaysInner.java
ExpressRouteGatewaysInner.beginCreateOrUpdate
public ExpressRouteGatewayInner beginCreateOrUpdate(String resourceGroupName, String expressRouteGatewayName, ExpressRouteGatewayInner putExpressRouteGatewayParameters) { """ Creates or updates a ExpressRoute gateway in a specified resource group. @param resourceGroupName The name of the resource group. @param expressRouteGatewayName The name of the ExpressRoute gateway. @param putExpressRouteGatewayParameters Parameters required in an ExpressRoute gateway PUT operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteGatewayInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters).toBlocking().single().body(); }
java
public ExpressRouteGatewayInner beginCreateOrUpdate(String resourceGroupName, String expressRouteGatewayName, ExpressRouteGatewayInner putExpressRouteGatewayParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters).toBlocking().single().body(); }
[ "public", "ExpressRouteGatewayInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "expressRouteGatewayName", ",", "ExpressRouteGatewayInner", "putExpressRouteGatewayParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "expressRouteGatewayName", ",", "putExpressRouteGatewayParameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates a ExpressRoute gateway in a specified resource group. @param resourceGroupName The name of the resource group. @param expressRouteGatewayName The name of the ExpressRoute gateway. @param putExpressRouteGatewayParameters Parameters required in an ExpressRoute gateway PUT operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteGatewayInner object if successful.
[ "Creates", "or", "updates", "a", "ExpressRoute", "gateway", "in", "a", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteGatewaysInner.java#L345-L347
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/io/JsonUtil.java
JsonUtil.writeJson
public static void writeJson(@javax.annotation.Nonnull final OutputStream out, final Object obj) throws IOException { """ Write json. @param out the out @param obj the obj @throws IOException the io exception """ final ObjectMapper mapper = new ObjectMapper().enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL) .enable(SerializationFeature.INDENT_OUTPUT); @javax.annotation.Nonnull final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); mapper.writeValue(buffer, obj); out.write(buffer.toByteArray()); }
java
public static void writeJson(@javax.annotation.Nonnull final OutputStream out, final Object obj) throws IOException { final ObjectMapper mapper = new ObjectMapper().enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL) .enable(SerializationFeature.INDENT_OUTPUT); @javax.annotation.Nonnull final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); mapper.writeValue(buffer, obj); out.write(buffer.toByteArray()); }
[ "public", "static", "void", "writeJson", "(", "@", "javax", ".", "annotation", ".", "Nonnull", "final", "OutputStream", "out", ",", "final", "Object", "obj", ")", "throws", "IOException", "{", "final", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ".", "enableDefaultTyping", "(", "ObjectMapper", ".", "DefaultTyping", ".", "NON_FINAL", ")", ".", "enable", "(", "SerializationFeature", ".", "INDENT_OUTPUT", ")", ";", "@", "javax", ".", "annotation", ".", "Nonnull", "final", "ByteArrayOutputStream", "buffer", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "mapper", ".", "writeValue", "(", "buffer", ",", "obj", ")", ";", "out", ".", "write", "(", "buffer", ".", "toByteArray", "(", ")", ")", ";", "}" ]
Write json. @param out the out @param obj the obj @throws IOException the io exception
[ "Write", "json", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/io/JsonUtil.java#L99-L105
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java
RepositoryResourceImpl.doesResourceMatch
public boolean doesResourceMatch(Collection<ProductDefinition> productDefinitions, Visibility visibility) { """ Perform the matching logic for {@link #getResources(Collection, Collection, Visibility, RepositoryConnectionList)} and {@link #findResources(String, Collection, Collection, Visibility, RepositoryConnectionList)} so that this method will return <code>true</code> if the resource has the <code>visibility</code> supplied and matches one of the products in <code>productDefinitions</code>. @param resource The resource to test @param productDefinitions The product definitions to match to, maybe <code>null</code> which means that no product matching will take place. @param visibility The visibility to match to, maybe <code>null</code> which means that no visibility matching will take place. @return """ ResourceType type = getType(); if (ResourceType.FEATURE == type && visibility != null) { EsaResourceImpl esa = (EsaResourceImpl) this; Visibility visibilityMatches = esa.getVisibility() == null ? Visibility.PUBLIC : esa.getVisibility(); if (!visibilityMatches.equals(visibility)) { // Visibility is different, no match return false; } } // If there is no product definitions defined then say it matches - not being filtered to a specific version boolean matches = productDefinitions == null || productDefinitions.isEmpty(); if (productDefinitions != null) { for (ProductDefinition productDefinition : productDefinitions) { if (matches(productDefinition) == MatchResult.MATCHED) { matches = true; break; } } } return matches; }
java
public boolean doesResourceMatch(Collection<ProductDefinition> productDefinitions, Visibility visibility) { ResourceType type = getType(); if (ResourceType.FEATURE == type && visibility != null) { EsaResourceImpl esa = (EsaResourceImpl) this; Visibility visibilityMatches = esa.getVisibility() == null ? Visibility.PUBLIC : esa.getVisibility(); if (!visibilityMatches.equals(visibility)) { // Visibility is different, no match return false; } } // If there is no product definitions defined then say it matches - not being filtered to a specific version boolean matches = productDefinitions == null || productDefinitions.isEmpty(); if (productDefinitions != null) { for (ProductDefinition productDefinition : productDefinitions) { if (matches(productDefinition) == MatchResult.MATCHED) { matches = true; break; } } } return matches; }
[ "public", "boolean", "doesResourceMatch", "(", "Collection", "<", "ProductDefinition", ">", "productDefinitions", ",", "Visibility", "visibility", ")", "{", "ResourceType", "type", "=", "getType", "(", ")", ";", "if", "(", "ResourceType", ".", "FEATURE", "==", "type", "&&", "visibility", "!=", "null", ")", "{", "EsaResourceImpl", "esa", "=", "(", "EsaResourceImpl", ")", "this", ";", "Visibility", "visibilityMatches", "=", "esa", ".", "getVisibility", "(", ")", "==", "null", "?", "Visibility", ".", "PUBLIC", ":", "esa", ".", "getVisibility", "(", ")", ";", "if", "(", "!", "visibilityMatches", ".", "equals", "(", "visibility", ")", ")", "{", "// Visibility is different, no match", "return", "false", ";", "}", "}", "// If there is no product definitions defined then say it matches - not being filtered to a specific version", "boolean", "matches", "=", "productDefinitions", "==", "null", "||", "productDefinitions", ".", "isEmpty", "(", ")", ";", "if", "(", "productDefinitions", "!=", "null", ")", "{", "for", "(", "ProductDefinition", "productDefinition", ":", "productDefinitions", ")", "{", "if", "(", "matches", "(", "productDefinition", ")", "==", "MatchResult", ".", "MATCHED", ")", "{", "matches", "=", "true", ";", "break", ";", "}", "}", "}", "return", "matches", ";", "}" ]
Perform the matching logic for {@link #getResources(Collection, Collection, Visibility, RepositoryConnectionList)} and {@link #findResources(String, Collection, Collection, Visibility, RepositoryConnectionList)} so that this method will return <code>true</code> if the resource has the <code>visibility</code> supplied and matches one of the products in <code>productDefinitions</code>. @param resource The resource to test @param productDefinitions The product definitions to match to, maybe <code>null</code> which means that no product matching will take place. @param visibility The visibility to match to, maybe <code>null</code> which means that no visibility matching will take place. @return
[ "Perform", "the", "matching", "logic", "for", "{", "@link", "#getResources", "(", "Collection", "Collection", "Visibility", "RepositoryConnectionList", ")", "}", "and", "{", "@link", "#findResources", "(", "String", "Collection", "Collection", "Visibility", "RepositoryConnectionList", ")", "}", "so", "that", "this", "method", "will", "return", "<code", ">", "true<", "/", "code", ">", "if", "the", "resource", "has", "the", "<code", ">", "visibility<", "/", "code", ">", "supplied", "and", "matches", "one", "of", "the", "products", "in", "<code", ">", "productDefinitions<", "/", "code", ">", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/RepositoryResourceImpl.java#L995-L1017
audit4j/audit4j-core
src/main/java/org/audit4j/core/handler/file/archive/AbstractArchiveJob.java
AbstractArchiveJob.getAvailableFiles
protected File[] getAvailableFiles(final String logFileLocation, final Date maxDate) { """ Gets the available files. @param logFileLocation the log file location @param maxDate the max date @return the available files """ File dir = new File(logFileLocation); return dir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String fileName) { boolean extentionMatch = fileName.endsWith(compressionExtention); boolean dateMatch = maxDate.before(fileCreatedDate(fileName)); return dateMatch && extentionMatch; } }); }
java
protected File[] getAvailableFiles(final String logFileLocation, final Date maxDate) { File dir = new File(logFileLocation); return dir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String fileName) { boolean extentionMatch = fileName.endsWith(compressionExtention); boolean dateMatch = maxDate.before(fileCreatedDate(fileName)); return dateMatch && extentionMatch; } }); }
[ "protected", "File", "[", "]", "getAvailableFiles", "(", "final", "String", "logFileLocation", ",", "final", "Date", "maxDate", ")", "{", "File", "dir", "=", "new", "File", "(", "logFileLocation", ")", ";", "return", "dir", ".", "listFiles", "(", "new", "FilenameFilter", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "File", "dir", ",", "String", "fileName", ")", "{", "boolean", "extentionMatch", "=", "fileName", ".", "endsWith", "(", "compressionExtention", ")", ";", "boolean", "dateMatch", "=", "maxDate", ".", "before", "(", "fileCreatedDate", "(", "fileName", ")", ")", ";", "return", "dateMatch", "&&", "extentionMatch", ";", "}", "}", ")", ";", "}" ]
Gets the available files. @param logFileLocation the log file location @param maxDate the max date @return the available files
[ "Gets", "the", "available", "files", "." ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/handler/file/archive/AbstractArchiveJob.java#L66-L79
keenon/loglinear
src/main/java/com/github/keenon/loglinear/model/ConcatVectorNamespace.java
ConcatVectorNamespace.setSparseFeature
public void setSparseFeature(ConcatVector vector, String featureName, String index, double value) { """ This adds a sparse feature to a vector, setting the appropriate component of the given vector to the passed in value. @param vector the vector @param featureName the feature whose value to set @param index the index of the one-hot vector to set, as a string, which we will translate into a mapping @param value the value we want to set this one-hot index to """ vector.setSparseComponent(ensureFeature(featureName), ensureSparseFeature(featureName, index), value); }
java
public void setSparseFeature(ConcatVector vector, String featureName, String index, double value) { vector.setSparseComponent(ensureFeature(featureName), ensureSparseFeature(featureName, index), value); }
[ "public", "void", "setSparseFeature", "(", "ConcatVector", "vector", ",", "String", "featureName", ",", "String", "index", ",", "double", "value", ")", "{", "vector", ".", "setSparseComponent", "(", "ensureFeature", "(", "featureName", ")", ",", "ensureSparseFeature", "(", "featureName", ",", "index", ")", ",", "value", ")", ";", "}" ]
This adds a sparse feature to a vector, setting the appropriate component of the given vector to the passed in value. @param vector the vector @param featureName the feature whose value to set @param index the index of the one-hot vector to set, as a string, which we will translate into a mapping @param value the value we want to set this one-hot index to
[ "This", "adds", "a", "sparse", "feature", "to", "a", "vector", "setting", "the", "appropriate", "component", "of", "the", "given", "vector", "to", "the", "passed", "in", "value", "." ]
train
https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/ConcatVectorNamespace.java#L146-L148
ineunetOS/knife-commons
knife-commons-utils/src/main/java/com/ineunet/knife/util/ReflectionUtils.java
ReflectionUtils.getSuperClassGenricType
@SuppressWarnings("rawtypes") public static Class getSuperClassGenricType(final Class<?> clazz, final int index) { """ 通过反射, 获得Class定义中声明的父类的泛型参数的类型. 如无法找到, 返回Object.class. 如public UserDao extends HibernateDao<User,Long> @param clazz clazz The class to introspect @param index the Index of the generic ddeclaration,start from 0. @return the index generic declaration, or Object.class if cannot be determined """ Type genType = clazz.getGenericSuperclass(); if (!(genType instanceof ParameterizedType)) { /* * By Hilbert Wang @2015-3-8 * logger.info(clazz.getSimpleName() + "'s superclass not ParameterizedType"); */ return Object.class; } Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); if (index >= params.length || index < 0) { logger.warn("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " + params.length); return Object.class; } if (!(params[index] instanceof Class)) { logger.warn(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); return Object.class; } return (Class) params[index]; }
java
@SuppressWarnings("rawtypes") public static Class getSuperClassGenricType(final Class<?> clazz, final int index) { Type genType = clazz.getGenericSuperclass(); if (!(genType instanceof ParameterizedType)) { /* * By Hilbert Wang @2015-3-8 * logger.info(clazz.getSimpleName() + "'s superclass not ParameterizedType"); */ return Object.class; } Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); if (index >= params.length || index < 0) { logger.warn("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " + params.length); return Object.class; } if (!(params[index] instanceof Class)) { logger.warn(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); return Object.class; } return (Class) params[index]; }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "Class", "getSuperClassGenricType", "(", "final", "Class", "<", "?", ">", "clazz", ",", "final", "int", "index", ")", "{", "Type", "genType", "=", "clazz", ".", "getGenericSuperclass", "(", ")", ";", "if", "(", "!", "(", "genType", "instanceof", "ParameterizedType", ")", ")", "{", "/*\n\t\t\t * By Hilbert Wang @2015-3-8\n\t\t\t * logger.info(clazz.getSimpleName() + \"'s superclass not ParameterizedType\");\n\t\t\t */", "return", "Object", ".", "class", ";", "}", "Type", "[", "]", "params", "=", "(", "(", "ParameterizedType", ")", "genType", ")", ".", "getActualTypeArguments", "(", ")", ";", "if", "(", "index", ">=", "params", ".", "length", "||", "index", "<", "0", ")", "{", "logger", ".", "warn", "(", "\"Index: \"", "+", "index", "+", "\", Size of \"", "+", "clazz", ".", "getSimpleName", "(", ")", "+", "\"'s Parameterized Type: \"", "+", "params", ".", "length", ")", ";", "return", "Object", ".", "class", ";", "}", "if", "(", "!", "(", "params", "[", "index", "]", "instanceof", "Class", ")", ")", "{", "logger", ".", "warn", "(", "clazz", ".", "getSimpleName", "(", ")", "+", "\" not set the actual class on superclass generic parameter\"", ")", ";", "return", "Object", ".", "class", ";", "}", "return", "(", "Class", ")", "params", "[", "index", "]", ";", "}" ]
通过反射, 获得Class定义中声明的父类的泛型参数的类型. 如无法找到, 返回Object.class. 如public UserDao extends HibernateDao<User,Long> @param clazz clazz The class to introspect @param index the Index of the generic ddeclaration,start from 0. @return the index generic declaration, or Object.class if cannot be determined
[ "通过反射", "获得Class定义中声明的父类的泛型参数的类型", ".", "如无法找到", "返回Object", ".", "class", "." ]
train
https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/ReflectionUtils.java#L217-L243
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.setKnotBlend
public void setKnotBlend(int n, int type) { """ Set a knot blend type. @param n the knot index @param type the knot blend type @see #getKnotBlend """ knotTypes[n] = (byte)((knotTypes[n] & ~BLEND_MASK) | type); rebuildGradient(); }
java
public void setKnotBlend(int n, int type) { knotTypes[n] = (byte)((knotTypes[n] & ~BLEND_MASK) | type); rebuildGradient(); }
[ "public", "void", "setKnotBlend", "(", "int", "n", ",", "int", "type", ")", "{", "knotTypes", "[", "n", "]", "=", "(", "byte", ")", "(", "(", "knotTypes", "[", "n", "]", "&", "~", "BLEND_MASK", ")", "|", "type", ")", ";", "rebuildGradient", "(", ")", ";", "}" ]
Set a knot blend type. @param n the knot index @param type the knot blend type @see #getKnotBlend
[ "Set", "a", "knot", "blend", "type", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L218-L221
VoltDB/voltdb
third_party/java/src/org/apache/commons_voltpatches/cli/Options.java
Options.addOption
public Options addOption(String opt, boolean hasArg, String description) { """ Add an option that only contains a short-name. It may be specified as requiring an argument. @param opt Short single-character name of the option. @param hasArg flag signally if an argument is required after this option @param description Self-documenting description @return the resulting Options instance """ addOption(opt, null, hasArg, description); return this; }
java
public Options addOption(String opt, boolean hasArg, String description) { addOption(opt, null, hasArg, description); return this; }
[ "public", "Options", "addOption", "(", "String", "opt", ",", "boolean", "hasArg", ",", "String", "description", ")", "{", "addOption", "(", "opt", ",", "null", ",", "hasArg", ",", "description", ")", ";", "return", "this", ";", "}" ]
Add an option that only contains a short-name. It may be specified as requiring an argument. @param opt Short single-character name of the option. @param hasArg flag signally if an argument is required after this option @param description Self-documenting description @return the resulting Options instance
[ "Add", "an", "option", "that", "only", "contains", "a", "short", "-", "name", ".", "It", "may", "be", "specified", "as", "requiring", "an", "argument", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/Options.java#L124-L128
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/element/link/Link.java
Link.connectDevices
public void connectDevices(Device device1, Device device2) throws ShanksException { """ Connect both devices to the link @param device1 @param device2 @throws TooManyConnectionException """ this.connectDevice(device1); try { this.connectDevice(device2); } catch (ShanksException e) { this.disconnectDevice(device1); throw e; } }
java
public void connectDevices(Device device1, Device device2) throws ShanksException { this.connectDevice(device1); try { this.connectDevice(device2); } catch (ShanksException e) { this.disconnectDevice(device1); throw e; } }
[ "public", "void", "connectDevices", "(", "Device", "device1", ",", "Device", "device2", ")", "throws", "ShanksException", "{", "this", ".", "connectDevice", "(", "device1", ")", ";", "try", "{", "this", ".", "connectDevice", "(", "device2", ")", ";", "}", "catch", "(", "ShanksException", "e", ")", "{", "this", ".", "disconnectDevice", "(", "device1", ")", ";", "throw", "e", ";", "}", "}" ]
Connect both devices to the link @param device1 @param device2 @throws TooManyConnectionException
[ "Connect", "both", "devices", "to", "the", "link" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/element/link/Link.java#L123-L132
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/dialect/impl/GridDialects.java
GridDialects.getDialectFacetOrNull
static <T extends GridDialect> T getDialectFacetOrNull(GridDialect gridDialect, Class<T> facetType) { """ Returns the given dialect, narrowed down to the given dialect facet in case it is implemented by the dialect. @param gridDialect the dialect of interest @param facetType the dialect facet type of interest @return the given dialect, narrowed down to the given dialect facet or {@code null} in case the given dialect does not implement the given facet """ if ( hasFacet( gridDialect, facetType ) ) { @SuppressWarnings("unchecked") T asFacet = (T) gridDialect; return asFacet; } return null; }
java
static <T extends GridDialect> T getDialectFacetOrNull(GridDialect gridDialect, Class<T> facetType) { if ( hasFacet( gridDialect, facetType ) ) { @SuppressWarnings("unchecked") T asFacet = (T) gridDialect; return asFacet; } return null; }
[ "static", "<", "T", "extends", "GridDialect", ">", "T", "getDialectFacetOrNull", "(", "GridDialect", "gridDialect", ",", "Class", "<", "T", ">", "facetType", ")", "{", "if", "(", "hasFacet", "(", "gridDialect", ",", "facetType", ")", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "asFacet", "=", "(", "T", ")", "gridDialect", ";", "return", "asFacet", ";", "}", "return", "null", ";", "}" ]
Returns the given dialect, narrowed down to the given dialect facet in case it is implemented by the dialect. @param gridDialect the dialect of interest @param facetType the dialect facet type of interest @return the given dialect, narrowed down to the given dialect facet or {@code null} in case the given dialect does not implement the given facet
[ "Returns", "the", "given", "dialect", "narrowed", "down", "to", "the", "given", "dialect", "facet", "in", "case", "it", "is", "implemented", "by", "the", "dialect", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/dialect/impl/GridDialects.java#L37-L45
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.registerObject
public Factory registerObject(Object obj, String id, boolean visible) { """ Register an object with the provided id. The id will be canonicalized. The canonicalized ID will be returned by getVisibleIDs if visible is true. """ String canonicalID = createKey(id).canonicalID(); return registerFactory(new SimpleFactory(obj, canonicalID, visible)); }
java
public Factory registerObject(Object obj, String id, boolean visible) { String canonicalID = createKey(id).canonicalID(); return registerFactory(new SimpleFactory(obj, canonicalID, visible)); }
[ "public", "Factory", "registerObject", "(", "Object", "obj", ",", "String", "id", ",", "boolean", "visible", ")", "{", "String", "canonicalID", "=", "createKey", "(", "id", ")", ".", "canonicalID", "(", ")", ";", "return", "registerFactory", "(", "new", "SimpleFactory", "(", "obj", ",", "canonicalID", ",", "visible", ")", ")", ";", "}" ]
Register an object with the provided id. The id will be canonicalized. The canonicalized ID will be returned by getVisibleIDs if visible is true.
[ "Register", "an", "object", "with", "the", "provided", "id", ".", "The", "id", "will", "be", "canonicalized", ".", "The", "canonicalized", "ID", "will", "be", "returned", "by", "getVisibleIDs", "if", "visible", "is", "true", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L784-L787
JM-Lab/utils-java8
src/main/java/kr/jm/utils/time/JMTimeUtil.java
JMTimeUtil.changeIsoTimestampToLong
public static long changeIsoTimestampToLong(String isoTimestamp) { """ Change iso timestamp to long long. @param isoTimestamp the iso timestamp @return the long """ try { return ZonedDateTime.parse(isoTimestamp).toInstant().toEpochMilli(); } catch (Exception e) { return changeIsoTimestampToLong(isoTimestamp, DEFAULT_ZONE_ID); } }
java
public static long changeIsoTimestampToLong(String isoTimestamp) { try { return ZonedDateTime.parse(isoTimestamp).toInstant().toEpochMilli(); } catch (Exception e) { return changeIsoTimestampToLong(isoTimestamp, DEFAULT_ZONE_ID); } }
[ "public", "static", "long", "changeIsoTimestampToLong", "(", "String", "isoTimestamp", ")", "{", "try", "{", "return", "ZonedDateTime", ".", "parse", "(", "isoTimestamp", ")", ".", "toInstant", "(", ")", ".", "toEpochMilli", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "changeIsoTimestampToLong", "(", "isoTimestamp", ",", "DEFAULT_ZONE_ID", ")", ";", "}", "}" ]
Change iso timestamp to long long. @param isoTimestamp the iso timestamp @return the long
[ "Change", "iso", "timestamp", "to", "long", "long", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/time/JMTimeUtil.java#L459-L465
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentLoader.java
XMLContentLoader.loadContent
public Node loadContent(final Session session, final URL contentDef) { """ Loads the content from the specified contentDefinition into the JCRRepository, using the specified session. @param session the session used to import the date. The user bound to the session must have the required privileges to perform the import operation. @param contentDef """ final SAXParserFactory factory = this.getSAXParserFactory(); try { factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); final SAXParser parser = factory.newSAXParser(); final InputSource source = new InputSource(contentDef.openStream()); final XMLContentHandler handler = new XMLContentHandler(session); parser.parse(source, handler); return handler.getRootNode(); } catch (ParserConfigurationException | SAXException | IOException e) { throw new AssertionError("Loading Content to JCR Repository failed", e); } }
java
public Node loadContent(final Session session, final URL contentDef) { final SAXParserFactory factory = this.getSAXParserFactory(); try { factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); final SAXParser parser = factory.newSAXParser(); final InputSource source = new InputSource(contentDef.openStream()); final XMLContentHandler handler = new XMLContentHandler(session); parser.parse(source, handler); return handler.getRootNode(); } catch (ParserConfigurationException | SAXException | IOException e) { throw new AssertionError("Loading Content to JCR Repository failed", e); } }
[ "public", "Node", "loadContent", "(", "final", "Session", "session", ",", "final", "URL", "contentDef", ")", "{", "final", "SAXParserFactory", "factory", "=", "this", ".", "getSAXParserFactory", "(", ")", ";", "try", "{", "factory", ".", "setFeature", "(", "\"http://apache.org/xml/features/disallow-doctype-decl\"", ",", "true", ")", ";", "final", "SAXParser", "parser", "=", "factory", ".", "newSAXParser", "(", ")", ";", "final", "InputSource", "source", "=", "new", "InputSource", "(", "contentDef", ".", "openStream", "(", ")", ")", ";", "final", "XMLContentHandler", "handler", "=", "new", "XMLContentHandler", "(", "session", ")", ";", "parser", ".", "parse", "(", "source", ",", "handler", ")", ";", "return", "handler", ".", "getRootNode", "(", ")", ";", "}", "catch", "(", "ParserConfigurationException", "|", "SAXException", "|", "IOException", "e", ")", "{", "throw", "new", "AssertionError", "(", "\"Loading Content to JCR Repository failed\"", ",", "e", ")", ";", "}", "}" ]
Loads the content from the specified contentDefinition into the JCRRepository, using the specified session. @param session the session used to import the date. The user bound to the session must have the required privileges to perform the import operation. @param contentDef
[ "Loads", "the", "content", "from", "the", "specified", "contentDefinition", "into", "the", "JCRRepository", "using", "the", "specified", "session", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentLoader.java#L54-L67
indeedeng/util
io/src/main/java/com/indeed/util/io/SafeFiles.java
SafeFiles.writeUTF8
public static void writeUTF8(final String value, final Path path) throws IOException { """ Write the string to a temporary file, fsync the file, then atomically rename to the target path. On error it will make a best-effort to erase the temporary file. @param value string value to write to file as UTF8 bytes @param path path to write out to @throws IOException in the event that the data could not be written to the path. """ write(value.getBytes(Charsets.UTF_8), path); }
java
public static void writeUTF8(final String value, final Path path) throws IOException { write(value.getBytes(Charsets.UTF_8), path); }
[ "public", "static", "void", "writeUTF8", "(", "final", "String", "value", ",", "final", "Path", "path", ")", "throws", "IOException", "{", "write", "(", "value", ".", "getBytes", "(", "Charsets", ".", "UTF_8", ")", ",", "path", ")", ";", "}" ]
Write the string to a temporary file, fsync the file, then atomically rename to the target path. On error it will make a best-effort to erase the temporary file. @param value string value to write to file as UTF8 bytes @param path path to write out to @throws IOException in the event that the data could not be written to the path.
[ "Write", "the", "string", "to", "a", "temporary", "file", "fsync", "the", "file", "then", "atomically", "rename", "to", "the", "target", "path", ".", "On", "error", "it", "will", "make", "a", "best", "-", "effort", "to", "erase", "the", "temporary", "file", "." ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/SafeFiles.java#L169-L171
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ling/WordTagFactory.java
WordTagFactory.newLabelFromString
public Label newLabelFromString(String word) { """ Create a new word, where the label is formed from the <code>String</code> passed in. The String is divided according to the divider character. We assume that we can always just divide on the rightmost divider character, rather than trying to parse up escape sequences. If the divider character isn't found in the word, then the whole string becomes the word, and the tag is <code>null</code>. @param word The word that will go into the <code>Word</code> @return The new WordTag """ int where = word.lastIndexOf(divider); if (where >= 0) { return new WordTag(word.substring(0, where), word.substring(where + 1)); } else { return new WordTag(word); } }
java
public Label newLabelFromString(String word) { int where = word.lastIndexOf(divider); if (where >= 0) { return new WordTag(word.substring(0, where), word.substring(where + 1)); } else { return new WordTag(word); } }
[ "public", "Label", "newLabelFromString", "(", "String", "word", ")", "{", "int", "where", "=", "word", ".", "lastIndexOf", "(", "divider", ")", ";", "if", "(", "where", ">=", "0", ")", "{", "return", "new", "WordTag", "(", "word", ".", "substring", "(", "0", ",", "where", ")", ",", "word", ".", "substring", "(", "where", "+", "1", ")", ")", ";", "}", "else", "{", "return", "new", "WordTag", "(", "word", ")", ";", "}", "}" ]
Create a new word, where the label is formed from the <code>String</code> passed in. The String is divided according to the divider character. We assume that we can always just divide on the rightmost divider character, rather than trying to parse up escape sequences. If the divider character isn't found in the word, then the whole string becomes the word, and the tag is <code>null</code>. @param word The word that will go into the <code>Word</code> @return The new WordTag
[ "Create", "a", "new", "word", "where", "the", "label", "is", "formed", "from", "the", "<code", ">", "String<", "/", "code", ">", "passed", "in", ".", "The", "String", "is", "divided", "according", "to", "the", "divider", "character", ".", "We", "assume", "that", "we", "can", "always", "just", "divide", "on", "the", "rightmost", "divider", "character", "rather", "than", "trying", "to", "parse", "up", "escape", "sequences", ".", "If", "the", "divider", "character", "isn", "t", "found", "in", "the", "word", "then", "the", "whole", "string", "becomes", "the", "word", "and", "the", "tag", "is", "<code", ">", "null<", "/", "code", ">", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ling/WordTagFactory.java#L82-L89
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.beginUpdateTags
public VirtualNetworkGatewayConnectionListEntityInner beginUpdateTags(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { """ Updates a virtual network gateway connection tags. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualNetworkGatewayConnectionListEntityInner object if successful. """ return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).toBlocking().single().body(); }
java
public VirtualNetworkGatewayConnectionListEntityInner beginUpdateTags(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).toBlocking().single().body(); }
[ "public", "VirtualNetworkGatewayConnectionListEntityInner", "beginUpdateTags", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayConnectionName", ",", "tags", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates a virtual network gateway connection tags. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualNetworkGatewayConnectionListEntityInner object if successful.
[ "Updates", "a", "virtual", "network", "gateway", "connection", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L765-L767
vincentk/joptimizer
src/main/java/com/joptimizer/algebra/Matrix1NornRescaler.java
Matrix1NornRescaler.checkScaling
@Override public boolean checkScaling(final DoubleMatrix2D AOriginal, final DoubleMatrix1D U, final DoubleMatrix1D V) { """ Check if the scaling algorithm returned proper results. Note that AOriginal cannot be only subdiagonal filled, because this check is for both symm and bath notsymm matrices. @param AOriginal the ORIGINAL (before scaling) matrix @param U the return of the scaling algorithm @param V the return of the scaling algorithm @param base @return """ int c = AOriginal.columns(); int r = AOriginal.rows(); final double[] maxValueHolder = new double[]{-Double.MAX_VALUE}; IntIntDoubleFunction myFunct = new IntIntDoubleFunction() { @Override public double apply(int i, int j, double pij) { maxValueHolder[0] = Math.max(maxValueHolder[0], Math.abs(pij)); return pij; } }; DoubleMatrix2D AScaled = ColtUtils.diagonalMatrixMult(U, AOriginal, V); //view A row by row boolean isOk = true; for (int i = 0; isOk && i < r; i++) { maxValueHolder[0] = -Double.MAX_VALUE; DoubleMatrix2D P = AScaled.viewPart(i, 0, 1, c); P.forEachNonZero(myFunct); isOk = Math.abs(1. - maxValueHolder[0]) < eps; } //view A col by col for (int j = 0; isOk && j < c; j++) { maxValueHolder[0] = -Double.MAX_VALUE; DoubleMatrix2D P = AScaled.viewPart(0, j, r, 1); P.forEachNonZero(myFunct); isOk = Math.abs(1. - maxValueHolder[0]) < eps; } return isOk; }
java
@Override public boolean checkScaling(final DoubleMatrix2D AOriginal, final DoubleMatrix1D U, final DoubleMatrix1D V){ int c = AOriginal.columns(); int r = AOriginal.rows(); final double[] maxValueHolder = new double[]{-Double.MAX_VALUE}; IntIntDoubleFunction myFunct = new IntIntDoubleFunction() { @Override public double apply(int i, int j, double pij) { maxValueHolder[0] = Math.max(maxValueHolder[0], Math.abs(pij)); return pij; } }; DoubleMatrix2D AScaled = ColtUtils.diagonalMatrixMult(U, AOriginal, V); //view A row by row boolean isOk = true; for (int i = 0; isOk && i < r; i++) { maxValueHolder[0] = -Double.MAX_VALUE; DoubleMatrix2D P = AScaled.viewPart(i, 0, 1, c); P.forEachNonZero(myFunct); isOk = Math.abs(1. - maxValueHolder[0]) < eps; } //view A col by col for (int j = 0; isOk && j < c; j++) { maxValueHolder[0] = -Double.MAX_VALUE; DoubleMatrix2D P = AScaled.viewPart(0, j, r, 1); P.forEachNonZero(myFunct); isOk = Math.abs(1. - maxValueHolder[0]) < eps; } return isOk; }
[ "@", "Override", "public", "boolean", "checkScaling", "(", "final", "DoubleMatrix2D", "AOriginal", ",", "final", "DoubleMatrix1D", "U", ",", "final", "DoubleMatrix1D", "V", ")", "{", "int", "c", "=", "AOriginal", ".", "columns", "(", ")", ";", "int", "r", "=", "AOriginal", ".", "rows", "(", ")", ";", "final", "double", "[", "]", "maxValueHolder", "=", "new", "double", "[", "]", "{", "-", "Double", ".", "MAX_VALUE", "}", ";", "IntIntDoubleFunction", "myFunct", "=", "new", "IntIntDoubleFunction", "(", ")", "{", "@", "Override", "public", "double", "apply", "(", "int", "i", ",", "int", "j", ",", "double", "pij", ")", "{", "maxValueHolder", "[", "0", "]", "=", "Math", ".", "max", "(", "maxValueHolder", "[", "0", "]", ",", "Math", ".", "abs", "(", "pij", ")", ")", ";", "return", "pij", ";", "}", "}", ";", "DoubleMatrix2D", "AScaled", "=", "ColtUtils", ".", "diagonalMatrixMult", "(", "U", ",", "AOriginal", ",", "V", ")", ";", "//view A row by row\r", "boolean", "isOk", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "isOk", "&&", "i", "<", "r", ";", "i", "++", ")", "{", "maxValueHolder", "[", "0", "]", "=", "-", "Double", ".", "MAX_VALUE", ";", "DoubleMatrix2D", "P", "=", "AScaled", ".", "viewPart", "(", "i", ",", "0", ",", "1", ",", "c", ")", ";", "P", ".", "forEachNonZero", "(", "myFunct", ")", ";", "isOk", "=", "Math", ".", "abs", "(", "1.", "-", "maxValueHolder", "[", "0", "]", ")", "<", "eps", ";", "}", "//view A col by col\r", "for", "(", "int", "j", "=", "0", ";", "isOk", "&&", "j", "<", "c", ";", "j", "++", ")", "{", "maxValueHolder", "[", "0", "]", "=", "-", "Double", ".", "MAX_VALUE", ";", "DoubleMatrix2D", "P", "=", "AScaled", ".", "viewPart", "(", "0", ",", "j", ",", "r", ",", "1", ")", ";", "P", ".", "forEachNonZero", "(", "myFunct", ")", ";", "isOk", "=", "Math", ".", "abs", "(", "1.", "-", "maxValueHolder", "[", "0", "]", ")", "<", "eps", ";", "}", "return", "isOk", ";", "}" ]
Check if the scaling algorithm returned proper results. Note that AOriginal cannot be only subdiagonal filled, because this check is for both symm and bath notsymm matrices. @param AOriginal the ORIGINAL (before scaling) matrix @param U the return of the scaling algorithm @param V the return of the scaling algorithm @param base @return
[ "Check", "if", "the", "scaling", "algorithm", "returned", "proper", "results", ".", "Note", "that", "AOriginal", "cannot", "be", "only", "subdiagonal", "filled", "because", "this", "check", "is", "for", "both", "symm", "and", "bath", "notsymm", "matrices", "." ]
train
https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/algebra/Matrix1NornRescaler.java#L177-L210
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/ScriptService.java
ScriptService.updateName
public Script updateName(int id, String name) throws Exception { """ Update the name of a script @param id ID of script @param name new name @return updated script @throws Exception exception """ PreparedStatement statement = null; try (Connection sqlConnection = SQLService.getInstance().getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_SCRIPT + " SET " + Constants.SCRIPT_NAME + " = ? " + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setString(1, name); statement.setInt(2, id); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } return this.getScript(id); }
java
public Script updateName(int id, String name) throws Exception { PreparedStatement statement = null; try (Connection sqlConnection = SQLService.getInstance().getConnection()) { statement = sqlConnection.prepareStatement( "UPDATE " + Constants.DB_TABLE_SCRIPT + " SET " + Constants.SCRIPT_NAME + " = ? " + " WHERE " + Constants.GENERIC_ID + " = ?" ); statement.setString(1, name); statement.setInt(2, id); statement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } return this.getScript(id); }
[ "public", "Script", "updateName", "(", "int", "id", ",", "String", "name", ")", "throws", "Exception", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "SQLService", ".", "getInstance", "(", ")", ".", "getConnection", "(", ")", ")", "{", "statement", "=", "sqlConnection", ".", "prepareStatement", "(", "\"UPDATE \"", "+", "Constants", ".", "DB_TABLE_SCRIPT", "+", "\" SET \"", "+", "Constants", ".", "SCRIPT_NAME", "+", "\" = ? \"", "+", "\" WHERE \"", "+", "Constants", ".", "GENERIC_ID", "+", "\" = ?\"", ")", ";", "statement", ".", "setString", "(", "1", ",", "name", ")", ";", "statement", ".", "setInt", "(", "2", ",", "id", ")", ";", "statement", ".", "executeUpdate", "(", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "statement", "!=", "null", ")", "{", "statement", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "return", "this", ".", "getScript", "(", "id", ")", ";", "}" ]
Update the name of a script @param id ID of script @param name new name @return updated script @throws Exception exception
[ "Update", "the", "name", "of", "a", "script" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/ScriptService.java#L218-L242
joestelmach/natty
src/main/java/com/joestelmach/natty/Parser.java
Parser.singleParse
private DateGroup singleParse(TokenStream stream, String fullText, Date referenceDate) { """ Parses the token stream for a SINGLE date time alternative. This method assumes that the entire token stream represents date and or time information (no extraneous tokens) @param stream @return """ DateGroup group = null; List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens(); if(tokens.isEmpty()) return group; StringBuilder tokenString = new StringBuilder(); for(Token token:tokens) { tokenString.append(DateParser.tokenNames[token.getType()]); tokenString.append(" "); } try { // parse ParseListener listener = new ParseListener(); DateParser parser = new DateParser(stream, listener); DateParser.parse_return parseReturn = parser.parse(); Tree tree = (Tree) parseReturn.getTree(); // we only continue if a meaningful syntax tree has been built if(tree.getChildCount() > 0) { _logger.info("PARSE: " + tokenString.toString()); // rewrite the tree (temporary fix for http://www.antlr.org/jira/browse/ANTLR-427) CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree); TreeRewrite s = new TreeRewrite(nodes); tree = (CommonTree)s.downup(tree); // and walk it nodes = new CommonTreeNodeStream(tree); nodes.setTokenStream(stream); DateWalker walker = new DateWalker(nodes); walker.setReferenceDate(referenceDate); walker.getState().setDefaultTimeZone(_defaultTimeZone); walker.parse(); _logger.info("AST: " + tree.toStringTree()); // run through the results and append the parse information group = walker.getState().getDateGroup(); ParseLocation location = listener.getDateGroupLocation(); group.setLine(location.getLine()); group.setText(location.getText()); group.setPosition(location.getStart()); group.setSyntaxTree(tree); group.setParseLocations(listener.getLocations()); group.setFullText(fullText); // if the group's matching text has an immediate alphabetic prefix or suffix, // we ignore this result String prefix = group.getPrefix(1); String suffix = group.getSuffix(1); if((!prefix.isEmpty() && Character.isLetter(prefix.charAt(0))) || (!suffix.isEmpty() && Character.isLetter(suffix.charAt(0)))) { group = null; } } } catch(RecognitionException e) { _logger.debug("Could not parse input", e); } return group; }
java
private DateGroup singleParse(TokenStream stream, String fullText, Date referenceDate) { DateGroup group = null; List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens(); if(tokens.isEmpty()) return group; StringBuilder tokenString = new StringBuilder(); for(Token token:tokens) { tokenString.append(DateParser.tokenNames[token.getType()]); tokenString.append(" "); } try { // parse ParseListener listener = new ParseListener(); DateParser parser = new DateParser(stream, listener); DateParser.parse_return parseReturn = parser.parse(); Tree tree = (Tree) parseReturn.getTree(); // we only continue if a meaningful syntax tree has been built if(tree.getChildCount() > 0) { _logger.info("PARSE: " + tokenString.toString()); // rewrite the tree (temporary fix for http://www.antlr.org/jira/browse/ANTLR-427) CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree); TreeRewrite s = new TreeRewrite(nodes); tree = (CommonTree)s.downup(tree); // and walk it nodes = new CommonTreeNodeStream(tree); nodes.setTokenStream(stream); DateWalker walker = new DateWalker(nodes); walker.setReferenceDate(referenceDate); walker.getState().setDefaultTimeZone(_defaultTimeZone); walker.parse(); _logger.info("AST: " + tree.toStringTree()); // run through the results and append the parse information group = walker.getState().getDateGroup(); ParseLocation location = listener.getDateGroupLocation(); group.setLine(location.getLine()); group.setText(location.getText()); group.setPosition(location.getStart()); group.setSyntaxTree(tree); group.setParseLocations(listener.getLocations()); group.setFullText(fullText); // if the group's matching text has an immediate alphabetic prefix or suffix, // we ignore this result String prefix = group.getPrefix(1); String suffix = group.getSuffix(1); if((!prefix.isEmpty() && Character.isLetter(prefix.charAt(0))) || (!suffix.isEmpty() && Character.isLetter(suffix.charAt(0)))) { group = null; } } } catch(RecognitionException e) { _logger.debug("Could not parse input", e); } return group; }
[ "private", "DateGroup", "singleParse", "(", "TokenStream", "stream", ",", "String", "fullText", ",", "Date", "referenceDate", ")", "{", "DateGroup", "group", "=", "null", ";", "List", "<", "Token", ">", "tokens", "=", "(", "(", "NattyTokenSource", ")", "stream", ".", "getTokenSource", "(", ")", ")", ".", "getTokens", "(", ")", ";", "if", "(", "tokens", ".", "isEmpty", "(", ")", ")", "return", "group", ";", "StringBuilder", "tokenString", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Token", "token", ":", "tokens", ")", "{", "tokenString", ".", "append", "(", "DateParser", ".", "tokenNames", "[", "token", ".", "getType", "(", ")", "]", ")", ";", "tokenString", ".", "append", "(", "\" \"", ")", ";", "}", "try", "{", "// parse ", "ParseListener", "listener", "=", "new", "ParseListener", "(", ")", ";", "DateParser", "parser", "=", "new", "DateParser", "(", "stream", ",", "listener", ")", ";", "DateParser", ".", "parse_return", "parseReturn", "=", "parser", ".", "parse", "(", ")", ";", "Tree", "tree", "=", "(", "Tree", ")", "parseReturn", ".", "getTree", "(", ")", ";", "// we only continue if a meaningful syntax tree has been built", "if", "(", "tree", ".", "getChildCount", "(", ")", ">", "0", ")", "{", "_logger", ".", "info", "(", "\"PARSE: \"", "+", "tokenString", ".", "toString", "(", ")", ")", ";", "// rewrite the tree (temporary fix for http://www.antlr.org/jira/browse/ANTLR-427)", "CommonTreeNodeStream", "nodes", "=", "new", "CommonTreeNodeStream", "(", "tree", ")", ";", "TreeRewrite", "s", "=", "new", "TreeRewrite", "(", "nodes", ")", ";", "tree", "=", "(", "CommonTree", ")", "s", ".", "downup", "(", "tree", ")", ";", "// and walk it", "nodes", "=", "new", "CommonTreeNodeStream", "(", "tree", ")", ";", "nodes", ".", "setTokenStream", "(", "stream", ")", ";", "DateWalker", "walker", "=", "new", "DateWalker", "(", "nodes", ")", ";", "walker", ".", "setReferenceDate", "(", "referenceDate", ")", ";", "walker", ".", "getState", "(", ")", ".", "setDefaultTimeZone", "(", "_defaultTimeZone", ")", ";", "walker", ".", "parse", "(", ")", ";", "_logger", ".", "info", "(", "\"AST: \"", "+", "tree", ".", "toStringTree", "(", ")", ")", ";", "// run through the results and append the parse information", "group", "=", "walker", ".", "getState", "(", ")", ".", "getDateGroup", "(", ")", ";", "ParseLocation", "location", "=", "listener", ".", "getDateGroupLocation", "(", ")", ";", "group", ".", "setLine", "(", "location", ".", "getLine", "(", ")", ")", ";", "group", ".", "setText", "(", "location", ".", "getText", "(", ")", ")", ";", "group", ".", "setPosition", "(", "location", ".", "getStart", "(", ")", ")", ";", "group", ".", "setSyntaxTree", "(", "tree", ")", ";", "group", ".", "setParseLocations", "(", "listener", ".", "getLocations", "(", ")", ")", ";", "group", ".", "setFullText", "(", "fullText", ")", ";", "// if the group's matching text has an immediate alphabetic prefix or suffix,", "// we ignore this result", "String", "prefix", "=", "group", ".", "getPrefix", "(", "1", ")", ";", "String", "suffix", "=", "group", ".", "getSuffix", "(", "1", ")", ";", "if", "(", "(", "!", "prefix", ".", "isEmpty", "(", ")", "&&", "Character", ".", "isLetter", "(", "prefix", ".", "charAt", "(", "0", ")", ")", ")", "||", "(", "!", "suffix", ".", "isEmpty", "(", ")", "&&", "Character", ".", "isLetter", "(", "suffix", ".", "charAt", "(", "0", ")", ")", ")", ")", "{", "group", "=", "null", ";", "}", "}", "}", "catch", "(", "RecognitionException", "e", ")", "{", "_logger", ".", "debug", "(", "\"Could not parse input\"", ",", "e", ")", ";", "}", "return", "group", ";", "}" ]
Parses the token stream for a SINGLE date time alternative. This method assumes that the entire token stream represents date and or time information (no extraneous tokens) @param stream @return
[ "Parses", "the", "token", "stream", "for", "a", "SINGLE", "date", "time", "alternative", ".", "This", "method", "assumes", "that", "the", "entire", "token", "stream", "represents", "date", "and", "or", "time", "information", "(", "no", "extraneous", "tokens", ")" ]
train
https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/Parser.java#L186-L250
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.leftShift
public static OutputStream leftShift(OutputStream self, InputStream in) throws IOException { """ Pipe an InputStream into an OutputStream for efficient stream copying. @param self stream on which to write @param in stream to read from @return the outputstream itself @throws IOException if an I/O error occurs. @since 1.0 """ byte[] buf = new byte[1024]; while (true) { int count = in.read(buf, 0, buf.length); if (count == -1) break; if (count == 0) { Thread.yield(); continue; } self.write(buf, 0, count); } self.flush(); return self; }
java
public static OutputStream leftShift(OutputStream self, InputStream in) throws IOException { byte[] buf = new byte[1024]; while (true) { int count = in.read(buf, 0, buf.length); if (count == -1) break; if (count == 0) { Thread.yield(); continue; } self.write(buf, 0, count); } self.flush(); return self; }
[ "public", "static", "OutputStream", "leftShift", "(", "OutputStream", "self", ",", "InputStream", "in", ")", "throws", "IOException", "{", "byte", "[", "]", "buf", "=", "new", "byte", "[", "1024", "]", ";", "while", "(", "true", ")", "{", "int", "count", "=", "in", ".", "read", "(", "buf", ",", "0", ",", "buf", ".", "length", ")", ";", "if", "(", "count", "==", "-", "1", ")", "break", ";", "if", "(", "count", "==", "0", ")", "{", "Thread", ".", "yield", "(", ")", ";", "continue", ";", "}", "self", ".", "write", "(", "buf", ",", "0", ",", "count", ")", ";", "}", "self", ".", "flush", "(", ")", ";", "return", "self", ";", "}" ]
Pipe an InputStream into an OutputStream for efficient stream copying. @param self stream on which to write @param in stream to read from @return the outputstream itself @throws IOException if an I/O error occurs. @since 1.0
[ "Pipe", "an", "InputStream", "into", "an", "OutputStream", "for", "efficient", "stream", "copying", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java#L231-L244
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/util/LoggerUtil.java
LoggerUtil.veryVerbose
public static void veryVerbose(Logger log, String format, Object... args) { """ Prints {@link Level#FINE} messages to the provided {@link Logger}. """ if (log.isLoggable(Level.FINER)) { StackTraceElement[] callStack = Thread.currentThread().getStackTrace(); // Index 0 is Thread.getStackTrace() // Index 1 is this method // Index 2 is the caller // Index 3 and beyond we don't care about StackTraceElement caller = callStack[2]; String callingClass = caller.getClassName(); String callingMethod = caller.getMethodName(); log.logp(Level.FINER, callingClass, callingMethod, String.format(format, args)); } }
java
public static void veryVerbose(Logger log, String format, Object... args) { if (log.isLoggable(Level.FINER)) { StackTraceElement[] callStack = Thread.currentThread().getStackTrace(); // Index 0 is Thread.getStackTrace() // Index 1 is this method // Index 2 is the caller // Index 3 and beyond we don't care about StackTraceElement caller = callStack[2]; String callingClass = caller.getClassName(); String callingMethod = caller.getMethodName(); log.logp(Level.FINER, callingClass, callingMethod, String.format(format, args)); } }
[ "public", "static", "void", "veryVerbose", "(", "Logger", "log", ",", "String", "format", ",", "Object", "...", "args", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINER", ")", ")", "{", "StackTraceElement", "[", "]", "callStack", "=", "Thread", ".", "currentThread", "(", ")", ".", "getStackTrace", "(", ")", ";", "// Index 0 is Thread.getStackTrace()", "// Index 1 is this method", "// Index 2 is the caller", "// Index 3 and beyond we don't care about", "StackTraceElement", "caller", "=", "callStack", "[", "2", "]", ";", "String", "callingClass", "=", "caller", ".", "getClassName", "(", ")", ";", "String", "callingMethod", "=", "caller", ".", "getMethodName", "(", ")", ";", "log", ".", "logp", "(", "Level", ".", "FINER", ",", "callingClass", ",", "callingMethod", ",", "String", ".", "format", "(", "format", ",", "args", ")", ")", ";", "}", "}" ]
Prints {@link Level#FINE} messages to the provided {@link Logger}.
[ "Prints", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/LoggerUtil.java#L97-L111
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RunnersApi.java
RunnersApi.getRunners
public List<Runner> getRunners(int page, int perPage) throws GitLabApiException { """ Get a list of all available runners available to the user with pagination support. <pre><code>GitLab Endpoint: GET /runners</code></pre> @param page The page offset of runners @param perPage The number of runners to get after the page offset @return List of Runners @throws GitLabApiException if any exception occurs """ return getRunners(null, page, perPage); }
java
public List<Runner> getRunners(int page, int perPage) throws GitLabApiException { return getRunners(null, page, perPage); }
[ "public", "List", "<", "Runner", ">", "getRunners", "(", "int", "page", ",", "int", "perPage", ")", "throws", "GitLabApiException", "{", "return", "getRunners", "(", "null", ",", "page", ",", "perPage", ")", ";", "}" ]
Get a list of all available runners available to the user with pagination support. <pre><code>GitLab Endpoint: GET /runners</code></pre> @param page The page offset of runners @param perPage The number of runners to get after the page offset @return List of Runners @throws GitLabApiException if any exception occurs
[ "Get", "a", "list", "of", "all", "available", "runners", "available", "to", "the", "user", "with", "pagination", "support", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RunnersApi.java#L82-L84
twilliamson/mogwee-logging
src/main/java/com/mogwee/logging/Logger.java
Logger.infoDebugf
public final void infoDebugf(final Throwable cause, final String message, final Object... args) { """ Logs a formatted message and stack trace if DEBUG logging is enabled or a formatted message and exception description if INFO logging is enabled. @param cause an exception to print stack trace of if DEBUG logging is enabled @param message a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Formatter.html#syntax">format string</a> @param args arguments referenced by the format specifiers in the format string. """ logDebugf(Level.INFO, cause, message, args); }
java
public final void infoDebugf(final Throwable cause, final String message, final Object... args) { logDebugf(Level.INFO, cause, message, args); }
[ "public", "final", "void", "infoDebugf", "(", "final", "Throwable", "cause", ",", "final", "String", "message", ",", "final", "Object", "...", "args", ")", "{", "logDebugf", "(", "Level", ".", "INFO", ",", "cause", ",", "message", ",", "args", ")", ";", "}" ]
Logs a formatted message and stack trace if DEBUG logging is enabled or a formatted message and exception description if INFO logging is enabled. @param cause an exception to print stack trace of if DEBUG logging is enabled @param message a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Formatter.html#syntax">format string</a> @param args arguments referenced by the format specifiers in the format string.
[ "Logs", "a", "formatted", "message", "and", "stack", "trace", "if", "DEBUG", "logging", "is", "enabled", "or", "a", "formatted", "message", "and", "exception", "description", "if", "INFO", "logging", "is", "enabled", "." ]
train
https://github.com/twilliamson/mogwee-logging/blob/30b99c2649de455432d956a8f6a74316de4cd62c/src/main/java/com/mogwee/logging/Logger.java#L333-L336
NessComputing/syslog4j
src/main/java/com/nesscomputing/syslog4j/Syslog.java
Syslog.destroyInstance
public synchronized static void destroyInstance(String protocol) throws SyslogRuntimeException { """ destroyInstance() gracefully shuts down the specified Syslog protocol and removes the instance from Syslog4j. @param protocol - the Syslog protocol to destroy @throws SyslogRuntimeException """ if (StringUtils.isBlank(protocol)) { return; } String _protocol = protocol.toLowerCase(); if (instances.containsKey(_protocol)) { SyslogUtility.sleep(SyslogConstants.THREAD_LOOP_INTERVAL_DEFAULT); SyslogIF syslog = instances.get(_protocol); try { syslog.shutdown(); } finally { instances.remove(_protocol); } } else { throw new SyslogRuntimeException("Cannot destroy protocol \"%s\" instance; call shutdown instead", protocol); } }
java
public synchronized static void destroyInstance(String protocol) throws SyslogRuntimeException { if (StringUtils.isBlank(protocol)) { return; } String _protocol = protocol.toLowerCase(); if (instances.containsKey(_protocol)) { SyslogUtility.sleep(SyslogConstants.THREAD_LOOP_INTERVAL_DEFAULT); SyslogIF syslog = instances.get(_protocol); try { syslog.shutdown(); } finally { instances.remove(_protocol); } } else { throw new SyslogRuntimeException("Cannot destroy protocol \"%s\" instance; call shutdown instead", protocol); } }
[ "public", "synchronized", "static", "void", "destroyInstance", "(", "String", "protocol", ")", "throws", "SyslogRuntimeException", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "protocol", ")", ")", "{", "return", ";", "}", "String", "_protocol", "=", "protocol", ".", "toLowerCase", "(", ")", ";", "if", "(", "instances", ".", "containsKey", "(", "_protocol", ")", ")", "{", "SyslogUtility", ".", "sleep", "(", "SyslogConstants", ".", "THREAD_LOOP_INTERVAL_DEFAULT", ")", ";", "SyslogIF", "syslog", "=", "instances", ".", "get", "(", "_protocol", ")", ";", "try", "{", "syslog", ".", "shutdown", "(", ")", ";", "}", "finally", "{", "instances", ".", "remove", "(", "_protocol", ")", ";", "}", "}", "else", "{", "throw", "new", "SyslogRuntimeException", "(", "\"Cannot destroy protocol \\\"%s\\\" instance; call shutdown instead\"", ",", "protocol", ")", ";", "}", "}" ]
destroyInstance() gracefully shuts down the specified Syslog protocol and removes the instance from Syslog4j. @param protocol - the Syslog protocol to destroy @throws SyslogRuntimeException
[ "destroyInstance", "()", "gracefully", "shuts", "down", "the", "specified", "Syslog", "protocol", "and", "removes", "the", "instance", "from", "Syslog4j", "." ]
train
https://github.com/NessComputing/syslog4j/blob/698fe4ce926cfc46524329d089052507cdb8cba4/src/main/java/com/nesscomputing/syslog4j/Syslog.java#L238-L260
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/avro/HiveAvroCopyEntityHelper.java
HiveAvroCopyEntityHelper.updateTableAttributesIfAvro
public static void updateTableAttributesIfAvro(Table targetTable, HiveCopyEntityHelper hiveHelper) throws IOException { """ Currently updated the {@link #HIVE_TABLE_AVRO_SCHEMA_URL} location for new hive table @param targetTable, new Table to be registered in hive @throws IOException """ if (isHiveTableAvroType(targetTable)) { updateAvroSchemaURL(targetTable.getCompleteName(), targetTable.getTTable().getSd(), hiveHelper); } }
java
public static void updateTableAttributesIfAvro(Table targetTable, HiveCopyEntityHelper hiveHelper) throws IOException { if (isHiveTableAvroType(targetTable)) { updateAvroSchemaURL(targetTable.getCompleteName(), targetTable.getTTable().getSd(), hiveHelper); } }
[ "public", "static", "void", "updateTableAttributesIfAvro", "(", "Table", "targetTable", ",", "HiveCopyEntityHelper", "hiveHelper", ")", "throws", "IOException", "{", "if", "(", "isHiveTableAvroType", "(", "targetTable", ")", ")", "{", "updateAvroSchemaURL", "(", "targetTable", ".", "getCompleteName", "(", ")", ",", "targetTable", ".", "getTTable", "(", ")", ".", "getSd", "(", ")", ",", "hiveHelper", ")", ";", "}", "}" ]
Currently updated the {@link #HIVE_TABLE_AVRO_SCHEMA_URL} location for new hive table @param targetTable, new Table to be registered in hive @throws IOException
[ "Currently", "updated", "the", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/avro/HiveAvroCopyEntityHelper.java#L51-L55