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
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.payment_thod_paymentMethodId_GET
public OvhPaymentMethod payment_thod_paymentMethodId_GET(Long paymentMethodId) throws IOException { """ Get one payment method REST: GET /me/payment/method/{paymentMethodId} @param paymentMethodId [required] Payment method ID API beta """ String qPath = "/me/payment/method/{paymentMethodId}"; StringBuilder sb = path(qPath, paymentMethodId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPaymentMethod.class); }
java
public OvhPaymentMethod payment_thod_paymentMethodId_GET(Long paymentMethodId) throws IOException { String qPath = "/me/payment/method/{paymentMethodId}"; StringBuilder sb = path(qPath, paymentMethodId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPaymentMethod.class); }
[ "public", "OvhPaymentMethod", "payment_thod_paymentMethodId_GET", "(", "Long", "paymentMethodId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/payment/method/{paymentMethodId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "paymentMethodId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhPaymentMethod", ".", "class", ")", ";", "}" ]
Get one payment method REST: GET /me/payment/method/{paymentMethodId} @param paymentMethodId [required] Payment method ID API beta
[ "Get", "one", "payment", "method" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1057-L1062
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ShortExtensions.java
ShortExtensions.operator_minus
@Pure @Inline(value="($1 - $2)", constantExpression=true) public static long operator_minus(short a, long b) { """ The binary <code>minus</code> operator. This is the equivalent to the Java <code>-</code> operator. @param a a short. @param b a long. @return <code>a-b</code> @since 2.3 """ return a - b; }
java
@Pure @Inline(value="($1 - $2)", constantExpression=true) public static long operator_minus(short a, long b) { return a - b; }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"($1 - $2)\"", ",", "constantExpression", "=", "true", ")", "public", "static", "long", "operator_minus", "(", "short", "a", ",", "long", "b", ")", "{", "return", "a", "-", "b", ";", "}" ]
The binary <code>minus</code> operator. This is the equivalent to the Java <code>-</code> operator. @param a a short. @param b a long. @return <code>a-b</code> @since 2.3
[ "The", "binary", "<code", ">", "minus<", "/", "code", ">", "operator", ".", "This", "is", "the", "equivalent", "to", "the", "Java", "<code", ">", "-", "<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ShortExtensions.java#L499-L503
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.orNotEqual
public ZealotKhala orNotEqual(String field, Object value) { """ 生成带" OR "前缀不等查询的SQL片段. @param field 数据库字段 @param value 值 @return ZealotKhala实例 """ return this.doNormal(ZealotConst.OR_PREFIX, field, value, ZealotConst.NOT_EQUAL_SUFFIX, true); }
java
public ZealotKhala orNotEqual(String field, Object value) { return this.doNormal(ZealotConst.OR_PREFIX, field, value, ZealotConst.NOT_EQUAL_SUFFIX, true); }
[ "public", "ZealotKhala", "orNotEqual", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "this", ".", "doNormal", "(", "ZealotConst", ".", "OR_PREFIX", ",", "field", ",", "value", ",", "ZealotConst", ".", "NOT_EQUAL_SUFFIX", ",", "true", ")", ";", "}" ]
生成带" OR "前缀不等查询的SQL片段. @param field 数据库字段 @param value 值 @return ZealotKhala实例
[ "生成带", "OR", "前缀不等查询的SQL片段", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L627-L629
spring-cloud/spring-cloud-config
spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/VaultKvAccessStrategyFactory.java
VaultKvAccessStrategyFactory.forVersion
public static VaultKvAccessStrategy forVersion(RestOperations rest, String baseUrl, int version) { """ Create a new {@link VaultKvAccessStrategy} given {@link RestOperations}, {@code baseUrl}, and {@code version}. @param rest must not be {@literal null}. @param baseUrl the Vault base URL. @param version version of the Vault key-value backend. @return the access strategy. """ switch (version) { case 1: return new V1VaultKvAccessStrategy(baseUrl, rest); case 2: return new V2VaultKvAccessStrategy(baseUrl, rest); default: throw new IllegalArgumentException( "No support for given Vault k/v backend version " + version); } }
java
public static VaultKvAccessStrategy forVersion(RestOperations rest, String baseUrl, int version) { switch (version) { case 1: return new V1VaultKvAccessStrategy(baseUrl, rest); case 2: return new V2VaultKvAccessStrategy(baseUrl, rest); default: throw new IllegalArgumentException( "No support for given Vault k/v backend version " + version); } }
[ "public", "static", "VaultKvAccessStrategy", "forVersion", "(", "RestOperations", "rest", ",", "String", "baseUrl", ",", "int", "version", ")", "{", "switch", "(", "version", ")", "{", "case", "1", ":", "return", "new", "V1VaultKvAccessStrategy", "(", "baseUrl", ",", "rest", ")", ";", "case", "2", ":", "return", "new", "V2VaultKvAccessStrategy", "(", "baseUrl", ",", "rest", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"No support for given Vault k/v backend version \"", "+", "version", ")", ";", "}", "}" ]
Create a new {@link VaultKvAccessStrategy} given {@link RestOperations}, {@code baseUrl}, and {@code version}. @param rest must not be {@literal null}. @param baseUrl the Vault base URL. @param version version of the Vault key-value backend. @return the access strategy.
[ "Create", "a", "new", "{" ]
train
https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/VaultKvAccessStrategyFactory.java#L44-L56
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/misc/BoofMiscOps.java
BoofMiscOps.boundRectangleInside
public static void boundRectangleInside( ImageBase b , ImageRectangle r ) { """ Bounds the provided rectangle to be inside the image. @param b An image. @param r Rectangle """ if( r.x0 < 0 ) r.x0 = 0; if( r.x1 > b.width ) r.x1 = b.width; if( r.y0 < 0 ) r.y0 = 0; if( r.y1 > b.height ) r.y1 = b.height; }
java
public static void boundRectangleInside( ImageBase b , ImageRectangle r ) { if( r.x0 < 0 ) r.x0 = 0; if( r.x1 > b.width ) r.x1 = b.width; if( r.y0 < 0 ) r.y0 = 0; if( r.y1 > b.height ) r.y1 = b.height; }
[ "public", "static", "void", "boundRectangleInside", "(", "ImageBase", "b", ",", "ImageRectangle", "r", ")", "{", "if", "(", "r", ".", "x0", "<", "0", ")", "r", ".", "x0", "=", "0", ";", "if", "(", "r", ".", "x1", ">", "b", ".", "width", ")", "r", ".", "x1", "=", "b", ".", "width", ";", "if", "(", "r", ".", "y0", "<", "0", ")", "r", ".", "y0", "=", "0", ";", "if", "(", "r", ".", "y1", ">", "b", ".", "height", ")", "r", ".", "y1", "=", "b", ".", "height", ";", "}" ]
Bounds the provided rectangle to be inside the image. @param b An image. @param r Rectangle
[ "Bounds", "the", "provided", "rectangle", "to", "be", "inside", "the", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/misc/BoofMiscOps.java#L149-L160
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/Morphia.java
Morphia.fromDBObject
public <T> T fromDBObject(final Datastore datastore, final Class<T> entityClass, final DBObject dbObject, final EntityCache cache) { """ Creates an entity and populates its state based on the dbObject given. This method is primarily an internal method. Reliance on this method may break your application in future releases. @param <T> type of the entity @param datastore the Datastore to use when fetching this reference @param entityClass type to create @param dbObject the object state to use @param cache the EntityCache to use to prevent multiple loads of the same entities over and over @return the newly created and populated entity """ if (!entityClass.isInterface() && !mapper.isMapped(entityClass)) { throw new MappingException("Trying to map to an unmapped class: " + entityClass.getName()); } try { return mapper.fromDBObject(datastore, entityClass, dbObject, cache); } catch (Exception e) { throw new MappingException("Could not map entity from DBObject", e); } }
java
public <T> T fromDBObject(final Datastore datastore, final Class<T> entityClass, final DBObject dbObject, final EntityCache cache) { if (!entityClass.isInterface() && !mapper.isMapped(entityClass)) { throw new MappingException("Trying to map to an unmapped class: " + entityClass.getName()); } try { return mapper.fromDBObject(datastore, entityClass, dbObject, cache); } catch (Exception e) { throw new MappingException("Could not map entity from DBObject", e); } }
[ "public", "<", "T", ">", "T", "fromDBObject", "(", "final", "Datastore", "datastore", ",", "final", "Class", "<", "T", ">", "entityClass", ",", "final", "DBObject", "dbObject", ",", "final", "EntityCache", "cache", ")", "{", "if", "(", "!", "entityClass", ".", "isInterface", "(", ")", "&&", "!", "mapper", ".", "isMapped", "(", "entityClass", ")", ")", "{", "throw", "new", "MappingException", "(", "\"Trying to map to an unmapped class: \"", "+", "entityClass", ".", "getName", "(", ")", ")", ";", "}", "try", "{", "return", "mapper", ".", "fromDBObject", "(", "datastore", ",", "entityClass", ",", "dbObject", ",", "cache", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "MappingException", "(", "\"Could not map entity from DBObject\"", ",", "e", ")", ";", "}", "}" ]
Creates an entity and populates its state based on the dbObject given. This method is primarily an internal method. Reliance on this method may break your application in future releases. @param <T> type of the entity @param datastore the Datastore to use when fetching this reference @param entityClass type to create @param dbObject the object state to use @param cache the EntityCache to use to prevent multiple loads of the same entities over and over @return the newly created and populated entity
[ "Creates", "an", "entity", "and", "populates", "its", "state", "based", "on", "the", "dbObject", "given", ".", "This", "method", "is", "primarily", "an", "internal", "method", ".", "Reliance", "on", "this", "method", "may", "break", "your", "application", "in", "future", "releases", "." ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/Morphia.java#L131-L140
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/util/WorkQueue.java
WorkQueue.await
public boolean await(Object taskGroupId, long timeout, TimeUnit unit) { """ Waits until all the tasks associated with the group identifier have finished. Once a task group has been successfully waited upon, the group identifier is removed from the queue and is valid to be reused for a new task group. @throws IllegalArgumentException if the {@code taskGroupId} is not currently associated with any active taskGroup """ CountDownLatch latch = taskKeyToLatch.get(taskGroupId); if (latch == null) throw new IllegalArgumentException( "Unknown task group: " + taskGroupId); try { if (latch.await(timeout, unit)) { // Once finished, remove the key so it can be associated with a // new task taskKeyToLatch.remove(taskGroupId); return true; } return false; } catch (InterruptedException ie) { throw new IllegalStateException("Not all tasks finished", ie); } }
java
public boolean await(Object taskGroupId, long timeout, TimeUnit unit) { CountDownLatch latch = taskKeyToLatch.get(taskGroupId); if (latch == null) throw new IllegalArgumentException( "Unknown task group: " + taskGroupId); try { if (latch.await(timeout, unit)) { // Once finished, remove the key so it can be associated with a // new task taskKeyToLatch.remove(taskGroupId); return true; } return false; } catch (InterruptedException ie) { throw new IllegalStateException("Not all tasks finished", ie); } }
[ "public", "boolean", "await", "(", "Object", "taskGroupId", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "CountDownLatch", "latch", "=", "taskKeyToLatch", ".", "get", "(", "taskGroupId", ")", ";", "if", "(", "latch", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Unknown task group: \"", "+", "taskGroupId", ")", ";", "try", "{", "if", "(", "latch", ".", "await", "(", "timeout", ",", "unit", ")", ")", "{", "// Once finished, remove the key so it can be associated with a", "// new task", "taskKeyToLatch", ".", "remove", "(", "taskGroupId", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Not all tasks finished\"", ",", "ie", ")", ";", "}", "}" ]
Waits until all the tasks associated with the group identifier have finished. Once a task group has been successfully waited upon, the group identifier is removed from the queue and is valid to be reused for a new task group. @throws IllegalArgumentException if the {@code taskGroupId} is not currently associated with any active taskGroup
[ "Waits", "until", "all", "the", "tasks", "associated", "with", "the", "group", "identifier", "have", "finished", ".", "Once", "a", "task", "group", "has", "been", "successfully", "waited", "upon", "the", "group", "identifier", "is", "removed", "from", "the", "queue", "and", "is", "valid", "to", "be", "reused", "for", "a", "new", "task", "group", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/WorkQueue.java#L186-L203
oboehm/jfachwert
src/main/java/de/jfachwert/math/PackedDecimal.java
PackedDecimal.setScale
public PackedDecimal setScale(int n, RoundingMode mode) { """ Setzt die Anzahl der Nachkommastellen. @param n z.B. 0, falls keine Nachkommastelle gesetzt sein soll @param mode Rundungs-Mode @return eine neue {@link PackedDecimal} """ BigDecimal result = toBigDecimal().setScale(n, mode); return PackedDecimal.valueOf(result); }
java
public PackedDecimal setScale(int n, RoundingMode mode) { BigDecimal result = toBigDecimal().setScale(n, mode); return PackedDecimal.valueOf(result); }
[ "public", "PackedDecimal", "setScale", "(", "int", "n", ",", "RoundingMode", "mode", ")", "{", "BigDecimal", "result", "=", "toBigDecimal", "(", ")", ".", "setScale", "(", "n", ",", "mode", ")", ";", "return", "PackedDecimal", ".", "valueOf", "(", "result", ")", ";", "}" ]
Setzt die Anzahl der Nachkommastellen. @param n z.B. 0, falls keine Nachkommastelle gesetzt sein soll @param mode Rundungs-Mode @return eine neue {@link PackedDecimal}
[ "Setzt", "die", "Anzahl", "der", "Nachkommastellen", "." ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/PackedDecimal.java#L561-L564
rundeck/rundeck
rundeck-storage/rundeck-storage-api/src/main/java/org/rundeck/storage/api/PathUtil.java
PathUtil.pathStringFromComponents
public static String pathStringFromComponents(String[] components) { """ create a path from an array of components @param components path components strings @return a path string """ if (null == components || components.length == 0) { return null; } return cleanPath(join(components, SEPARATOR)); }
java
public static String pathStringFromComponents(String[] components) { if (null == components || components.length == 0) { return null; } return cleanPath(join(components, SEPARATOR)); }
[ "public", "static", "String", "pathStringFromComponents", "(", "String", "[", "]", "components", ")", "{", "if", "(", "null", "==", "components", "||", "components", ".", "length", "==", "0", ")", "{", "return", "null", ";", "}", "return", "cleanPath", "(", "join", "(", "components", ",", "SEPARATOR", ")", ")", ";", "}" ]
create a path from an array of components @param components path components strings @return a path string
[ "create", "a", "path", "from", "an", "array", "of", "components" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-api/src/main/java/org/rundeck/storage/api/PathUtil.java#L97-L102
amplexus/java-flac-encoder
src/main/java/net/sourceforge/javaflacencoder/EncodedElement_32.java
EncodedElement_32.addInt
@Override public EncodedElement addInt(int input, int bitCount) { """ Add a number of bits from an int to the end of this list's data. Will add a new element if necessary. The bits stored are taken from the lower- order of input. @param input Int containing bits to append to end. @param bitCount Number of bits to append. @return EncodedElement which actually contains the appended value. """ byteArrayValid = false; if(next != null) { EncodedElement end = EncodedElement_32.getEnd_S(next); return end.addInt(input, bitCount); } else if(data_32.length*32 < usableBits+bitCount) { //create child and attach to next. //Set child's offset appropriately(i.e, manually set usable bits) int tOff = usableBits %32; //int size = data.length/2+1; int size = 1000; //guarantee that our new element can store our given value //if(size <= bitCount+tOff) size = (size+tOff+bitCount)*10; next = new EncodedElement_32(size, tOff); System.err.println("creating next node of size:bitCount "+size+ ":"+bitCount+":"+usableBits+":"+data_32.length); System.err.println("value: "+input); //+this.toString()+"::"+next.toString()); //add int to child return next.addInt(input, bitCount); } else { //At this point, we have the space, and we are the end of the chain. int startPos = this.usableBits; int[] dest = this.data_32; EncodedElement_32.addInt(input, bitCount, startPos, dest); usableBits += bitCount; return this; } }
java
@Override public EncodedElement addInt(int input, int bitCount) { byteArrayValid = false; if(next != null) { EncodedElement end = EncodedElement_32.getEnd_S(next); return end.addInt(input, bitCount); } else if(data_32.length*32 < usableBits+bitCount) { //create child and attach to next. //Set child's offset appropriately(i.e, manually set usable bits) int tOff = usableBits %32; //int size = data.length/2+1; int size = 1000; //guarantee that our new element can store our given value //if(size <= bitCount+tOff) size = (size+tOff+bitCount)*10; next = new EncodedElement_32(size, tOff); System.err.println("creating next node of size:bitCount "+size+ ":"+bitCount+":"+usableBits+":"+data_32.length); System.err.println("value: "+input); //+this.toString()+"::"+next.toString()); //add int to child return next.addInt(input, bitCount); } else { //At this point, we have the space, and we are the end of the chain. int startPos = this.usableBits; int[] dest = this.data_32; EncodedElement_32.addInt(input, bitCount, startPos, dest); usableBits += bitCount; return this; } }
[ "@", "Override", "public", "EncodedElement", "addInt", "(", "int", "input", ",", "int", "bitCount", ")", "{", "byteArrayValid", "=", "false", ";", "if", "(", "next", "!=", "null", ")", "{", "EncodedElement", "end", "=", "EncodedElement_32", ".", "getEnd_S", "(", "next", ")", ";", "return", "end", ".", "addInt", "(", "input", ",", "bitCount", ")", ";", "}", "else", "if", "(", "data_32", ".", "length", "*", "32", "<", "usableBits", "+", "bitCount", ")", "{", "//create child and attach to next.", "//Set child's offset appropriately(i.e, manually set usable bits)", "int", "tOff", "=", "usableBits", "%", "32", ";", "//int size = data.length/2+1;", "int", "size", "=", "1000", ";", "//guarantee that our new element can store our given value", "//if(size <= bitCount+tOff) size = (size+tOff+bitCount)*10;", "next", "=", "new", "EncodedElement_32", "(", "size", ",", "tOff", ")", ";", "System", ".", "err", ".", "println", "(", "\"creating next node of size:bitCount \"", "+", "size", "+", "\":\"", "+", "bitCount", "+", "\":\"", "+", "usableBits", "+", "\":\"", "+", "data_32", ".", "length", ")", ";", "System", ".", "err", ".", "println", "(", "\"value: \"", "+", "input", ")", ";", "//+this.toString()+\"::\"+next.toString());", "//add int to child", "return", "next", ".", "addInt", "(", "input", ",", "bitCount", ")", ";", "}", "else", "{", "//At this point, we have the space, and we are the end of the chain.", "int", "startPos", "=", "this", ".", "usableBits", ";", "int", "[", "]", "dest", "=", "this", ".", "data_32", ";", "EncodedElement_32", ".", "addInt", "(", "input", ",", "bitCount", ",", "startPos", ",", "dest", ")", ";", "usableBits", "+=", "bitCount", ";", "return", "this", ";", "}", "}" ]
Add a number of bits from an int to the end of this list's data. Will add a new element if necessary. The bits stored are taken from the lower- order of input. @param input Int containing bits to append to end. @param bitCount Number of bits to append. @return EncodedElement which actually contains the appended value.
[ "Add", "a", "number", "of", "bits", "from", "an", "int", "to", "the", "end", "of", "this", "list", "s", "data", ".", "Will", "add", "a", "new", "element", "if", "necessary", ".", "The", "bits", "stored", "are", "taken", "from", "the", "lower", "-", "order", "of", "input", "." ]
train
https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/EncodedElement_32.java#L386-L418
CloudSlang/cs-actions
cs-commons/src/main/java/io/cloudslang/content/utils/StringEscapeUtilities.java
StringEscapeUtilities.removeEscapedChar
@NotNull public static String removeEscapedChar(@NotNull final String string, final char toRemove) { """ Removes all the occurrences of the \<toRemove> characters from the <string> @param string the string from which to remove the character @param toRemove the \character to remove from the <string> @return a new string with the removed \<toRemove> character """ return string.replaceAll("\\\\" + toRemove, ""); }
java
@NotNull public static String removeEscapedChar(@NotNull final String string, final char toRemove) { return string.replaceAll("\\\\" + toRemove, ""); }
[ "@", "NotNull", "public", "static", "String", "removeEscapedChar", "(", "@", "NotNull", "final", "String", "string", ",", "final", "char", "toRemove", ")", "{", "return", "string", ".", "replaceAll", "(", "\"\\\\\\\\\"", "+", "toRemove", ",", "\"\"", ")", ";", "}" ]
Removes all the occurrences of the \<toRemove> characters from the <string> @param string the string from which to remove the character @param toRemove the \character to remove from the <string> @return a new string with the removed \<toRemove> character
[ "Removes", "all", "the", "occurrences", "of", "the", "\\", "<toRemove", ">", "characters", "from", "the", "<string", ">" ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-commons/src/main/java/io/cloudslang/content/utils/StringEscapeUtilities.java#L97-L100
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AbstractCell.java
AbstractCell.addStateAttribute
protected final void addStateAttribute(AbstractHtmlState state, String name, String value) throws JspException { """ <p> Add an HTML state attribute to a {@link AbstractHtmlState} object. This method performs checks on common attributes and sets their values on the state object or throws an exception. </p> <p> For the HTML tags it is not legal to set the <code>id</code> or <code>name</code> attributes. In addition, the base tag does not allow facets to be set. If the attribute is legal it will be added to the general expression map stored in the <code>AbstractHtmlState</code> of the tag. </p> @param state the state object to which attributes are appliedn @param name the name of an attribute @param value the value of the attribute @throws JspException when an error occurs setting the attribute on the state object """ // validate the name attribute, in the case of an error simply return. if(name == null || name.length() <= 0) { String s = Bundle.getString("Tags_AttributeNameNotSet"); throw new JspException(s); } // it's not legal to set the id or name attributes this way if(name.equals(HtmlConstants.ID) || name.equals(HtmlConstants.NAME)) { String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name}); throw new JspException(s); } // if there is a style or class we will let them override the base if(name.equals(HtmlConstants.CLASS)) { state.styleClass = value; return; } else if(name.equals(HtmlConstants.STYLE)) { state.style = value; return; } state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, name, value); }
java
protected final void addStateAttribute(AbstractHtmlState state, String name, String value) throws JspException { // validate the name attribute, in the case of an error simply return. if(name == null || name.length() <= 0) { String s = Bundle.getString("Tags_AttributeNameNotSet"); throw new JspException(s); } // it's not legal to set the id or name attributes this way if(name.equals(HtmlConstants.ID) || name.equals(HtmlConstants.NAME)) { String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name}); throw new JspException(s); } // if there is a style or class we will let them override the base if(name.equals(HtmlConstants.CLASS)) { state.styleClass = value; return; } else if(name.equals(HtmlConstants.STYLE)) { state.style = value; return; } state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, name, value); }
[ "protected", "final", "void", "addStateAttribute", "(", "AbstractHtmlState", "state", ",", "String", "name", ",", "String", "value", ")", "throws", "JspException", "{", "// validate the name attribute, in the case of an error simply return.", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "<=", "0", ")", "{", "String", "s", "=", "Bundle", ".", "getString", "(", "\"Tags_AttributeNameNotSet\"", ")", ";", "throw", "new", "JspException", "(", "s", ")", ";", "}", "// it's not legal to set the id or name attributes this way", "if", "(", "name", ".", "equals", "(", "HtmlConstants", ".", "ID", ")", "||", "name", ".", "equals", "(", "HtmlConstants", ".", "NAME", ")", ")", "{", "String", "s", "=", "Bundle", ".", "getString", "(", "\"Tags_AttributeMayNotBeSet\"", ",", "new", "Object", "[", "]", "{", "name", "}", ")", ";", "throw", "new", "JspException", "(", "s", ")", ";", "}", "// if there is a style or class we will let them override the base", "if", "(", "name", ".", "equals", "(", "HtmlConstants", ".", "CLASS", ")", ")", "{", "state", ".", "styleClass", "=", "value", ";", "return", ";", "}", "else", "if", "(", "name", ".", "equals", "(", "HtmlConstants", ".", "STYLE", ")", ")", "{", "state", ".", "style", "=", "value", ";", "return", ";", "}", "state", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "name", ",", "value", ")", ";", "}" ]
<p> Add an HTML state attribute to a {@link AbstractHtmlState} object. This method performs checks on common attributes and sets their values on the state object or throws an exception. </p> <p> For the HTML tags it is not legal to set the <code>id</code> or <code>name</code> attributes. In addition, the base tag does not allow facets to be set. If the attribute is legal it will be added to the general expression map stored in the <code>AbstractHtmlState</code> of the tag. </p> @param state the state object to which attributes are appliedn @param name the name of an attribute @param value the value of the attribute @throws JspException when an error occurs setting the attribute on the state object
[ "<p", ">", "Add", "an", "HTML", "state", "attribute", "to", "a", "{", "@link", "AbstractHtmlState", "}", "object", ".", "This", "method", "performs", "checks", "on", "common", "attributes", "and", "sets", "their", "values", "on", "the", "state", "object", "or", "throws", "an", "exception", ".", "<", "/", "p", ">", "<p", ">", "For", "the", "HTML", "tags", "it", "is", "not", "legal", "to", "set", "the", "<code", ">", "id<", "/", "code", ">", "or", "<code", ">", "name<", "/", "code", ">", "attributes", ".", "In", "addition", "the", "base", "tag", "does", "not", "allow", "facets", "to", "be", "set", ".", "If", "the", "attribute", "is", "legal", "it", "will", "be", "added", "to", "the", "general", "expression", "map", "stored", "in", "the", "<code", ">", "AbstractHtmlState<", "/", "code", ">", "of", "the", "tag", ".", "<", "/", "p", ">" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AbstractCell.java#L195-L221
samskivert/samskivert
src/main/java/com/samskivert/util/PrefsConfig.java
PrefsConfig.setValue
public void setValue (String name, long value) { """ Sets the value of the specified preference, overriding the value defined in the configuration files shipped with the application. """ Long oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { oldValue = Long.valueOf(_prefs.getLong(name, super.getValue(name, 0L))); } _prefs.putLong(name, value); _propsup.firePropertyChange(name, oldValue, Long.valueOf(value)); }
java
public void setValue (String name, long value) { Long oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { oldValue = Long.valueOf(_prefs.getLong(name, super.getValue(name, 0L))); } _prefs.putLong(name, value); _propsup.firePropertyChange(name, oldValue, Long.valueOf(value)); }
[ "public", "void", "setValue", "(", "String", "name", ",", "long", "value", ")", "{", "Long", "oldValue", "=", "null", ";", "if", "(", "_prefs", ".", "get", "(", "name", ",", "null", ")", "!=", "null", "||", "_props", ".", "getProperty", "(", "name", ")", "!=", "null", ")", "{", "oldValue", "=", "Long", ".", "valueOf", "(", "_prefs", ".", "getLong", "(", "name", ",", "super", ".", "getValue", "(", "name", ",", "0L", ")", ")", ")", ";", "}", "_prefs", ".", "putLong", "(", "name", ",", "value", ")", ";", "_propsup", ".", "firePropertyChange", "(", "name", ",", "oldValue", ",", "Long", ".", "valueOf", "(", "value", ")", ")", ";", "}" ]
Sets the value of the specified preference, overriding the value defined in the configuration files shipped with the application.
[ "Sets", "the", "value", "of", "the", "specified", "preference", "overriding", "the", "value", "defined", "in", "the", "configuration", "files", "shipped", "with", "the", "application", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PrefsConfig.java#L84-L93
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java
HttpFileUploadManager.uploadFile
public URL uploadFile(File file) throws InterruptedException, XMPPException.XMPPErrorException, SmackException, IOException { """ Request slot and uploaded file to HTTP file upload service. You don't need to request slot and upload file separately, this method will do both. Note that this is a synchronous call -- Smack must wait for the server response. @param file file to be uploaded @return public URL for sharing uploaded file @throws InterruptedException @throws XMPPException.XMPPErrorException @throws SmackException @throws IOException in case of HTTP upload errors """ return uploadFile(file, null); }
java
public URL uploadFile(File file) throws InterruptedException, XMPPException.XMPPErrorException, SmackException, IOException { return uploadFile(file, null); }
[ "public", "URL", "uploadFile", "(", "File", "file", ")", "throws", "InterruptedException", ",", "XMPPException", ".", "XMPPErrorException", ",", "SmackException", ",", "IOException", "{", "return", "uploadFile", "(", "file", ",", "null", ")", ";", "}" ]
Request slot and uploaded file to HTTP file upload service. You don't need to request slot and upload file separately, this method will do both. Note that this is a synchronous call -- Smack must wait for the server response. @param file file to be uploaded @return public URL for sharing uploaded file @throws InterruptedException @throws XMPPException.XMPPErrorException @throws SmackException @throws IOException in case of HTTP upload errors
[ "Request", "slot", "and", "uploaded", "file", "to", "HTTP", "file", "upload", "service", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java#L236-L239
threerings/narya
core/src/main/java/com/threerings/presents/net/ServiceCreds.java
ServiceCreds.createAuthToken
protected static String createAuthToken (String clientId, String sharedSecret) { """ Creates a unique password for the specified node using the supplied shared secret. """ return StringUtil.md5hex(clientId + sharedSecret); }
java
protected static String createAuthToken (String clientId, String sharedSecret) { return StringUtil.md5hex(clientId + sharedSecret); }
[ "protected", "static", "String", "createAuthToken", "(", "String", "clientId", ",", "String", "sharedSecret", ")", "{", "return", "StringUtil", ".", "md5hex", "(", "clientId", "+", "sharedSecret", ")", ";", "}" ]
Creates a unique password for the specified node using the supplied shared secret.
[ "Creates", "a", "unique", "password", "for", "the", "specified", "node", "using", "the", "supplied", "shared", "secret", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/net/ServiceCreds.java#L68-L71
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TableProxy.java
TableProxy.doSetHandle
public Object doSetHandle(Object bookmark, int iOpenMode, String strFields, int iHandleType) throws DBException, RemoteException { """ Reposition to this record using this bookmark. <p />JiniTables can't access the datasource on the server, so they must use the bookmark. @param bookmark The handle of the record to retrieve. @param iHandleType The type of handle to use. @return The record or the return code as an Boolean. """ BaseTransport transport = this.createProxyTransport(DO_SET_HANDLE); transport.addParam(BOOKMARK, bookmark); transport.addParam(OPEN_MODE, iOpenMode); transport.addParam(FIELDS, strFields); transport.addParam(TYPE, iHandleType); transport.sendMessageAndGetReply(); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return this.checkDBException(objReturn); }
java
public Object doSetHandle(Object bookmark, int iOpenMode, String strFields, int iHandleType) throws DBException, RemoteException { BaseTransport transport = this.createProxyTransport(DO_SET_HANDLE); transport.addParam(BOOKMARK, bookmark); transport.addParam(OPEN_MODE, iOpenMode); transport.addParam(FIELDS, strFields); transport.addParam(TYPE, iHandleType); transport.sendMessageAndGetReply(); Object strReturn = transport.sendMessageAndGetReply(); Object objReturn = transport.convertReturnObject(strReturn); return this.checkDBException(objReturn); }
[ "public", "Object", "doSetHandle", "(", "Object", "bookmark", ",", "int", "iOpenMode", ",", "String", "strFields", ",", "int", "iHandleType", ")", "throws", "DBException", ",", "RemoteException", "{", "BaseTransport", "transport", "=", "this", ".", "createProxyTransport", "(", "DO_SET_HANDLE", ")", ";", "transport", ".", "addParam", "(", "BOOKMARK", ",", "bookmark", ")", ";", "transport", ".", "addParam", "(", "OPEN_MODE", ",", "iOpenMode", ")", ";", "transport", ".", "addParam", "(", "FIELDS", ",", "strFields", ")", ";", "transport", ".", "addParam", "(", "TYPE", ",", "iHandleType", ")", ";", "transport", ".", "sendMessageAndGetReply", "(", ")", ";", "Object", "strReturn", "=", "transport", ".", "sendMessageAndGetReply", "(", ")", ";", "Object", "objReturn", "=", "transport", ".", "convertReturnObject", "(", "strReturn", ")", ";", "return", "this", ".", "checkDBException", "(", "objReturn", ")", ";", "}" ]
Reposition to this record using this bookmark. <p />JiniTables can't access the datasource on the server, so they must use the bookmark. @param bookmark The handle of the record to retrieve. @param iHandleType The type of handle to use. @return The record or the return code as an Boolean.
[ "Reposition", "to", "this", "record", "using", "this", "bookmark", ".", "<p", "/", ">", "JiniTables", "can", "t", "access", "the", "datasource", "on", "the", "server", "so", "they", "must", "use", "the", "bookmark", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TableProxy.java#L192-L203
google/closure-templates
java/src/com/google/template/soy/soyparse/Tokens.java
Tokens.areAdjacent
static boolean areAdjacent(Token first, Token second) { """ Returns {@code true} if the two tokens are adjacent in the input stream with no intervening characters. """ return first.endLine == second.beginLine && first.endColumn == second.beginColumn - 1; }
java
static boolean areAdjacent(Token first, Token second) { return first.endLine == second.beginLine && first.endColumn == second.beginColumn - 1; }
[ "static", "boolean", "areAdjacent", "(", "Token", "first", ",", "Token", "second", ")", "{", "return", "first", ".", "endLine", "==", "second", ".", "beginLine", "&&", "first", ".", "endColumn", "==", "second", ".", "beginColumn", "-", "1", ";", "}" ]
Returns {@code true} if the two tokens are adjacent in the input stream with no intervening characters.
[ "Returns", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soyparse/Tokens.java#L62-L64
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreHelper.java
DatastoreHelper.fetch
static List<Entity> fetch(Transaction reader, Key... keys) { """ Returns a list with a value for each given key (ordered by input). {@code null} values are returned for nonexistent keys. """ return compileEntities(keys, reader.get(keys)); }
java
static List<Entity> fetch(Transaction reader, Key... keys) { return compileEntities(keys, reader.get(keys)); }
[ "static", "List", "<", "Entity", ">", "fetch", "(", "Transaction", "reader", ",", "Key", "...", "keys", ")", "{", "return", "compileEntities", "(", "keys", ",", "reader", ".", "get", "(", "keys", ")", ")", ";", "}" ]
Returns a list with a value for each given key (ordered by input). {@code null} values are returned for nonexistent keys.
[ "Returns", "a", "list", "with", "a", "value", "for", "each", "given", "key", "(", "ordered", "by", "input", ")", ".", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreHelper.java#L64-L66
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.toLongBiFunction
public static <T, U> ToLongBiFunction<T, U> toLongBiFunction(CheckedToLongBiFunction<T, U> function, Consumer<Throwable> handler) { """ Wrap a {@link CheckedToLongBiFunction} in a {@link ToLongBiFunction} with a custom handler for checked exceptions. """ return (t, u) -> { try { return function.applyAsLong(t, u); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
java
public static <T, U> ToLongBiFunction<T, U> toLongBiFunction(CheckedToLongBiFunction<T, U> function, Consumer<Throwable> handler) { return (t, u) -> { try { return function.applyAsLong(t, u); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
[ "public", "static", "<", "T", ",", "U", ">", "ToLongBiFunction", "<", "T", ",", "U", ">", "toLongBiFunction", "(", "CheckedToLongBiFunction", "<", "T", ",", "U", ">", "function", ",", "Consumer", "<", "Throwable", ">", "handler", ")", "{", "return", "(", "t", ",", "u", ")", "->", "{", "try", "{", "return", "function", ".", "applyAsLong", "(", "t", ",", "u", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "handler", ".", "accept", "(", "e", ")", ";", "throw", "new", "IllegalStateException", "(", "\"Exception handler must throw a RuntimeException\"", ",", "e", ")", ";", "}", "}", ";", "}" ]
Wrap a {@link CheckedToLongBiFunction} in a {@link ToLongBiFunction} with a custom handler for checked exceptions.
[ "Wrap", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L397-L408
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java
PatternBox.inComplexWith
public static Pattern inComplexWith() { """ Two proteins have states that are members of the same complex. Handles nested complexes and homologies. Also guarantees that relationship to the complex is through different direct complex members. @return pattern """ Pattern p = new Pattern(SequenceEntityReference.class, "Protein 1"); p.add(linkedER(true), "Protein 1", "generic Protein 1"); p.add(erToPE(), "generic Protein 1", "SPE1"); p.add(linkToComplex(), "SPE1", "PE1"); p.add(new PathConstraint("PhysicalEntity/componentOf"), "PE1", "Complex"); p.add(new PathConstraint("Complex/component"), "Complex", "PE2"); p.add(equal(false), "PE1", "PE2"); p.add(linkToSpecific(), "PE2", "SPE2"); p.add(peToER(), "SPE2", "generic Protein 2"); p.add(linkedER(false), "generic Protein 2", "Protein 2"); p.add(equal(false), "Protein 1", "Protein 2"); p.add(new Type(SequenceEntityReference.class), "Protein 2"); return p; }
java
public static Pattern inComplexWith() { Pattern p = new Pattern(SequenceEntityReference.class, "Protein 1"); p.add(linkedER(true), "Protein 1", "generic Protein 1"); p.add(erToPE(), "generic Protein 1", "SPE1"); p.add(linkToComplex(), "SPE1", "PE1"); p.add(new PathConstraint("PhysicalEntity/componentOf"), "PE1", "Complex"); p.add(new PathConstraint("Complex/component"), "Complex", "PE2"); p.add(equal(false), "PE1", "PE2"); p.add(linkToSpecific(), "PE2", "SPE2"); p.add(peToER(), "SPE2", "generic Protein 2"); p.add(linkedER(false), "generic Protein 2", "Protein 2"); p.add(equal(false), "Protein 1", "Protein 2"); p.add(new Type(SequenceEntityReference.class), "Protein 2"); return p; }
[ "public", "static", "Pattern", "inComplexWith", "(", ")", "{", "Pattern", "p", "=", "new", "Pattern", "(", "SequenceEntityReference", ".", "class", ",", "\"Protein 1\"", ")", ";", "p", ".", "add", "(", "linkedER", "(", "true", ")", ",", "\"Protein 1\"", ",", "\"generic Protein 1\"", ")", ";", "p", ".", "add", "(", "erToPE", "(", ")", ",", "\"generic Protein 1\"", ",", "\"SPE1\"", ")", ";", "p", ".", "add", "(", "linkToComplex", "(", ")", ",", "\"SPE1\"", ",", "\"PE1\"", ")", ";", "p", ".", "add", "(", "new", "PathConstraint", "(", "\"PhysicalEntity/componentOf\"", ")", ",", "\"PE1\"", ",", "\"Complex\"", ")", ";", "p", ".", "add", "(", "new", "PathConstraint", "(", "\"Complex/component\"", ")", ",", "\"Complex\"", ",", "\"PE2\"", ")", ";", "p", ".", "add", "(", "equal", "(", "false", ")", ",", "\"PE1\"", ",", "\"PE2\"", ")", ";", "p", ".", "add", "(", "linkToSpecific", "(", ")", ",", "\"PE2\"", ",", "\"SPE2\"", ")", ";", "p", ".", "add", "(", "peToER", "(", ")", ",", "\"SPE2\"", ",", "\"generic Protein 2\"", ")", ";", "p", ".", "add", "(", "linkedER", "(", "false", ")", ",", "\"generic Protein 2\"", ",", "\"Protein 2\"", ")", ";", "p", ".", "add", "(", "equal", "(", "false", ")", ",", "\"Protein 1\"", ",", "\"Protein 2\"", ")", ";", "p", ".", "add", "(", "new", "Type", "(", "SequenceEntityReference", ".", "class", ")", ",", "\"Protein 2\"", ")", ";", "return", "p", ";", "}" ]
Two proteins have states that are members of the same complex. Handles nested complexes and homologies. Also guarantees that relationship to the complex is through different direct complex members. @return pattern
[ "Two", "proteins", "have", "states", "that", "are", "members", "of", "the", "same", "complex", ".", "Handles", "nested", "complexes", "and", "homologies", ".", "Also", "guarantees", "that", "relationship", "to", "the", "complex", "is", "through", "different", "direct", "complex", "members", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L504-L519
camunda/camunda-bpmn-model
src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java
AbstractBoundaryEventBuilder.errorEventDefinition
public ErrorEventDefinitionBuilder errorEventDefinition() { """ Creates an error event definition and returns a builder for the error event definition. @return the error event definition builder object """ ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition(); element.getEventDefinitions().add(errorEventDefinition); return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition); }
java
public ErrorEventDefinitionBuilder errorEventDefinition() { ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition(); element.getEventDefinitions().add(errorEventDefinition); return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition); }
[ "public", "ErrorEventDefinitionBuilder", "errorEventDefinition", "(", ")", "{", "ErrorEventDefinition", "errorEventDefinition", "=", "createEmptyErrorEventDefinition", "(", ")", ";", "element", ".", "getEventDefinitions", "(", ")", ".", "add", "(", "errorEventDefinition", ")", ";", "return", "new", "ErrorEventDefinitionBuilder", "(", "modelInstance", ",", "errorEventDefinition", ")", ";", "}" ]
Creates an error event definition and returns a builder for the error event definition. @return the error event definition builder object
[ "Creates", "an", "error", "event", "definition", "and", "returns", "a", "builder", "for", "the", "error", "event", "definition", "." ]
train
https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java#L95-L99
carewebframework/carewebframework-core
org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/CWFAuthenticationDetails.java
CWFAuthenticationDetails.setDetail
public void setDetail(String name, Object value) { """ Sets the specified detail element to the specified value. @param name Name of the detail element. @param value Value for the detail element. A null value removes any existing detail element. """ if (value == null) { details.remove(name); } else { details.put(name, value); } if (log.isDebugEnabled()) { if (value == null) { log.debug("Detail removed: " + name); } else { log.debug("Detail added: " + name + " = " + value); } } }
java
public void setDetail(String name, Object value) { if (value == null) { details.remove(name); } else { details.put(name, value); } if (log.isDebugEnabled()) { if (value == null) { log.debug("Detail removed: " + name); } else { log.debug("Detail added: " + name + " = " + value); } } }
[ "public", "void", "setDetail", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "details", ".", "remove", "(", "name", ")", ";", "}", "else", "{", "details", ".", "put", "(", "name", ",", "value", ")", ";", "}", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "if", "(", "value", "==", "null", ")", "{", "log", ".", "debug", "(", "\"Detail removed: \"", "+", "name", ")", ";", "}", "else", "{", "log", ".", "debug", "(", "\"Detail added: \"", "+", "name", "+", "\" = \"", "+", "value", ")", ";", "}", "}", "}" ]
Sets the specified detail element to the specified value. @param name Name of the detail element. @param value Value for the detail element. A null value removes any existing detail element.
[ "Sets", "the", "specified", "detail", "element", "to", "the", "specified", "value", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/CWFAuthenticationDetails.java#L62-L76
networknt/light-4j
client/src/main/java/com/networknt/client/oauth/cache/LongestExpireCacheStrategy.java
LongestExpireCacheStrategy.cacheJwt
@Override public synchronized void cacheJwt(Jwt.Key cachedKey, Jwt jwt) { """ This method is to cache a jwt LongestExpireCacheStrategy based on a given Jwt.Key and a Jwt. Every time it updates the expiry time of a jwt, and shift it up to a proper position. Since the PriorityQueue is implemented by heap, the average O(n) should be O(log n). @param cachedKey Jwt.Key the key to be used to cache @param jwt Jwt the jwt to be cached """ //update the expire time LongestExpireCacheKey leCachKey = new LongestExpireCacheKey(cachedKey); leCachKey.setExpiry(jwt.getExpire()); if(cachedJwts.size() >= capacity) { if(expiryQueue.contains(leCachKey)) { expiryQueue.remove(leCachKey); } else { cachedJwts.remove(expiryQueue.peek().getCacheKey()); expiryQueue.poll(); } } else { if(expiryQueue.contains(leCachKey)) { expiryQueue.remove(leCachKey); } } expiryQueue.add(leCachKey); cachedJwts.put(cachedKey, jwt); }
java
@Override public synchronized void cacheJwt(Jwt.Key cachedKey, Jwt jwt) { //update the expire time LongestExpireCacheKey leCachKey = new LongestExpireCacheKey(cachedKey); leCachKey.setExpiry(jwt.getExpire()); if(cachedJwts.size() >= capacity) { if(expiryQueue.contains(leCachKey)) { expiryQueue.remove(leCachKey); } else { cachedJwts.remove(expiryQueue.peek().getCacheKey()); expiryQueue.poll(); } } else { if(expiryQueue.contains(leCachKey)) { expiryQueue.remove(leCachKey); } } expiryQueue.add(leCachKey); cachedJwts.put(cachedKey, jwt); }
[ "@", "Override", "public", "synchronized", "void", "cacheJwt", "(", "Jwt", ".", "Key", "cachedKey", ",", "Jwt", "jwt", ")", "{", "//update the expire time", "LongestExpireCacheKey", "leCachKey", "=", "new", "LongestExpireCacheKey", "(", "cachedKey", ")", ";", "leCachKey", ".", "setExpiry", "(", "jwt", ".", "getExpire", "(", ")", ")", ";", "if", "(", "cachedJwts", ".", "size", "(", ")", ">=", "capacity", ")", "{", "if", "(", "expiryQueue", ".", "contains", "(", "leCachKey", ")", ")", "{", "expiryQueue", ".", "remove", "(", "leCachKey", ")", ";", "}", "else", "{", "cachedJwts", ".", "remove", "(", "expiryQueue", ".", "peek", "(", ")", ".", "getCacheKey", "(", ")", ")", ";", "expiryQueue", ".", "poll", "(", ")", ";", "}", "}", "else", "{", "if", "(", "expiryQueue", ".", "contains", "(", "leCachKey", ")", ")", "{", "expiryQueue", ".", "remove", "(", "leCachKey", ")", ";", "}", "}", "expiryQueue", ".", "add", "(", "leCachKey", ")", ";", "cachedJwts", ".", "put", "(", "cachedKey", ",", "jwt", ")", ";", "}" ]
This method is to cache a jwt LongestExpireCacheStrategy based on a given Jwt.Key and a Jwt. Every time it updates the expiry time of a jwt, and shift it up to a proper position. Since the PriorityQueue is implemented by heap, the average O(n) should be O(log n). @param cachedKey Jwt.Key the key to be used to cache @param jwt Jwt the jwt to be cached
[ "This", "method", "is", "to", "cache", "a", "jwt", "LongestExpireCacheStrategy", "based", "on", "a", "given", "Jwt", ".", "Key", "and", "a", "Jwt", ".", "Every", "time", "it", "updates", "the", "expiry", "time", "of", "a", "jwt", "and", "shift", "it", "up", "to", "a", "proper", "position", ".", "Since", "the", "PriorityQueue", "is", "implemented", "by", "heap", "the", "average", "O", "(", "n", ")", "should", "be", "O", "(", "log", "n", ")", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/cache/LongestExpireCacheStrategy.java#L45-L64
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/HttpFields.java
HttpFields.addDateField
public void addDateField(String name, long date) { """ Adds the value of a date field. @param name the field name @param date the field date value """ if (_dateBuffer==null) { _dateBuffer=new StringBuffer(32); _calendar=new HttpCal(); } _dateBuffer.setLength(0); _calendar.setTimeInMillis(date); formatDate(_dateBuffer, _calendar, false); add(name, _dateBuffer.toString()); }
java
public void addDateField(String name, long date) { if (_dateBuffer==null) { _dateBuffer=new StringBuffer(32); _calendar=new HttpCal(); } _dateBuffer.setLength(0); _calendar.setTimeInMillis(date); formatDate(_dateBuffer, _calendar, false); add(name, _dateBuffer.toString()); }
[ "public", "void", "addDateField", "(", "String", "name", ",", "long", "date", ")", "{", "if", "(", "_dateBuffer", "==", "null", ")", "{", "_dateBuffer", "=", "new", "StringBuffer", "(", "32", ")", ";", "_calendar", "=", "new", "HttpCal", "(", ")", ";", "}", "_dateBuffer", ".", "setLength", "(", "0", ")", ";", "_calendar", ".", "setTimeInMillis", "(", "date", ")", ";", "formatDate", "(", "_dateBuffer", ",", "_calendar", ",", "false", ")", ";", "add", "(", "name", ",", "_dateBuffer", ".", "toString", "(", ")", ")", ";", "}" ]
Adds the value of a date field. @param name the field name @param date the field date value
[ "Adds", "the", "value", "of", "a", "date", "field", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpFields.java#L1063-L1074
beanshell/beanshell
src/main/java/bsh/org/objectweb/asm/SymbolTable.java
SymbolTable.addUninitializedType
int addUninitializedType(final String value, final int bytecodeOffset) { """ Adds an {@link Frame#ITEM_UNINITIALIZED} type in the type table of this symbol table. Does nothing if the type table already contains a similar type. @param value an internal class name. @param bytecodeOffset the bytecode offset of the NEW instruction that created this {@link Frame#ITEM_UNINITIALIZED} type value. @return the index of a new or already existing type Symbol with the given value. """ int hashCode = hash(Symbol.UNINITIALIZED_TYPE_TAG, value, bytecodeOffset); Entry entry = get(hashCode); while (entry != null) { if (entry.tag == Symbol.UNINITIALIZED_TYPE_TAG && entry.hashCode == hashCode && entry.data == bytecodeOffset && entry.value.equals(value)) { return entry.index; } entry = entry.next; } return addType( new Entry(typeCount, Symbol.UNINITIALIZED_TYPE_TAG, value, bytecodeOffset, hashCode)); }
java
int addUninitializedType(final String value, final int bytecodeOffset) { int hashCode = hash(Symbol.UNINITIALIZED_TYPE_TAG, value, bytecodeOffset); Entry entry = get(hashCode); while (entry != null) { if (entry.tag == Symbol.UNINITIALIZED_TYPE_TAG && entry.hashCode == hashCode && entry.data == bytecodeOffset && entry.value.equals(value)) { return entry.index; } entry = entry.next; } return addType( new Entry(typeCount, Symbol.UNINITIALIZED_TYPE_TAG, value, bytecodeOffset, hashCode)); }
[ "int", "addUninitializedType", "(", "final", "String", "value", ",", "final", "int", "bytecodeOffset", ")", "{", "int", "hashCode", "=", "hash", "(", "Symbol", ".", "UNINITIALIZED_TYPE_TAG", ",", "value", ",", "bytecodeOffset", ")", ";", "Entry", "entry", "=", "get", "(", "hashCode", ")", ";", "while", "(", "entry", "!=", "null", ")", "{", "if", "(", "entry", ".", "tag", "==", "Symbol", ".", "UNINITIALIZED_TYPE_TAG", "&&", "entry", ".", "hashCode", "==", "hashCode", "&&", "entry", ".", "data", "==", "bytecodeOffset", "&&", "entry", ".", "value", ".", "equals", "(", "value", ")", ")", "{", "return", "entry", ".", "index", ";", "}", "entry", "=", "entry", ".", "next", ";", "}", "return", "addType", "(", "new", "Entry", "(", "typeCount", ",", "Symbol", ".", "UNINITIALIZED_TYPE_TAG", ",", "value", ",", "bytecodeOffset", ",", "hashCode", ")", ")", ";", "}" ]
Adds an {@link Frame#ITEM_UNINITIALIZED} type in the type table of this symbol table. Does nothing if the type table already contains a similar type. @param value an internal class name. @param bytecodeOffset the bytecode offset of the NEW instruction that created this {@link Frame#ITEM_UNINITIALIZED} type value. @return the index of a new or already existing type Symbol with the given value.
[ "Adds", "an", "{", "@link", "Frame#ITEM_UNINITIALIZED", "}", "type", "in", "the", "type", "table", "of", "this", "symbol", "table", ".", "Does", "nothing", "if", "the", "type", "table", "already", "contains", "a", "similar", "type", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/org/objectweb/asm/SymbolTable.java#L1013-L1027
playframework/play-ws
play-ahc-ws-standalone/src/main/java/play/libs/oauth/OAuth.java
OAuth.retrieveRequestToken
public RequestToken retrieveRequestToken(String callbackURL) { """ Request the request token and secret. @param callbackURL the URL where the provider should redirect to (usually a URL on the current app) @return A Right(RequestToken) in case of success, Left(OAuthException) otherwise """ OAuthConsumer consumer = new DefaultOAuthConsumer(info.key.key, info.key.secret); try { provider.retrieveRequestToken(consumer, callbackURL); return new RequestToken(consumer.getToken(), consumer.getTokenSecret()); } catch (OAuthException ex) { throw new RuntimeException(ex); } }
java
public RequestToken retrieveRequestToken(String callbackURL) { OAuthConsumer consumer = new DefaultOAuthConsumer(info.key.key, info.key.secret); try { provider.retrieveRequestToken(consumer, callbackURL); return new RequestToken(consumer.getToken(), consumer.getTokenSecret()); } catch (OAuthException ex) { throw new RuntimeException(ex); } }
[ "public", "RequestToken", "retrieveRequestToken", "(", "String", "callbackURL", ")", "{", "OAuthConsumer", "consumer", "=", "new", "DefaultOAuthConsumer", "(", "info", ".", "key", ".", "key", ",", "info", ".", "key", ".", "secret", ")", ";", "try", "{", "provider", ".", "retrieveRequestToken", "(", "consumer", ",", "callbackURL", ")", ";", "return", "new", "RequestToken", "(", "consumer", ".", "getToken", "(", ")", ",", "consumer", ".", "getTokenSecret", "(", ")", ")", ";", "}", "catch", "(", "OAuthException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "ex", ")", ";", "}", "}" ]
Request the request token and secret. @param callbackURL the URL where the provider should redirect to (usually a URL on the current app) @return A Right(RequestToken) in case of success, Left(OAuthException) otherwise
[ "Request", "the", "request", "token", "and", "secret", "." ]
train
https://github.com/playframework/play-ws/blob/fbc25196eb6295281e9b43810e45c252913fbfcf/play-ahc-ws-standalone/src/main/java/play/libs/oauth/OAuth.java#L44-L52
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.HEADING
public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle, HtmlStyle styleClass, Content body) { """ Generates a heading tag (h1 to h6) with the title and style class attributes. It also encloses a content. @param headingTag the heading tag to be generated @param printTitle true if title for the tag needs to be printed else false @param styleClass stylesheet class for the tag @param body content for the tag @return an HtmlTree object for the tag """ HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body)); if (printTitle) htmltree.setTitle(body); if (styleClass != null) htmltree.addStyle(styleClass); return htmltree; }
java
public static HtmlTree HEADING(HtmlTag headingTag, boolean printTitle, HtmlStyle styleClass, Content body) { HtmlTree htmltree = new HtmlTree(headingTag, nullCheck(body)); if (printTitle) htmltree.setTitle(body); if (styleClass != null) htmltree.addStyle(styleClass); return htmltree; }
[ "public", "static", "HtmlTree", "HEADING", "(", "HtmlTag", "headingTag", ",", "boolean", "printTitle", ",", "HtmlStyle", "styleClass", ",", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "headingTag", ",", "nullCheck", "(", "body", ")", ")", ";", "if", "(", "printTitle", ")", "htmltree", ".", "setTitle", "(", "body", ")", ";", "if", "(", "styleClass", "!=", "null", ")", "htmltree", ".", "addStyle", "(", "styleClass", ")", ";", "return", "htmltree", ";", "}" ]
Generates a heading tag (h1 to h6) with the title and style class attributes. It also encloses a content. @param headingTag the heading tag to be generated @param printTitle true if title for the tag needs to be printed else false @param styleClass stylesheet class for the tag @param body content for the tag @return an HtmlTree object for the tag
[ "Generates", "a", "heading", "tag", "(", "h1", "to", "h6", ")", "with", "the", "title", "and", "style", "class", "attributes", ".", "It", "also", "encloses", "a", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L394-L402
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Sound.java
Sound.playAt
public void playAt(float pitch, float volume, float x, float y, float z) { """ Play a sound effect from a particular location @param pitch The pitch to play the sound effect at @param volume The volumen to play the sound effect at @param x The x position of the source of the effect @param y The y position of the source of the effect @param z The z position of the source of the effect """ sound.playAsSoundEffect(pitch, volume * SoundStore.get().getSoundVolume(), false, x,y,z); }
java
public void playAt(float pitch, float volume, float x, float y, float z) { sound.playAsSoundEffect(pitch, volume * SoundStore.get().getSoundVolume(), false, x,y,z); }
[ "public", "void", "playAt", "(", "float", "pitch", ",", "float", "volume", ",", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "sound", ".", "playAsSoundEffect", "(", "pitch", ",", "volume", "*", "SoundStore", ".", "get", "(", ")", ".", "getSoundVolume", "(", ")", ",", "false", ",", "x", ",", "y", ",", "z", ")", ";", "}" ]
Play a sound effect from a particular location @param pitch The pitch to play the sound effect at @param volume The volumen to play the sound effect at @param x The x position of the source of the effect @param y The y position of the source of the effect @param z The z position of the source of the effect
[ "Play", "a", "sound", "effect", "from", "a", "particular", "location" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Sound.java#L140-L142
m-m-m/util
cli/src/main/java/net/sf/mmm/util/cli/api/AbstractMain.java
AbstractMain.run
public int run(String... args) { """ This method should be invoked from the static main-method. @param args are the commandline-arguments. @return the exit code or {@code 0} on success. """ CliParser parser = getParserBuilder().build(this); try { CliModeObject mode = parser.parseParameters(args); if (this.help) { assert (mode.getId().equals(CliMode.ID_HELP)); printHelp(parser); return 0; } validate(mode); return run(mode); } catch (Exception e) { return handleError(e, parser); } finally { getStandardOutput().flush(); getStandardError().flush(); } }
java
public int run(String... args) { CliParser parser = getParserBuilder().build(this); try { CliModeObject mode = parser.parseParameters(args); if (this.help) { assert (mode.getId().equals(CliMode.ID_HELP)); printHelp(parser); return 0; } validate(mode); return run(mode); } catch (Exception e) { return handleError(e, parser); } finally { getStandardOutput().flush(); getStandardError().flush(); } }
[ "public", "int", "run", "(", "String", "...", "args", ")", "{", "CliParser", "parser", "=", "getParserBuilder", "(", ")", ".", "build", "(", "this", ")", ";", "try", "{", "CliModeObject", "mode", "=", "parser", ".", "parseParameters", "(", "args", ")", ";", "if", "(", "this", ".", "help", ")", "{", "assert", "(", "mode", ".", "getId", "(", ")", ".", "equals", "(", "CliMode", ".", "ID_HELP", ")", ")", ";", "printHelp", "(", "parser", ")", ";", "return", "0", ";", "}", "validate", "(", "mode", ")", ";", "return", "run", "(", "mode", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "handleError", "(", "e", ",", "parser", ")", ";", "}", "finally", "{", "getStandardOutput", "(", ")", ".", "flush", "(", ")", ";", "getStandardError", "(", ")", ".", "flush", "(", ")", ";", "}", "}" ]
This method should be invoked from the static main-method. @param args are the commandline-arguments. @return the exit code or {@code 0} on success.
[ "This", "method", "should", "be", "invoked", "from", "the", "static", "main", "-", "method", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/api/AbstractMain.java#L244-L262
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/misc/CircularIndex.java
CircularIndex.addOffset
public static int addOffset(int index, int offset, int size) { """ Adds offset (positive or negative) to index in a circular buffer. @param index element in circular buffer @param offset offset. |offset| < size @param size size of the circular buffer @return new index """ index += offset; if( index < 0 ) { return size + index; } else { return index%size; } }
java
public static int addOffset(int index, int offset, int size) { index += offset; if( index < 0 ) { return size + index; } else { return index%size; } }
[ "public", "static", "int", "addOffset", "(", "int", "index", ",", "int", "offset", ",", "int", "size", ")", "{", "index", "+=", "offset", ";", "if", "(", "index", "<", "0", ")", "{", "return", "size", "+", "index", ";", "}", "else", "{", "return", "index", "%", "size", ";", "}", "}" ]
Adds offset (positive or negative) to index in a circular buffer. @param index element in circular buffer @param offset offset. |offset| < size @param size size of the circular buffer @return new index
[ "Adds", "offset", "(", "positive", "or", "negative", ")", "to", "index", "in", "a", "circular", "buffer", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/misc/CircularIndex.java#L64-L71
Wikidata/Wikidata-Toolkit
wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java
ClassPropertyUsageAnalyzer.printClassList
private void printClassList(PrintStream out, Iterable<EntityIdValue> classes) { """ Prints a list of classes to the given output. The list is encoded as a single CSV value, using "@" as a separator. Miga can decode this. Standard CSV processors do not support lists of entries as values, however. @param out the output to write to @param classes the list of class items """ out.print(",\""); boolean first = true; for (EntityIdValue superClass : classes) { if (first) { first = false; } else { out.print("@"); } // makeshift escaping for Miga: out.print(getClassLabel(superClass).replace("@", "@")); } out.print("\""); }
java
private void printClassList(PrintStream out, Iterable<EntityIdValue> classes) { out.print(",\""); boolean first = true; for (EntityIdValue superClass : classes) { if (first) { first = false; } else { out.print("@"); } // makeshift escaping for Miga: out.print(getClassLabel(superClass).replace("@", "@")); } out.print("\""); }
[ "private", "void", "printClassList", "(", "PrintStream", "out", ",", "Iterable", "<", "EntityIdValue", ">", "classes", ")", "{", "out", ".", "print", "(", "\",\\\"\"", ")", ";", "boolean", "first", "=", "true", ";", "for", "(", "EntityIdValue", "superClass", ":", "classes", ")", "{", "if", "(", "first", ")", "{", "first", "=", "false", ";", "}", "else", "{", "out", ".", "print", "(", "\"@\"", ")", ";", "}", "// makeshift escaping for Miga:", "out", ".", "print", "(", "getClassLabel", "(", "superClass", ")", ".", "replace", "(", "\"@\"", ",", "\"@\"))", ";", "", "", "}", "out", ".", "print", "(", "\"\\\"\"", ")", ";", "}" ]
Prints a list of classes to the given output. The list is encoded as a single CSV value, using "@" as a separator. Miga can decode this. Standard CSV processors do not support lists of entries as values, however. @param out the output to write to @param classes the list of class items
[ "Prints", "a", "list", "of", "classes", "to", "the", "given", "output", ".", "The", "list", "is", "encoded", "as", "a", "single", "CSV", "value", "using", "@", "as", "a", "separator", ".", "Miga", "can", "decode", "this", ".", "Standard", "CSV", "processors", "do", "not", "support", "lists", "of", "entries", "as", "values", "however", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java#L575-L588
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java
WebUtils.putServiceTicketInRequestScope
public static void putServiceTicketInRequestScope(final RequestContext context, final ServiceTicket ticketValue) { """ Put service ticket in request scope. @param context the context @param ticketValue the ticket value """ context.getRequestScope().put(PARAMETER_SERVICE_TICKET_ID, ticketValue.getId()); }
java
public static void putServiceTicketInRequestScope(final RequestContext context, final ServiceTicket ticketValue) { context.getRequestScope().put(PARAMETER_SERVICE_TICKET_ID, ticketValue.getId()); }
[ "public", "static", "void", "putServiceTicketInRequestScope", "(", "final", "RequestContext", "context", ",", "final", "ServiceTicket", "ticketValue", ")", "{", "context", ".", "getRequestScope", "(", ")", ".", "put", "(", "PARAMETER_SERVICE_TICKET_ID", ",", "ticketValue", ".", "getId", "(", ")", ")", ";", "}" ]
Put service ticket in request scope. @param context the context @param ticketValue the ticket value
[ "Put", "service", "ticket", "in", "request", "scope", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L229-L231
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectIntersectionOfImpl_CustomFieldSerializer.java
OWLObjectIntersectionOfImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectIntersectionOfImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectIntersectionOfImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectIntersectionOfImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectIntersectionOfImpl_CustomFieldSerializer.java#L70-L73
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.createGroup
public CmsGroup createGroup(CmsDbContext dbc, CmsUUID id, String name, String description, int flags, String parent) throws CmsIllegalArgumentException, CmsException { """ Add a new group to the Cms.<p> Only the admin can do this. Only users, which are in the group "administrators" are granted.<p> @param dbc the current database context @param id the id of the new group @param name the name of the new group @param description the description for the new group @param flags the flags for the new group @param parent the name of the parent group (or <code>null</code>) @return new created group @throws CmsException if the creation of the group failed @throws CmsIllegalArgumentException if the length of the given name was below 1 """ // check the group name OpenCms.getValidationHandler().checkGroupName(CmsOrganizationalUnit.getSimpleName(name)); // trim the name name = name.trim(); // check the OU readOrganizationalUnit(dbc, CmsOrganizationalUnit.getParentFqn(name)); // get the id of the parent group if necessary if (CmsStringUtil.isNotEmpty(parent)) { CmsGroup parentGroup = readGroup(dbc, parent); if (!parentGroup.isRole() && !CmsOrganizationalUnit.getParentFqn(parent).equals(CmsOrganizationalUnit.getParentFqn(name))) { throw new CmsDataAccessException( Messages.get().container( Messages.ERR_PARENT_GROUP_MUST_BE_IN_SAME_OU_3, CmsOrganizationalUnit.getSimpleName(name), CmsOrganizationalUnit.getParentFqn(name), parent)); } } // create the group CmsGroup group = getUserDriver(dbc).createGroup(dbc, id, name, description, flags, parent); // if the group is in fact a role, initialize it if (group.isVirtual()) { // get all users that have the given role String groupname = CmsRole.valueOf(group).getGroupName(); Iterator<CmsUser> it = getUsersOfGroup(dbc, groupname, true, false, true).iterator(); while (it.hasNext()) { CmsUser user = it.next(); // put them in the new group addUserToGroup(dbc, user.getName(), group.getName(), true); } } // put it into the cache m_monitor.cacheGroup(group); if (!dbc.getProjectId().isNullUUID()) { // group modified event is not needed return group; } // fire group modified event Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put(I_CmsEventListener.KEY_GROUP_NAME, group.getName()); eventData.put(I_CmsEventListener.KEY_GROUP_ID, group.getId().toString()); eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_GROUP_MODIFIED_ACTION_CREATE); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_GROUP_MODIFIED, eventData)); // return it return group; }
java
public CmsGroup createGroup(CmsDbContext dbc, CmsUUID id, String name, String description, int flags, String parent) throws CmsIllegalArgumentException, CmsException { // check the group name OpenCms.getValidationHandler().checkGroupName(CmsOrganizationalUnit.getSimpleName(name)); // trim the name name = name.trim(); // check the OU readOrganizationalUnit(dbc, CmsOrganizationalUnit.getParentFqn(name)); // get the id of the parent group if necessary if (CmsStringUtil.isNotEmpty(parent)) { CmsGroup parentGroup = readGroup(dbc, parent); if (!parentGroup.isRole() && !CmsOrganizationalUnit.getParentFqn(parent).equals(CmsOrganizationalUnit.getParentFqn(name))) { throw new CmsDataAccessException( Messages.get().container( Messages.ERR_PARENT_GROUP_MUST_BE_IN_SAME_OU_3, CmsOrganizationalUnit.getSimpleName(name), CmsOrganizationalUnit.getParentFqn(name), parent)); } } // create the group CmsGroup group = getUserDriver(dbc).createGroup(dbc, id, name, description, flags, parent); // if the group is in fact a role, initialize it if (group.isVirtual()) { // get all users that have the given role String groupname = CmsRole.valueOf(group).getGroupName(); Iterator<CmsUser> it = getUsersOfGroup(dbc, groupname, true, false, true).iterator(); while (it.hasNext()) { CmsUser user = it.next(); // put them in the new group addUserToGroup(dbc, user.getName(), group.getName(), true); } } // put it into the cache m_monitor.cacheGroup(group); if (!dbc.getProjectId().isNullUUID()) { // group modified event is not needed return group; } // fire group modified event Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put(I_CmsEventListener.KEY_GROUP_NAME, group.getName()); eventData.put(I_CmsEventListener.KEY_GROUP_ID, group.getId().toString()); eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_GROUP_MODIFIED_ACTION_CREATE); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_GROUP_MODIFIED, eventData)); // return it return group; }
[ "public", "CmsGroup", "createGroup", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "id", ",", "String", "name", ",", "String", "description", ",", "int", "flags", ",", "String", "parent", ")", "throws", "CmsIllegalArgumentException", ",", "CmsException", "{", "// check the group name", "OpenCms", ".", "getValidationHandler", "(", ")", ".", "checkGroupName", "(", "CmsOrganizationalUnit", ".", "getSimpleName", "(", "name", ")", ")", ";", "// trim the name", "name", "=", "name", ".", "trim", "(", ")", ";", "// check the OU", "readOrganizationalUnit", "(", "dbc", ",", "CmsOrganizationalUnit", ".", "getParentFqn", "(", "name", ")", ")", ";", "// get the id of the parent group if necessary", "if", "(", "CmsStringUtil", ".", "isNotEmpty", "(", "parent", ")", ")", "{", "CmsGroup", "parentGroup", "=", "readGroup", "(", "dbc", ",", "parent", ")", ";", "if", "(", "!", "parentGroup", ".", "isRole", "(", ")", "&&", "!", "CmsOrganizationalUnit", ".", "getParentFqn", "(", "parent", ")", ".", "equals", "(", "CmsOrganizationalUnit", ".", "getParentFqn", "(", "name", ")", ")", ")", "{", "throw", "new", "CmsDataAccessException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_PARENT_GROUP_MUST_BE_IN_SAME_OU_3", ",", "CmsOrganizationalUnit", ".", "getSimpleName", "(", "name", ")", ",", "CmsOrganizationalUnit", ".", "getParentFqn", "(", "name", ")", ",", "parent", ")", ")", ";", "}", "}", "// create the group", "CmsGroup", "group", "=", "getUserDriver", "(", "dbc", ")", ".", "createGroup", "(", "dbc", ",", "id", ",", "name", ",", "description", ",", "flags", ",", "parent", ")", ";", "// if the group is in fact a role, initialize it", "if", "(", "group", ".", "isVirtual", "(", ")", ")", "{", "// get all users that have the given role", "String", "groupname", "=", "CmsRole", ".", "valueOf", "(", "group", ")", ".", "getGroupName", "(", ")", ";", "Iterator", "<", "CmsUser", ">", "it", "=", "getUsersOfGroup", "(", "dbc", ",", "groupname", ",", "true", ",", "false", ",", "true", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "CmsUser", "user", "=", "it", ".", "next", "(", ")", ";", "// put them in the new group", "addUserToGroup", "(", "dbc", ",", "user", ".", "getName", "(", ")", ",", "group", ".", "getName", "(", ")", ",", "true", ")", ";", "}", "}", "// put it into the cache", "m_monitor", ".", "cacheGroup", "(", "group", ")", ";", "if", "(", "!", "dbc", ".", "getProjectId", "(", ")", ".", "isNullUUID", "(", ")", ")", "{", "// group modified event is not needed", "return", "group", ";", "}", "// fire group modified event", "Map", "<", "String", ",", "Object", ">", "eventData", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "eventData", ".", "put", "(", "I_CmsEventListener", ".", "KEY_GROUP_NAME", ",", "group", ".", "getName", "(", ")", ")", ";", "eventData", ".", "put", "(", "I_CmsEventListener", ".", "KEY_GROUP_ID", ",", "group", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ";", "eventData", ".", "put", "(", "I_CmsEventListener", ".", "KEY_USER_ACTION", ",", "I_CmsEventListener", ".", "VALUE_GROUP_MODIFIED_ACTION_CREATE", ")", ";", "OpenCms", ".", "fireCmsEvent", "(", "new", "CmsEvent", "(", "I_CmsEventListener", ".", "EVENT_GROUP_MODIFIED", ",", "eventData", ")", ")", ";", "// return it", "return", "group", ";", "}" ]
Add a new group to the Cms.<p> Only the admin can do this. Only users, which are in the group "administrators" are granted.<p> @param dbc the current database context @param id the id of the new group @param name the name of the new group @param description the description for the new group @param flags the flags for the new group @param parent the name of the parent group (or <code>null</code>) @return new created group @throws CmsException if the creation of the group failed @throws CmsIllegalArgumentException if the length of the given name was below 1
[ "Add", "a", "new", "group", "to", "the", "Cms", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L1315-L1371
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.setSREFromXML
public static void setSREFromXML(ISREInstall sre, String xml) throws CoreException { """ Returns the XML representation of the given SRE. @param sre the SRE to serialize. @param xml the XML representation of the given SRE. @throws CoreException if trying to compute the XML for the SRE state encounters a problem. """ try { final Element root = parseXML(xml, false); sre.setFromXML(root); } catch (Throwable e) { throw new CoreException(SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, e)); } }
java
public static void setSREFromXML(ISREInstall sre, String xml) throws CoreException { try { final Element root = parseXML(xml, false); sre.setFromXML(root); } catch (Throwable e) { throw new CoreException(SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, e)); } }
[ "public", "static", "void", "setSREFromXML", "(", "ISREInstall", "sre", ",", "String", "xml", ")", "throws", "CoreException", "{", "try", "{", "final", "Element", "root", "=", "parseXML", "(", "xml", ",", "false", ")", ";", "sre", ".", "setFromXML", "(", "root", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "throw", "new", "CoreException", "(", "SARLEclipsePlugin", ".", "getDefault", "(", ")", ".", "createStatus", "(", "IStatus", ".", "ERROR", ",", "e", ")", ")", ";", "}", "}" ]
Returns the XML representation of the given SRE. @param sre the SRE to serialize. @param xml the XML representation of the given SRE. @throws CoreException if trying to compute the XML for the SRE state encounters a problem.
[ "Returns", "the", "XML", "representation", "of", "the", "given", "SRE", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L536-L543
phax/ph-web
ph-web/src/main/java/com/helger/web/fileupload/parse/AbstractFileUploadBase.java
AbstractFileUploadBase._parseEndOfLine
private static int _parseEndOfLine (@Nonnull final String sHeaderPart, final int nEnd) { """ Skips bytes until the end of the current line. @param sHeaderPart The headers, which are being parsed. @param nEnd Index of the last byte, which has yet been processed. @return Index of the \r\n sequence, which indicates end of line. """ int nIndex = nEnd; for (;;) { final int nOffset = sHeaderPart.indexOf ('\r', nIndex); if (nOffset == -1 || nOffset + 1 >= sHeaderPart.length ()) throw new IllegalStateException ("Expected headers to be terminated by an empty line."); if (sHeaderPart.charAt (nOffset + 1) == '\n') return nOffset; nIndex = nOffset + 1; } }
java
private static int _parseEndOfLine (@Nonnull final String sHeaderPart, final int nEnd) { int nIndex = nEnd; for (;;) { final int nOffset = sHeaderPart.indexOf ('\r', nIndex); if (nOffset == -1 || nOffset + 1 >= sHeaderPart.length ()) throw new IllegalStateException ("Expected headers to be terminated by an empty line."); if (sHeaderPart.charAt (nOffset + 1) == '\n') return nOffset; nIndex = nOffset + 1; } }
[ "private", "static", "int", "_parseEndOfLine", "(", "@", "Nonnull", "final", "String", "sHeaderPart", ",", "final", "int", "nEnd", ")", "{", "int", "nIndex", "=", "nEnd", ";", "for", "(", ";", ";", ")", "{", "final", "int", "nOffset", "=", "sHeaderPart", ".", "indexOf", "(", "'", "'", ",", "nIndex", ")", ";", "if", "(", "nOffset", "==", "-", "1", "||", "nOffset", "+", "1", ">=", "sHeaderPart", ".", "length", "(", ")", ")", "throw", "new", "IllegalStateException", "(", "\"Expected headers to be terminated by an empty line.\"", ")", ";", "if", "(", "sHeaderPart", ".", "charAt", "(", "nOffset", "+", "1", ")", "==", "'", "'", ")", "return", "nOffset", ";", "nIndex", "=", "nOffset", "+", "1", ";", "}", "}" ]
Skips bytes until the end of the current line. @param sHeaderPart The headers, which are being parsed. @param nEnd Index of the last byte, which has yet been processed. @return Index of the \r\n sequence, which indicates end of line.
[ "Skips", "bytes", "until", "the", "end", "of", "the", "current", "line", "." ]
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/fileupload/parse/AbstractFileUploadBase.java#L525-L538
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserCommand.java
ParserCommand.compileCommit
private Statement compileCommit() { """ Responsible for handling the execution of COMMIT [WORK] @throws HsqlException """ boolean chain = false; read(); readIfThis(Tokens.WORK); if (token.tokenType == Tokens.AND) { read(); if (token.tokenType == Tokens.NO) { read(); } else { chain = true; } readThis(Tokens.CHAIN); } String sql = getLastPart(); Object[] args = new Object[]{ Boolean.valueOf(chain) }; Statement cs = new StatementSession(StatementTypes.COMMIT_WORK, args); return cs; }
java
private Statement compileCommit() { boolean chain = false; read(); readIfThis(Tokens.WORK); if (token.tokenType == Tokens.AND) { read(); if (token.tokenType == Tokens.NO) { read(); } else { chain = true; } readThis(Tokens.CHAIN); } String sql = getLastPart(); Object[] args = new Object[]{ Boolean.valueOf(chain) }; Statement cs = new StatementSession(StatementTypes.COMMIT_WORK, args); return cs; }
[ "private", "Statement", "compileCommit", "(", ")", "{", "boolean", "chain", "=", "false", ";", "read", "(", ")", ";", "readIfThis", "(", "Tokens", ".", "WORK", ")", ";", "if", "(", "token", ".", "tokenType", "==", "Tokens", ".", "AND", ")", "{", "read", "(", ")", ";", "if", "(", "token", ".", "tokenType", "==", "Tokens", ".", "NO", ")", "{", "read", "(", ")", ";", "}", "else", "{", "chain", "=", "true", ";", "}", "readThis", "(", "Tokens", ".", "CHAIN", ")", ";", "}", "String", "sql", "=", "getLastPart", "(", ")", ";", "Object", "[", "]", "args", "=", "new", "Object", "[", "]", "{", "Boolean", ".", "valueOf", "(", "chain", ")", "}", ";", "Statement", "cs", "=", "new", "StatementSession", "(", "StatementTypes", ".", "COMMIT_WORK", ",", "args", ")", ";", "return", "cs", ";", "}" ]
Responsible for handling the execution of COMMIT [WORK] @throws HsqlException
[ "Responsible", "for", "handling", "the", "execution", "of", "COMMIT", "[", "WORK", "]" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserCommand.java#L1098-L1122
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java
DependencyCheckScanAgent.populateSettings
private void populateSettings() { """ Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties required to change the proxy server, port, and connection timeout. """ settings = new Settings(); if (dataDirectory != null) { settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); } else { final File jarPath = new File(DependencyCheckScanAgent.class.getProtectionDomain().getCodeSource().getLocation().getPath()); final File base = jarPath.getParentFile(); final String sub = settings.getString(Settings.KEYS.DATA_DIRECTORY); final File dataDir = new File(base, sub); settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); } if (propertiesFilePath != null) { try { settings.mergeProperties(propertiesFilePath); LOGGER.info("Successfully loaded user-defined properties"); } catch (IOException e) { LOGGER.error("Unable to merge user-defined properties", e); LOGGER.error("Continuing execution"); } } settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); settings.setStringIfNotEmpty(Settings.KEYS.PROXY_SERVER, proxyServer); settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PORT, proxyPort); settings.setStringIfNotEmpty(Settings.KEYS.PROXY_USERNAME, proxyUsername); settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPassword); settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); settings.setStringIfNotEmpty(Settings.KEYS.CVE_CPE_STARTS_WITH_FILTER, cpeStartsWithFilter); settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_CENTRAL_URL, centralUrl); settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_JSON, cveUrlModified); settings.setStringIfNotEmpty(Settings.KEYS.CVE_BASE_JSON, cveUrlBase); settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_DOTNET_PATH, pathToCore); }
java
private void populateSettings() { settings = new Settings(); if (dataDirectory != null) { settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory); } else { final File jarPath = new File(DependencyCheckScanAgent.class.getProtectionDomain().getCodeSource().getLocation().getPath()); final File base = jarPath.getParentFile(); final String sub = settings.getString(Settings.KEYS.DATA_DIRECTORY); final File dataDir = new File(base, sub); settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath()); } if (propertiesFilePath != null) { try { settings.mergeProperties(propertiesFilePath); LOGGER.info("Successfully loaded user-defined properties"); } catch (IOException e) { LOGGER.error("Unable to merge user-defined properties", e); LOGGER.error("Continuing execution"); } } settings.setBoolean(Settings.KEYS.AUTO_UPDATE, autoUpdate); settings.setStringIfNotEmpty(Settings.KEYS.PROXY_SERVER, proxyServer); settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PORT, proxyPort); settings.setStringIfNotEmpty(Settings.KEYS.PROXY_USERNAME, proxyUsername); settings.setStringIfNotEmpty(Settings.KEYS.PROXY_PASSWORD, proxyPassword); settings.setStringIfNotEmpty(Settings.KEYS.CONNECTION_TIMEOUT, connectionTimeout); settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile); settings.setStringIfNotEmpty(Settings.KEYS.CVE_CPE_STARTS_WITH_FILTER, cpeStartsWithFilter); settings.setBoolean(Settings.KEYS.ANALYZER_CENTRAL_ENABLED, centralAnalyzerEnabled); settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_CENTRAL_URL, centralUrl); settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_ENABLED, nexusAnalyzerEnabled); settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_NEXUS_URL, nexusUrl); settings.setBoolean(Settings.KEYS.ANALYZER_NEXUS_USES_PROXY, nexusUsesProxy); settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_NAME, databaseDriverName); settings.setStringIfNotEmpty(Settings.KEYS.DB_DRIVER_PATH, databaseDriverPath); settings.setStringIfNotEmpty(Settings.KEYS.DB_CONNECTION_STRING, connectionString); settings.setStringIfNotEmpty(Settings.KEYS.DB_USER, databaseUser); settings.setStringIfNotEmpty(Settings.KEYS.DB_PASSWORD, databasePassword); settings.setStringIfNotEmpty(Settings.KEYS.ADDITIONAL_ZIP_EXTENSIONS, zipExtensions); settings.setStringIfNotEmpty(Settings.KEYS.CVE_MODIFIED_JSON, cveUrlModified); settings.setStringIfNotEmpty(Settings.KEYS.CVE_BASE_JSON, cveUrlBase); settings.setStringIfNotEmpty(Settings.KEYS.ANALYZER_ASSEMBLY_DOTNET_PATH, pathToCore); }
[ "private", "void", "populateSettings", "(", ")", "{", "settings", "=", "new", "Settings", "(", ")", ";", "if", "(", "dataDirectory", "!=", "null", ")", "{", "settings", ".", "setString", "(", "Settings", ".", "KEYS", ".", "DATA_DIRECTORY", ",", "dataDirectory", ")", ";", "}", "else", "{", "final", "File", "jarPath", "=", "new", "File", "(", "DependencyCheckScanAgent", ".", "class", ".", "getProtectionDomain", "(", ")", ".", "getCodeSource", "(", ")", ".", "getLocation", "(", ")", ".", "getPath", "(", ")", ")", ";", "final", "File", "base", "=", "jarPath", ".", "getParentFile", "(", ")", ";", "final", "String", "sub", "=", "settings", ".", "getString", "(", "Settings", ".", "KEYS", ".", "DATA_DIRECTORY", ")", ";", "final", "File", "dataDir", "=", "new", "File", "(", "base", ",", "sub", ")", ";", "settings", ".", "setString", "(", "Settings", ".", "KEYS", ".", "DATA_DIRECTORY", ",", "dataDir", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "if", "(", "propertiesFilePath", "!=", "null", ")", "{", "try", "{", "settings", ".", "mergeProperties", "(", "propertiesFilePath", ")", ";", "LOGGER", ".", "info", "(", "\"Successfully loaded user-defined properties\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"Unable to merge user-defined properties\"", ",", "e", ")", ";", "LOGGER", ".", "error", "(", "\"Continuing execution\"", ")", ";", "}", "}", "settings", ".", "setBoolean", "(", "Settings", ".", "KEYS", ".", "AUTO_UPDATE", ",", "autoUpdate", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "PROXY_SERVER", ",", "proxyServer", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "PROXY_PORT", ",", "proxyPort", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "PROXY_USERNAME", ",", "proxyUsername", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "PROXY_PASSWORD", ",", "proxyPassword", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "CONNECTION_TIMEOUT", ",", "connectionTimeout", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "SUPPRESSION_FILE", ",", "suppressionFile", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "CVE_CPE_STARTS_WITH_FILTER", ",", "cpeStartsWithFilter", ")", ";", "settings", ".", "setBoolean", "(", "Settings", ".", "KEYS", ".", "ANALYZER_CENTRAL_ENABLED", ",", "centralAnalyzerEnabled", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "ANALYZER_CENTRAL_URL", ",", "centralUrl", ")", ";", "settings", ".", "setBoolean", "(", "Settings", ".", "KEYS", ".", "ANALYZER_NEXUS_ENABLED", ",", "nexusAnalyzerEnabled", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "ANALYZER_NEXUS_URL", ",", "nexusUrl", ")", ";", "settings", ".", "setBoolean", "(", "Settings", ".", "KEYS", ".", "ANALYZER_NEXUS_USES_PROXY", ",", "nexusUsesProxy", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "DB_DRIVER_NAME", ",", "databaseDriverName", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "DB_DRIVER_PATH", ",", "databaseDriverPath", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "DB_CONNECTION_STRING", ",", "connectionString", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "DB_USER", ",", "databaseUser", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "DB_PASSWORD", ",", "databasePassword", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "ADDITIONAL_ZIP_EXTENSIONS", ",", "zipExtensions", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "CVE_MODIFIED_JSON", ",", "cveUrlModified", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "CVE_BASE_JSON", ",", "cveUrlBase", ")", ";", "settings", ".", "setStringIfNotEmpty", "(", "Settings", ".", "KEYS", ".", "ANALYZER_ASSEMBLY_DOTNET_PATH", ",", "pathToCore", ")", ";", "}" ]
Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties required to change the proxy server, port, and connection timeout.
[ "Takes", "the", "properties", "supplied", "and", "updates", "the", "dependency", "-", "check", "settings", ".", "Additionally", "this", "sets", "the", "system", "properties", "required", "to", "change", "the", "proxy", "server", "port", "and", "connection", "timeout", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java#L907-L950
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/engine/QuerySources.java
QuerySources.childNodes
public NodeSequence childNodes( Path parentPath, float score ) { """ Obtain a {@link NodeSequence} that returns the (queryable) children of the node at the given path in the workspace, where each child node is assigned the given score. @param parentPath the path of the parent node; may not be null @param score the score for the nodes @return the sequence of nodes; never null """ String workspaceName = getWorkspaceName(parentPath); // Get the node filter to use ... NodeFilter nodeFilter = nodeFilterForWorkspace(workspaceName); if (nodeFilter != null) { // always append a shared nodes filter to the end of the workspace filter // JCR #14.16 -If a query matches a descendant node of a shared set, it appears in query results only once. NodeFilter compositeFilter = new CompositeNodeFilter(nodeFilter, sharedNodesFilter()); // Find the node by path ... NodeCache cache = repo.getWorkspaceCache(workspaceName); CachedNode parentNode = getNodeAtPath(parentPath, cache); if (parentNode != null) { // Only add those children that are queryable ... ChildReferences childRefs = parentNode.getChildReferences(cache); List<CachedNode> results = new ArrayList<CachedNode>((int)childRefs.size()); for (ChildReference childRef : childRefs) { CachedNode child = cache.getNode(childRef); if (compositeFilter.includeNode(child, cache)) { results.add(child); } } return NodeSequence.withNodes(results, score, workspaceName); } } return NodeSequence.emptySequence(1); }
java
public NodeSequence childNodes( Path parentPath, float score ) { String workspaceName = getWorkspaceName(parentPath); // Get the node filter to use ... NodeFilter nodeFilter = nodeFilterForWorkspace(workspaceName); if (nodeFilter != null) { // always append a shared nodes filter to the end of the workspace filter // JCR #14.16 -If a query matches a descendant node of a shared set, it appears in query results only once. NodeFilter compositeFilter = new CompositeNodeFilter(nodeFilter, sharedNodesFilter()); // Find the node by path ... NodeCache cache = repo.getWorkspaceCache(workspaceName); CachedNode parentNode = getNodeAtPath(parentPath, cache); if (parentNode != null) { // Only add those children that are queryable ... ChildReferences childRefs = parentNode.getChildReferences(cache); List<CachedNode> results = new ArrayList<CachedNode>((int)childRefs.size()); for (ChildReference childRef : childRefs) { CachedNode child = cache.getNode(childRef); if (compositeFilter.includeNode(child, cache)) { results.add(child); } } return NodeSequence.withNodes(results, score, workspaceName); } } return NodeSequence.emptySequence(1); }
[ "public", "NodeSequence", "childNodes", "(", "Path", "parentPath", ",", "float", "score", ")", "{", "String", "workspaceName", "=", "getWorkspaceName", "(", "parentPath", ")", ";", "// Get the node filter to use ...", "NodeFilter", "nodeFilter", "=", "nodeFilterForWorkspace", "(", "workspaceName", ")", ";", "if", "(", "nodeFilter", "!=", "null", ")", "{", "// always append a shared nodes filter to the end of the workspace filter", "// JCR #14.16 -If a query matches a descendant node of a shared set, it appears in query results only once.", "NodeFilter", "compositeFilter", "=", "new", "CompositeNodeFilter", "(", "nodeFilter", ",", "sharedNodesFilter", "(", ")", ")", ";", "// Find the node by path ...", "NodeCache", "cache", "=", "repo", ".", "getWorkspaceCache", "(", "workspaceName", ")", ";", "CachedNode", "parentNode", "=", "getNodeAtPath", "(", "parentPath", ",", "cache", ")", ";", "if", "(", "parentNode", "!=", "null", ")", "{", "// Only add those children that are queryable ...", "ChildReferences", "childRefs", "=", "parentNode", ".", "getChildReferences", "(", "cache", ")", ";", "List", "<", "CachedNode", ">", "results", "=", "new", "ArrayList", "<", "CachedNode", ">", "(", "(", "int", ")", "childRefs", ".", "size", "(", ")", ")", ";", "for", "(", "ChildReference", "childRef", ":", "childRefs", ")", "{", "CachedNode", "child", "=", "cache", ".", "getNode", "(", "childRef", ")", ";", "if", "(", "compositeFilter", ".", "includeNode", "(", "child", ",", "cache", ")", ")", "{", "results", ".", "add", "(", "child", ")", ";", "}", "}", "return", "NodeSequence", ".", "withNodes", "(", "results", ",", "score", ",", "workspaceName", ")", ";", "}", "}", "return", "NodeSequence", ".", "emptySequence", "(", "1", ")", ";", "}" ]
Obtain a {@link NodeSequence} that returns the (queryable) children of the node at the given path in the workspace, where each child node is assigned the given score. @param parentPath the path of the parent node; may not be null @param score the score for the nodes @return the sequence of nodes; never null
[ "Obtain", "a", "{", "@link", "NodeSequence", "}", "that", "returns", "the", "(", "queryable", ")", "children", "of", "the", "node", "at", "the", "given", "path", "in", "the", "workspace", "where", "each", "child", "node", "is", "assigned", "the", "given", "score", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/engine/QuerySources.java#L246-L274
OpenLiberty/open-liberty
dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/adapter/BundleEventAdapter.java
BundleEventAdapter.bundleChanged
public void bundleChanged(BundleEvent bundleEvent) { """ Receive notification of a bundle lifecycle change event and adapt it to the format required for the <code>EventAdmin</code> service. @param bundleEvent the bundle lifecycle event to publish as an <code>Event</code> """ final String topic = getTopic(bundleEvent); // Bail quickly if the event is one that should be ignored if (topic == null) { return; } // Event properties Map<String, Object> eventProperties = new HashMap<String, Object>(); // "event" --> the original event object eventProperties.put(EventConstants.EVENT, bundleEvent); // Non-null result from getBundle // "bundle.id" --> source bundle id as Long // "bundle.symbolicName" --> source bundle's symbolic name // "bundle" --> the source bundle object Bundle bundle = bundleEvent.getBundle(); if (bundle != null) { eventProperties.put(EventConstants.BUNDLE_ID, Long.valueOf(bundle.getBundleId())); String symbolicName = bundle.getSymbolicName(); if (symbolicName != null) { eventProperties.put(EventConstants.BUNDLE_SYMBOLICNAME, symbolicName); } eventProperties.put(EventConstants.BUNDLE, bundle); } // Construct and fire the event Event event = new Event(topic, eventProperties); eventAdmin.postEvent(event); }
java
public void bundleChanged(BundleEvent bundleEvent) { final String topic = getTopic(bundleEvent); // Bail quickly if the event is one that should be ignored if (topic == null) { return; } // Event properties Map<String, Object> eventProperties = new HashMap<String, Object>(); // "event" --> the original event object eventProperties.put(EventConstants.EVENT, bundleEvent); // Non-null result from getBundle // "bundle.id" --> source bundle id as Long // "bundle.symbolicName" --> source bundle's symbolic name // "bundle" --> the source bundle object Bundle bundle = bundleEvent.getBundle(); if (bundle != null) { eventProperties.put(EventConstants.BUNDLE_ID, Long.valueOf(bundle.getBundleId())); String symbolicName = bundle.getSymbolicName(); if (symbolicName != null) { eventProperties.put(EventConstants.BUNDLE_SYMBOLICNAME, symbolicName); } eventProperties.put(EventConstants.BUNDLE, bundle); } // Construct and fire the event Event event = new Event(topic, eventProperties); eventAdmin.postEvent(event); }
[ "public", "void", "bundleChanged", "(", "BundleEvent", "bundleEvent", ")", "{", "final", "String", "topic", "=", "getTopic", "(", "bundleEvent", ")", ";", "// Bail quickly if the event is one that should be ignored", "if", "(", "topic", "==", "null", ")", "{", "return", ";", "}", "// Event properties", "Map", "<", "String", ",", "Object", ">", "eventProperties", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "// \"event\" --> the original event object", "eventProperties", ".", "put", "(", "EventConstants", ".", "EVENT", ",", "bundleEvent", ")", ";", "// Non-null result from getBundle", "// \"bundle.id\" --> source bundle id as Long", "// \"bundle.symbolicName\" --> source bundle's symbolic name", "// \"bundle\" --> the source bundle object", "Bundle", "bundle", "=", "bundleEvent", ".", "getBundle", "(", ")", ";", "if", "(", "bundle", "!=", "null", ")", "{", "eventProperties", ".", "put", "(", "EventConstants", ".", "BUNDLE_ID", ",", "Long", ".", "valueOf", "(", "bundle", ".", "getBundleId", "(", ")", ")", ")", ";", "String", "symbolicName", "=", "bundle", ".", "getSymbolicName", "(", ")", ";", "if", "(", "symbolicName", "!=", "null", ")", "{", "eventProperties", ".", "put", "(", "EventConstants", ".", "BUNDLE_SYMBOLICNAME", ",", "symbolicName", ")", ";", "}", "eventProperties", ".", "put", "(", "EventConstants", ".", "BUNDLE", ",", "bundle", ")", ";", "}", "// Construct and fire the event", "Event", "event", "=", "new", "Event", "(", "topic", ",", "eventProperties", ")", ";", "eventAdmin", ".", "postEvent", "(", "event", ")", ";", "}" ]
Receive notification of a bundle lifecycle change event and adapt it to the format required for the <code>EventAdmin</code> service. @param bundleEvent the bundle lifecycle event to publish as an <code>Event</code>
[ "Receive", "notification", "of", "a", "bundle", "lifecycle", "change", "event", "and", "adapt", "it", "to", "the", "format", "required", "for", "the", "<code", ">", "EventAdmin<", "/", "code", ">", "service", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/adapter/BundleEventAdapter.java#L53-L84
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapHelper.java
LdapHelper.encodePassword
public static byte[] encodePassword(String password) throws WIMSystemException { """ Encode the input password from String format to special byte array format so that it can be stored in attribute <code>unicodePwd</code> in Active Directory. @param password The password to be encoded. @return The encoded byte array which can be stored in <code>unicodePwd</code> attribute in Active Directory. """ try { return ("\"" + password + "\"").getBytes("UTF-16LE"); } catch (Exception e) { String msg = Tr.formatMessage(tc, WIMMessageKey.GENERIC, WIMMessageHelper.generateMsgParms(e.getMessage())); throw new WIMSystemException(WIMMessageKey.GENERIC, msg, e); } }
java
public static byte[] encodePassword(String password) throws WIMSystemException { try { return ("\"" + password + "\"").getBytes("UTF-16LE"); } catch (Exception e) { String msg = Tr.formatMessage(tc, WIMMessageKey.GENERIC, WIMMessageHelper.generateMsgParms(e.getMessage())); throw new WIMSystemException(WIMMessageKey.GENERIC, msg, e); } }
[ "public", "static", "byte", "[", "]", "encodePassword", "(", "String", "password", ")", "throws", "WIMSystemException", "{", "try", "{", "return", "(", "\"\\\"\"", "+", "password", "+", "\"\\\"\"", ")", ".", "getBytes", "(", "\"UTF-16LE\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "String", "msg", "=", "Tr", ".", "formatMessage", "(", "tc", ",", "WIMMessageKey", ".", "GENERIC", ",", "WIMMessageHelper", ".", "generateMsgParms", "(", "e", ".", "getMessage", "(", ")", ")", ")", ";", "throw", "new", "WIMSystemException", "(", "WIMMessageKey", ".", "GENERIC", ",", "msg", ",", "e", ")", ";", "}", "}" ]
Encode the input password from String format to special byte array format so that it can be stored in attribute <code>unicodePwd</code> in Active Directory. @param password The password to be encoded. @return The encoded byte array which can be stored in <code>unicodePwd</code> attribute in Active Directory.
[ "Encode", "the", "input", "password", "from", "String", "format", "to", "special", "byte", "array", "format", "so", "that", "it", "can", "be", "stored", "in", "attribute", "<code", ">", "unicodePwd<", "/", "code", ">", "in", "Active", "Directory", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapHelper.java#L682-L689
pravega/pravega
common/src/main/java/io/pravega/common/tracing/RequestTracker.java
RequestTracker.getRequestTagFor
public RequestTag getRequestTagFor(String requestDescriptor) { """ Retrieves a {@link RequestTag} object formed by a request descriptor and request id. If the request descriptor does not exist or tracing is disabled, a new {@link RequestTag} object with a default request id is returned. In the case of concurrent requests with the same descriptor, multiple request ids will be associated to that request descriptor. The policy adopted is to retrieve the first one that was stored in the cache. Given that tracing is applied to idempotent operations, this allows us to consistently trace the operation that actually changes the state of the system. The rest of concurrent operations will be rejected and their response will be logged with a different requestId, as an indicator that another client request was ongoing. For more information, we refer to this PDP: https://github.com/pravega/pravega/wiki/PDP-31:-End-to-end-Request-Tags @param requestDescriptor Request descriptor as a single string. @return Request descriptor and request id pair embedded in a {@link RequestTag} object. """ Preconditions.checkNotNull(requestDescriptor, "Attempting to get a null request descriptor."); if (!tracingEnabled) { return new RequestTag(requestDescriptor, RequestTag.NON_EXISTENT_ID); } long requestId; List<Long> descriptorIds; synchronized (lock) { descriptorIds = ongoingRequests.getIfPresent(requestDescriptor); requestId = (descriptorIds == null || descriptorIds.size() == 0) ? RequestTag.NON_EXISTENT_ID : descriptorIds.get(0); if (descriptorIds == null) { log.debug("Attempting to get a non-existing tag: {}.", requestDescriptor); } else if (descriptorIds.size() > 1) { log.debug("{} request ids associated with same descriptor: {}. Propagating only first one: {}.", descriptorIds, requestDescriptor, requestId); } } return new RequestTag(requestDescriptor, requestId); }
java
public RequestTag getRequestTagFor(String requestDescriptor) { Preconditions.checkNotNull(requestDescriptor, "Attempting to get a null request descriptor."); if (!tracingEnabled) { return new RequestTag(requestDescriptor, RequestTag.NON_EXISTENT_ID); } long requestId; List<Long> descriptorIds; synchronized (lock) { descriptorIds = ongoingRequests.getIfPresent(requestDescriptor); requestId = (descriptorIds == null || descriptorIds.size() == 0) ? RequestTag.NON_EXISTENT_ID : descriptorIds.get(0); if (descriptorIds == null) { log.debug("Attempting to get a non-existing tag: {}.", requestDescriptor); } else if (descriptorIds.size() > 1) { log.debug("{} request ids associated with same descriptor: {}. Propagating only first one: {}.", descriptorIds, requestDescriptor, requestId); } } return new RequestTag(requestDescriptor, requestId); }
[ "public", "RequestTag", "getRequestTagFor", "(", "String", "requestDescriptor", ")", "{", "Preconditions", ".", "checkNotNull", "(", "requestDescriptor", ",", "\"Attempting to get a null request descriptor.\"", ")", ";", "if", "(", "!", "tracingEnabled", ")", "{", "return", "new", "RequestTag", "(", "requestDescriptor", ",", "RequestTag", ".", "NON_EXISTENT_ID", ")", ";", "}", "long", "requestId", ";", "List", "<", "Long", ">", "descriptorIds", ";", "synchronized", "(", "lock", ")", "{", "descriptorIds", "=", "ongoingRequests", ".", "getIfPresent", "(", "requestDescriptor", ")", ";", "requestId", "=", "(", "descriptorIds", "==", "null", "||", "descriptorIds", ".", "size", "(", ")", "==", "0", ")", "?", "RequestTag", ".", "NON_EXISTENT_ID", ":", "descriptorIds", ".", "get", "(", "0", ")", ";", "if", "(", "descriptorIds", "==", "null", ")", "{", "log", ".", "debug", "(", "\"Attempting to get a non-existing tag: {}.\"", ",", "requestDescriptor", ")", ";", "}", "else", "if", "(", "descriptorIds", ".", "size", "(", ")", ">", "1", ")", "{", "log", ".", "debug", "(", "\"{} request ids associated with same descriptor: {}. Propagating only first one: {}.\"", ",", "descriptorIds", ",", "requestDescriptor", ",", "requestId", ")", ";", "}", "}", "return", "new", "RequestTag", "(", "requestDescriptor", ",", "requestId", ")", ";", "}" ]
Retrieves a {@link RequestTag} object formed by a request descriptor and request id. If the request descriptor does not exist or tracing is disabled, a new {@link RequestTag} object with a default request id is returned. In the case of concurrent requests with the same descriptor, multiple request ids will be associated to that request descriptor. The policy adopted is to retrieve the first one that was stored in the cache. Given that tracing is applied to idempotent operations, this allows us to consistently trace the operation that actually changes the state of the system. The rest of concurrent operations will be rejected and their response will be logged with a different requestId, as an indicator that another client request was ongoing. For more information, we refer to this PDP: https://github.com/pravega/pravega/wiki/PDP-31:-End-to-end-Request-Tags @param requestDescriptor Request descriptor as a single string. @return Request descriptor and request id pair embedded in a {@link RequestTag} object.
[ "Retrieves", "a", "{", "@link", "RequestTag", "}", "object", "formed", "by", "a", "request", "descriptor", "and", "request", "id", ".", "If", "the", "request", "descriptor", "does", "not", "exist", "or", "tracing", "is", "disabled", "a", "new", "{", "@link", "RequestTag", "}", "object", "with", "a", "default", "request", "id", "is", "returned", ".", "In", "the", "case", "of", "concurrent", "requests", "with", "the", "same", "descriptor", "multiple", "request", "ids", "will", "be", "associated", "to", "that", "request", "descriptor", ".", "The", "policy", "adopted", "is", "to", "retrieve", "the", "first", "one", "that", "was", "stored", "in", "the", "cache", ".", "Given", "that", "tracing", "is", "applied", "to", "idempotent", "operations", "this", "allows", "us", "to", "consistently", "trace", "the", "operation", "that", "actually", "changes", "the", "state", "of", "the", "system", ".", "The", "rest", "of", "concurrent", "operations", "will", "be", "rejected", "and", "their", "response", "will", "be", "logged", "with", "a", "different", "requestId", "as", "an", "indicator", "that", "another", "client", "request", "was", "ongoing", ".", "For", "more", "information", "we", "refer", "to", "this", "PDP", ":", "https", ":", "//", "github", ".", "com", "/", "pravega", "/", "pravega", "/", "wiki", "/", "PDP", "-", "31", ":", "-", "End", "-", "to", "-", "end", "-", "Request", "-", "Tags" ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/tracing/RequestTracker.java#L94-L114
jakenjarvis/Android-OrmLiteContentProvider
ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherPattern.java
MatcherPattern.setContentMimeTypeVnd
public MatcherPattern setContentMimeTypeVnd(String name, String type) { """ Set the MIME types. This is used when you are not using the DefaultContentMimeTypeVnd annotation, or want to override the setting of the DefaultContentMimeTypeVnd annotation. This method can not be called after MatcherController#hasPreinitialized(). @see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentMimeTypeVnd @see com.tojc.ormlite.android.framework.MatcherController#hasPreinitialized() @param name @param type @return Instance of the MatcherPattern class. """ return this.setContentMimeTypeVnd(new ContentMimeTypeVndInfo(name, type)); }
java
public MatcherPattern setContentMimeTypeVnd(String name, String type) { return this.setContentMimeTypeVnd(new ContentMimeTypeVndInfo(name, type)); }
[ "public", "MatcherPattern", "setContentMimeTypeVnd", "(", "String", "name", ",", "String", "type", ")", "{", "return", "this", ".", "setContentMimeTypeVnd", "(", "new", "ContentMimeTypeVndInfo", "(", "name", ",", "type", ")", ")", ";", "}" ]
Set the MIME types. This is used when you are not using the DefaultContentMimeTypeVnd annotation, or want to override the setting of the DefaultContentMimeTypeVnd annotation. This method can not be called after MatcherController#hasPreinitialized(). @see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentMimeTypeVnd @see com.tojc.ormlite.android.framework.MatcherController#hasPreinitialized() @param name @param type @return Instance of the MatcherPattern class.
[ "Set", "the", "MIME", "types", ".", "This", "is", "used", "when", "you", "are", "not", "using", "the", "DefaultContentMimeTypeVnd", "annotation", "or", "want", "to", "override", "the", "setting", "of", "the", "DefaultContentMimeTypeVnd", "annotation", ".", "This", "method", "can", "not", "be", "called", "after", "MatcherController#hasPreinitialized", "()", "." ]
train
https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherPattern.java#L189-L191
lastaflute/lastaflute
src/main/java/org/lastaflute/web/hook/GodHandPrologue.java
GodHandPrologue.createSqlStringFilter
protected SqlStringFilter createSqlStringFilter(ActionRuntime runtime) { """ Create the filter of SQL string for DBFlute. @param runtime The runtime meta of action execute. (NotNull) @return The filter of SQL string. (NullAllowed: if null, no filter) """ final Method actionMethod = runtime.getExecuteMethod(); return newRomanticTraceableSqlStringFilter(actionMethod, () -> { return buildSqlMarkingAdditionalInfo(); // lazy because it may be auto-login later }); }
java
protected SqlStringFilter createSqlStringFilter(ActionRuntime runtime) { final Method actionMethod = runtime.getExecuteMethod(); return newRomanticTraceableSqlStringFilter(actionMethod, () -> { return buildSqlMarkingAdditionalInfo(); // lazy because it may be auto-login later }); }
[ "protected", "SqlStringFilter", "createSqlStringFilter", "(", "ActionRuntime", "runtime", ")", "{", "final", "Method", "actionMethod", "=", "runtime", ".", "getExecuteMethod", "(", ")", ";", "return", "newRomanticTraceableSqlStringFilter", "(", "actionMethod", ",", "(", ")", "->", "{", "return", "buildSqlMarkingAdditionalInfo", "(", ")", ";", "// lazy because it may be auto-login later", "}", ")", ";", "}" ]
Create the filter of SQL string for DBFlute. @param runtime The runtime meta of action execute. (NotNull) @return The filter of SQL string. (NullAllowed: if null, no filter)
[ "Create", "the", "filter", "of", "SQL", "string", "for", "DBFlute", "." ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/hook/GodHandPrologue.java#L169-L174
b3log/latke
latke-core/src/main/java/org/json/JSONTokener.java
JSONTokener.syntaxError
public JSONException syntaxError(String message, Throwable causedBy) { """ Make a JSONException to signal a syntax error. @param message The error message. @param causedBy The throwable that caused the error. @return A JSONException object, suitable for throwing """ return new JSONException(message + this.toString(), causedBy); }
java
public JSONException syntaxError(String message, Throwable causedBy) { return new JSONException(message + this.toString(), causedBy); }
[ "public", "JSONException", "syntaxError", "(", "String", "message", ",", "Throwable", "causedBy", ")", "{", "return", "new", "JSONException", "(", "message", "+", "this", ".", "toString", "(", ")", ",", "causedBy", ")", ";", "}" ]
Make a JSONException to signal a syntax error. @param message The error message. @param causedBy The throwable that caused the error. @return A JSONException object, suitable for throwing
[ "Make", "a", "JSONException", "to", "signal", "a", "syntax", "error", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONTokener.java#L515-L517
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/QualifiedName.java
QualifiedName.valueOf
public static QualifiedName valueOf(String value, NamespaceContext ctx) { """ Parses strings of the form "{NS-URI}LOCAL-NAME" or "prefix:localName" as QualifiedNames. <p>When using the prefix-version the prefix must be defined inside the NamespaceContext given as argument.</p> """ if (value == null) { throw new IllegalArgumentException("value must not be null"); } int colon = value.indexOf(':'); int closingBrace = value.indexOf('}'); boolean qnameToStringStyle = value.startsWith("{") && closingBrace > 0; if (!qnameToStringStyle && colon < 0) { return new QualifiedName(value); // null namespace } return qnameToStringStyle ? parseQNameToString(value, closingBrace) : parsePrefixFormat(value, colon, ctx); }
java
public static QualifiedName valueOf(String value, NamespaceContext ctx) { if (value == null) { throw new IllegalArgumentException("value must not be null"); } int colon = value.indexOf(':'); int closingBrace = value.indexOf('}'); boolean qnameToStringStyle = value.startsWith("{") && closingBrace > 0; if (!qnameToStringStyle && colon < 0) { return new QualifiedName(value); // null namespace } return qnameToStringStyle ? parseQNameToString(value, closingBrace) : parsePrefixFormat(value, colon, ctx); }
[ "public", "static", "QualifiedName", "valueOf", "(", "String", "value", ",", "NamespaceContext", "ctx", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"value must not be null\"", ")", ";", "}", "int", "colon", "=", "value", ".", "indexOf", "(", "'", "'", ")", ";", "int", "closingBrace", "=", "value", ".", "indexOf", "(", "'", "'", ")", ";", "boolean", "qnameToStringStyle", "=", "value", ".", "startsWith", "(", "\"{\"", ")", "&&", "closingBrace", ">", "0", ";", "if", "(", "!", "qnameToStringStyle", "&&", "colon", "<", "0", ")", "{", "return", "new", "QualifiedName", "(", "value", ")", ";", "// null namespace", "}", "return", "qnameToStringStyle", "?", "parseQNameToString", "(", "value", ",", "closingBrace", ")", ":", "parsePrefixFormat", "(", "value", ",", "colon", ",", "ctx", ")", ";", "}" ]
Parses strings of the form "{NS-URI}LOCAL-NAME" or "prefix:localName" as QualifiedNames. <p>When using the prefix-version the prefix must be defined inside the NamespaceContext given as argument.</p>
[ "Parses", "strings", "of", "the", "form", "{", "NS", "-", "URI", "}", "LOCAL", "-", "NAME", "or", "prefix", ":", "localName", "as", "QualifiedNames", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/QualifiedName.java#L109-L121
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java
DirectoryServiceClient.getACL
public ACL getACL(AuthScheme scheme, String id) { """ Get the ACL. @param scheme the AuthScheme. @param id the identity. @return the ACL. """ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.GetACL); GetACLProtocol p = new GetACLProtocol(scheme, id); Response resp = connection.submitRequest(header, p, null); return ((GetACLResponse) resp).getAcl(); }
java
public ACL getACL(AuthScheme scheme, String id){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.GetACL); GetACLProtocol p = new GetACLProtocol(scheme, id); Response resp = connection.submitRequest(header, p, null); return ((GetACLResponse) resp).getAcl(); }
[ "public", "ACL", "getACL", "(", "AuthScheme", "scheme", ",", "String", "id", ")", "{", "ProtocolHeader", "header", "=", "new", "ProtocolHeader", "(", ")", ";", "header", ".", "setType", "(", "ProtocolType", ".", "GetACL", ")", ";", "GetACLProtocol", "p", "=", "new", "GetACLProtocol", "(", "scheme", ",", "id", ")", ";", "Response", "resp", "=", "connection", ".", "submitRequest", "(", "header", ",", "p", ",", "null", ")", ";", "return", "(", "(", "GetACLResponse", ")", "resp", ")", ".", "getAcl", "(", ")", ";", "}" ]
Get the ACL. @param scheme the AuthScheme. @param id the identity. @return the ACL.
[ "Get", "the", "ACL", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L333-L341
qiujuer/Genius-Android
caprice/ui/src/main/java/net/qiujuer/genius/ui/compat/UiCompat.java
UiCompat.getColorStateList
public static ColorStateList getColorStateList(Resources resources, int id) { """ Returns a themed color state list associated with a particular resource ID. The resource may contain either a single raw color value or a complex {@link ColorStateList} holding multiple possible colors. @param resources Resources @param id The desired resource identifier of a {@link ColorStateList}, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. @return A themed ColorStateList object containing either a single solid color or multiple colors that can be selected based on a state. """ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return resources.getColorStateList(id, null); } else { return resources.getColorStateList(id); } }
java
public static ColorStateList getColorStateList(Resources resources, int id) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return resources.getColorStateList(id, null); } else { return resources.getColorStateList(id); } }
[ "public", "static", "ColorStateList", "getColorStateList", "(", "Resources", "resources", ",", "int", "id", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "M", ")", "{", "return", "resources", ".", "getColorStateList", "(", "id", ",", "null", ")", ";", "}", "else", "{", "return", "resources", ".", "getColorStateList", "(", "id", ")", ";", "}", "}" ]
Returns a themed color state list associated with a particular resource ID. The resource may contain either a single raw color value or a complex {@link ColorStateList} holding multiple possible colors. @param resources Resources @param id The desired resource identifier of a {@link ColorStateList}, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. @return A themed ColorStateList object containing either a single solid color or multiple colors that can be selected based on a state.
[ "Returns", "a", "themed", "color", "state", "list", "associated", "with", "a", "particular", "resource", "ID", ".", "The", "resource", "may", "contain", "either", "a", "single", "raw", "color", "value", "or", "a", "complex", "{", "@link", "ColorStateList", "}", "holding", "multiple", "possible", "colors", "." ]
train
https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/compat/UiCompat.java#L131-L137
chr78rm/tracelogger
src/main/java/de/christofreichardt/diagnosis/JDKLoggingRouter.java
JDKLoggingRouter.logException
@Override public void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName) { """ Calls the {@link Logger} for the given clazz. @param logLevel the log level @param throwable the to be logged throwable @param clazz the originating class """ Logger logger = Logger.getLogger(clazz.getName()); logger.logp(convertToJDK14Level(logLevel), clazz.getName(), "-", throwable.getMessage(), throwable); }
java
@Override public void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName) { Logger logger = Logger.getLogger(clazz.getName()); logger.logp(convertToJDK14Level(logLevel), clazz.getName(), "-", throwable.getMessage(), throwable); }
[ "@", "Override", "public", "void", "logException", "(", "LogLevel", "logLevel", ",", "Throwable", "throwable", ",", "Class", "clazz", ",", "String", "methodName", ")", "{", "Logger", "logger", "=", "Logger", ".", "getLogger", "(", "clazz", ".", "getName", "(", ")", ")", ";", "logger", ".", "logp", "(", "convertToJDK14Level", "(", "logLevel", ")", ",", "clazz", ".", "getName", "(", ")", ",", "\"-\"", ",", "throwable", ".", "getMessage", "(", ")", ",", "throwable", ")", ";", "}" ]
Calls the {@link Logger} for the given clazz. @param logLevel the log level @param throwable the to be logged throwable @param clazz the originating class
[ "Calls", "the", "{", "@link", "Logger", "}", "for", "the", "given", "clazz", "." ]
train
https://github.com/chr78rm/tracelogger/blob/ad22452b20f8111ad4d367302c2b26a100a20200/src/main/java/de/christofreichardt/diagnosis/JDKLoggingRouter.java#L69-L73
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DiscreteBayesNetwork.java
DiscreteBayesNetwork.depends
public void depends(int parent, int child) { """ Adds a dependency relation ship between two variables that will be in the network. The integer value corresponds the the index of the i'th categorical variable, where the class target's value is the number of categorical variables. @param parent the parent variable, which will be explained in part by the child @param child the child variable, which contributes to the conditional probability of the parent. """ dag.addNode(child); dag.addNode(parent); dag.addEdge(parent, child); }
java
public void depends(int parent, int child) { dag.addNode(child); dag.addNode(parent); dag.addEdge(parent, child); }
[ "public", "void", "depends", "(", "int", "parent", ",", "int", "child", ")", "{", "dag", ".", "addNode", "(", "child", ")", ";", "dag", ".", "addNode", "(", "parent", ")", ";", "dag", ".", "addEdge", "(", "parent", ",", "child", ")", ";", "}" ]
Adds a dependency relation ship between two variables that will be in the network. The integer value corresponds the the index of the i'th categorical variable, where the class target's value is the number of categorical variables. @param parent the parent variable, which will be explained in part by the child @param child the child variable, which contributes to the conditional probability of the parent.
[ "Adds", "a", "dependency", "relation", "ship", "between", "two", "variables", "that", "will", "be", "in", "the", "network", ".", "The", "integer", "value", "corresponds", "the", "the", "index", "of", "the", "i", "th", "categorical", "variable", "where", "the", "class", "target", "s", "value", "is", "the", "number", "of", "categorical", "variables", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DiscreteBayesNetwork.java#L98-L103
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java
JobHistoryService.getFlowTimeSeriesStats
public List<Flow> getFlowTimeSeriesStats(String cluster, String user, String appId, String version, long startTime, long endTime, int limit, byte[] startRow) throws IOException { """ Returns the {@link Flow} runs' stats - summed up per flow If the {@code version} parameter is non-null, the returned results will be restricted to those matching this app version. <p> <strong>Note:</strong> this retrieval method will omit the configuration data from all of the returned jobs. </p> @param cluster the cluster where the jobs were run @param user the user running the jobs @param appId the application identifier for the jobs @param version if non-null, only flows matching this application version will be returned @param startTime the start time for the flows to be looked at @param endTime the end time for the flows to be looked at @param limit the maximum number of flows to return @return """ // app portion of row key byte[] rowPrefix = Bytes.toBytes((cluster + Constants.SEP + user + Constants.SEP + appId + Constants.SEP)); byte[] scanStartRow; if (startRow != null) { scanStartRow = startRow; } else { if (endTime != 0) { // use end time in start row, if present long endRunId = FlowKey.encodeRunId(endTime); scanStartRow = Bytes.add(rowPrefix, Bytes.toBytes(endRunId), Constants.SEP_BYTES); } else { scanStartRow = rowPrefix; } } // TODO: use RunMatchFilter to limit scan on the server side Scan scan = new Scan(); scan.setStartRow(scanStartRow); FilterList filters = new FilterList(FilterList.Operator.MUST_PASS_ALL); if (startTime != 0) { // if limited by start time, early out as soon as we hit it long startRunId = FlowKey.encodeRunId(startTime); // zero byte at the end makes the startRunId inclusive byte[] scanEndRow = Bytes.add(rowPrefix, Bytes.toBytes(startRunId), Constants.ZERO_SINGLE_BYTE); scan.setStopRow(scanEndRow); } else { // require that all rows match the app prefix we're looking for filters.addFilter(new WhileMatchFilter(new PrefixFilter(rowPrefix))); } // if version is passed, restrict the rows returned to that version if (version != null && version.length() > 0) { filters.addFilter(new SingleColumnValueFilter(Constants.INFO_FAM_BYTES, Constants.VERSION_COLUMN_BYTES, CompareFilter.CompareOp.EQUAL, Bytes.toBytes(version))); } // filter out all config columns except the queue name filters.addFilter(new QualifierFilter(CompareFilter.CompareOp.NOT_EQUAL, new RegexStringComparator( "^c\\!((?!" + Constants.HRAVEN_QUEUE + ").)*$"))); scan.setFilter(filters); LOG.info("scan : \n " + scan.toJSON() + " \n"); return createFromResults(scan, false, limit); }
java
public List<Flow> getFlowTimeSeriesStats(String cluster, String user, String appId, String version, long startTime, long endTime, int limit, byte[] startRow) throws IOException { // app portion of row key byte[] rowPrefix = Bytes.toBytes((cluster + Constants.SEP + user + Constants.SEP + appId + Constants.SEP)); byte[] scanStartRow; if (startRow != null) { scanStartRow = startRow; } else { if (endTime != 0) { // use end time in start row, if present long endRunId = FlowKey.encodeRunId(endTime); scanStartRow = Bytes.add(rowPrefix, Bytes.toBytes(endRunId), Constants.SEP_BYTES); } else { scanStartRow = rowPrefix; } } // TODO: use RunMatchFilter to limit scan on the server side Scan scan = new Scan(); scan.setStartRow(scanStartRow); FilterList filters = new FilterList(FilterList.Operator.MUST_PASS_ALL); if (startTime != 0) { // if limited by start time, early out as soon as we hit it long startRunId = FlowKey.encodeRunId(startTime); // zero byte at the end makes the startRunId inclusive byte[] scanEndRow = Bytes.add(rowPrefix, Bytes.toBytes(startRunId), Constants.ZERO_SINGLE_BYTE); scan.setStopRow(scanEndRow); } else { // require that all rows match the app prefix we're looking for filters.addFilter(new WhileMatchFilter(new PrefixFilter(rowPrefix))); } // if version is passed, restrict the rows returned to that version if (version != null && version.length() > 0) { filters.addFilter(new SingleColumnValueFilter(Constants.INFO_FAM_BYTES, Constants.VERSION_COLUMN_BYTES, CompareFilter.CompareOp.EQUAL, Bytes.toBytes(version))); } // filter out all config columns except the queue name filters.addFilter(new QualifierFilter(CompareFilter.CompareOp.NOT_EQUAL, new RegexStringComparator( "^c\\!((?!" + Constants.HRAVEN_QUEUE + ").)*$"))); scan.setFilter(filters); LOG.info("scan : \n " + scan.toJSON() + " \n"); return createFromResults(scan, false, limit); }
[ "public", "List", "<", "Flow", ">", "getFlowTimeSeriesStats", "(", "String", "cluster", ",", "String", "user", ",", "String", "appId", ",", "String", "version", ",", "long", "startTime", ",", "long", "endTime", ",", "int", "limit", ",", "byte", "[", "]", "startRow", ")", "throws", "IOException", "{", "// app portion of row key", "byte", "[", "]", "rowPrefix", "=", "Bytes", ".", "toBytes", "(", "(", "cluster", "+", "Constants", ".", "SEP", "+", "user", "+", "Constants", ".", "SEP", "+", "appId", "+", "Constants", ".", "SEP", ")", ")", ";", "byte", "[", "]", "scanStartRow", ";", "if", "(", "startRow", "!=", "null", ")", "{", "scanStartRow", "=", "startRow", ";", "}", "else", "{", "if", "(", "endTime", "!=", "0", ")", "{", "// use end time in start row, if present", "long", "endRunId", "=", "FlowKey", ".", "encodeRunId", "(", "endTime", ")", ";", "scanStartRow", "=", "Bytes", ".", "add", "(", "rowPrefix", ",", "Bytes", ".", "toBytes", "(", "endRunId", ")", ",", "Constants", ".", "SEP_BYTES", ")", ";", "}", "else", "{", "scanStartRow", "=", "rowPrefix", ";", "}", "}", "// TODO: use RunMatchFilter to limit scan on the server side", "Scan", "scan", "=", "new", "Scan", "(", ")", ";", "scan", ".", "setStartRow", "(", "scanStartRow", ")", ";", "FilterList", "filters", "=", "new", "FilterList", "(", "FilterList", ".", "Operator", ".", "MUST_PASS_ALL", ")", ";", "if", "(", "startTime", "!=", "0", ")", "{", "// if limited by start time, early out as soon as we hit it", "long", "startRunId", "=", "FlowKey", ".", "encodeRunId", "(", "startTime", ")", ";", "// zero byte at the end makes the startRunId inclusive", "byte", "[", "]", "scanEndRow", "=", "Bytes", ".", "add", "(", "rowPrefix", ",", "Bytes", ".", "toBytes", "(", "startRunId", ")", ",", "Constants", ".", "ZERO_SINGLE_BYTE", ")", ";", "scan", ".", "setStopRow", "(", "scanEndRow", ")", ";", "}", "else", "{", "// require that all rows match the app prefix we're looking for", "filters", ".", "addFilter", "(", "new", "WhileMatchFilter", "(", "new", "PrefixFilter", "(", "rowPrefix", ")", ")", ")", ";", "}", "// if version is passed, restrict the rows returned to that version", "if", "(", "version", "!=", "null", "&&", "version", ".", "length", "(", ")", ">", "0", ")", "{", "filters", ".", "addFilter", "(", "new", "SingleColumnValueFilter", "(", "Constants", ".", "INFO_FAM_BYTES", ",", "Constants", ".", "VERSION_COLUMN_BYTES", ",", "CompareFilter", ".", "CompareOp", ".", "EQUAL", ",", "Bytes", ".", "toBytes", "(", "version", ")", ")", ")", ";", "}", "// filter out all config columns except the queue name", "filters", ".", "addFilter", "(", "new", "QualifierFilter", "(", "CompareFilter", ".", "CompareOp", ".", "NOT_EQUAL", ",", "new", "RegexStringComparator", "(", "\"^c\\\\!((?!\"", "+", "Constants", ".", "HRAVEN_QUEUE", "+", "\").)*$\"", ")", ")", ")", ";", "scan", ".", "setFilter", "(", "filters", ")", ";", "LOG", ".", "info", "(", "\"scan : \\n \"", "+", "scan", ".", "toJSON", "(", ")", "+", "\" \\n\"", ")", ";", "return", "createFromResults", "(", "scan", ",", "false", ",", "limit", ")", ";", "}" ]
Returns the {@link Flow} runs' stats - summed up per flow If the {@code version} parameter is non-null, the returned results will be restricted to those matching this app version. <p> <strong>Note:</strong> this retrieval method will omit the configuration data from all of the returned jobs. </p> @param cluster the cluster where the jobs were run @param user the user running the jobs @param appId the application identifier for the jobs @param version if non-null, only flows matching this application version will be returned @param startTime the start time for the flows to be looked at @param endTime the end time for the flows to be looked at @param limit the maximum number of flows to return @return
[ "Returns", "the", "{", "@link", "Flow", "}", "runs", "stats", "-", "summed", "up", "per", "flow", "If", "the", "{", "@code", "version", "}", "parameter", "is", "non", "-", "null", "the", "returned", "results", "will", "be", "restricted", "to", "those", "matching", "this", "app", "version", "." ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryService.java#L338-L393
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java
CmsResultsTab.addSingleResult
protected void addSingleResult(CmsResultItemBean resultItem, boolean front, boolean showPath) { """ Adds a list item for a single search result.<p> @param resultItem the search result @param front if true, adds the list item to the front of the list, else at the back @param showPath <code>true</code> to show the resource path in sub title """ m_types.add(resultItem.getType()); boolean hasPreview = m_tabHandler.hasPreview(resultItem.getType()); CmsDNDHandler dndHandler = m_dndHandler; if (!m_galleryHandler.filterDnd(resultItem)) { dndHandler = null; } CmsResultListItem listItem = new CmsResultListItem(resultItem, hasPreview, showPath, dndHandler); if (resultItem.isPreset()) { m_preset = listItem; } if (hasPreview) { listItem.addPreviewClickHandler(new PreviewHandler(resultItem.getPath(), resultItem.getType())); } CmsUUID structureId = new CmsUUID(resultItem.getClientId()); listItem.getListItemWidget().addButton( new CmsContextMenuButton(structureId, m_contextMenuHandler, AdeContext.gallery)); listItem.getListItemWidget().addOpenHandler(new OpenHandler<CmsListItemWidget>() { public void onOpen(OpenEvent<CmsListItemWidget> event) { onContentChange(); } }); if (m_tabHandler.hasSelectResource()) { SelectHandler selectHandler = new SelectHandler( resultItem.getPath(), structureId, resultItem.getRawTitle(), resultItem.getType()); listItem.addSelectClickHandler(selectHandler); // this affects both tiled and non-tiled result lists. listItem.addDoubleClickHandler(selectHandler); } m_galleryHandler.processResultItem(listItem); if (front) { addWidgetToFrontOfList(listItem); } else { addWidgetToList(listItem); } }
java
protected void addSingleResult(CmsResultItemBean resultItem, boolean front, boolean showPath) { m_types.add(resultItem.getType()); boolean hasPreview = m_tabHandler.hasPreview(resultItem.getType()); CmsDNDHandler dndHandler = m_dndHandler; if (!m_galleryHandler.filterDnd(resultItem)) { dndHandler = null; } CmsResultListItem listItem = new CmsResultListItem(resultItem, hasPreview, showPath, dndHandler); if (resultItem.isPreset()) { m_preset = listItem; } if (hasPreview) { listItem.addPreviewClickHandler(new PreviewHandler(resultItem.getPath(), resultItem.getType())); } CmsUUID structureId = new CmsUUID(resultItem.getClientId()); listItem.getListItemWidget().addButton( new CmsContextMenuButton(structureId, m_contextMenuHandler, AdeContext.gallery)); listItem.getListItemWidget().addOpenHandler(new OpenHandler<CmsListItemWidget>() { public void onOpen(OpenEvent<CmsListItemWidget> event) { onContentChange(); } }); if (m_tabHandler.hasSelectResource()) { SelectHandler selectHandler = new SelectHandler( resultItem.getPath(), structureId, resultItem.getRawTitle(), resultItem.getType()); listItem.addSelectClickHandler(selectHandler); // this affects both tiled and non-tiled result lists. listItem.addDoubleClickHandler(selectHandler); } m_galleryHandler.processResultItem(listItem); if (front) { addWidgetToFrontOfList(listItem); } else { addWidgetToList(listItem); } }
[ "protected", "void", "addSingleResult", "(", "CmsResultItemBean", "resultItem", ",", "boolean", "front", ",", "boolean", "showPath", ")", "{", "m_types", ".", "add", "(", "resultItem", ".", "getType", "(", ")", ")", ";", "boolean", "hasPreview", "=", "m_tabHandler", ".", "hasPreview", "(", "resultItem", ".", "getType", "(", ")", ")", ";", "CmsDNDHandler", "dndHandler", "=", "m_dndHandler", ";", "if", "(", "!", "m_galleryHandler", ".", "filterDnd", "(", "resultItem", ")", ")", "{", "dndHandler", "=", "null", ";", "}", "CmsResultListItem", "listItem", "=", "new", "CmsResultListItem", "(", "resultItem", ",", "hasPreview", ",", "showPath", ",", "dndHandler", ")", ";", "if", "(", "resultItem", ".", "isPreset", "(", ")", ")", "{", "m_preset", "=", "listItem", ";", "}", "if", "(", "hasPreview", ")", "{", "listItem", ".", "addPreviewClickHandler", "(", "new", "PreviewHandler", "(", "resultItem", ".", "getPath", "(", ")", ",", "resultItem", ".", "getType", "(", ")", ")", ")", ";", "}", "CmsUUID", "structureId", "=", "new", "CmsUUID", "(", "resultItem", ".", "getClientId", "(", ")", ")", ";", "listItem", ".", "getListItemWidget", "(", ")", ".", "addButton", "(", "new", "CmsContextMenuButton", "(", "structureId", ",", "m_contextMenuHandler", ",", "AdeContext", ".", "gallery", ")", ")", ";", "listItem", ".", "getListItemWidget", "(", ")", ".", "addOpenHandler", "(", "new", "OpenHandler", "<", "CmsListItemWidget", ">", "(", ")", "{", "public", "void", "onOpen", "(", "OpenEvent", "<", "CmsListItemWidget", ">", "event", ")", "{", "onContentChange", "(", ")", ";", "}", "}", ")", ";", "if", "(", "m_tabHandler", ".", "hasSelectResource", "(", ")", ")", "{", "SelectHandler", "selectHandler", "=", "new", "SelectHandler", "(", "resultItem", ".", "getPath", "(", ")", ",", "structureId", ",", "resultItem", ".", "getRawTitle", "(", ")", ",", "resultItem", ".", "getType", "(", ")", ")", ";", "listItem", ".", "addSelectClickHandler", "(", "selectHandler", ")", ";", "// this affects both tiled and non-tiled result lists.", "listItem", ".", "addDoubleClickHandler", "(", "selectHandler", ")", ";", "}", "m_galleryHandler", ".", "processResultItem", "(", "listItem", ")", ";", "if", "(", "front", ")", "{", "addWidgetToFrontOfList", "(", "listItem", ")", ";", "}", "else", "{", "addWidgetToList", "(", "listItem", ")", ";", "}", "}" ]
Adds a list item for a single search result.<p> @param resultItem the search result @param front if true, adds the list item to the front of the list, else at the back @param showPath <code>true</code> to show the resource path in sub title
[ "Adds", "a", "list", "item", "for", "a", "single", "search", "result", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java#L542-L584
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionRendererModel.java
MapTileCollisionRendererModel.renderY
private static void renderY(Graphic g, CollisionFunction function, CollisionRange range, int th, int x) { """ Render vertical collision from current vector. @param g The graphic buffer. @param function The collision function. @param range The collision range. @param th The tile height. @param x The current horizontal location. """ if (UtilMath.isBetween(x, range.getMinX(), range.getMaxX())) { g.drawRect(x, th - function.getRenderY(x) - 1, 0, 0, false); } }
java
private static void renderY(Graphic g, CollisionFunction function, CollisionRange range, int th, int x) { if (UtilMath.isBetween(x, range.getMinX(), range.getMaxX())) { g.drawRect(x, th - function.getRenderY(x) - 1, 0, 0, false); } }
[ "private", "static", "void", "renderY", "(", "Graphic", "g", ",", "CollisionFunction", "function", ",", "CollisionRange", "range", ",", "int", "th", ",", "int", "x", ")", "{", "if", "(", "UtilMath", ".", "isBetween", "(", "x", ",", "range", ".", "getMinX", "(", ")", ",", "range", ".", "getMaxX", "(", ")", ")", ")", "{", "g", ".", "drawRect", "(", "x", ",", "th", "-", "function", ".", "getRenderY", "(", "x", ")", "-", "1", ",", "0", ",", "0", ",", "false", ")", ";", "}", "}" ]
Render vertical collision from current vector. @param g The graphic buffer. @param function The collision function. @param range The collision range. @param th The tile height. @param x The current horizontal location.
[ "Render", "vertical", "collision", "from", "current", "vector", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionRendererModel.java#L131-L137
aws/aws-sdk-java
aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/ProvisioningArtifactSummary.java
ProvisioningArtifactSummary.withProvisioningArtifactMetadata
public ProvisioningArtifactSummary withProvisioningArtifactMetadata(java.util.Map<String, String> provisioningArtifactMetadata) { """ <p> The metadata for the provisioning artifact. This is used with AWS Marketplace products. </p> @param provisioningArtifactMetadata The metadata for the provisioning artifact. This is used with AWS Marketplace products. @return Returns a reference to this object so that method calls can be chained together. """ setProvisioningArtifactMetadata(provisioningArtifactMetadata); return this; }
java
public ProvisioningArtifactSummary withProvisioningArtifactMetadata(java.util.Map<String, String> provisioningArtifactMetadata) { setProvisioningArtifactMetadata(provisioningArtifactMetadata); return this; }
[ "public", "ProvisioningArtifactSummary", "withProvisioningArtifactMetadata", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "provisioningArtifactMetadata", ")", "{", "setProvisioningArtifactMetadata", "(", "provisioningArtifactMetadata", ")", ";", "return", "this", ";", "}" ]
<p> The metadata for the provisioning artifact. This is used with AWS Marketplace products. </p> @param provisioningArtifactMetadata The metadata for the provisioning artifact. This is used with AWS Marketplace products. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "metadata", "for", "the", "provisioning", "artifact", ".", "This", "is", "used", "with", "AWS", "Marketplace", "products", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/ProvisioningArtifactSummary.java#L257-L260
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRRenderData.java
GVRRenderData.setCullFace
public GVRRenderData setCullFace(GVRCullFaceEnum cullFace, int passIndex) { """ Set the face to be culled @param cullFace {@code GVRCullFaceEnum.Back} Tells Graphics API to discard back faces, {@code GVRCullFaceEnum.Front} Tells Graphics API to discard front faces, {@code GVRCullFaceEnum.None} Tells Graphics API to not discard any face @param passIndex The rendering pass to set cull face state """ if (passIndex < mRenderPassList.size()) { mRenderPassList.get(passIndex).setCullFace(cullFace); } else { Log.e(TAG, "Trying to set cull face to a invalid pass. Pass " + passIndex + " was not created."); } return this; }
java
public GVRRenderData setCullFace(GVRCullFaceEnum cullFace, int passIndex) { if (passIndex < mRenderPassList.size()) { mRenderPassList.get(passIndex).setCullFace(cullFace); } else { Log.e(TAG, "Trying to set cull face to a invalid pass. Pass " + passIndex + " was not created."); } return this; }
[ "public", "GVRRenderData", "setCullFace", "(", "GVRCullFaceEnum", "cullFace", ",", "int", "passIndex", ")", "{", "if", "(", "passIndex", "<", "mRenderPassList", ".", "size", "(", ")", ")", "{", "mRenderPassList", ".", "get", "(", "passIndex", ")", ".", "setCullFace", "(", "cullFace", ")", ";", "}", "else", "{", "Log", ".", "e", "(", "TAG", ",", "\"Trying to set cull face to a invalid pass. Pass \"", "+", "passIndex", "+", "\" was not created.\"", ")", ";", "}", "return", "this", ";", "}" ]
Set the face to be culled @param cullFace {@code GVRCullFaceEnum.Back} Tells Graphics API to discard back faces, {@code GVRCullFaceEnum.Front} Tells Graphics API to discard front faces, {@code GVRCullFaceEnum.None} Tells Graphics API to not discard any face @param passIndex The rendering pass to set cull face state
[ "Set", "the", "face", "to", "be", "culled" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRRenderData.java#L494-L501
reactor/reactor-netty
src/main/java/reactor/netty/http/client/HttpClient.java
HttpClient.doAfterResponse
public final HttpClient doAfterResponse(BiConsumer<? super HttpClientResponse, ? super Connection> doAfterResponse) { """ Setup a callback called after {@link HttpClientResponse} has been fully received. @param doAfterResponse a consumer observing disconnected events @return a new {@link HttpClient} """ Objects.requireNonNull(doAfterResponse, "doAfterResponse"); return new HttpClientDoOn(this, null, null, null, doAfterResponse); }
java
public final HttpClient doAfterResponse(BiConsumer<? super HttpClientResponse, ? super Connection> doAfterResponse) { Objects.requireNonNull(doAfterResponse, "doAfterResponse"); return new HttpClientDoOn(this, null, null, null, doAfterResponse); }
[ "public", "final", "HttpClient", "doAfterResponse", "(", "BiConsumer", "<", "?", "super", "HttpClientResponse", ",", "?", "super", "Connection", ">", "doAfterResponse", ")", "{", "Objects", ".", "requireNonNull", "(", "doAfterResponse", ",", "\"doAfterResponse\"", ")", ";", "return", "new", "HttpClientDoOn", "(", "this", ",", "null", ",", "null", ",", "null", ",", "doAfterResponse", ")", ";", "}" ]
Setup a callback called after {@link HttpClientResponse} has been fully received. @param doAfterResponse a consumer observing disconnected events @return a new {@link HttpClient}
[ "Setup", "a", "callback", "called", "after", "{", "@link", "HttpClientResponse", "}", "has", "been", "fully", "received", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/http/client/HttpClient.java#L581-L584
aws/aws-sdk-java
aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TrainingJob.java
TrainingJob.withHyperParameters
public TrainingJob withHyperParameters(java.util.Map<String, String> hyperParameters) { """ <p> Algorithm-specific parameters. </p> @param hyperParameters Algorithm-specific parameters. @return Returns a reference to this object so that method calls can be chained together. """ setHyperParameters(hyperParameters); return this; }
java
public TrainingJob withHyperParameters(java.util.Map<String, String> hyperParameters) { setHyperParameters(hyperParameters); return this; }
[ "public", "TrainingJob", "withHyperParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "hyperParameters", ")", "{", "setHyperParameters", "(", "hyperParameters", ")", ";", "return", "this", ";", "}" ]
<p> Algorithm-specific parameters. </p> @param hyperParameters Algorithm-specific parameters. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Algorithm", "-", "specific", "parameters", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TrainingJob.java#L1831-L1834
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java
FineUploader5Session.addParams
@Nonnull public FineUploader5Session addParams (@Nullable final Map <String, String> aParams) { """ Any parameters you would like passed with the associated GET request to your server. @param aParams New parameters to be added. @return this """ m_aSessionParams.addAll (aParams); return this; }
java
@Nonnull public FineUploader5Session addParams (@Nullable final Map <String, String> aParams) { m_aSessionParams.addAll (aParams); return this; }
[ "@", "Nonnull", "public", "FineUploader5Session", "addParams", "(", "@", "Nullable", "final", "Map", "<", "String", ",", "String", ">", "aParams", ")", "{", "m_aSessionParams", ".", "addAll", "(", "aParams", ")", ";", "return", "this", ";", "}" ]
Any parameters you would like passed with the associated GET request to your server. @param aParams New parameters to be added. @return this
[ "Any", "parameters", "you", "would", "like", "passed", "with", "the", "associated", "GET", "request", "to", "your", "server", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java#L159-L164
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java
RecommendationsInner.listHistoryForWebAppAsync
public Observable<Page<RecommendationInner>> listHistoryForWebAppAsync(final String resourceGroupName, final String siteName) { """ Get past recommendations for an app, optionally specified by the time range. Get past recommendations for an app, optionally specified by the time range. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;RecommendationInner&gt; object """ return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName) .map(new Func1<ServiceResponse<Page<RecommendationInner>>, Page<RecommendationInner>>() { @Override public Page<RecommendationInner> call(ServiceResponse<Page<RecommendationInner>> response) { return response.body(); } }); }
java
public Observable<Page<RecommendationInner>> listHistoryForWebAppAsync(final String resourceGroupName, final String siteName) { return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName) .map(new Func1<ServiceResponse<Page<RecommendationInner>>, Page<RecommendationInner>>() { @Override public Page<RecommendationInner> call(ServiceResponse<Page<RecommendationInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "RecommendationInner", ">", ">", "listHistoryForWebAppAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "siteName", ")", "{", "return", "listHistoryForWebAppWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "RecommendationInner", ">", ">", ",", "Page", "<", "RecommendationInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "RecommendationInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "RecommendationInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get past recommendations for an app, optionally specified by the time range. Get past recommendations for an app, optionally specified by the time range. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;RecommendationInner&gt; object
[ "Get", "past", "recommendations", "for", "an", "app", "optionally", "specified", "by", "the", "time", "range", ".", "Get", "past", "recommendations", "for", "an", "app", "optionally", "specified", "by", "the", "time", "range", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L550-L558
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageQueue.java
RemoteMessageQueue.createMessageReceiver
public BaseMessageReceiver createMessageReceiver() { """ Create a new (Remote) message receiver. @return The message receiver. """ RemoteTask server = (RemoteTask)((App)this.getMessageManager().getApplication()).getRemoteTask(this.getMessageManager()); try { return new RemoteMessageReceiver(server, this); } catch (RemoteException ex) { ex.printStackTrace(); } return null; }
java
public BaseMessageReceiver createMessageReceiver() { RemoteTask server = (RemoteTask)((App)this.getMessageManager().getApplication()).getRemoteTask(this.getMessageManager()); try { return new RemoteMessageReceiver(server, this); } catch (RemoteException ex) { ex.printStackTrace(); } return null; }
[ "public", "BaseMessageReceiver", "createMessageReceiver", "(", ")", "{", "RemoteTask", "server", "=", "(", "RemoteTask", ")", "(", "(", "App", ")", "this", ".", "getMessageManager", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getRemoteTask", "(", "this", ".", "getMessageManager", "(", ")", ")", ";", "try", "{", "return", "new", "RemoteMessageReceiver", "(", "server", ",", "this", ")", ";", "}", "catch", "(", "RemoteException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}" ]
Create a new (Remote) message receiver. @return The message receiver.
[ "Create", "a", "new", "(", "Remote", ")", "message", "receiver", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageQueue.java#L78-L87
kuali/ojb-1.0.4
src/ejb/org/apache/ojb/ejb/odmg/RollbackBean.java
RollbackBean.rollbackOtherBeanUsing_2
public void rollbackOtherBeanUsing_2(ArticleVO article, List persons) { """ First store a list of persons then we store the article using a failure store method in ArticleManager. @ejb:interface-method """ log.info("rollbackOtherBeanUsing_2 method was called"); ArticleManagerODMGLocal am = getArticleManager(); PersonManagerODMGLocal pm = getPersonManager(); pm.storePersons(persons); am.failureStore(article); }
java
public void rollbackOtherBeanUsing_2(ArticleVO article, List persons) { log.info("rollbackOtherBeanUsing_2 method was called"); ArticleManagerODMGLocal am = getArticleManager(); PersonManagerODMGLocal pm = getPersonManager(); pm.storePersons(persons); am.failureStore(article); }
[ "public", "void", "rollbackOtherBeanUsing_2", "(", "ArticleVO", "article", ",", "List", "persons", ")", "{", "log", ".", "info", "(", "\"rollbackOtherBeanUsing_2 method was called\"", ")", ";", "ArticleManagerODMGLocal", "am", "=", "getArticleManager", "(", ")", ";", "PersonManagerODMGLocal", "pm", "=", "getPersonManager", "(", ")", ";", "pm", ".", "storePersons", "(", "persons", ")", ";", "am", ".", "failureStore", "(", "article", ")", ";", "}" ]
First store a list of persons then we store the article using a failure store method in ArticleManager. @ejb:interface-method
[ "First", "store", "a", "list", "of", "persons", "then", "we", "store", "the", "article", "using", "a", "failure", "store", "method", "in", "ArticleManager", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/ejb/org/apache/ojb/ejb/odmg/RollbackBean.java#L148-L155
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XCostExtension.java
XCostExtension.assignAmounts
public void assignAmounts(XTrace trace, Map<String, Double> amounts) { """ Assigns (to the given trace) multiple amounts given their keys. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key. For example, the call: <pre> assignAmounts(trace, [[a 10.00] [b 15.00] [c 25.00]]) </pre> should result into the following XES fragment: <pre> {@code <trace> <string key="a" value=""> <float key="cost:amount" value="10.00"/> </string> <string key="b" value=""> <float key="cost:amount" value="15.00"/> </string> <string key="c" value=""> <float key="cost:amount" value="25.00"/> </string> </trace> } </pre> @param trace Trace to assign the amounts to. @param amounts Mapping from keys to amounts which are to be assigned. """ XCostAmount.instance().assignValues(trace, amounts); }
java
public void assignAmounts(XTrace trace, Map<String, Double> amounts) { XCostAmount.instance().assignValues(trace, amounts); }
[ "public", "void", "assignAmounts", "(", "XTrace", "trace", ",", "Map", "<", "String", ",", "Double", ">", "amounts", ")", "{", "XCostAmount", ".", "instance", "(", ")", ".", "assignValues", "(", "trace", ",", "amounts", ")", ";", "}" ]
Assigns (to the given trace) multiple amounts given their keys. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key. For example, the call: <pre> assignAmounts(trace, [[a 10.00] [b 15.00] [c 25.00]]) </pre> should result into the following XES fragment: <pre> {@code <trace> <string key="a" value=""> <float key="cost:amount" value="10.00"/> </string> <string key="b" value=""> <float key="cost:amount" value="15.00"/> </string> <string key="c" value=""> <float key="cost:amount" value="25.00"/> </string> </trace> } </pre> @param trace Trace to assign the amounts to. @param amounts Mapping from keys to amounts which are to be assigned.
[ "Assigns", "(", "to", "the", "given", "trace", ")", "multiple", "amounts", "given", "their", "keys", ".", "Note", "that", "as", "a", "side", "effect", "this", "method", "creates", "attributes", "when", "it", "does", "not", "find", "an", "attribute", "with", "the", "proper", "key", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XCostExtension.java#L570-L572
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/JsonRpcUtils.java
JsonRpcUtils.buildResponse
public static JsonNode buildResponse(int status, String message, Object data) { """ Build Json-RPC's response in JSON format. <p> Json-RPC response as the following format: </p> <pre> { "status" : (int) response status/error code, "message": (string) response message, "data" : (object) response data } </pre> @param status @param message @param data @return """ return SerializationUtils.toJson(MapUtils.removeNulls(MapUtils.createMap(FIELD_STATUS, status, FIELD_MESSAGE, message, FIELD_DATA, data))); }
java
public static JsonNode buildResponse(int status, String message, Object data) { return SerializationUtils.toJson(MapUtils.removeNulls(MapUtils.createMap(FIELD_STATUS, status, FIELD_MESSAGE, message, FIELD_DATA, data))); }
[ "public", "static", "JsonNode", "buildResponse", "(", "int", "status", ",", "String", "message", ",", "Object", "data", ")", "{", "return", "SerializationUtils", ".", "toJson", "(", "MapUtils", ".", "removeNulls", "(", "MapUtils", ".", "createMap", "(", "FIELD_STATUS", ",", "status", ",", "FIELD_MESSAGE", ",", "message", ",", "FIELD_DATA", ",", "data", ")", ")", ")", ";", "}" ]
Build Json-RPC's response in JSON format. <p> Json-RPC response as the following format: </p> <pre> { "status" : (int) response status/error code, "message": (string) response message, "data" : (object) response data } </pre> @param status @param message @param data @return
[ "Build", "Json", "-", "RPC", "s", "response", "in", "JSON", "format", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/JsonRpcUtils.java#L42-L45
alkacon/opencms-core
src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditToolbarHandler.java
CmsDirectEditToolbarHandler.insertContextMenu
public void insertContextMenu(List<CmsContextMenuEntryBean> menuBeans, CmsUUID structureId) { """ Inserts the context menu.<p> @param menuBeans the menu beans from the server @param structureId the structure id of the resource at which the workplace should be opened """ List<I_CmsContextMenuEntry> menuEntries = transformEntries(menuBeans, structureId); m_contextButton.showMenu(menuEntries); }
java
public void insertContextMenu(List<CmsContextMenuEntryBean> menuBeans, CmsUUID structureId) { List<I_CmsContextMenuEntry> menuEntries = transformEntries(menuBeans, structureId); m_contextButton.showMenu(menuEntries); }
[ "public", "void", "insertContextMenu", "(", "List", "<", "CmsContextMenuEntryBean", ">", "menuBeans", ",", "CmsUUID", "structureId", ")", "{", "List", "<", "I_CmsContextMenuEntry", ">", "menuEntries", "=", "transformEntries", "(", "menuBeans", ",", "structureId", ")", ";", "m_contextButton", ".", "showMenu", "(", "menuEntries", ")", ";", "}" ]
Inserts the context menu.<p> @param menuBeans the menu beans from the server @param structureId the structure id of the resource at which the workplace should be opened
[ "Inserts", "the", "context", "menu", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditToolbarHandler.java#L167-L171
otto-de/edison-microservice
edison-jobs/src/main/java/de/otto/edison/jobs/service/JobMetaService.java
JobMetaService.aquireRunLock
public void aquireRunLock(final String jobId, final String jobType) throws JobBlockedException { """ Marks a job as running or throws JobBlockException if it is either disabled, was marked running before or is blocked by some other job from the mutex group. This operation must be implemented atomically on the persistent datastore (i. e. test and set) to make sure a job is never marked as running twice. @param jobId the id of the job @param jobType the type of the job @throws JobBlockedException if at least one of the jobTypes in the jobTypesMutex set is already marked running, or if the job type was disabled. """ // check for disabled lock: final JobMeta jobMeta = getJobMeta(jobType); if (jobMeta.isDisabled()) { throw new JobBlockedException(format("Job '%s' is currently disabled", jobType)); } // aquire lock: if (jobMetaRepository.setRunningJob(jobType, jobId)) { // check for mutually exclusive running jobs: mutexGroups.mutexJobTypesFor(jobType) .stream() .filter(mutexJobType -> jobMetaRepository.getRunningJob(mutexJobType) != null) .findAny() .ifPresent(running -> { releaseRunLock(jobType); throw new JobBlockedException(format("Job '%s' blocked by currently running job '%s'", jobType, running)); }); } else { throw new JobBlockedException(format("Job '%s' is already running", jobType)); } }
java
public void aquireRunLock(final String jobId, final String jobType) throws JobBlockedException { // check for disabled lock: final JobMeta jobMeta = getJobMeta(jobType); if (jobMeta.isDisabled()) { throw new JobBlockedException(format("Job '%s' is currently disabled", jobType)); } // aquire lock: if (jobMetaRepository.setRunningJob(jobType, jobId)) { // check for mutually exclusive running jobs: mutexGroups.mutexJobTypesFor(jobType) .stream() .filter(mutexJobType -> jobMetaRepository.getRunningJob(mutexJobType) != null) .findAny() .ifPresent(running -> { releaseRunLock(jobType); throw new JobBlockedException(format("Job '%s' blocked by currently running job '%s'", jobType, running)); }); } else { throw new JobBlockedException(format("Job '%s' is already running", jobType)); } }
[ "public", "void", "aquireRunLock", "(", "final", "String", "jobId", ",", "final", "String", "jobType", ")", "throws", "JobBlockedException", "{", "// check for disabled lock:", "final", "JobMeta", "jobMeta", "=", "getJobMeta", "(", "jobType", ")", ";", "if", "(", "jobMeta", ".", "isDisabled", "(", ")", ")", "{", "throw", "new", "JobBlockedException", "(", "format", "(", "\"Job '%s' is currently disabled\"", ",", "jobType", ")", ")", ";", "}", "// aquire lock:", "if", "(", "jobMetaRepository", ".", "setRunningJob", "(", "jobType", ",", "jobId", ")", ")", "{", "// check for mutually exclusive running jobs:", "mutexGroups", ".", "mutexJobTypesFor", "(", "jobType", ")", ".", "stream", "(", ")", ".", "filter", "(", "mutexJobType", "->", "jobMetaRepository", ".", "getRunningJob", "(", "mutexJobType", ")", "!=", "null", ")", ".", "findAny", "(", ")", ".", "ifPresent", "(", "running", "->", "{", "releaseRunLock", "(", "jobType", ")", ";", "throw", "new", "JobBlockedException", "(", "format", "(", "\"Job '%s' blocked by currently running job '%s'\"", ",", "jobType", ",", "running", ")", ")", ";", "}", ")", ";", "}", "else", "{", "throw", "new", "JobBlockedException", "(", "format", "(", "\"Job '%s' is already running\"", ",", "jobType", ")", ")", ";", "}", "}" ]
Marks a job as running or throws JobBlockException if it is either disabled, was marked running before or is blocked by some other job from the mutex group. This operation must be implemented atomically on the persistent datastore (i. e. test and set) to make sure a job is never marked as running twice. @param jobId the id of the job @param jobType the type of the job @throws JobBlockedException if at least one of the jobTypes in the jobTypesMutex set is already marked running, or if the job type was disabled.
[ "Marks", "a", "job", "as", "running", "or", "throws", "JobBlockException", "if", "it", "is", "either", "disabled", "was", "marked", "running", "before", "or", "is", "blocked", "by", "some", "other", "job", "from", "the", "mutex", "group", ".", "This", "operation", "must", "be", "implemented", "atomically", "on", "the", "persistent", "datastore", "(", "i", ".", "e", ".", "test", "and", "set", ")", "to", "make", "sure", "a", "job", "is", "never", "marked", "as", "running", "twice", "." ]
train
https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-jobs/src/main/java/de/otto/edison/jobs/service/JobMetaService.java#L45-L69
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/HString.java
HString.leftContext
public HString leftContext(@NonNull AnnotationType type, int windowSize) { """ Left context h string. @param type the type @param windowSize the window size @return the h string """ windowSize = Math.abs(windowSize); Preconditions.checkArgument(windowSize >= 0); int sentenceStart = sentence().start(); if (windowSize == 0 || start() <= sentenceStart) { return Fragments.detachedEmptyHString(); } HString context = firstToken().previous(type); for (int i = 1; i < windowSize; i++) { HString next = context .firstToken() .previous(type); if (next.end() <= sentenceStart) { break; } context = context.union(next); } return context; }
java
public HString leftContext(@NonNull AnnotationType type, int windowSize) { windowSize = Math.abs(windowSize); Preconditions.checkArgument(windowSize >= 0); int sentenceStart = sentence().start(); if (windowSize == 0 || start() <= sentenceStart) { return Fragments.detachedEmptyHString(); } HString context = firstToken().previous(type); for (int i = 1; i < windowSize; i++) { HString next = context .firstToken() .previous(type); if (next.end() <= sentenceStart) { break; } context = context.union(next); } return context; }
[ "public", "HString", "leftContext", "(", "@", "NonNull", "AnnotationType", "type", ",", "int", "windowSize", ")", "{", "windowSize", "=", "Math", ".", "abs", "(", "windowSize", ")", ";", "Preconditions", ".", "checkArgument", "(", "windowSize", ">=", "0", ")", ";", "int", "sentenceStart", "=", "sentence", "(", ")", ".", "start", "(", ")", ";", "if", "(", "windowSize", "==", "0", "||", "start", "(", ")", "<=", "sentenceStart", ")", "{", "return", "Fragments", ".", "detachedEmptyHString", "(", ")", ";", "}", "HString", "context", "=", "firstToken", "(", ")", ".", "previous", "(", "type", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "windowSize", ";", "i", "++", ")", "{", "HString", "next", "=", "context", ".", "firstToken", "(", ")", ".", "previous", "(", "type", ")", ";", "if", "(", "next", ".", "end", "(", ")", "<=", "sentenceStart", ")", "{", "break", ";", "}", "context", "=", "context", ".", "union", "(", "next", ")", ";", "}", "return", "context", ";", "}" ]
Left context h string. @param type the type @param windowSize the window size @return the h string
[ "Left", "context", "h", "string", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/HString.java#L810-L828
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/SimpleDeploymentDescription.java
SimpleDeploymentDescription.of
public static SimpleDeploymentDescription of(final String name, @SuppressWarnings("TypeMayBeWeakened") final Set<String> serverGroups) { """ Creates a simple deployment description. @param name the name for the deployment @param serverGroups the server groups @return the deployment description """ final SimpleDeploymentDescription result = of(name); if (serverGroups != null) { result.addServerGroups(serverGroups); } return result; }
java
public static SimpleDeploymentDescription of(final String name, @SuppressWarnings("TypeMayBeWeakened") final Set<String> serverGroups) { final SimpleDeploymentDescription result = of(name); if (serverGroups != null) { result.addServerGroups(serverGroups); } return result; }
[ "public", "static", "SimpleDeploymentDescription", "of", "(", "final", "String", "name", ",", "@", "SuppressWarnings", "(", "\"TypeMayBeWeakened\"", ")", "final", "Set", "<", "String", ">", "serverGroups", ")", "{", "final", "SimpleDeploymentDescription", "result", "=", "of", "(", "name", ")", ";", "if", "(", "serverGroups", "!=", "null", ")", "{", "result", ".", "addServerGroups", "(", "serverGroups", ")", ";", "}", "return", "result", ";", "}" ]
Creates a simple deployment description. @param name the name for the deployment @param serverGroups the server groups @return the deployment description
[ "Creates", "a", "simple", "deployment", "description", "." ]
train
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/SimpleDeploymentDescription.java#L64-L70
selendroid/selendroid
selendroid-client/src/main/java/io/selendroid/client/TouchActionBuilder.java
TouchActionBuilder.pointerMove
public TouchActionBuilder pointerMove(WebElement element, int x, int y) { """ Moves the pointer to a position offset from the top left corner of the specified WebElement This is only possible if the pointer is currently down. @param element WebElement to place pointer relative to @param x x-offset from top left @param y y-offset from top left @return this """ Preconditions.checkState(isDown); Map<String, Object> params = getTouchParameters(element, x, y); addAction(TouchActionName.POINTER_MOVE, params); return this; }
java
public TouchActionBuilder pointerMove(WebElement element, int x, int y) { Preconditions.checkState(isDown); Map<String, Object> params = getTouchParameters(element, x, y); addAction(TouchActionName.POINTER_MOVE, params); return this; }
[ "public", "TouchActionBuilder", "pointerMove", "(", "WebElement", "element", ",", "int", "x", ",", "int", "y", ")", "{", "Preconditions", ".", "checkState", "(", "isDown", ")", ";", "Map", "<", "String", ",", "Object", ">", "params", "=", "getTouchParameters", "(", "element", ",", "x", ",", "y", ")", ";", "addAction", "(", "TouchActionName", ".", "POINTER_MOVE", ",", "params", ")", ";", "return", "this", ";", "}" ]
Moves the pointer to a position offset from the top left corner of the specified WebElement This is only possible if the pointer is currently down. @param element WebElement to place pointer relative to @param x x-offset from top left @param y y-offset from top left @return this
[ "Moves", "the", "pointer", "to", "a", "position", "offset", "from", "the", "top", "left", "corner", "of", "the", "specified", "WebElement", "This", "is", "only", "possible", "if", "the", "pointer", "is", "currently", "down", "." ]
train
https://github.com/selendroid/selendroid/blob/a32c1a96c973b80c14a588b1075f084201f7fe94/selendroid-client/src/main/java/io/selendroid/client/TouchActionBuilder.java#L137-L143
DDTH/ddth-zookeeper
src/main/java/com/github/ddth/zookeeper/ZooKeeperClient.java
ZooKeeperClient.getData
public String getData(String path) throws ZooKeeperException { """ Reads data from a node. @param path @return @throws ZooKeeperException """ byte[] data = getDataRaw(path); return data != null ? new String(data, UTF8) : null; }
java
public String getData(String path) throws ZooKeeperException { byte[] data = getDataRaw(path); return data != null ? new String(data, UTF8) : null; }
[ "public", "String", "getData", "(", "String", "path", ")", "throws", "ZooKeeperException", "{", "byte", "[", "]", "data", "=", "getDataRaw", "(", "path", ")", ";", "return", "data", "!=", "null", "?", "new", "String", "(", "data", ",", "UTF8", ")", ":", "null", ";", "}" ]
Reads data from a node. @param path @return @throws ZooKeeperException
[ "Reads", "data", "from", "a", "node", "." ]
train
https://github.com/DDTH/ddth-zookeeper/blob/0994eea8b25fa3d885f3da4579768b7d08c1c32b/src/main/java/com/github/ddth/zookeeper/ZooKeeperClient.java#L576-L579
apereo/cas
support/cas-server-support-openid/src/main/java/org/apereo/cas/web/DelegatingController.java
DelegatingController.handleRequestInternal
@Override protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) throws Exception { """ Handles the request. Ask all delegates if they can handle the current request. The first to answer true is elected as the delegate that will process the request. If no controller answers true, we redirect to the error page. @param request the request to handle @param response the response to write to @return the model and view object @throws Exception if an error occurs during request handling """ for (val delegate : this.delegates) { if (delegate.canHandle(request, response)) { return delegate.handleRequestInternal(request, response); } } return generateErrorView(CasProtocolConstants.ERROR_CODE_INVALID_REQUEST, null); }
java
@Override protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) throws Exception { for (val delegate : this.delegates) { if (delegate.canHandle(request, response)) { return delegate.handleRequestInternal(request, response); } } return generateErrorView(CasProtocolConstants.ERROR_CODE_INVALID_REQUEST, null); }
[ "@", "Override", "protected", "ModelAndView", "handleRequestInternal", "(", "final", "HttpServletRequest", "request", ",", "final", "HttpServletResponse", "response", ")", "throws", "Exception", "{", "for", "(", "val", "delegate", ":", "this", ".", "delegates", ")", "{", "if", "(", "delegate", ".", "canHandle", "(", "request", ",", "response", ")", ")", "{", "return", "delegate", ".", "handleRequestInternal", "(", "request", ",", "response", ")", ";", "}", "}", "return", "generateErrorView", "(", "CasProtocolConstants", ".", "ERROR_CODE_INVALID_REQUEST", ",", "null", ")", ";", "}" ]
Handles the request. Ask all delegates if they can handle the current request. The first to answer true is elected as the delegate that will process the request. If no controller answers true, we redirect to the error page. @param request the request to handle @param response the response to write to @return the model and view object @throws Exception if an error occurs during request handling
[ "Handles", "the", "request", ".", "Ask", "all", "delegates", "if", "they", "can", "handle", "the", "current", "request", ".", "The", "first", "to", "answer", "true", "is", "elected", "as", "the", "delegate", "that", "will", "process", "the", "request", ".", "If", "no", "controller", "answers", "true", "we", "redirect", "to", "the", "error", "page", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-openid/src/main/java/org/apereo/cas/web/DelegatingController.java#L49-L57
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java
ExpressRouteCircuitConnectionsInner.getAsync
public Observable<ExpressRouteCircuitConnectionInner> getAsync(String resourceGroupName, String circuitName, String peeringName, String connectionName) { """ Gets the specified Express Route Circuit Connection from the specified express route circuit. @param resourceGroupName The name of the resource group. @param circuitName The name of the express route circuit. @param peeringName The name of the peering. @param connectionName The name of the express route circuit connection. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteCircuitConnectionInner object """ return getWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName).map(new Func1<ServiceResponse<ExpressRouteCircuitConnectionInner>, ExpressRouteCircuitConnectionInner>() { @Override public ExpressRouteCircuitConnectionInner call(ServiceResponse<ExpressRouteCircuitConnectionInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCircuitConnectionInner> getAsync(String resourceGroupName, String circuitName, String peeringName, String connectionName) { return getWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName).map(new Func1<ServiceResponse<ExpressRouteCircuitConnectionInner>, ExpressRouteCircuitConnectionInner>() { @Override public ExpressRouteCircuitConnectionInner call(ServiceResponse<ExpressRouteCircuitConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCircuitConnectionInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "circuitName", ",", "String", "peeringName", ",", "String", "connectionName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "circuitName", ",", "peeringName", ",", "connectionName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ExpressRouteCircuitConnectionInner", ">", ",", "ExpressRouteCircuitConnectionInner", ">", "(", ")", "{", "@", "Override", "public", "ExpressRouteCircuitConnectionInner", "call", "(", "ServiceResponse", "<", "ExpressRouteCircuitConnectionInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the specified Express Route Circuit Connection from the specified express route circuit. @param resourceGroupName The name of the resource group. @param circuitName The name of the express route circuit. @param peeringName The name of the peering. @param connectionName The name of the express route circuit connection. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteCircuitConnectionInner object
[ "Gets", "the", "specified", "Express", "Route", "Circuit", "Connection", "from", "the", "specified", "express", "route", "circuit", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java#L300-L307
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneView.java
TurnLaneView.updateLaneView
public void updateLaneView(@NonNull BannerComponents lane, @NonNull String maneuverModifier) { """ Updates this view based on the banner component lane data and the given maneuver modifier (to highlight which lane should be chosen). @param lane data {@link BannerComponents} @param maneuverModifier for the given maneuver """ if (hasInvalidData(lane)) { return; } TurnLaneViewData drawData = buildTurnLaneViewData(lane, maneuverModifier); Integer resId = findDrawableResId(drawData); if (resId == null) { return; } drawFor(lane, drawData, resId); }
java
public void updateLaneView(@NonNull BannerComponents lane, @NonNull String maneuverModifier) { if (hasInvalidData(lane)) { return; } TurnLaneViewData drawData = buildTurnLaneViewData(lane, maneuverModifier); Integer resId = findDrawableResId(drawData); if (resId == null) { return; } drawFor(lane, drawData, resId); }
[ "public", "void", "updateLaneView", "(", "@", "NonNull", "BannerComponents", "lane", ",", "@", "NonNull", "String", "maneuverModifier", ")", "{", "if", "(", "hasInvalidData", "(", "lane", ")", ")", "{", "return", ";", "}", "TurnLaneViewData", "drawData", "=", "buildTurnLaneViewData", "(", "lane", ",", "maneuverModifier", ")", ";", "Integer", "resId", "=", "findDrawableResId", "(", "drawData", ")", ";", "if", "(", "resId", "==", "null", ")", "{", "return", ";", "}", "drawFor", "(", "lane", ",", "drawData", ",", "resId", ")", ";", "}" ]
Updates this view based on the banner component lane data and the given maneuver modifier (to highlight which lane should be chosen). @param lane data {@link BannerComponents} @param maneuverModifier for the given maneuver
[ "Updates", "this", "view", "based", "on", "the", "banner", "component", "lane", "data", "and", "the", "given", "maneuver", "modifier", "(", "to", "highlight", "which", "lane", "should", "be", "chosen", ")", "." ]
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneView.java#L46-L57
Stratio/stratio-cassandra
src/java/org/apache/cassandra/hadoop/ConfigHelper.java
ConfigHelper.setInputColumnFamily
public static void setInputColumnFamily(Configuration conf, String keyspace, String columnFamily, boolean widerows) { """ Set the keyspace and column family for the input of this job. @param conf Job configuration you are about to run @param keyspace @param columnFamily @param widerows """ if (keyspace == null) throw new UnsupportedOperationException("keyspace may not be null"); if (columnFamily == null) throw new UnsupportedOperationException("columnfamily may not be null"); conf.set(INPUT_KEYSPACE_CONFIG, keyspace); conf.set(INPUT_COLUMNFAMILY_CONFIG, columnFamily); conf.set(INPUT_WIDEROWS_CONFIG, String.valueOf(widerows)); }
java
public static void setInputColumnFamily(Configuration conf, String keyspace, String columnFamily, boolean widerows) { if (keyspace == null) throw new UnsupportedOperationException("keyspace may not be null"); if (columnFamily == null) throw new UnsupportedOperationException("columnfamily may not be null"); conf.set(INPUT_KEYSPACE_CONFIG, keyspace); conf.set(INPUT_COLUMNFAMILY_CONFIG, columnFamily); conf.set(INPUT_WIDEROWS_CONFIG, String.valueOf(widerows)); }
[ "public", "static", "void", "setInputColumnFamily", "(", "Configuration", "conf", ",", "String", "keyspace", ",", "String", "columnFamily", ",", "boolean", "widerows", ")", "{", "if", "(", "keyspace", "==", "null", ")", "throw", "new", "UnsupportedOperationException", "(", "\"keyspace may not be null\"", ")", ";", "if", "(", "columnFamily", "==", "null", ")", "throw", "new", "UnsupportedOperationException", "(", "\"columnfamily may not be null\"", ")", ";", "conf", ".", "set", "(", "INPUT_KEYSPACE_CONFIG", ",", "keyspace", ")", ";", "conf", ".", "set", "(", "INPUT_COLUMNFAMILY_CONFIG", ",", "columnFamily", ")", ";", "conf", ".", "set", "(", "INPUT_WIDEROWS_CONFIG", ",", "String", ".", "valueOf", "(", "widerows", ")", ")", ";", "}" ]
Set the keyspace and column family for the input of this job. @param conf Job configuration you are about to run @param keyspace @param columnFamily @param widerows
[ "Set", "the", "keyspace", "and", "column", "family", "for", "the", "input", "of", "this", "job", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/ConfigHelper.java#L83-L94
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ServiceExtensionLoader.java
ServiceExtensionLoader.createFromLoadExtension
private <T extends Assignable> T createFromLoadExtension(Class<T> extensionClass, Archive<?> archive) { """ Creates a new instance of a <code>extensionClass</code> implementation. The implementation class is found in a provider-configuration file in META-INF/services/ @param <T> @param extensionClass @param archive @return an instance of the <code>extensionClass</code>' implementation. """ ExtensionWrapper extensionWrapper = loadExtensionMapping(extensionClass); if (extensionWrapper == null) { throw new RuntimeException("Failed to load ExtensionMapping"); } Class<T> extensionImplClass = loadExtension(extensionWrapper); if (!extensionClass.isAssignableFrom(extensionImplClass)) { throw new RuntimeException("Found extension impl class " + extensionImplClass.getName() + " not assignable to extension interface " + extensionClass.getName()); } return createExtension(extensionImplClass, archive); }
java
private <T extends Assignable> T createFromLoadExtension(Class<T> extensionClass, Archive<?> archive) { ExtensionWrapper extensionWrapper = loadExtensionMapping(extensionClass); if (extensionWrapper == null) { throw new RuntimeException("Failed to load ExtensionMapping"); } Class<T> extensionImplClass = loadExtension(extensionWrapper); if (!extensionClass.isAssignableFrom(extensionImplClass)) { throw new RuntimeException("Found extension impl class " + extensionImplClass.getName() + " not assignable to extension interface " + extensionClass.getName()); } return createExtension(extensionImplClass, archive); }
[ "private", "<", "T", "extends", "Assignable", ">", "T", "createFromLoadExtension", "(", "Class", "<", "T", ">", "extensionClass", ",", "Archive", "<", "?", ">", "archive", ")", "{", "ExtensionWrapper", "extensionWrapper", "=", "loadExtensionMapping", "(", "extensionClass", ")", ";", "if", "(", "extensionWrapper", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"Failed to load ExtensionMapping\"", ")", ";", "}", "Class", "<", "T", ">", "extensionImplClass", "=", "loadExtension", "(", "extensionWrapper", ")", ";", "if", "(", "!", "extensionClass", ".", "isAssignableFrom", "(", "extensionImplClass", ")", ")", "{", "throw", "new", "RuntimeException", "(", "\"Found extension impl class \"", "+", "extensionImplClass", ".", "getName", "(", ")", "+", "\" not assignable to extension interface \"", "+", "extensionClass", ".", "getName", "(", ")", ")", ";", "}", "return", "createExtension", "(", "extensionImplClass", ",", "archive", ")", ";", "}" ]
Creates a new instance of a <code>extensionClass</code> implementation. The implementation class is found in a provider-configuration file in META-INF/services/ @param <T> @param extensionClass @param archive @return an instance of the <code>extensionClass</code>' implementation.
[ "Creates", "a", "new", "instance", "of", "a", "<code", ">", "extensionClass<", "/", "code", ">", "implementation", ".", "The", "implementation", "class", "is", "found", "in", "a", "provider", "-", "configuration", "file", "in", "META", "-", "INF", "/", "services", "/" ]
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ServiceExtensionLoader.java#L211-L224
molgenis/molgenis
molgenis-api-data/src/main/java/org/molgenis/api/data/v2/AttributeFilterToFetchConverter.java
AttributeFilterToFetchConverter.createDefaultAttributeFetch
public static Fetch createDefaultAttributeFetch(Attribute attr, String languageCode) { """ Create default fetch for the given attribute. For attributes referencing entities the id and label value are fetched. Additionally for file entities the URL is fetched. For other attributes the default fetch is null; @return default attribute fetch or null """ Fetch fetch; if (isReferenceType(attr)) { fetch = new Fetch(); EntityType refEntityType = attr.getRefEntity(); String idAttrName = refEntityType.getIdAttribute().getName(); fetch.field(idAttrName); String labelAttrName = refEntityType.getLabelAttribute(languageCode).getName(); if (!labelAttrName.equals(idAttrName)) { fetch.field(labelAttrName); } if (attr.getDataType() == FILE) { fetch.field(FileMetaMetadata.URL); } } else { fetch = null; } return fetch; }
java
public static Fetch createDefaultAttributeFetch(Attribute attr, String languageCode) { Fetch fetch; if (isReferenceType(attr)) { fetch = new Fetch(); EntityType refEntityType = attr.getRefEntity(); String idAttrName = refEntityType.getIdAttribute().getName(); fetch.field(idAttrName); String labelAttrName = refEntityType.getLabelAttribute(languageCode).getName(); if (!labelAttrName.equals(idAttrName)) { fetch.field(labelAttrName); } if (attr.getDataType() == FILE) { fetch.field(FileMetaMetadata.URL); } } else { fetch = null; } return fetch; }
[ "public", "static", "Fetch", "createDefaultAttributeFetch", "(", "Attribute", "attr", ",", "String", "languageCode", ")", "{", "Fetch", "fetch", ";", "if", "(", "isReferenceType", "(", "attr", ")", ")", "{", "fetch", "=", "new", "Fetch", "(", ")", ";", "EntityType", "refEntityType", "=", "attr", ".", "getRefEntity", "(", ")", ";", "String", "idAttrName", "=", "refEntityType", ".", "getIdAttribute", "(", ")", ".", "getName", "(", ")", ";", "fetch", ".", "field", "(", "idAttrName", ")", ";", "String", "labelAttrName", "=", "refEntityType", ".", "getLabelAttribute", "(", "languageCode", ")", ".", "getName", "(", ")", ";", "if", "(", "!", "labelAttrName", ".", "equals", "(", "idAttrName", ")", ")", "{", "fetch", ".", "field", "(", "labelAttrName", ")", ";", "}", "if", "(", "attr", ".", "getDataType", "(", ")", "==", "FILE", ")", "{", "fetch", ".", "field", "(", "FileMetaMetadata", ".", "URL", ")", ";", "}", "}", "else", "{", "fetch", "=", "null", ";", "}", "return", "fetch", ";", "}" ]
Create default fetch for the given attribute. For attributes referencing entities the id and label value are fetched. Additionally for file entities the URL is fetched. For other attributes the default fetch is null; @return default attribute fetch or null
[ "Create", "default", "fetch", "for", "the", "given", "attribute", ".", "For", "attributes", "referencing", "entities", "the", "id", "and", "label", "value", "are", "fetched", ".", "Additionally", "for", "file", "entities", "the", "URL", "is", "fetched", ".", "For", "other", "attributes", "the", "default", "fetch", "is", "null", ";" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v2/AttributeFilterToFetchConverter.java#L177-L197
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/component/UIComponent.java
UIComponent.pushComponentToEL
public final void pushComponentToEL(FacesContext context, UIComponent component) { """ <p class="changed_added_2_0">Push the current <code>UIComponent</code> <code>this</code> to the {@link FacesContext} attribute map using the key {@link #CURRENT_COMPONENT} saving the previous <code>UIComponent</code> associated with {@link #CURRENT_COMPONENT} for a subsequent call to {@link #popComponentFromEL}.</p> <pclass="changed_added_2_0">This method and <code>popComponentFromEL()</code> form the basis for the contract that enables the EL Expression "<code>#{component}</code>" to resolve to the "current" component that is being processed in the lifecycle. The requirements for when <code>pushComponentToEL()</code> and <code>popComponentFromEL()</code> must be called are specified as needed in the javadoc for this class.</p> <p class="changed_added_2_0">After <code>pushComponentToEL()</code> returns, a call to {@link #getCurrentComponent} must return <code>this</code> <code>UIComponent</code> instance until <code>popComponentFromEL()</code> is called, after which point the previous <code>UIComponent</code> instance will be returned from <code>getCurrentComponent()</code></p> @param context the {@link FacesContext} for the current request @param component the <code>component</code> to push to the EL. If <code>component</code> is <code>null</code> the <code>UIComponent</code> instance that this call was invoked upon will be pushed to the EL. @throws NullPointerException if <code>context</code> is <code>null</code> @see javax.faces.context.FacesContext#getAttributes() @since 2.0 """ if (context == null) { throw new NullPointerException(); } if (null == component) { component = this; } Map<Object, Object> contextAttributes = context.getAttributes(); ArrayDeque<UIComponent> componentELStack = _getComponentELStack(_CURRENT_COMPONENT_STACK_KEY, contextAttributes); componentELStack.push(component); component._isPushedAsCurrentRefCount++; // we only do this because of the spec boolean setCurrentComponent = isSetCurrentComponent(context); if (setCurrentComponent) { contextAttributes.put(UIComponent.CURRENT_COMPONENT, component); } // if the pushed component is a composite component, we need to update that // stack as well if (UIComponent.isCompositeComponent(component)) { _getComponentELStack(_CURRENT_COMPOSITE_COMPONENT_STACK_KEY, contextAttributes).push(component); // we only do this because of the spec if (setCurrentComponent) { contextAttributes.put(UIComponent.CURRENT_COMPOSITE_COMPONENT, component); } } }
java
public final void pushComponentToEL(FacesContext context, UIComponent component) { if (context == null) { throw new NullPointerException(); } if (null == component) { component = this; } Map<Object, Object> contextAttributes = context.getAttributes(); ArrayDeque<UIComponent> componentELStack = _getComponentELStack(_CURRENT_COMPONENT_STACK_KEY, contextAttributes); componentELStack.push(component); component._isPushedAsCurrentRefCount++; // we only do this because of the spec boolean setCurrentComponent = isSetCurrentComponent(context); if (setCurrentComponent) { contextAttributes.put(UIComponent.CURRENT_COMPONENT, component); } // if the pushed component is a composite component, we need to update that // stack as well if (UIComponent.isCompositeComponent(component)) { _getComponentELStack(_CURRENT_COMPOSITE_COMPONENT_STACK_KEY, contextAttributes).push(component); // we only do this because of the spec if (setCurrentComponent) { contextAttributes.put(UIComponent.CURRENT_COMPOSITE_COMPONENT, component); } } }
[ "public", "final", "void", "pushComponentToEL", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "(", "null", "==", "component", ")", "{", "component", "=", "this", ";", "}", "Map", "<", "Object", ",", "Object", ">", "contextAttributes", "=", "context", ".", "getAttributes", "(", ")", ";", "ArrayDeque", "<", "UIComponent", ">", "componentELStack", "=", "_getComponentELStack", "(", "_CURRENT_COMPONENT_STACK_KEY", ",", "contextAttributes", ")", ";", "componentELStack", ".", "push", "(", "component", ")", ";", "component", ".", "_isPushedAsCurrentRefCount", "++", ";", "// we only do this because of the spec", "boolean", "setCurrentComponent", "=", "isSetCurrentComponent", "(", "context", ")", ";", "if", "(", "setCurrentComponent", ")", "{", "contextAttributes", ".", "put", "(", "UIComponent", ".", "CURRENT_COMPONENT", ",", "component", ")", ";", "}", "// if the pushed component is a composite component, we need to update that", "// stack as well", "if", "(", "UIComponent", ".", "isCompositeComponent", "(", "component", ")", ")", "{", "_getComponentELStack", "(", "_CURRENT_COMPOSITE_COMPONENT_STACK_KEY", ",", "contextAttributes", ")", ".", "push", "(", "component", ")", ";", "// we only do this because of the spec", "if", "(", "setCurrentComponent", ")", "{", "contextAttributes", ".", "put", "(", "UIComponent", ".", "CURRENT_COMPOSITE_COMPONENT", ",", "component", ")", ";", "}", "}", "}" ]
<p class="changed_added_2_0">Push the current <code>UIComponent</code> <code>this</code> to the {@link FacesContext} attribute map using the key {@link #CURRENT_COMPONENT} saving the previous <code>UIComponent</code> associated with {@link #CURRENT_COMPONENT} for a subsequent call to {@link #popComponentFromEL}.</p> <pclass="changed_added_2_0">This method and <code>popComponentFromEL()</code> form the basis for the contract that enables the EL Expression "<code>#{component}</code>" to resolve to the "current" component that is being processed in the lifecycle. The requirements for when <code>pushComponentToEL()</code> and <code>popComponentFromEL()</code> must be called are specified as needed in the javadoc for this class.</p> <p class="changed_added_2_0">After <code>pushComponentToEL()</code> returns, a call to {@link #getCurrentComponent} must return <code>this</code> <code>UIComponent</code> instance until <code>popComponentFromEL()</code> is called, after which point the previous <code>UIComponent</code> instance will be returned from <code>getCurrentComponent()</code></p> @param context the {@link FacesContext} for the current request @param component the <code>component</code> to push to the EL. If <code>component</code> is <code>null</code> the <code>UIComponent</code> instance that this call was invoked upon will be pushed to the EL. @throws NullPointerException if <code>context</code> is <code>null</code> @see javax.faces.context.FacesContext#getAttributes() @since 2.0
[ "<p", "class", "=", "changed_added_2_0", ">", "Push", "the", "current", "<code", ">", "UIComponent<", "/", "code", ">", "<code", ">", "this<", "/", "code", ">", "to", "the", "{", "@link", "FacesContext", "}", "attribute", "map", "using", "the", "key", "{", "@link", "#CURRENT_COMPONENT", "}", "saving", "the", "previous", "<code", ">", "UIComponent<", "/", "code", ">", "associated", "with", "{", "@link", "#CURRENT_COMPONENT", "}", "for", "a", "subsequent", "call", "to", "{", "@link", "#popComponentFromEL", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UIComponent.java#L1945-L1979
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
StrSubstitutor.resolveVariable
protected String resolveVariable(final String variableName, final StrBuilder buf, final int startPos, final int endPos) { """ Internal method that resolves the value of a variable. <p> Most users of this class do not need to call this method. This method is called automatically by the substitution process. <p> Writers of subclasses can override this method if they need to alter how each substitution occurs. The method is passed the variable's name and must return the corresponding value. This implementation uses the {@link #getVariableResolver()} with the variable's name as the key. @param variableName the name of the variable, not null @param buf the buffer where the substitution is occurring, not null @param startPos the start position of the variable including the prefix, valid @param endPos the end position of the variable including the suffix, valid @return the variable's value or <b>null</b> if the variable is unknown """ final StrLookup<?> resolver = getVariableResolver(); if (resolver == null) { return null; } return resolver.lookup(variableName); }
java
protected String resolveVariable(final String variableName, final StrBuilder buf, final int startPos, final int endPos) { final StrLookup<?> resolver = getVariableResolver(); if (resolver == null) { return null; } return resolver.lookup(variableName); }
[ "protected", "String", "resolveVariable", "(", "final", "String", "variableName", ",", "final", "StrBuilder", "buf", ",", "final", "int", "startPos", ",", "final", "int", "endPos", ")", "{", "final", "StrLookup", "<", "?", ">", "resolver", "=", "getVariableResolver", "(", ")", ";", "if", "(", "resolver", "==", "null", ")", "{", "return", "null", ";", "}", "return", "resolver", ".", "lookup", "(", "variableName", ")", ";", "}" ]
Internal method that resolves the value of a variable. <p> Most users of this class do not need to call this method. This method is called automatically by the substitution process. <p> Writers of subclasses can override this method if they need to alter how each substitution occurs. The method is passed the variable's name and must return the corresponding value. This implementation uses the {@link #getVariableResolver()} with the variable's name as the key. @param variableName the name of the variable, not null @param buf the buffer where the substitution is occurring, not null @param startPos the start position of the variable including the prefix, valid @param endPos the end position of the variable including the suffix, valid @return the variable's value or <b>null</b> if the variable is unknown
[ "Internal", "method", "that", "resolves", "the", "value", "of", "a", "variable", ".", "<p", ">", "Most", "users", "of", "this", "class", "do", "not", "need", "to", "call", "this", "method", ".", "This", "method", "is", "called", "automatically", "by", "the", "substitution", "process", ".", "<p", ">", "Writers", "of", "subclasses", "can", "override", "this", "method", "if", "they", "need", "to", "alter", "how", "each", "substitution", "occurs", ".", "The", "method", "is", "passed", "the", "variable", "s", "name", "and", "must", "return", "the", "corresponding", "value", ".", "This", "implementation", "uses", "the", "{", "@link", "#getVariableResolver", "()", "}", "with", "the", "variable", "s", "name", "as", "the", "key", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java#L932-L938
wildfly-extras/wildfly-camel
common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java
IllegalStateAssertion.assertEquals
public static <T> T assertEquals(T exp, T was, String message) { """ Throws an IllegalStateException when the given values are not equal. """ assertNotNull(exp, message); assertNotNull(was, message); assertTrue(exp.equals(was), message); return was; }
java
public static <T> T assertEquals(T exp, T was, String message) { assertNotNull(exp, message); assertNotNull(was, message); assertTrue(exp.equals(was), message); return was; }
[ "public", "static", "<", "T", ">", "T", "assertEquals", "(", "T", "exp", ",", "T", "was", ",", "String", "message", ")", "{", "assertNotNull", "(", "exp", ",", "message", ")", ";", "assertNotNull", "(", "was", ",", "message", ")", ";", "assertTrue", "(", "exp", ".", "equals", "(", "was", ")", ",", "message", ")", ";", "return", "was", ";", "}" ]
Throws an IllegalStateException when the given values are not equal.
[ "Throws", "an", "IllegalStateException", "when", "the", "given", "values", "are", "not", "equal", "." ]
train
https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/common/src/main/java/org/wildfly/camel/utils/IllegalStateAssertion.java#L76-L81
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/StringUtils.java
StringUtils.argsToProperties
public static Properties argsToProperties(String[] args) { """ In this version each flag has zero or one argument. It has one argument if there is a thing following a flag that does not begin with '-'. See {@link #argsToProperties(String[], Map)} for full documentation. @param args Command line arguments @return A Properties object representing the arguments. """ return argsToProperties(args, Collections.<String,Integer>emptyMap()); }
java
public static Properties argsToProperties(String[] args) { return argsToProperties(args, Collections.<String,Integer>emptyMap()); }
[ "public", "static", "Properties", "argsToProperties", "(", "String", "[", "]", "args", ")", "{", "return", "argsToProperties", "(", "args", ",", "Collections", ".", "<", "String", ",", "Integer", ">", "emptyMap", "(", ")", ")", ";", "}" ]
In this version each flag has zero or one argument. It has one argument if there is a thing following a flag that does not begin with '-'. See {@link #argsToProperties(String[], Map)} for full documentation. @param args Command line arguments @return A Properties object representing the arguments.
[ "In", "this", "version", "each", "flag", "has", "zero", "or", "one", "argument", ".", "It", "has", "one", "argument", "if", "there", "is", "a", "thing", "following", "a", "flag", "that", "does", "not", "begin", "with", "-", ".", "See", "{", "@link", "#argsToProperties", "(", "String", "[]", "Map", ")", "}", "for", "full", "documentation", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/StringUtils.java#L706-L708
rampatra/jbot
jbot/src/main/java/me/ramswaroop/jbot/core/common/BaseBot.java
BaseBot.getMethodWithMatchingPatternAndFilterUnmatchedMethods
protected MethodWrapper getMethodWithMatchingPatternAndFilterUnmatchedMethods(String text, List<MethodWrapper> methodWrappers) { """ Search for a method whose {@link Controller#pattern()} match with the {@code Event} text or payload received from Slack/Facebook and also filter out the methods in {@code methodWrappers} whose {@link Controller#pattern()} do not match. @param text is the message from the user @param methodWrappers @return the MethodWrapper whose method pattern match with that of the slack message received, {@code null} if no such method is found. """ if (methodWrappers != null) { Iterator<MethodWrapper> listIterator = methodWrappers.listIterator(); while (listIterator.hasNext()) { MethodWrapper methodWrapper = listIterator.next(); String pattern = methodWrapper.getPattern(); int patternFlags = methodWrapper.getPatternFlags(); if (!StringUtils.isEmpty(pattern)) { if (StringUtils.isEmpty(text)) { listIterator.remove(); continue; } Pattern p = Pattern.compile(pattern, patternFlags); Matcher m = p.matcher(text); if (m.find()) { methodWrapper.setMatcher(m); return methodWrapper; } else { listIterator.remove(); // remove methods from the original list whose pattern do not match } } } } return null; }
java
protected MethodWrapper getMethodWithMatchingPatternAndFilterUnmatchedMethods(String text, List<MethodWrapper> methodWrappers) { if (methodWrappers != null) { Iterator<MethodWrapper> listIterator = methodWrappers.listIterator(); while (listIterator.hasNext()) { MethodWrapper methodWrapper = listIterator.next(); String pattern = methodWrapper.getPattern(); int patternFlags = methodWrapper.getPatternFlags(); if (!StringUtils.isEmpty(pattern)) { if (StringUtils.isEmpty(text)) { listIterator.remove(); continue; } Pattern p = Pattern.compile(pattern, patternFlags); Matcher m = p.matcher(text); if (m.find()) { methodWrapper.setMatcher(m); return methodWrapper; } else { listIterator.remove(); // remove methods from the original list whose pattern do not match } } } } return null; }
[ "protected", "MethodWrapper", "getMethodWithMatchingPatternAndFilterUnmatchedMethods", "(", "String", "text", ",", "List", "<", "MethodWrapper", ">", "methodWrappers", ")", "{", "if", "(", "methodWrappers", "!=", "null", ")", "{", "Iterator", "<", "MethodWrapper", ">", "listIterator", "=", "methodWrappers", ".", "listIterator", "(", ")", ";", "while", "(", "listIterator", ".", "hasNext", "(", ")", ")", "{", "MethodWrapper", "methodWrapper", "=", "listIterator", ".", "next", "(", ")", ";", "String", "pattern", "=", "methodWrapper", ".", "getPattern", "(", ")", ";", "int", "patternFlags", "=", "methodWrapper", ".", "getPatternFlags", "(", ")", ";", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "pattern", ")", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "text", ")", ")", "{", "listIterator", ".", "remove", "(", ")", ";", "continue", ";", "}", "Pattern", "p", "=", "Pattern", ".", "compile", "(", "pattern", ",", "patternFlags", ")", ";", "Matcher", "m", "=", "p", ".", "matcher", "(", "text", ")", ";", "if", "(", "m", ".", "find", "(", ")", ")", "{", "methodWrapper", ".", "setMatcher", "(", "m", ")", ";", "return", "methodWrapper", ";", "}", "else", "{", "listIterator", ".", "remove", "(", ")", ";", "// remove methods from the original list whose pattern do not match", "}", "}", "}", "}", "return", "null", ";", "}" ]
Search for a method whose {@link Controller#pattern()} match with the {@code Event} text or payload received from Slack/Facebook and also filter out the methods in {@code methodWrappers} whose {@link Controller#pattern()} do not match. @param text is the message from the user @param methodWrappers @return the MethodWrapper whose method pattern match with that of the slack message received, {@code null} if no such method is found.
[ "Search", "for", "a", "method", "whose", "{", "@link", "Controller#pattern", "()", "}", "match", "with", "the", "{", "@code", "Event", "}", "text", "or", "payload", "received", "from", "Slack", "/", "Facebook", "and", "also", "filter", "out", "the", "methods", "in", "{", "@code", "methodWrappers", "}", "whose", "{", "@link", "Controller#pattern", "()", "}", "do", "not", "match", "." ]
train
https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot/src/main/java/me/ramswaroop/jbot/core/common/BaseBot.java#L110-L136
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java
ClassFile.addInnerClass
public ClassFile addInnerClass(String innerClassName, String superClassName) { """ Add an inner class to this class. By default, inner classes are private static. @param innerClassName Optional short inner class name. @param superClassName Full super class name. """ String fullInnerClassName; if (innerClassName == null) { fullInnerClassName = mClassName + '$' + (++mAnonymousInnerClassCount); } else { fullInnerClassName = mClassName + '$' + innerClassName; } ClassFile inner = new ClassFile(fullInnerClassName, superClassName); Modifiers access = inner.getModifiers(); access.setPrivate(true); access.setStatic(true); inner.mInnerClassName = innerClassName; inner.mOuterClass = this; if (mInnerClasses == null) { mInnerClasses = new ArrayList<ClassFile>(); } mInnerClasses.add(inner); // Record the inner class in this, the outer class. if (mInnerClassesAttr == null) { addAttribute(new InnerClassesAttr(mCp)); } mInnerClassesAttr.addInnerClass(fullInnerClassName, mClassName, innerClassName, access); // Record the inner class in itself. inner.addAttribute(new InnerClassesAttr(inner.getConstantPool())); inner.mInnerClassesAttr.addInnerClass(fullInnerClassName, mClassName, innerClassName, access); return inner; }
java
public ClassFile addInnerClass(String innerClassName, String superClassName) { String fullInnerClassName; if (innerClassName == null) { fullInnerClassName = mClassName + '$' + (++mAnonymousInnerClassCount); } else { fullInnerClassName = mClassName + '$' + innerClassName; } ClassFile inner = new ClassFile(fullInnerClassName, superClassName); Modifiers access = inner.getModifiers(); access.setPrivate(true); access.setStatic(true); inner.mInnerClassName = innerClassName; inner.mOuterClass = this; if (mInnerClasses == null) { mInnerClasses = new ArrayList<ClassFile>(); } mInnerClasses.add(inner); // Record the inner class in this, the outer class. if (mInnerClassesAttr == null) { addAttribute(new InnerClassesAttr(mCp)); } mInnerClassesAttr.addInnerClass(fullInnerClassName, mClassName, innerClassName, access); // Record the inner class in itself. inner.addAttribute(new InnerClassesAttr(inner.getConstantPool())); inner.mInnerClassesAttr.addInnerClass(fullInnerClassName, mClassName, innerClassName, access); return inner; }
[ "public", "ClassFile", "addInnerClass", "(", "String", "innerClassName", ",", "String", "superClassName", ")", "{", "String", "fullInnerClassName", ";", "if", "(", "innerClassName", "==", "null", ")", "{", "fullInnerClassName", "=", "mClassName", "+", "'", "'", "+", "(", "++", "mAnonymousInnerClassCount", ")", ";", "}", "else", "{", "fullInnerClassName", "=", "mClassName", "+", "'", "'", "+", "innerClassName", ";", "}", "ClassFile", "inner", "=", "new", "ClassFile", "(", "fullInnerClassName", ",", "superClassName", ")", ";", "Modifiers", "access", "=", "inner", ".", "getModifiers", "(", ")", ";", "access", ".", "setPrivate", "(", "true", ")", ";", "access", ".", "setStatic", "(", "true", ")", ";", "inner", ".", "mInnerClassName", "=", "innerClassName", ";", "inner", ".", "mOuterClass", "=", "this", ";", "if", "(", "mInnerClasses", "==", "null", ")", "{", "mInnerClasses", "=", "new", "ArrayList", "<", "ClassFile", ">", "(", ")", ";", "}", "mInnerClasses", ".", "add", "(", "inner", ")", ";", "// Record the inner class in this, the outer class.", "if", "(", "mInnerClassesAttr", "==", "null", ")", "{", "addAttribute", "(", "new", "InnerClassesAttr", "(", "mCp", ")", ")", ";", "}", "mInnerClassesAttr", ".", "addInnerClass", "(", "fullInnerClassName", ",", "mClassName", ",", "innerClassName", ",", "access", ")", ";", "// Record the inner class in itself.", "inner", ".", "addAttribute", "(", "new", "InnerClassesAttr", "(", "inner", ".", "getConstantPool", "(", ")", ")", ")", ";", "inner", ".", "mInnerClassesAttr", ".", "addInnerClass", "(", "fullInnerClassName", ",", "mClassName", ",", "innerClassName", ",", "access", ")", ";", "return", "inner", ";", "}" ]
Add an inner class to this class. By default, inner classes are private static. @param innerClassName Optional short inner class name. @param superClassName Full super class name.
[ "Add", "an", "inner", "class", "to", "this", "class", ".", "By", "default", "inner", "classes", "are", "private", "static", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/ClassFile.java#L705-L743
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getDeletedKeysAsync
public Observable<Page<DeletedKeyItem>> getDeletedKeysAsync(final String vaultBaseUrl, final Integer maxresults) { """ Lists the deleted keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a deleted key. This operation includes deletion-specific information. The Get Deleted Keys operation is applicable for vaults enabled for soft-delete. While the operation can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DeletedKeyItem&gt; object """ return getDeletedKeysWithServiceResponseAsync(vaultBaseUrl, maxresults) .map(new Func1<ServiceResponse<Page<DeletedKeyItem>>, Page<DeletedKeyItem>>() { @Override public Page<DeletedKeyItem> call(ServiceResponse<Page<DeletedKeyItem>> response) { return response.body(); } }); }
java
public Observable<Page<DeletedKeyItem>> getDeletedKeysAsync(final String vaultBaseUrl, final Integer maxresults) { return getDeletedKeysWithServiceResponseAsync(vaultBaseUrl, maxresults) .map(new Func1<ServiceResponse<Page<DeletedKeyItem>>, Page<DeletedKeyItem>>() { @Override public Page<DeletedKeyItem> call(ServiceResponse<Page<DeletedKeyItem>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DeletedKeyItem", ">", ">", "getDeletedKeysAsync", "(", "final", "String", "vaultBaseUrl", ",", "final", "Integer", "maxresults", ")", "{", "return", "getDeletedKeysWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "maxresults", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "DeletedKeyItem", ">", ">", ",", "Page", "<", "DeletedKeyItem", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "DeletedKeyItem", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "DeletedKeyItem", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists the deleted keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a deleted key. This operation includes deletion-specific information. The Get Deleted Keys operation is applicable for vaults enabled for soft-delete. While the operation can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DeletedKeyItem&gt; object
[ "Lists", "the", "deleted", "keys", "in", "the", "specified", "vault", ".", "Retrieves", "a", "list", "of", "the", "keys", "in", "the", "Key", "Vault", "as", "JSON", "Web", "Key", "structures", "that", "contain", "the", "public", "part", "of", "a", "deleted", "key", ".", "This", "operation", "includes", "deletion", "-", "specific", "information", ".", "The", "Get", "Deleted", "Keys", "operation", "is", "applicable", "for", "vaults", "enabled", "for", "soft", "-", "delete", ".", "While", "the", "operation", "can", "be", "invoked", "on", "any", "vault", "it", "will", "return", "an", "error", "if", "invoked", "on", "a", "non", "soft", "-", "delete", "enabled", "vault", ".", "This", "operation", "requires", "the", "keys", "/", "list", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L2976-L2984
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/BucketTimer.java
BucketTimer.get
public static BucketTimer get(Registry registry, Id id, BucketFunction f) { """ Creates a timer object that manages a set of timers based on the bucket function supplied. Calling record will be mapped to the record on the appropriate timer. @param registry Registry to use. @param id Identifier for the metric being registered. @param f Function to map values to buckets. @return Timer that manages sub-timers based on the bucket function. """ return new BucketTimer( com.netflix.spectator.api.histogram.BucketTimer.get(registry, id, f)); }
java
public static BucketTimer get(Registry registry, Id id, BucketFunction f) { return new BucketTimer( com.netflix.spectator.api.histogram.BucketTimer.get(registry, id, f)); }
[ "public", "static", "BucketTimer", "get", "(", "Registry", "registry", ",", "Id", "id", ",", "BucketFunction", "f", ")", "{", "return", "new", "BucketTimer", "(", "com", ".", "netflix", ".", "spectator", ".", "api", ".", "histogram", ".", "BucketTimer", ".", "get", "(", "registry", ",", "id", ",", "f", ")", ")", ";", "}" ]
Creates a timer object that manages a set of timers based on the bucket function supplied. Calling record will be mapped to the record on the appropriate timer. @param registry Registry to use. @param id Identifier for the metric being registered. @param f Function to map values to buckets. @return Timer that manages sub-timers based on the bucket function.
[ "Creates", "a", "timer", "object", "that", "manages", "a", "set", "of", "timers", "based", "on", "the", "bucket", "function", "supplied", ".", "Calling", "record", "will", "be", "mapped", "to", "the", "record", "on", "the", "appropriate", "timer", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/BucketTimer.java#L63-L66
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/SafeTraceLevelIndexFactory.java
SafeTraceLevelIndexFactory.addFiltersAndValuesToIndex
private static void addFiltersAndValuesToIndex(BufferedReader br, PackageIndex<Integer> packageIndex) throws IOException { """ /* Add the filters and values to the index. The values are inserted as Integers for easy comparison in TraceComponent and to avoid having to recompute each time the spec is checked. """ String line; while ((line = br.readLine()) != null) { if (line.isEmpty() || line.startsWith("#")) { continue; } int pos = line.indexOf('='); if (pos > 0) { String filter = line.substring(0, pos).trim(); String value = line.substring(pos + 1).trim(); packageIndex.add(filter, getMinLevelIndex(value)); } } }
java
private static void addFiltersAndValuesToIndex(BufferedReader br, PackageIndex<Integer> packageIndex) throws IOException { String line; while ((line = br.readLine()) != null) { if (line.isEmpty() || line.startsWith("#")) { continue; } int pos = line.indexOf('='); if (pos > 0) { String filter = line.substring(0, pos).trim(); String value = line.substring(pos + 1).trim(); packageIndex.add(filter, getMinLevelIndex(value)); } } }
[ "private", "static", "void", "addFiltersAndValuesToIndex", "(", "BufferedReader", "br", ",", "PackageIndex", "<", "Integer", ">", "packageIndex", ")", "throws", "IOException", "{", "String", "line", ";", "while", "(", "(", "line", "=", "br", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "if", "(", "line", ".", "isEmpty", "(", ")", "||", "line", ".", "startsWith", "(", "\"#\"", ")", ")", "{", "continue", ";", "}", "int", "pos", "=", "line", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "pos", ">", "0", ")", "{", "String", "filter", "=", "line", ".", "substring", "(", "0", ",", "pos", ")", ".", "trim", "(", ")", ";", "String", "value", "=", "line", ".", "substring", "(", "pos", "+", "1", ")", ".", "trim", "(", ")", ";", "packageIndex", ".", "add", "(", "filter", ",", "getMinLevelIndex", "(", "value", ")", ")", ";", "}", "}", "}" ]
/* Add the filters and values to the index. The values are inserted as Integers for easy comparison in TraceComponent and to avoid having to recompute each time the spec is checked.
[ "/", "*", "Add", "the", "filters", "and", "values", "to", "the", "index", ".", "The", "values", "are", "inserted", "as", "Integers", "for", "easy", "comparison", "in", "TraceComponent", "and", "to", "avoid", "having", "to", "recompute", "each", "time", "the", "spec", "is", "checked", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/SafeTraceLevelIndexFactory.java#L72-L85
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Project.java
Project.getTotalEstimate
public Double getTotalEstimate(PrimaryWorkitemFilter filter, boolean includeChildProjects) { """ Retrieves the total estimate for all stories and defects in this project optionally filtered. @param filter Criteria to filter stories and defects on. @param includeChildProjects If true, include open sub projects, otherwise only include this project. @return total estimate of selected Workitems. """ filter = (filter != null) ? filter : new PrimaryWorkitemFilter(); return getRollup("Workitems:PrimaryWorkitem", "Estimate", filter, includeChildProjects); }
java
public Double getTotalEstimate(PrimaryWorkitemFilter filter, boolean includeChildProjects) { filter = (filter != null) ? filter : new PrimaryWorkitemFilter(); return getRollup("Workitems:PrimaryWorkitem", "Estimate", filter, includeChildProjects); }
[ "public", "Double", "getTotalEstimate", "(", "PrimaryWorkitemFilter", "filter", ",", "boolean", "includeChildProjects", ")", "{", "filter", "=", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "PrimaryWorkitemFilter", "(", ")", ";", "return", "getRollup", "(", "\"Workitems:PrimaryWorkitem\"", ",", "\"Estimate\"", ",", "filter", ",", "includeChildProjects", ")", ";", "}" ]
Retrieves the total estimate for all stories and defects in this project optionally filtered. @param filter Criteria to filter stories and defects on. @param includeChildProjects If true, include open sub projects, otherwise only include this project. @return total estimate of selected Workitems.
[ "Retrieves", "the", "total", "estimate", "for", "all", "stories", "and", "defects", "in", "this", "project", "optionally", "filtered", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Project.java#L1073-L1078
Erudika/para
para-server/src/main/java/com/erudika/para/security/SecurityUtils.java
SecurityUtils.generateJWToken
public static SignedJWT generateJWToken(User user, App app) { """ Generates a new JWT token. @param user a User object belonging to the app @param app the app object @return a new JWT or null """ if (app != null) { try { Date now = new Date(); JWTClaimsSet.Builder claimsSet = new JWTClaimsSet.Builder(); String userSecret = ""; claimsSet.issueTime(now); claimsSet.expirationTime(new Date(now.getTime() + (app.getTokenValiditySec() * 1000))); claimsSet.notBeforeTime(now); claimsSet.claim("refresh", getNextRefresh(app.getTokenValiditySec())); claimsSet.claim(Config._APPID, app.getId()); if (user != null) { claimsSet.subject(user.getId()); userSecret = user.getTokenSecret(); } JWSSigner signer = new MACSigner(app.getSecret() + userSecret); SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet.build()); signedJWT.sign(signer); return signedJWT; } catch (JOSEException e) { logger.warn("Unable to sign JWT: {}.", e.getMessage()); } } return null; }
java
public static SignedJWT generateJWToken(User user, App app) { if (app != null) { try { Date now = new Date(); JWTClaimsSet.Builder claimsSet = new JWTClaimsSet.Builder(); String userSecret = ""; claimsSet.issueTime(now); claimsSet.expirationTime(new Date(now.getTime() + (app.getTokenValiditySec() * 1000))); claimsSet.notBeforeTime(now); claimsSet.claim("refresh", getNextRefresh(app.getTokenValiditySec())); claimsSet.claim(Config._APPID, app.getId()); if (user != null) { claimsSet.subject(user.getId()); userSecret = user.getTokenSecret(); } JWSSigner signer = new MACSigner(app.getSecret() + userSecret); SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet.build()); signedJWT.sign(signer); return signedJWT; } catch (JOSEException e) { logger.warn("Unable to sign JWT: {}.", e.getMessage()); } } return null; }
[ "public", "static", "SignedJWT", "generateJWToken", "(", "User", "user", ",", "App", "app", ")", "{", "if", "(", "app", "!=", "null", ")", "{", "try", "{", "Date", "now", "=", "new", "Date", "(", ")", ";", "JWTClaimsSet", ".", "Builder", "claimsSet", "=", "new", "JWTClaimsSet", ".", "Builder", "(", ")", ";", "String", "userSecret", "=", "\"\"", ";", "claimsSet", ".", "issueTime", "(", "now", ")", ";", "claimsSet", ".", "expirationTime", "(", "new", "Date", "(", "now", ".", "getTime", "(", ")", "+", "(", "app", ".", "getTokenValiditySec", "(", ")", "*", "1000", ")", ")", ")", ";", "claimsSet", ".", "notBeforeTime", "(", "now", ")", ";", "claimsSet", ".", "claim", "(", "\"refresh\"", ",", "getNextRefresh", "(", "app", ".", "getTokenValiditySec", "(", ")", ")", ")", ";", "claimsSet", ".", "claim", "(", "Config", ".", "_APPID", ",", "app", ".", "getId", "(", ")", ")", ";", "if", "(", "user", "!=", "null", ")", "{", "claimsSet", ".", "subject", "(", "user", ".", "getId", "(", ")", ")", ";", "userSecret", "=", "user", ".", "getTokenSecret", "(", ")", ";", "}", "JWSSigner", "signer", "=", "new", "MACSigner", "(", "app", ".", "getSecret", "(", ")", "+", "userSecret", ")", ";", "SignedJWT", "signedJWT", "=", "new", "SignedJWT", "(", "new", "JWSHeader", "(", "JWSAlgorithm", ".", "HS256", ")", ",", "claimsSet", ".", "build", "(", ")", ")", ";", "signedJWT", ".", "sign", "(", "signer", ")", ";", "return", "signedJWT", ";", "}", "catch", "(", "JOSEException", "e", ")", "{", "logger", ".", "warn", "(", "\"Unable to sign JWT: {}.\"", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "return", "null", ";", "}" ]
Generates a new JWT token. @param user a User object belonging to the app @param app the app object @return a new JWT or null
[ "Generates", "a", "new", "JWT", "token", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/SecurityUtils.java#L269-L293
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
DFSClient.recoverLease
boolean recoverLease(String src, boolean discardLastBlock) throws IOException { """ Recover a file's lease @param src a file's path @return if lease recovery completes @throws IOException """ checkOpen(); // We remove the file from local lease checker. Usually it is already been // removed by the client but we want to be extra safe. leasechecker.remove(src); if (this.namenodeProtocolProxy == null) { return versionBasedRecoverLease(src); } return methodBasedRecoverLease(src, discardLastBlock); }
java
boolean recoverLease(String src, boolean discardLastBlock) throws IOException { checkOpen(); // We remove the file from local lease checker. Usually it is already been // removed by the client but we want to be extra safe. leasechecker.remove(src); if (this.namenodeProtocolProxy == null) { return versionBasedRecoverLease(src); } return methodBasedRecoverLease(src, discardLastBlock); }
[ "boolean", "recoverLease", "(", "String", "src", ",", "boolean", "discardLastBlock", ")", "throws", "IOException", "{", "checkOpen", "(", ")", ";", "// We remove the file from local lease checker. Usually it is already been", "// removed by the client but we want to be extra safe.", "leasechecker", ".", "remove", "(", "src", ")", ";", "if", "(", "this", ".", "namenodeProtocolProxy", "==", "null", ")", "{", "return", "versionBasedRecoverLease", "(", "src", ")", ";", "}", "return", "methodBasedRecoverLease", "(", "src", ",", "discardLastBlock", ")", ";", "}" ]
Recover a file's lease @param src a file's path @return if lease recovery completes @throws IOException
[ "Recover", "a", "file", "s", "lease" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java#L1189-L1199
alibaba/Virtualview-Android
app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java
ViewServer.addWindow
public void addWindow(View view, String name) { """ Invoke this method to register a new view hierarchy. @param view A view that belongs to the view hierarchy/window to register @name name The name of the view hierarchy/window to register @see #removeWindow(View) """ mWindowsLock.writeLock().lock(); try { mWindows.put(view.getRootView(), name); } finally { mWindowsLock.writeLock().unlock(); } fireWindowsChangedEvent(); }
java
public void addWindow(View view, String name) { mWindowsLock.writeLock().lock(); try { mWindows.put(view.getRootView(), name); } finally { mWindowsLock.writeLock().unlock(); } fireWindowsChangedEvent(); }
[ "public", "void", "addWindow", "(", "View", "view", ",", "String", "name", ")", "{", "mWindowsLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "mWindows", ".", "put", "(", "view", ".", "getRootView", "(", ")", ",", "name", ")", ";", "}", "finally", "{", "mWindowsLock", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "fireWindowsChangedEvent", "(", ")", ";", "}" ]
Invoke this method to register a new view hierarchy. @param view A view that belongs to the view hierarchy/window to register @name name The name of the view hierarchy/window to register @see #removeWindow(View)
[ "Invoke", "this", "method", "to", "register", "a", "new", "view", "hierarchy", "." ]
train
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java#L336-L344
btrplace/scheduler
examples/src/main/java/org/btrplace/examples/GettingStarted.java
GettingStarted.makeModel
private Model makeModel() { """ Make a model with 4 online nodes, 6 VMs (5 running, 1 ready). Declare 2 resources. """ Model model = new DefaultModel(); Mapping map = model.getMapping(); //Create 4 online nodes for (int i = 0; i < 4; i++) { Node n = model.newNode(); nodes.add(n); map.addOnlineNode(n); } //Create 6 VMs: vm0..vm5 for (int i = 0; i < 6; i++) { VM v = model.newVM(); vms.add(v); } //vm2,vm1,vm0,vm3,vm5 are running on the nodes map.addRunningVM(vms.get(2), nodes.get(0)); map.addRunningVM(vms.get(1), nodes.get(1)); map.addRunningVM(vms.get(0), nodes.get(2)); map.addRunningVM(vms.get(3), nodes.get(2)); map.addRunningVM(vms.get(5), nodes.get(3)); //vm4 is ready to be running on a node. map.addReadyVM(vms.get(4)); //Declare a view to specify the "cpu" physical capacity of the nodes // and the virtual consumption of the VMs. //By default, nodes have 8 "cpu" resources ShareableResource rcCPU = new ShareableResource("cpu", 8, 0); rcCPU.setConsumption(vms.get(0), 2); rcCPU.setConsumption(vms.get(1), 3); rcCPU.setConsumption(vms.get(2), 4); rcCPU.setConsumption(vms.get(3), 3); rcCPU.setConsumption(vms.get(5), 5); //By default, nodes have 7 "mem" resources ShareableResource rcMem = new ShareableResource("mem", 7, 0); rcMem.setConsumption(vms.get(0), 2); rcMem.setConsumption(vms.get(1), 2); rcMem.setConsumption(vms.get(2), 4); rcMem.setConsumption(vms.get(3), 3); rcMem.setConsumption(vms.get(5), 4); //Attach the resources model.attach(rcCPU); model.attach(rcMem); return model; }
java
private Model makeModel() { Model model = new DefaultModel(); Mapping map = model.getMapping(); //Create 4 online nodes for (int i = 0; i < 4; i++) { Node n = model.newNode(); nodes.add(n); map.addOnlineNode(n); } //Create 6 VMs: vm0..vm5 for (int i = 0; i < 6; i++) { VM v = model.newVM(); vms.add(v); } //vm2,vm1,vm0,vm3,vm5 are running on the nodes map.addRunningVM(vms.get(2), nodes.get(0)); map.addRunningVM(vms.get(1), nodes.get(1)); map.addRunningVM(vms.get(0), nodes.get(2)); map.addRunningVM(vms.get(3), nodes.get(2)); map.addRunningVM(vms.get(5), nodes.get(3)); //vm4 is ready to be running on a node. map.addReadyVM(vms.get(4)); //Declare a view to specify the "cpu" physical capacity of the nodes // and the virtual consumption of the VMs. //By default, nodes have 8 "cpu" resources ShareableResource rcCPU = new ShareableResource("cpu", 8, 0); rcCPU.setConsumption(vms.get(0), 2); rcCPU.setConsumption(vms.get(1), 3); rcCPU.setConsumption(vms.get(2), 4); rcCPU.setConsumption(vms.get(3), 3); rcCPU.setConsumption(vms.get(5), 5); //By default, nodes have 7 "mem" resources ShareableResource rcMem = new ShareableResource("mem", 7, 0); rcMem.setConsumption(vms.get(0), 2); rcMem.setConsumption(vms.get(1), 2); rcMem.setConsumption(vms.get(2), 4); rcMem.setConsumption(vms.get(3), 3); rcMem.setConsumption(vms.get(5), 4); //Attach the resources model.attach(rcCPU); model.attach(rcMem); return model; }
[ "private", "Model", "makeModel", "(", ")", "{", "Model", "model", "=", "new", "DefaultModel", "(", ")", ";", "Mapping", "map", "=", "model", ".", "getMapping", "(", ")", ";", "//Create 4 online nodes", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "Node", "n", "=", "model", ".", "newNode", "(", ")", ";", "nodes", ".", "add", "(", "n", ")", ";", "map", ".", "addOnlineNode", "(", "n", ")", ";", "}", "//Create 6 VMs: vm0..vm5", "for", "(", "int", "i", "=", "0", ";", "i", "<", "6", ";", "i", "++", ")", "{", "VM", "v", "=", "model", ".", "newVM", "(", ")", ";", "vms", ".", "add", "(", "v", ")", ";", "}", "//vm2,vm1,vm0,vm3,vm5 are running on the nodes", "map", ".", "addRunningVM", "(", "vms", ".", "get", "(", "2", ")", ",", "nodes", ".", "get", "(", "0", ")", ")", ";", "map", ".", "addRunningVM", "(", "vms", ".", "get", "(", "1", ")", ",", "nodes", ".", "get", "(", "1", ")", ")", ";", "map", ".", "addRunningVM", "(", "vms", ".", "get", "(", "0", ")", ",", "nodes", ".", "get", "(", "2", ")", ")", ";", "map", ".", "addRunningVM", "(", "vms", ".", "get", "(", "3", ")", ",", "nodes", ".", "get", "(", "2", ")", ")", ";", "map", ".", "addRunningVM", "(", "vms", ".", "get", "(", "5", ")", ",", "nodes", ".", "get", "(", "3", ")", ")", ";", "//vm4 is ready to be running on a node.", "map", ".", "addReadyVM", "(", "vms", ".", "get", "(", "4", ")", ")", ";", "//Declare a view to specify the \"cpu\" physical capacity of the nodes", "// and the virtual consumption of the VMs.", "//By default, nodes have 8 \"cpu\" resources", "ShareableResource", "rcCPU", "=", "new", "ShareableResource", "(", "\"cpu\"", ",", "8", ",", "0", ")", ";", "rcCPU", ".", "setConsumption", "(", "vms", ".", "get", "(", "0", ")", ",", "2", ")", ";", "rcCPU", ".", "setConsumption", "(", "vms", ".", "get", "(", "1", ")", ",", "3", ")", ";", "rcCPU", ".", "setConsumption", "(", "vms", ".", "get", "(", "2", ")", ",", "4", ")", ";", "rcCPU", ".", "setConsumption", "(", "vms", ".", "get", "(", "3", ")", ",", "3", ")", ";", "rcCPU", ".", "setConsumption", "(", "vms", ".", "get", "(", "5", ")", ",", "5", ")", ";", "//By default, nodes have 7 \"mem\" resources", "ShareableResource", "rcMem", "=", "new", "ShareableResource", "(", "\"mem\"", ",", "7", ",", "0", ")", ";", "rcMem", ".", "setConsumption", "(", "vms", ".", "get", "(", "0", ")", ",", "2", ")", ";", "rcMem", ".", "setConsumption", "(", "vms", ".", "get", "(", "1", ")", ",", "2", ")", ";", "rcMem", ".", "setConsumption", "(", "vms", ".", "get", "(", "2", ")", ",", "4", ")", ";", "rcMem", ".", "setConsumption", "(", "vms", ".", "get", "(", "3", ")", ",", "3", ")", ";", "rcMem", ".", "setConsumption", "(", "vms", ".", "get", "(", "5", ")", ",", "4", ")", ";", "//Attach the resources", "model", ".", "attach", "(", "rcCPU", ")", ";", "model", ".", "attach", "(", "rcMem", ")", ";", "return", "model", ";", "}" ]
Make a model with 4 online nodes, 6 VMs (5 running, 1 ready). Declare 2 resources.
[ "Make", "a", "model", "with", "4", "online", "nodes", "6", "VMs", "(", "5", "running", "1", "ready", ")", ".", "Declare", "2", "resources", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/examples/src/main/java/org/btrplace/examples/GettingStarted.java#L51-L100
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.formatToStartOfDay
public static Date formatToStartOfDay(final Date date) { """ Returns the beginning of the given day. <br/> e.g: '2012-12-21 21:21:21' => '2012-12-21 00:00:00' @param date date to be handled. @return a new date is beginning of the given day. @throws DateException """ try { SimpleDateFormat dateFormat = buildDateFormat(DEFAULT_DATE_SIMPLE_PATTERN); String formattedDate = dateFormat.format(date); return dateFormat.parse(formattedDate); } catch (ParseException pe) { throw new DateException("Unparseable date specified.", pe); } }
java
public static Date formatToStartOfDay(final Date date) { try { SimpleDateFormat dateFormat = buildDateFormat(DEFAULT_DATE_SIMPLE_PATTERN); String formattedDate = dateFormat.format(date); return dateFormat.parse(formattedDate); } catch (ParseException pe) { throw new DateException("Unparseable date specified.", pe); } }
[ "public", "static", "Date", "formatToStartOfDay", "(", "final", "Date", "date", ")", "{", "try", "{", "SimpleDateFormat", "dateFormat", "=", "buildDateFormat", "(", "DEFAULT_DATE_SIMPLE_PATTERN", ")", ";", "String", "formattedDate", "=", "dateFormat", ".", "format", "(", "date", ")", ";", "return", "dateFormat", ".", "parse", "(", "formattedDate", ")", ";", "}", "catch", "(", "ParseException", "pe", ")", "{", "throw", "new", "DateException", "(", "\"Unparseable date specified.\"", ",", "pe", ")", ";", "}", "}" ]
Returns the beginning of the given day. <br/> e.g: '2012-12-21 21:21:21' => '2012-12-21 00:00:00' @param date date to be handled. @return a new date is beginning of the given day. @throws DateException
[ "Returns", "the", "beginning", "of", "the", "given", "day", ".", "<br", "/", ">", "e", ".", "g", ":", "2012", "-", "12", "-", "21", "21", ":", "21", ":", "21", "=", ">", "2012", "-", "12", "-", "21", "00", ":", "00", ":", "00" ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L537-L546
googleapis/cloud-bigtable-client
bigtable-hbase-1.x-parent/bigtable-hbase-1.x-mapreduce/src/main/java/com/google/cloud/bigtable/mapreduce/Export.java
Export.createSubmittableJob
public static Job createSubmittableJob(Configuration conf, String[] args) throws IOException { """ Sets up the actual job. @param conf The current configuration. @param args The command line parameters. @return The newly created job. @throws java.io.IOException When setting up the job fails. """ conf.setIfUnset("hbase.client.connection.impl", BigtableConfiguration.getConnectionClass().getName()); conf.setIfUnset(BigtableOptionsFactory.BIGTABLE_RPC_TIMEOUT_MS_KEY, "60000"); conf.setBoolean(TableInputFormat.SHUFFLE_MAPS, true); String tableName = args[0]; Path outputDir = new Path(args[1]); Job job = Job.getInstance(conf, NAME + "_" + tableName); job.setJobName(NAME + "_" + tableName); job.setJarByClass(Export.class); // Set optional scan parameters Scan s = getConfiguredScanForJob(conf, args); TableMapReduceUtil.initTableMapperJob(tableName, s, IdentityTableMapper.class, ImmutableBytesWritable.class, Result.class, job, false); // No reducers. Just write straight to output files. job.setNumReduceTasks(0); job.setOutputFormatClass(SequenceFileOutputFormat.class); job.setOutputKeyClass(ImmutableBytesWritable.class); job.setOutputValueClass(Result.class); FileOutputFormat.setOutputPath(job, outputDir); // job conf doesn't contain the conf so doesn't have a default fs. return job; }
java
public static Job createSubmittableJob(Configuration conf, String[] args) throws IOException { conf.setIfUnset("hbase.client.connection.impl", BigtableConfiguration.getConnectionClass().getName()); conf.setIfUnset(BigtableOptionsFactory.BIGTABLE_RPC_TIMEOUT_MS_KEY, "60000"); conf.setBoolean(TableInputFormat.SHUFFLE_MAPS, true); String tableName = args[0]; Path outputDir = new Path(args[1]); Job job = Job.getInstance(conf, NAME + "_" + tableName); job.setJobName(NAME + "_" + tableName); job.setJarByClass(Export.class); // Set optional scan parameters Scan s = getConfiguredScanForJob(conf, args); TableMapReduceUtil.initTableMapperJob(tableName, s, IdentityTableMapper.class, ImmutableBytesWritable.class, Result.class, job, false); // No reducers. Just write straight to output files. job.setNumReduceTasks(0); job.setOutputFormatClass(SequenceFileOutputFormat.class); job.setOutputKeyClass(ImmutableBytesWritable.class); job.setOutputValueClass(Result.class); FileOutputFormat.setOutputPath(job, outputDir); // job conf doesn't contain the conf so doesn't have a default fs. return job; }
[ "public", "static", "Job", "createSubmittableJob", "(", "Configuration", "conf", ",", "String", "[", "]", "args", ")", "throws", "IOException", "{", "conf", ".", "setIfUnset", "(", "\"hbase.client.connection.impl\"", ",", "BigtableConfiguration", ".", "getConnectionClass", "(", ")", ".", "getName", "(", ")", ")", ";", "conf", ".", "setIfUnset", "(", "BigtableOptionsFactory", ".", "BIGTABLE_RPC_TIMEOUT_MS_KEY", ",", "\"60000\"", ")", ";", "conf", ".", "setBoolean", "(", "TableInputFormat", ".", "SHUFFLE_MAPS", ",", "true", ")", ";", "String", "tableName", "=", "args", "[", "0", "]", ";", "Path", "outputDir", "=", "new", "Path", "(", "args", "[", "1", "]", ")", ";", "Job", "job", "=", "Job", ".", "getInstance", "(", "conf", ",", "NAME", "+", "\"_\"", "+", "tableName", ")", ";", "job", ".", "setJobName", "(", "NAME", "+", "\"_\"", "+", "tableName", ")", ";", "job", ".", "setJarByClass", "(", "Export", ".", "class", ")", ";", "// Set optional scan parameters", "Scan", "s", "=", "getConfiguredScanForJob", "(", "conf", ",", "args", ")", ";", "TableMapReduceUtil", ".", "initTableMapperJob", "(", "tableName", ",", "s", ",", "IdentityTableMapper", ".", "class", ",", "ImmutableBytesWritable", ".", "class", ",", "Result", ".", "class", ",", "job", ",", "false", ")", ";", "// No reducers. Just write straight to output files.", "job", ".", "setNumReduceTasks", "(", "0", ")", ";", "job", ".", "setOutputFormatClass", "(", "SequenceFileOutputFormat", ".", "class", ")", ";", "job", ".", "setOutputKeyClass", "(", "ImmutableBytesWritable", ".", "class", ")", ";", "job", ".", "setOutputValueClass", "(", "Result", ".", "class", ")", ";", "FileOutputFormat", ".", "setOutputPath", "(", "job", ",", "outputDir", ")", ";", "// job conf doesn't contain the conf so doesn't have a default fs.", "return", "job", ";", "}" ]
Sets up the actual job. @param conf The current configuration. @param args The command line parameters. @return The newly created job. @throws java.io.IOException When setting up the job fails.
[ "Sets", "up", "the", "actual", "job", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-hbase-1.x-parent/bigtable-hbase-1.x-mapreduce/src/main/java/com/google/cloud/bigtable/mapreduce/Export.java#L77-L99
headius/invokebinder
src/main/java/com/headius/invokebinder/Signature.java
Signature.insertArg
public Signature insertArg(int index, String name, Class<?> type) { """ Insert an argument (name + type) into the signature. @param index the index at which to insert @param name the name of the new argument @param type the type of the new argument @return a new signature with the added arguments """ return insertArgs(index, new String[]{name}, new Class<?>[]{type}); }
java
public Signature insertArg(int index, String name, Class<?> type) { return insertArgs(index, new String[]{name}, new Class<?>[]{type}); }
[ "public", "Signature", "insertArg", "(", "int", "index", ",", "String", "name", ",", "Class", "<", "?", ">", "type", ")", "{", "return", "insertArgs", "(", "index", ",", "new", "String", "[", "]", "{", "name", "}", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "type", "}", ")", ";", "}" ]
Insert an argument (name + type) into the signature. @param index the index at which to insert @param name the name of the new argument @param type the type of the new argument @return a new signature with the added arguments
[ "Insert", "an", "argument", "(", "name", "+", "type", ")", "into", "the", "signature", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L250-L252
redkale/redkale
src/org/redkale/net/http/WebSocket.java
WebSocket.sendMap
public final CompletableFuture<Integer> sendMap(boolean last, Object... messages) { """ 给自身发送消息, 消息类型是key-value键值对 @param last 是否最后一条 @param messages key-value键值对 @return 0表示成功, 非0表示错误码 """ return send(true, messages, last); }
java
public final CompletableFuture<Integer> sendMap(boolean last, Object... messages) { return send(true, messages, last); }
[ "public", "final", "CompletableFuture", "<", "Integer", ">", "sendMap", "(", "boolean", "last", ",", "Object", "...", "messages", ")", "{", "return", "send", "(", "true", ",", "messages", ",", "last", ")", ";", "}" ]
给自身发送消息, 消息类型是key-value键值对 @param last 是否最后一条 @param messages key-value键值对 @return 0表示成功, 非0表示错误码
[ "给自身发送消息", "消息类型是key", "-", "value键值对" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/WebSocket.java#L174-L176
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cdn_webstorage_serviceName_storage_GET
public ArrayList<String> cdn_webstorage_serviceName_storage_GET(String serviceName, OvhOrderStorageEnum storage) throws IOException { """ Get allowed durations for 'storage' option REST: GET /order/cdn/webstorage/{serviceName}/storage @param storage [required] Storage option that will be ordered @param serviceName [required] The internal name of your CDN Static offer """ String qPath = "/order/cdn/webstorage/{serviceName}/storage"; StringBuilder sb = path(qPath, serviceName); query(sb, "storage", storage); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> cdn_webstorage_serviceName_storage_GET(String serviceName, OvhOrderStorageEnum storage) throws IOException { String qPath = "/order/cdn/webstorage/{serviceName}/storage"; StringBuilder sb = path(qPath, serviceName); query(sb, "storage", storage); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "cdn_webstorage_serviceName_storage_GET", "(", "String", "serviceName", ",", "OvhOrderStorageEnum", "storage", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cdn/webstorage/{serviceName}/storage\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"storage\"", ",", "storage", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
Get allowed durations for 'storage' option REST: GET /order/cdn/webstorage/{serviceName}/storage @param storage [required] Storage option that will be ordered @param serviceName [required] The internal name of your CDN Static offer
[ "Get", "allowed", "durations", "for", "storage", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5466-L5472
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/cellconverter/CellConverterRegistry.java
CellConverterRegistry.registerConverter
public <T> void registerConverter(final Class<T> clazz, final CellConverterFactory<T> converterFactory) { """ タイプに対する{@link CellConverter}を登録する。 @param clazz 変換対象のJavaのクラスタイプ。 @param converterFactory 変換する{@link CellConverterFactory}のインスタンス。 """ ArgUtils.notNull(clazz, "clazz"); ArgUtils.notNull(converterFactory, "converterFactory"); converterFactoryMap.put(clazz, converterFactory); }
java
public <T> void registerConverter(final Class<T> clazz, final CellConverterFactory<T> converterFactory) { ArgUtils.notNull(clazz, "clazz"); ArgUtils.notNull(converterFactory, "converterFactory"); converterFactoryMap.put(clazz, converterFactory); }
[ "public", "<", "T", ">", "void", "registerConverter", "(", "final", "Class", "<", "T", ">", "clazz", ",", "final", "CellConverterFactory", "<", "T", ">", "converterFactory", ")", "{", "ArgUtils", ".", "notNull", "(", "clazz", ",", "\"clazz\"", ")", ";", "ArgUtils", ".", "notNull", "(", "converterFactory", ",", "\"converterFactory\"", ")", ";", "converterFactoryMap", ".", "put", "(", "clazz", ",", "converterFactory", ")", ";", "}" ]
タイプに対する{@link CellConverter}を登録する。 @param clazz 変換対象のJavaのクラスタイプ。 @param converterFactory 変換する{@link CellConverterFactory}のインスタンス。
[ "タイプに対する", "{" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/cellconverter/CellConverterRegistry.java#L162-L167
lastaflute/lasta-di
src/main/java/org/lastaflute/di/util/LdiSrl.java
LdiSrl.indexOfLastIgnoreCase
public static IndexOfInfo indexOfLastIgnoreCase(final String str, final String... delimiters) { """ Get the index of the last-found delimiter ignoring case. <pre> indexOfLast("foo.bar/baz.qux", "A", "U") returns the index of "ux" </pre> @param str The target string. (NotNull) @param delimiters The array of delimiters. (NotNull) @return The information of index. (NullAllowed: if delimiter not found) """ return doIndexOfLast(true, str, delimiters); }
java
public static IndexOfInfo indexOfLastIgnoreCase(final String str, final String... delimiters) { return doIndexOfLast(true, str, delimiters); }
[ "public", "static", "IndexOfInfo", "indexOfLastIgnoreCase", "(", "final", "String", "str", ",", "final", "String", "...", "delimiters", ")", "{", "return", "doIndexOfLast", "(", "true", ",", "str", ",", "delimiters", ")", ";", "}" ]
Get the index of the last-found delimiter ignoring case. <pre> indexOfLast("foo.bar/baz.qux", "A", "U") returns the index of "ux" </pre> @param str The target string. (NotNull) @param delimiters The array of delimiters. (NotNull) @return The information of index. (NullAllowed: if delimiter not found)
[ "Get", "the", "index", "of", "the", "last", "-", "found", "delimiter", "ignoring", "case", ".", "<pre", ">", "indexOfLast", "(", "foo", ".", "bar", "/", "baz", ".", "qux", "A", "U", ")", "returns", "the", "index", "of", "ux", "<", "/", "pre", ">" ]
train
https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L425-L427
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/ServerMappingController.java
ServerMappingController.updateDestRedirectUrl
@RequestMapping(value = "api/edit/server/ { """ Updates the dest URL in the server redirects @param model @param id @param destUrl @return @throws Exception """id}/dest", method = RequestMethod.POST) public @ResponseBody ServerRedirect updateDestRedirectUrl(Model model, @PathVariable int id, String destUrl) throws Exception { ServerRedirectService.getInstance().setDestinationUrl(destUrl, id); return ServerRedirectService.getInstance().getRedirect(id); }
java
@RequestMapping(value = "api/edit/server/{id}/dest", method = RequestMethod.POST) public @ResponseBody ServerRedirect updateDestRedirectUrl(Model model, @PathVariable int id, String destUrl) throws Exception { ServerRedirectService.getInstance().setDestinationUrl(destUrl, id); return ServerRedirectService.getInstance().getRedirect(id); }
[ "@", "RequestMapping", "(", "value", "=", "\"api/edit/server/{id}/dest\"", ",", "method", "=", "RequestMethod", ".", "POST", ")", "public", "@", "ResponseBody", "ServerRedirect", "updateDestRedirectUrl", "(", "Model", "model", ",", "@", "PathVariable", "int", "id", ",", "String", "destUrl", ")", "throws", "Exception", "{", "ServerRedirectService", ".", "getInstance", "(", ")", ".", "setDestinationUrl", "(", "destUrl", ",", "id", ")", ";", "return", "ServerRedirectService", ".", "getInstance", "(", ")", ".", "getRedirect", "(", "id", ")", ";", "}" ]
Updates the dest URL in the server redirects @param model @param id @param destUrl @return @throws Exception
[ "Updates", "the", "dest", "URL", "in", "the", "server", "redirects" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/ServerMappingController.java#L304-L310
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-nlp/src/main/java/org/datavec/nlp/transforms/TokenizerBagOfWordsTermSequenceIndexTransform.java
TokenizerBagOfWordsTermSequenceIndexTransform.tfidfWord
public double tfidfWord(String word, long wordCount, long documentLength) { """ Calculate the tifdf for a word given the word, word count, and document length @param word the word to calculate @param wordCount the word frequency @param documentLength the number of words in the document @return the tfidf weight for a given word """ double tf = tfForWord(wordCount, documentLength); double idf = idfForWord(word); return MathUtils.tfidf(tf, idf); }
java
public double tfidfWord(String word, long wordCount, long documentLength) { double tf = tfForWord(wordCount, documentLength); double idf = idfForWord(word); return MathUtils.tfidf(tf, idf); }
[ "public", "double", "tfidfWord", "(", "String", "word", ",", "long", "wordCount", ",", "long", "documentLength", ")", "{", "double", "tf", "=", "tfForWord", "(", "wordCount", ",", "documentLength", ")", ";", "double", "idf", "=", "idfForWord", "(", "word", ")", ";", "return", "MathUtils", ".", "tfidf", "(", "tf", ",", "idf", ")", ";", "}" ]
Calculate the tifdf for a word given the word, word count, and document length @param word the word to calculate @param wordCount the word frequency @param documentLength the number of words in the document @return the tfidf weight for a given word
[ "Calculate", "the", "tifdf", "for", "a", "word", "given", "the", "word", "word", "count", "and", "document", "length" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-nlp/src/main/java/org/datavec/nlp/transforms/TokenizerBagOfWordsTermSequenceIndexTransform.java#L192-L196
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java
DPathUtils.getDate
public static Date getDate(Object target, String dPath, String dateTimeFormat) { """ Extract a date value from the target object using DPath expression. If the extracted value is a string, parse it as a {@link Date} using the specified date-time format. @param target @param dPath @param dateTimeFormat see {@link SimpleDateFormat} @return @since 0.6.2 """ Object obj = getValue(target, dPath); return ValueUtils.convertDate(obj, dateTimeFormat); }
java
public static Date getDate(Object target, String dPath, String dateTimeFormat) { Object obj = getValue(target, dPath); return ValueUtils.convertDate(obj, dateTimeFormat); }
[ "public", "static", "Date", "getDate", "(", "Object", "target", ",", "String", "dPath", ",", "String", "dateTimeFormat", ")", "{", "Object", "obj", "=", "getValue", "(", "target", ",", "dPath", ")", ";", "return", "ValueUtils", ".", "convertDate", "(", "obj", ",", "dateTimeFormat", ")", ";", "}" ]
Extract a date value from the target object using DPath expression. If the extracted value is a string, parse it as a {@link Date} using the specified date-time format. @param target @param dPath @param dateTimeFormat see {@link SimpleDateFormat} @return @since 0.6.2
[ "Extract", "a", "date", "value", "from", "the", "target", "object", "using", "DPath", "expression", ".", "If", "the", "extracted", "value", "is", "a", "string", "parse", "it", "as", "a", "{", "@link", "Date", "}", "using", "the", "specified", "date", "-", "time", "format", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java#L369-L372
tvesalainen/lpg
src/main/java/org/vesalainen/regex/RegexMatcher.java
RegexMatcher.split
public static Stream<CharSequence> split(CharSequence seq, RegexMatcher matcher) { """ Returns stream that contains subsequences delimited by given matcher <p>Stream is safe to use same regex from different thread. @param seq @param matcher @return """ return StreamSupport.stream(new SpliteratorImpl(seq, matcher), false); }
java
public static Stream<CharSequence> split(CharSequence seq, RegexMatcher matcher) { return StreamSupport.stream(new SpliteratorImpl(seq, matcher), false); }
[ "public", "static", "Stream", "<", "CharSequence", ">", "split", "(", "CharSequence", "seq", ",", "RegexMatcher", "matcher", ")", "{", "return", "StreamSupport", ".", "stream", "(", "new", "SpliteratorImpl", "(", "seq", ",", "matcher", ")", ",", "false", ")", ";", "}" ]
Returns stream that contains subsequences delimited by given matcher <p>Stream is safe to use same regex from different thread. @param seq @param matcher @return
[ "Returns", "stream", "that", "contains", "subsequences", "delimited", "by", "given", "matcher", "<p", ">", "Stream", "is", "safe", "to", "use", "same", "regex", "from", "different", "thread", "." ]
train
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/RegexMatcher.java#L272-L275