repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
roboconf/roboconf-platform
core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/nagios/LiveStatusClient.java
LiveStatusClient.queryLivestatus
public String queryLivestatus( String nagiosQuery ) throws UnknownHostException, IOException { """ Queries a live status server. @param nagiosQuery the query to pass through a socket (not null) @return the response @throws UnknownHostException @throws IOException """ Socket liveStatusSocket = null; try { this.logger.fine( "About to open a connection through Live Status..." ); liveStatusSocket = new Socket( this.host, this.port ); this.logger.fine( "A connection was established through Live Status." ); Writer osw = new OutputStreamWriter( liveStatusSocket.getOutputStream(), StandardCharsets.UTF_8 ); PrintWriter printer = new PrintWriter( osw, false ); printer.print( nagiosQuery ); printer.flush(); liveStatusSocket.shutdownOutput(); ByteArrayOutputStream os = new ByteArrayOutputStream(); Utils.copyStreamSafely( liveStatusSocket.getInputStream(), os ); String result = os.toString( "UTF-8" ); result = format( nagiosQuery, result ); return result; } finally { if( liveStatusSocket != null ) liveStatusSocket.close(); this.logger.fine( "The Live Status connection was closed." ); } }
java
public String queryLivestatus( String nagiosQuery ) throws UnknownHostException, IOException { Socket liveStatusSocket = null; try { this.logger.fine( "About to open a connection through Live Status..." ); liveStatusSocket = new Socket( this.host, this.port ); this.logger.fine( "A connection was established through Live Status." ); Writer osw = new OutputStreamWriter( liveStatusSocket.getOutputStream(), StandardCharsets.UTF_8 ); PrintWriter printer = new PrintWriter( osw, false ); printer.print( nagiosQuery ); printer.flush(); liveStatusSocket.shutdownOutput(); ByteArrayOutputStream os = new ByteArrayOutputStream(); Utils.copyStreamSafely( liveStatusSocket.getInputStream(), os ); String result = os.toString( "UTF-8" ); result = format( nagiosQuery, result ); return result; } finally { if( liveStatusSocket != null ) liveStatusSocket.close(); this.logger.fine( "The Live Status connection was closed." ); } }
[ "public", "String", "queryLivestatus", "(", "String", "nagiosQuery", ")", "throws", "UnknownHostException", ",", "IOException", "{", "Socket", "liveStatusSocket", "=", "null", ";", "try", "{", "this", ".", "logger", ".", "fine", "(", "\"About to open a connection through Live Status...\"", ")", ";", "liveStatusSocket", "=", "new", "Socket", "(", "this", ".", "host", ",", "this", ".", "port", ")", ";", "this", ".", "logger", ".", "fine", "(", "\"A connection was established through Live Status.\"", ")", ";", "Writer", "osw", "=", "new", "OutputStreamWriter", "(", "liveStatusSocket", ".", "getOutputStream", "(", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "PrintWriter", "printer", "=", "new", "PrintWriter", "(", "osw", ",", "false", ")", ";", "printer", ".", "print", "(", "nagiosQuery", ")", ";", "printer", ".", "flush", "(", ")", ";", "liveStatusSocket", ".", "shutdownOutput", "(", ")", ";", "ByteArrayOutputStream", "os", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "Utils", ".", "copyStreamSafely", "(", "liveStatusSocket", ".", "getInputStream", "(", ")", ",", "os", ")", ";", "String", "result", "=", "os", ".", "toString", "(", "\"UTF-8\"", ")", ";", "result", "=", "format", "(", "nagiosQuery", ",", "result", ")", ";", "return", "result", ";", "}", "finally", "{", "if", "(", "liveStatusSocket", "!=", "null", ")", "liveStatusSocket", ".", "close", "(", ")", ";", "this", ".", "logger", ".", "fine", "(", "\"The Live Status connection was closed.\"", ")", ";", "}", "}" ]
Queries a live status server. @param nagiosQuery the query to pass through a socket (not null) @return the response @throws UnknownHostException @throws IOException
[ "Queries", "a", "live", "status", "server", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/nagios/LiveStatusClient.java#L73-L101
roboconf/roboconf-platform
core/roboconf-dm-rest-commons/src/main/java/net/roboconf/dm/rest/commons/security/AuthenticationManager.java
AuthenticationManager.isSessionValid
public boolean isSessionValid( final String token, long validityPeriod ) { """ Determines whether a session is valid. @param token a token @param validityPeriod the validity period for a session (in seconds, < 0 for unbound) @return true if the session is valid, false otherwise """ boolean valid = false; Long loginTime = null; if( token != null ) loginTime = this.tokenToLoginTime.get( token ); if( validityPeriod < 0 ) { valid = loginTime != null; } else if( loginTime != null ) { long now = new Date().getTime(); valid = (now - loginTime) <= validityPeriod * 1000; // Invalid sessions should be deleted if( ! valid ) logout( token ); } return valid; }
java
public boolean isSessionValid( final String token, long validityPeriod ) { boolean valid = false; Long loginTime = null; if( token != null ) loginTime = this.tokenToLoginTime.get( token ); if( validityPeriod < 0 ) { valid = loginTime != null; } else if( loginTime != null ) { long now = new Date().getTime(); valid = (now - loginTime) <= validityPeriod * 1000; // Invalid sessions should be deleted if( ! valid ) logout( token ); } return valid; }
[ "public", "boolean", "isSessionValid", "(", "final", "String", "token", ",", "long", "validityPeriod", ")", "{", "boolean", "valid", "=", "false", ";", "Long", "loginTime", "=", "null", ";", "if", "(", "token", "!=", "null", ")", "loginTime", "=", "this", ".", "tokenToLoginTime", ".", "get", "(", "token", ")", ";", "if", "(", "validityPeriod", "<", "0", ")", "{", "valid", "=", "loginTime", "!=", "null", ";", "}", "else", "if", "(", "loginTime", "!=", "null", ")", "{", "long", "now", "=", "new", "Date", "(", ")", ".", "getTime", "(", ")", ";", "valid", "=", "(", "now", "-", "loginTime", ")", "<=", "validityPeriod", "*", "1000", ";", "// Invalid sessions should be deleted", "if", "(", "!", "valid", ")", "logout", "(", "token", ")", ";", "}", "return", "valid", ";", "}" ]
Determines whether a session is valid. @param token a token @param validityPeriod the validity period for a session (in seconds, < 0 for unbound) @return true if the session is valid, false otherwise
[ "Determines", "whether", "a", "session", "is", "valid", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-rest-commons/src/main/java/net/roboconf/dm/rest/commons/security/AuthenticationManager.java#L128-L148
googleapis/google-cloud-java
google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java
ProductSearchClient.addProductToProductSet
public final void addProductToProductSet(String name, String product) { """ Adds a Product to the specified ProductSet. If the Product is already present, no change is made. <p>One Product can be added to at most 100 ProductSets. <p>Possible errors: <p>&#42; Returns NOT_FOUND if the Product or the ProductSet doesn't exist. <p>Sample code: <pre><code> try (ProductSearchClient productSearchClient = ProductSearchClient.create()) { ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); productSearchClient.addProductToProductSet(name.toString(), product.toString()); } </code></pre> @param name The resource name for the ProductSet to modify. <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` @param product The resource name for the Product to be added to this ProductSet. <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` @throws com.google.api.gax.rpc.ApiException if the remote call fails """ AddProductToProductSetRequest request = AddProductToProductSetRequest.newBuilder().setName(name).setProduct(product).build(); addProductToProductSet(request); }
java
public final void addProductToProductSet(String name, String product) { AddProductToProductSetRequest request = AddProductToProductSetRequest.newBuilder().setName(name).setProduct(product).build(); addProductToProductSet(request); }
[ "public", "final", "void", "addProductToProductSet", "(", "String", "name", ",", "String", "product", ")", "{", "AddProductToProductSetRequest", "request", "=", "AddProductToProductSetRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", ")", ".", "setProduct", "(", "product", ")", ".", "build", "(", ")", ";", "addProductToProductSet", "(", "request", ")", ";", "}" ]
Adds a Product to the specified ProductSet. If the Product is already present, no change is made. <p>One Product can be added to at most 100 ProductSets. <p>Possible errors: <p>&#42; Returns NOT_FOUND if the Product or the ProductSet doesn't exist. <p>Sample code: <pre><code> try (ProductSearchClient productSearchClient = ProductSearchClient.create()) { ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); productSearchClient.addProductToProductSet(name.toString(), product.toString()); } </code></pre> @param name The resource name for the ProductSet to modify. <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` @param product The resource name for the Product to be added to this ProductSet. <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Adds", "a", "Product", "to", "the", "specified", "ProductSet", ".", "If", "the", "Product", "is", "already", "present", "no", "change", "is", "made", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java#L2294-L2299
aws/aws-sdk-java
aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/CreateTransformJobRequest.java
CreateTransformJobRequest.withEnvironment
public CreateTransformJobRequest withEnvironment(java.util.Map<String, String> environment) { """ <p> The environment variables to set in the Docker container. We support up to 16 key and values entries in the map. </p> @param environment The environment variables to set in the Docker container. We support up to 16 key and values entries in the map. @return Returns a reference to this object so that method calls can be chained together. """ setEnvironment(environment); return this; }
java
public CreateTransformJobRequest withEnvironment(java.util.Map<String, String> environment) { setEnvironment(environment); return this; }
[ "public", "CreateTransformJobRequest", "withEnvironment", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "environment", ")", "{", "setEnvironment", "(", "environment", ")", ";", "return", "this", ";", "}" ]
<p> The environment variables to set in the Docker container. We support up to 16 key and values entries in the map. </p> @param environment The environment variables to set in the Docker container. We support up to 16 key and values entries in the map. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "environment", "variables", "to", "set", "in", "the", "Docker", "container", ".", "We", "support", "up", "to", "16", "key", "and", "values", "entries", "in", "the", "map", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/CreateTransformJobRequest.java#L546-L549
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.notEmpty
public static Validator<CharSequence> notEmpty(@NonNull final Context context) { """ Creates and returns a validator, which allows to validate texts to ensure, that they are not empty. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @return The validator, which has been created, as an instance of the type {@link Validator} """ return new NotEmptyValidator(context, R.string.default_error_message); }
java
public static Validator<CharSequence> notEmpty(@NonNull final Context context) { return new NotEmptyValidator(context, R.string.default_error_message); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "notEmpty", "(", "@", "NonNull", "final", "Context", "context", ")", "{", "return", "new", "NotEmptyValidator", "(", "context", ",", "R", ".", "string", ".", "default_error_message", ")", ";", "}" ]
Creates and returns a validator, which allows to validate texts to ensure, that they are not empty. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "are", "not", "empty", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L386-L388
highsource/hyperjaxb3
ejb/plugin/src/main/java/org/jvnet/hyperjaxb3/xjc/reader/TypeUtil.java
TypeUtil.getAssignableTypes
private static void getAssignableTypes( JClass t, Set<JClass> s ) { """ Returns the set of all classes/interfaces that a given type implements/extends, including itself. For example, if you pass java.io.FilterInputStream, then the returned set will contain java.lang.Object, java.lang.InputStream, and java.lang.FilterInputStream. """ if(!s.add(t)) return; // TODO // if (t.fullName().equals(Equals.class.getName()) || // t.fullName().equals(HashCode.class.getName()) || // t.fullName().equals(ToString.class.getName()) || // t.fullName().equals(CopyTo.class.getName()) // ) // add its raw type s.add(t.erasure()); // if this type is added for the first time, // recursively process the super class. JClass _super = t._extends(); if(_super!=null) getAssignableTypes(_super,s); // recursively process all implemented interfaces Iterator<JClass> itr = t._implements(); while(itr.hasNext()) { getAssignableTypes(itr.next(),s); } }
java
private static void getAssignableTypes( JClass t, Set<JClass> s ) { if(!s.add(t)) return; // TODO // if (t.fullName().equals(Equals.class.getName()) || // t.fullName().equals(HashCode.class.getName()) || // t.fullName().equals(ToString.class.getName()) || // t.fullName().equals(CopyTo.class.getName()) // ) // add its raw type s.add(t.erasure()); // if this type is added for the first time, // recursively process the super class. JClass _super = t._extends(); if(_super!=null) getAssignableTypes(_super,s); // recursively process all implemented interfaces Iterator<JClass> itr = t._implements(); while(itr.hasNext()) { getAssignableTypes(itr.next(),s); } }
[ "private", "static", "void", "getAssignableTypes", "(", "JClass", "t", ",", "Set", "<", "JClass", ">", "s", ")", "{", "if", "(", "!", "s", ".", "add", "(", "t", ")", ")", "return", ";", "// TODO", "// if (t.fullName().equals(Equals.class.getName()) ||", "// \t\tt.fullName().equals(HashCode.class.getName()) ||", "// \t\tt.fullName().equals(ToString.class.getName()) ||", "// \t\tt.fullName().equals(CopyTo.class.getName())", "// \t\t)", "// add its raw type", "s", ".", "add", "(", "t", ".", "erasure", "(", ")", ")", ";", "// if this type is added for the first time,", "// recursively process the super class.", "JClass", "_super", "=", "t", ".", "_extends", "(", ")", ";", "if", "(", "_super", "!=", "null", ")", "getAssignableTypes", "(", "_super", ",", "s", ")", ";", "// recursively process all implemented interfaces", "Iterator", "<", "JClass", ">", "itr", "=", "t", ".", "_implements", "(", ")", ";", "while", "(", "itr", ".", "hasNext", "(", ")", ")", "{", "getAssignableTypes", "(", "itr", ".", "next", "(", ")", ",", "s", ")", ";", "}", "}" ]
Returns the set of all classes/interfaces that a given type implements/extends, including itself. For example, if you pass java.io.FilterInputStream, then the returned set will contain java.lang.Object, java.lang.InputStream, and java.lang.FilterInputStream.
[ "Returns", "the", "set", "of", "all", "classes", "/", "interfaces", "that", "a", "given", "type", "implements", "/", "extends", "including", "itself", "." ]
train
https://github.com/highsource/hyperjaxb3/blob/c645d1628b8c26a844858d221fc9affe9c18543e/ejb/plugin/src/main/java/org/jvnet/hyperjaxb3/xjc/reader/TypeUtil.java#L213-L240
apache/incubator-druid
extensions-core/parquet-extensions/src/main/java/org/apache/druid/data/input/parquet/simple/ParquetGroupConverter.java
ParquetGroupConverter.convertPrimitiveField
@Nullable private static Object convertPrimitiveField(Group g, int fieldIndex, boolean binaryAsString) { """ Convert a primitive group field to a "ingestion friendly" java object @return "ingestion ready" java object, or null """ PrimitiveType pt = (PrimitiveType) g.getType().getFields().get(fieldIndex); if (pt.isRepetition(Type.Repetition.REPEATED) && g.getFieldRepetitionCount(fieldIndex) > 1) { List<Object> vals = new ArrayList<>(); for (int i = 0; i < g.getFieldRepetitionCount(fieldIndex); i++) { vals.add(convertPrimitiveField(g, fieldIndex, i, binaryAsString)); } return vals; } return convertPrimitiveField(g, fieldIndex, 0, binaryAsString); }
java
@Nullable private static Object convertPrimitiveField(Group g, int fieldIndex, boolean binaryAsString) { PrimitiveType pt = (PrimitiveType) g.getType().getFields().get(fieldIndex); if (pt.isRepetition(Type.Repetition.REPEATED) && g.getFieldRepetitionCount(fieldIndex) > 1) { List<Object> vals = new ArrayList<>(); for (int i = 0; i < g.getFieldRepetitionCount(fieldIndex); i++) { vals.add(convertPrimitiveField(g, fieldIndex, i, binaryAsString)); } return vals; } return convertPrimitiveField(g, fieldIndex, 0, binaryAsString); }
[ "@", "Nullable", "private", "static", "Object", "convertPrimitiveField", "(", "Group", "g", ",", "int", "fieldIndex", ",", "boolean", "binaryAsString", ")", "{", "PrimitiveType", "pt", "=", "(", "PrimitiveType", ")", "g", ".", "getType", "(", ")", ".", "getFields", "(", ")", ".", "get", "(", "fieldIndex", ")", ";", "if", "(", "pt", ".", "isRepetition", "(", "Type", ".", "Repetition", ".", "REPEATED", ")", "&&", "g", ".", "getFieldRepetitionCount", "(", "fieldIndex", ")", ">", "1", ")", "{", "List", "<", "Object", ">", "vals", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "g", ".", "getFieldRepetitionCount", "(", "fieldIndex", ")", ";", "i", "++", ")", "{", "vals", ".", "add", "(", "convertPrimitiveField", "(", "g", ",", "fieldIndex", ",", "i", ",", "binaryAsString", ")", ")", ";", "}", "return", "vals", ";", "}", "return", "convertPrimitiveField", "(", "g", ",", "fieldIndex", ",", "0", ",", "binaryAsString", ")", ";", "}" ]
Convert a primitive group field to a "ingestion friendly" java object @return "ingestion ready" java object, or null
[ "Convert", "a", "primitive", "group", "field", "to", "a", "ingestion", "friendly", "java", "object" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/parquet-extensions/src/main/java/org/apache/druid/data/input/parquet/simple/ParquetGroupConverter.java#L246-L258
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java
UfsJournalFile.decodeTemporaryCheckpointFile
static UfsJournalFile decodeTemporaryCheckpointFile(UfsJournal journal, String filename) { """ Decodes a temporary checkpoint file name into a {@link UfsJournalFile}. @param journal the UFS journal instance @param filename the temporary checkpoint file name @return the instance of {@link UfsJournalFile} """ URI location = URIUtils.appendPathOrDie(journal.getTmpDir(), filename); return UfsJournalFile.createTmpCheckpointFile(location); }
java
static UfsJournalFile decodeTemporaryCheckpointFile(UfsJournal journal, String filename) { URI location = URIUtils.appendPathOrDie(journal.getTmpDir(), filename); return UfsJournalFile.createTmpCheckpointFile(location); }
[ "static", "UfsJournalFile", "decodeTemporaryCheckpointFile", "(", "UfsJournal", "journal", ",", "String", "filename", ")", "{", "URI", "location", "=", "URIUtils", ".", "appendPathOrDie", "(", "journal", ".", "getTmpDir", "(", ")", ",", "filename", ")", ";", "return", "UfsJournalFile", ".", "createTmpCheckpointFile", "(", "location", ")", ";", "}" ]
Decodes a temporary checkpoint file name into a {@link UfsJournalFile}. @param journal the UFS journal instance @param filename the temporary checkpoint file name @return the instance of {@link UfsJournalFile}
[ "Decodes", "a", "temporary", "checkpoint", "file", "name", "into", "a", "{", "@link", "UfsJournalFile", "}", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java#L210-L213
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Strings.java
Strings.subtractSeq
public static String subtractSeq(final String first, final String second) { """ <p> subtractSeq. </p> @param first a {@link java.lang.String} object. @param second a {@link java.lang.String} object. @return a {@link java.lang.String} object. """ return subtractSeq(first, second, DELIMITER); }
java
public static String subtractSeq(final String first, final String second) { return subtractSeq(first, second, DELIMITER); }
[ "public", "static", "String", "subtractSeq", "(", "final", "String", "first", ",", "final", "String", "second", ")", "{", "return", "subtractSeq", "(", "first", ",", "second", ",", "DELIMITER", ")", ";", "}" ]
<p> subtractSeq. </p> @param first a {@link java.lang.String} object. @param second a {@link java.lang.String} object. @return a {@link java.lang.String} object.
[ "<p", ">", "subtractSeq", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L1027-L1029
OpenBEL/openbel-framework
org.openbel.framework.core/src/main/java/org/openbel/framework/core/namespace/DefaultNamespaceService.java
DefaultNamespaceService.canOpen
private boolean canOpen(String resourceLocation) { """ Determines if the {@link Namespace} resource location can be opened for lookups. To be opened @param resourceLocation @return """ if (resourceLocation == null) { throw new InvalidArgument("resourceLocation", resourceLocation); } synchronized (resourceLocation) { // find the resource in the cache CachedResource cachedResource = cacheLookupService .findInCache(NAMESPACES, resourceLocation); if (cachedResource == null) { return false; } String indexPath = asPath( cachedResource.getLocalFile().getAbsolutePath(), NS_INDEX_FILE_NAME); JDBMNamespaceLookup il = new JDBMNamespaceLookup(indexPath); try { il.open(); il.close(); } catch (IOException e) { return false; } return true; } }
java
private boolean canOpen(String resourceLocation) { if (resourceLocation == null) { throw new InvalidArgument("resourceLocation", resourceLocation); } synchronized (resourceLocation) { // find the resource in the cache CachedResource cachedResource = cacheLookupService .findInCache(NAMESPACES, resourceLocation); if (cachedResource == null) { return false; } String indexPath = asPath( cachedResource.getLocalFile().getAbsolutePath(), NS_INDEX_FILE_NAME); JDBMNamespaceLookup il = new JDBMNamespaceLookup(indexPath); try { il.open(); il.close(); } catch (IOException e) { return false; } return true; } }
[ "private", "boolean", "canOpen", "(", "String", "resourceLocation", ")", "{", "if", "(", "resourceLocation", "==", "null", ")", "{", "throw", "new", "InvalidArgument", "(", "\"resourceLocation\"", ",", "resourceLocation", ")", ";", "}", "synchronized", "(", "resourceLocation", ")", "{", "// find the resource in the cache", "CachedResource", "cachedResource", "=", "cacheLookupService", ".", "findInCache", "(", "NAMESPACES", ",", "resourceLocation", ")", ";", "if", "(", "cachedResource", "==", "null", ")", "{", "return", "false", ";", "}", "String", "indexPath", "=", "asPath", "(", "cachedResource", ".", "getLocalFile", "(", ")", ".", "getAbsolutePath", "(", ")", ",", "NS_INDEX_FILE_NAME", ")", ";", "JDBMNamespaceLookup", "il", "=", "new", "JDBMNamespaceLookup", "(", "indexPath", ")", ";", "try", "{", "il", ".", "open", "(", ")", ";", "il", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "}" ]
Determines if the {@link Namespace} resource location can be opened for lookups. To be opened @param resourceLocation @return
[ "Determines", "if", "the", "{", "@link", "Namespace", "}", "resource", "location", "can", "be", "opened", "for", "lookups", ".", "To", "be", "opened" ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/namespace/DefaultNamespaceService.java#L442-L470
glyptodon/guacamole-client
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/ModeledUserGroup.java
ModeledUserGroup.putRestrictedAttributes
private void putRestrictedAttributes(Map<String, String> attributes) { """ Stores all restricted (privileged) attributes within the given Map, pulling the values of those attributes from the underlying user group model. If no value is yet defined for an attribute, that attribute will be set to null. @param attributes The Map to store all restricted attributes within. """ // Set disabled attribute attributes.put(DISABLED_ATTRIBUTE_NAME, getModel().isDisabled() ? "true" : null); }
java
private void putRestrictedAttributes(Map<String, String> attributes) { // Set disabled attribute attributes.put(DISABLED_ATTRIBUTE_NAME, getModel().isDisabled() ? "true" : null); }
[ "private", "void", "putRestrictedAttributes", "(", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "// Set disabled attribute", "attributes", ".", "put", "(", "DISABLED_ATTRIBUTE_NAME", ",", "getModel", "(", ")", ".", "isDisabled", "(", ")", "?", "\"true\"", ":", "null", ")", ";", "}" ]
Stores all restricted (privileged) attributes within the given Map, pulling the values of those attributes from the underlying user group model. If no value is yet defined for an attribute, that attribute will be set to null. @param attributes The Map to store all restricted attributes within.
[ "Stores", "all", "restricted", "(", "privileged", ")", "attributes", "within", "the", "given", "Map", "pulling", "the", "values", "of", "those", "attributes", "from", "the", "underlying", "user", "group", "model", ".", "If", "no", "value", "is", "yet", "defined", "for", "an", "attribute", "that", "attribute", "will", "be", "set", "to", "null", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/ModeledUserGroup.java#L134-L139
sputnikdev/bluetooth-utils
src/main/java/org/sputnikdev/bluetooth/URL.java
URL.copyWith
public URL copyWith(String serviceUUID, String characteristicUUID, String fieldName) { """ Makes a copy of a given URL with some additional components. @param serviceUUID UUID of a GATT service @param characteristicUUID UUID of a GATT characteristic @param fieldName name of a field of the characteristic @return a copy of a given URL with some additional components """ return new URL(this.protocol, this.adapterAddress, this.deviceAddress, this.deviceAttributes, serviceUUID, characteristicUUID, fieldName); }
java
public URL copyWith(String serviceUUID, String characteristicUUID, String fieldName) { return new URL(this.protocol, this.adapterAddress, this.deviceAddress, this.deviceAttributes, serviceUUID, characteristicUUID, fieldName); }
[ "public", "URL", "copyWith", "(", "String", "serviceUUID", ",", "String", "characteristicUUID", ",", "String", "fieldName", ")", "{", "return", "new", "URL", "(", "this", ".", "protocol", ",", "this", ".", "adapterAddress", ",", "this", ".", "deviceAddress", ",", "this", ".", "deviceAttributes", ",", "serviceUUID", ",", "characteristicUUID", ",", "fieldName", ")", ";", "}" ]
Makes a copy of a given URL with some additional components. @param serviceUUID UUID of a GATT service @param characteristicUUID UUID of a GATT characteristic @param fieldName name of a field of the characteristic @return a copy of a given URL with some additional components
[ "Makes", "a", "copy", "of", "a", "given", "URL", "with", "some", "additional", "components", "." ]
train
https://github.com/sputnikdev/bluetooth-utils/blob/794e4a8644c1eed54cd043de2bc967f4ef58acca/src/main/java/org/sputnikdev/bluetooth/URL.java#L321-L324
jtmelton/appsensor
analysis-engines/appsensor-analysis-reference/src/main/java/org/owasp/appsensor/analysis/ReferenceEventAnalysisEngine.java
ReferenceEventAnalysisEngine.findMostRecentAttackTime
protected DateTime findMostRecentAttackTime(Event event, DetectionPoint configuredDetectionPoint) { """ Find most recent {@link Attack} matching the given {@link Event} {@link User}, {@link DetectionPoint} matching the currently configured detection point (supporting multiple detection points per label), detection system and find it's timestamp. The {@link Event} should only be counted if they've occurred after the most recent {@link Attack}. @param event {@link Event} to use to find matching {@link Attack}s @param configuredDetectionPoint {@link DetectionPoint} to use to find matching {@link Attack}s @return timestamp representing last matching {@link Attack}, or -1L if not found """ DateTime newest = DateUtils.epoch(); SearchCriteria criteria = new SearchCriteria(). setUser(event.getUser()). setDetectionPoint(configuredDetectionPoint). setDetectionSystemIds(appSensorServer.getConfiguration().getRelatedDetectionSystems(event.getDetectionSystem())); Collection<Attack> attacks = appSensorServer.getAttackStore().findAttacks(criteria); for (Attack attack : attacks) { if (DateUtils.fromString(attack.getTimestamp()).isAfter(newest)) { newest = DateUtils.fromString(attack.getTimestamp()); } } return newest; }
java
protected DateTime findMostRecentAttackTime(Event event, DetectionPoint configuredDetectionPoint) { DateTime newest = DateUtils.epoch(); SearchCriteria criteria = new SearchCriteria(). setUser(event.getUser()). setDetectionPoint(configuredDetectionPoint). setDetectionSystemIds(appSensorServer.getConfiguration().getRelatedDetectionSystems(event.getDetectionSystem())); Collection<Attack> attacks = appSensorServer.getAttackStore().findAttacks(criteria); for (Attack attack : attacks) { if (DateUtils.fromString(attack.getTimestamp()).isAfter(newest)) { newest = DateUtils.fromString(attack.getTimestamp()); } } return newest; }
[ "protected", "DateTime", "findMostRecentAttackTime", "(", "Event", "event", ",", "DetectionPoint", "configuredDetectionPoint", ")", "{", "DateTime", "newest", "=", "DateUtils", ".", "epoch", "(", ")", ";", "SearchCriteria", "criteria", "=", "new", "SearchCriteria", "(", ")", ".", "setUser", "(", "event", ".", "getUser", "(", ")", ")", ".", "setDetectionPoint", "(", "configuredDetectionPoint", ")", ".", "setDetectionSystemIds", "(", "appSensorServer", ".", "getConfiguration", "(", ")", ".", "getRelatedDetectionSystems", "(", "event", ".", "getDetectionSystem", "(", ")", ")", ")", ";", "Collection", "<", "Attack", ">", "attacks", "=", "appSensorServer", ".", "getAttackStore", "(", ")", ".", "findAttacks", "(", "criteria", ")", ";", "for", "(", "Attack", "attack", ":", "attacks", ")", "{", "if", "(", "DateUtils", ".", "fromString", "(", "attack", ".", "getTimestamp", "(", ")", ")", ".", "isAfter", "(", "newest", ")", ")", "{", "newest", "=", "DateUtils", ".", "fromString", "(", "attack", ".", "getTimestamp", "(", ")", ")", ";", "}", "}", "return", "newest", ";", "}" ]
Find most recent {@link Attack} matching the given {@link Event} {@link User}, {@link DetectionPoint} matching the currently configured detection point (supporting multiple detection points per label), detection system and find it's timestamp. The {@link Event} should only be counted if they've occurred after the most recent {@link Attack}. @param event {@link Event} to use to find matching {@link Attack}s @param configuredDetectionPoint {@link DetectionPoint} to use to find matching {@link Attack}s @return timestamp representing last matching {@link Attack}, or -1L if not found
[ "Find", "most", "recent", "{", "@link", "Attack", "}", "matching", "the", "given", "{", "@link", "Event", "}", "{", "@link", "User", "}", "{", "@link", "DetectionPoint", "}", "matching", "the", "currently", "configured", "detection", "point", "(", "supporting", "multiple", "detection", "points", "per", "label", ")", "detection", "system", "and", "find", "it", "s", "timestamp", "." ]
train
https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/analysis-engines/appsensor-analysis-reference/src/main/java/org/owasp/appsensor/analysis/ReferenceEventAnalysisEngine.java#L157-L174
KayLerch/alexa-skills-kit-tellask-java
src/main/java/io/klerch/alexa/tellask/model/AlexaInput.java
AlexaInput.hasSlotIsEqual
public boolean hasSlotIsEqual(final String slotName, final String value) { """ Checks if a slot is contained in the intent request and also got the value provided. @param slotName name of the slot to look after @param value the value @return True, if slot with slotName has a value equal to the given value """ final String slotValue = getSlotValue(slotName); return (slotValue != null && slotValue.equals(value)) || slotValue == value; }
java
public boolean hasSlotIsEqual(final String slotName, final String value) { final String slotValue = getSlotValue(slotName); return (slotValue != null && slotValue.equals(value)) || slotValue == value; }
[ "public", "boolean", "hasSlotIsEqual", "(", "final", "String", "slotName", ",", "final", "String", "value", ")", "{", "final", "String", "slotValue", "=", "getSlotValue", "(", "slotName", ")", ";", "return", "(", "slotValue", "!=", "null", "&&", "slotValue", ".", "equals", "(", "value", ")", ")", "||", "slotValue", "==", "value", ";", "}" ]
Checks if a slot is contained in the intent request and also got the value provided. @param slotName name of the slot to look after @param value the value @return True, if slot with slotName has a value equal to the given value
[ "Checks", "if", "a", "slot", "is", "contained", "in", "the", "intent", "request", "and", "also", "got", "the", "value", "provided", "." ]
train
https://github.com/KayLerch/alexa-skills-kit-tellask-java/blob/2c19028e775c2512dd4649d12962c0b48bf7f2bc/src/main/java/io/klerch/alexa/tellask/model/AlexaInput.java#L123-L127
javamelody/javamelody
javamelody-core/src/main/java/net/bull/javamelody/JdbcWrapper.java
JdbcWrapper.createDataSourceProxy
public DataSource createDataSourceProxy(String name, final DataSource dataSource) { """ Crée un proxy d'une {@link DataSource} jdbc. @param name String @param dataSource DataSource @return DataSource """ assert dataSource != null; JdbcWrapperHelper.pullDataSourceProperties(name, dataSource); final InvocationHandler invocationHandler = new AbstractInvocationHandler<DataSource>( dataSource) { private static final long serialVersionUID = 1L; /** {@inheritDoc} */ @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = method.invoke(dataSource, args); if (result instanceof Connection) { result = createConnectionProxy((Connection) result); } return result; } }; return createProxy(dataSource, invocationHandler); }
java
public DataSource createDataSourceProxy(String name, final DataSource dataSource) { assert dataSource != null; JdbcWrapperHelper.pullDataSourceProperties(name, dataSource); final InvocationHandler invocationHandler = new AbstractInvocationHandler<DataSource>( dataSource) { private static final long serialVersionUID = 1L; /** {@inheritDoc} */ @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = method.invoke(dataSource, args); if (result instanceof Connection) { result = createConnectionProxy((Connection) result); } return result; } }; return createProxy(dataSource, invocationHandler); }
[ "public", "DataSource", "createDataSourceProxy", "(", "String", "name", ",", "final", "DataSource", "dataSource", ")", "{", "assert", "dataSource", "!=", "null", ";", "JdbcWrapperHelper", ".", "pullDataSourceProperties", "(", "name", ",", "dataSource", ")", ";", "final", "InvocationHandler", "invocationHandler", "=", "new", "AbstractInvocationHandler", "<", "DataSource", ">", "(", "dataSource", ")", "{", "private", "static", "final", "long", "serialVersionUID", "=", "1L", ";", "/** {@inheritDoc} */", "@", "Override", "public", "Object", "invoke", "(", "Object", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "Throwable", "{", "Object", "result", "=", "method", ".", "invoke", "(", "dataSource", ",", "args", ")", ";", "if", "(", "result", "instanceof", "Connection", ")", "{", "result", "=", "createConnectionProxy", "(", "(", "Connection", ")", "result", ")", ";", "}", "return", "result", ";", "}", "}", ";", "return", "createProxy", "(", "dataSource", ",", "invocationHandler", ")", ";", "}" ]
Crée un proxy d'une {@link DataSource} jdbc. @param name String @param dataSource DataSource @return DataSource
[ "Crée", "un", "proxy", "d", "une", "{" ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/JdbcWrapper.java#L771-L789
trustathsh/ifmapj
src/main/java/util/DomHelpers.java
DomHelpers.toDocument
public static Document toDocument(String s, Charset c) throws MarshalException { """ Marshal a {@link Document} from {@link String} with XML data @param s string containing XML data @param c charset used for encoding the string @return {@link Document} containg the XML data @throws MarshalException """ byte[] bytes = c == null ? s.getBytes() : s.getBytes(c); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); return toDocument(bais); }
java
public static Document toDocument(String s, Charset c) throws MarshalException { byte[] bytes = c == null ? s.getBytes() : s.getBytes(c); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); return toDocument(bais); }
[ "public", "static", "Document", "toDocument", "(", "String", "s", ",", "Charset", "c", ")", "throws", "MarshalException", "{", "byte", "[", "]", "bytes", "=", "c", "==", "null", "?", "s", ".", "getBytes", "(", ")", ":", "s", ".", "getBytes", "(", "c", ")", ";", "ByteArrayInputStream", "bais", "=", "new", "ByteArrayInputStream", "(", "bytes", ")", ";", "return", "toDocument", "(", "bais", ")", ";", "}" ]
Marshal a {@link Document} from {@link String} with XML data @param s string containing XML data @param c charset used for encoding the string @return {@link Document} containg the XML data @throws MarshalException
[ "Marshal", "a", "{", "@link", "Document", "}", "from", "{", "@link", "String", "}", "with", "XML", "data" ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/util/DomHelpers.java#L470-L476
btc-ag/redg
redg-runtime/src/main/java/com/btc/redg/runtime/dummy/DefaultDummyFactory.java
DefaultDummyFactory.createNewDummy
private <T extends RedGEntity> T createNewDummy(AbstractRedG redG, Class<T> dummyClass) { """ Creates a new dummy entity of the required type. Required non null foreign keys will be taken from the {@link #getDummy(AbstractRedG, Class)} method and will be created if necessary as well. If the creation fails for some reason, a {@link DummyCreationException} will be thrown. @param redG The redG instance @param dummyClass The class specifying the wanted entity type @param <T> The wanted entity type @return A new dummy entity of the required type. It has already been added to the redG object and can be used immediately. @throws DummyCreationException If no fitting constructor is found or instantiation fails """ Constructor constructor = Arrays.stream(dummyClass.getDeclaredConstructors()) .filter(this::isDummyRedGEntityConstructor) .findFirst().orElseThrow(() -> new DummyCreationException("Could not find a fitting constructor")); Object[] parameter = new Object[constructor.getParameterCount()]; parameter[0] = redG; for (int i = 1; i < constructor.getParameterCount(); i++) { parameter[i] = getDummy(redG, constructor.getParameterTypes()[i]); } try { constructor.setAccessible(true); T obj = dummyClass.cast(constructor.newInstance(parameter)); redG.addEntity(obj); return obj; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new DummyCreationException("Instantiation of the dummy failed", e); } }
java
private <T extends RedGEntity> T createNewDummy(AbstractRedG redG, Class<T> dummyClass) { Constructor constructor = Arrays.stream(dummyClass.getDeclaredConstructors()) .filter(this::isDummyRedGEntityConstructor) .findFirst().orElseThrow(() -> new DummyCreationException("Could not find a fitting constructor")); Object[] parameter = new Object[constructor.getParameterCount()]; parameter[0] = redG; for (int i = 1; i < constructor.getParameterCount(); i++) { parameter[i] = getDummy(redG, constructor.getParameterTypes()[i]); } try { constructor.setAccessible(true); T obj = dummyClass.cast(constructor.newInstance(parameter)); redG.addEntity(obj); return obj; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new DummyCreationException("Instantiation of the dummy failed", e); } }
[ "private", "<", "T", "extends", "RedGEntity", ">", "T", "createNewDummy", "(", "AbstractRedG", "redG", ",", "Class", "<", "T", ">", "dummyClass", ")", "{", "Constructor", "constructor", "=", "Arrays", ".", "stream", "(", "dummyClass", ".", "getDeclaredConstructors", "(", ")", ")", ".", "filter", "(", "this", "::", "isDummyRedGEntityConstructor", ")", ".", "findFirst", "(", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "DummyCreationException", "(", "\"Could not find a fitting constructor\"", ")", ")", ";", "Object", "[", "]", "parameter", "=", "new", "Object", "[", "constructor", ".", "getParameterCount", "(", ")", "]", ";", "parameter", "[", "0", "]", "=", "redG", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "constructor", ".", "getParameterCount", "(", ")", ";", "i", "++", ")", "{", "parameter", "[", "i", "]", "=", "getDummy", "(", "redG", ",", "constructor", ".", "getParameterTypes", "(", ")", "[", "i", "]", ")", ";", "}", "try", "{", "constructor", ".", "setAccessible", "(", "true", ")", ";", "T", "obj", "=", "dummyClass", ".", "cast", "(", "constructor", ".", "newInstance", "(", "parameter", ")", ")", ";", "redG", ".", "addEntity", "(", "obj", ")", ";", "return", "obj", ";", "}", "catch", "(", "InstantiationException", "|", "IllegalAccessException", "|", "InvocationTargetException", "e", ")", "{", "throw", "new", "DummyCreationException", "(", "\"Instantiation of the dummy failed\"", ",", "e", ")", ";", "}", "}" ]
Creates a new dummy entity of the required type. Required non null foreign keys will be taken from the {@link #getDummy(AbstractRedG, Class)} method and will be created if necessary as well. If the creation fails for some reason, a {@link DummyCreationException} will be thrown. @param redG The redG instance @param dummyClass The class specifying the wanted entity type @param <T> The wanted entity type @return A new dummy entity of the required type. It has already been added to the redG object and can be used immediately. @throws DummyCreationException If no fitting constructor is found or instantiation fails
[ "Creates", "a", "new", "dummy", "entity", "of", "the", "required", "type", ".", "Required", "non", "null", "foreign", "keys", "will", "be", "taken", "from", "the", "{", "@link", "#getDummy", "(", "AbstractRedG", "Class", ")", "}", "method", "and", "will", "be", "created", "if", "necessary", "as", "well", ".", "If", "the", "creation", "fails", "for", "some", "reason", "a", "{", "@link", "DummyCreationException", "}", "will", "be", "thrown", "." ]
train
https://github.com/btc-ag/redg/blob/416a68639d002512cabfebff09afd2e1909e27df/redg-runtime/src/main/java/com/btc/redg/runtime/dummy/DefaultDummyFactory.java#L78-L96
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java
ContentRepository.getAdminSession
public Session getAdminSession() throws RepositoryException { """ Logs into the repository as admin user. The session should be logged out after each test if the repository is used as a {@link org.junit.ClassRule}. @return a session with admin privileges @throws RepositoryException if the login failed for any reason """ if(this.isActive(this.adminSession)){ //perform a refresh to update the session to the latest repository version this.adminSession.refresh(false); } else { this.adminSession = this.repository.login(new SimpleCredentials("admin", "admin".toCharArray())); } return this.adminSession; }
java
public Session getAdminSession() throws RepositoryException { if(this.isActive(this.adminSession)){ //perform a refresh to update the session to the latest repository version this.adminSession.refresh(false); } else { this.adminSession = this.repository.login(new SimpleCredentials("admin", "admin".toCharArray())); } return this.adminSession; }
[ "public", "Session", "getAdminSession", "(", ")", "throws", "RepositoryException", "{", "if", "(", "this", ".", "isActive", "(", "this", ".", "adminSession", ")", ")", "{", "//perform a refresh to update the session to the latest repository version", "this", ".", "adminSession", ".", "refresh", "(", "false", ")", ";", "}", "else", "{", "this", ".", "adminSession", "=", "this", ".", "repository", ".", "login", "(", "new", "SimpleCredentials", "(", "\"admin\"", ",", "\"admin\"", ".", "toCharArray", "(", ")", ")", ")", ";", "}", "return", "this", ".", "adminSession", ";", "}" ]
Logs into the repository as admin user. The session should be logged out after each test if the repository is used as a {@link org.junit.ClassRule}. @return a session with admin privileges @throws RepositoryException if the login failed for any reason
[ "Logs", "into", "the", "repository", "as", "admin", "user", ".", "The", "session", "should", "be", "logged", "out", "after", "each", "test", "if", "the", "repository", "is", "used", "as", "a", "{", "@link", "org", ".", "junit", ".", "ClassRule", "}", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ContentRepository.java#L304-L314
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/job/internal/AbstractInstallPlanJob.java
AbstractInstallPlanJob.installExtension
private ModifableExtensionPlanNode installExtension(ExtensionId extensionId, boolean dependency, String namespace) throws InstallException { """ Install provided extension. @param extensionId the identifier of the extension to install @param dependency indicate if the extension is installed as a dependency @param namespace the namespace where to install the extension @return the install plan node for the provided extension @throws InstallException error when trying to install provided extension """ // Check if the feature is a root extension if (namespace != null) { // Check if the extension already exist on root, throw exception if not allowed if (checkRootExtension(extensionId.getId())) { // Restart install on root return installExtension(extensionId, dependency, null); } } this.progressManager.pushLevelProgress(2, this); try { this.progressManager.startStep(this); // Find the extension in a repository (starting with local one) Extension extension = resolveExtension(extensionId); // Rewrite the extension Extension rewrittenExtension; if (getRequest().getRewriter() != null) { rewrittenExtension = getRequest().getRewriter().rewrite(extension); } else { rewrittenExtension = extension; } this.progressManager.endStep(this); this.progressManager.startStep(this); try { return installExtension(extension, rewrittenExtension, dependency, namespace, null, Collections.emptyMap(), null); } catch (Exception e) { throw new InstallException("Failed to resolve extension", e); } } finally { this.progressManager.popLevelProgress(this); } }
java
private ModifableExtensionPlanNode installExtension(ExtensionId extensionId, boolean dependency, String namespace) throws InstallException { // Check if the feature is a root extension if (namespace != null) { // Check if the extension already exist on root, throw exception if not allowed if (checkRootExtension(extensionId.getId())) { // Restart install on root return installExtension(extensionId, dependency, null); } } this.progressManager.pushLevelProgress(2, this); try { this.progressManager.startStep(this); // Find the extension in a repository (starting with local one) Extension extension = resolveExtension(extensionId); // Rewrite the extension Extension rewrittenExtension; if (getRequest().getRewriter() != null) { rewrittenExtension = getRequest().getRewriter().rewrite(extension); } else { rewrittenExtension = extension; } this.progressManager.endStep(this); this.progressManager.startStep(this); try { return installExtension(extension, rewrittenExtension, dependency, namespace, null, Collections.emptyMap(), null); } catch (Exception e) { throw new InstallException("Failed to resolve extension", e); } } finally { this.progressManager.popLevelProgress(this); } }
[ "private", "ModifableExtensionPlanNode", "installExtension", "(", "ExtensionId", "extensionId", ",", "boolean", "dependency", ",", "String", "namespace", ")", "throws", "InstallException", "{", "// Check if the feature is a root extension", "if", "(", "namespace", "!=", "null", ")", "{", "// Check if the extension already exist on root, throw exception if not allowed", "if", "(", "checkRootExtension", "(", "extensionId", ".", "getId", "(", ")", ")", ")", "{", "// Restart install on root", "return", "installExtension", "(", "extensionId", ",", "dependency", ",", "null", ")", ";", "}", "}", "this", ".", "progressManager", ".", "pushLevelProgress", "(", "2", ",", "this", ")", ";", "try", "{", "this", ".", "progressManager", ".", "startStep", "(", "this", ")", ";", "// Find the extension in a repository (starting with local one)", "Extension", "extension", "=", "resolveExtension", "(", "extensionId", ")", ";", "// Rewrite the extension", "Extension", "rewrittenExtension", ";", "if", "(", "getRequest", "(", ")", ".", "getRewriter", "(", ")", "!=", "null", ")", "{", "rewrittenExtension", "=", "getRequest", "(", ")", ".", "getRewriter", "(", ")", ".", "rewrite", "(", "extension", ")", ";", "}", "else", "{", "rewrittenExtension", "=", "extension", ";", "}", "this", ".", "progressManager", ".", "endStep", "(", "this", ")", ";", "this", ".", "progressManager", ".", "startStep", "(", "this", ")", ";", "try", "{", "return", "installExtension", "(", "extension", ",", "rewrittenExtension", ",", "dependency", ",", "namespace", ",", "null", ",", "Collections", ".", "emptyMap", "(", ")", ",", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "InstallException", "(", "\"Failed to resolve extension\"", ",", "e", ")", ";", "}", "}", "finally", "{", "this", ".", "progressManager", ".", "popLevelProgress", "(", "this", ")", ";", "}", "}" ]
Install provided extension. @param extensionId the identifier of the extension to install @param dependency indicate if the extension is installed as a dependency @param namespace the namespace where to install the extension @return the install plan node for the provided extension @throws InstallException error when trying to install provided extension
[ "Install", "provided", "extension", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/job/internal/AbstractInstallPlanJob.java#L748-L789
RestComm/media-core
network/src/main/java/org/restcomm/media/core/network/deprecated/IPAddressCompare.java
IPAddressCompare.isInRangeV4
public static boolean isInRangeV4(byte[] network,byte[] subnet,byte[] ipAddress) { """ Checks whether ipAddress is in IPV4 network with specified subnet """ if(network.length!=4 || subnet.length!=4 || ipAddress.length!=4) return false; return compareByteValues(network,subnet,ipAddress); }
java
public static boolean isInRangeV4(byte[] network,byte[] subnet,byte[] ipAddress) { if(network.length!=4 || subnet.length!=4 || ipAddress.length!=4) return false; return compareByteValues(network,subnet,ipAddress); }
[ "public", "static", "boolean", "isInRangeV4", "(", "byte", "[", "]", "network", ",", "byte", "[", "]", "subnet", ",", "byte", "[", "]", "ipAddress", ")", "{", "if", "(", "network", ".", "length", "!=", "4", "||", "subnet", ".", "length", "!=", "4", "||", "ipAddress", ".", "length", "!=", "4", ")", "return", "false", ";", "return", "compareByteValues", "(", "network", ",", "subnet", ",", "ipAddress", ")", ";", "}" ]
Checks whether ipAddress is in IPV4 network with specified subnet
[ "Checks", "whether", "ipAddress", "is", "in", "IPV4", "network", "with", "specified", "subnet" ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/network/src/main/java/org/restcomm/media/core/network/deprecated/IPAddressCompare.java#L36-L42
square/pollexor
src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java
ThumborUrlBuilder.roundCorner
public static String roundCorner(int radiusInner, int radiusOuter, int color) { """ This filter adds rounded corners to the image using the specified color as the background. @param radiusInner amount of pixels to use as radius. @param radiusOuter specifies the second value for the ellipse used for the radius. Use 0 for no value. @param color fill color for clipped region. """ if (radiusInner < 1) { throw new IllegalArgumentException("Radius must be greater than zero."); } if (radiusOuter < 0) { throw new IllegalArgumentException("Outer radius must be greater than or equal to zero."); } StringBuilder builder = new StringBuilder(FILTER_ROUND_CORNER).append("(").append(radiusInner); if (radiusOuter > 0) { builder.append("|").append(radiusOuter); } final int r = (color & 0xFF0000) >>> 16; final int g = (color & 0xFF00) >>> 8; final int b = color & 0xFF; return builder.append(",") // .append(r).append(",") // .append(g).append(",") // .append(b).append(")") // .toString(); }
java
public static String roundCorner(int radiusInner, int radiusOuter, int color) { if (radiusInner < 1) { throw new IllegalArgumentException("Radius must be greater than zero."); } if (radiusOuter < 0) { throw new IllegalArgumentException("Outer radius must be greater than or equal to zero."); } StringBuilder builder = new StringBuilder(FILTER_ROUND_CORNER).append("(").append(radiusInner); if (radiusOuter > 0) { builder.append("|").append(radiusOuter); } final int r = (color & 0xFF0000) >>> 16; final int g = (color & 0xFF00) >>> 8; final int b = color & 0xFF; return builder.append(",") // .append(r).append(",") // .append(g).append(",") // .append(b).append(")") // .toString(); }
[ "public", "static", "String", "roundCorner", "(", "int", "radiusInner", ",", "int", "radiusOuter", ",", "int", "color", ")", "{", "if", "(", "radiusInner", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Radius must be greater than zero.\"", ")", ";", "}", "if", "(", "radiusOuter", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Outer radius must be greater than or equal to zero.\"", ")", ";", "}", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "FILTER_ROUND_CORNER", ")", ".", "append", "(", "\"(\"", ")", ".", "append", "(", "radiusInner", ")", ";", "if", "(", "radiusOuter", ">", "0", ")", "{", "builder", ".", "append", "(", "\"|\"", ")", ".", "append", "(", "radiusOuter", ")", ";", "}", "final", "int", "r", "=", "(", "color", "&", "0xFF0000", ")", ">>>", "16", ";", "final", "int", "g", "=", "(", "color", "&", "0xFF00", ")", ">>>", "8", ";", "final", "int", "b", "=", "color", "&", "0xFF", ";", "return", "builder", ".", "append", "(", "\",\"", ")", "//", ".", "append", "(", "r", ")", ".", "append", "(", "\",\"", ")", "//", ".", "append", "(", "g", ")", ".", "append", "(", "\",\"", ")", "//", ".", "append", "(", "b", ")", ".", "append", "(", "\")\"", ")", "//", ".", "toString", "(", ")", ";", "}" ]
This filter adds rounded corners to the image using the specified color as the background. @param radiusInner amount of pixels to use as radius. @param radiusOuter specifies the second value for the ellipse used for the radius. Use 0 for no value. @param color fill color for clipped region.
[ "This", "filter", "adds", "rounded", "corners", "to", "the", "image", "using", "the", "specified", "color", "as", "the", "background", "." ]
train
https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L601-L620
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Threads.java
Threads.assertUnlocked
public static void assertUnlocked(Object object, String name) { """ This is an assertion method that can be used by a thread to confirm that the thread isn't already holding lock for an object, before acquiring a lock @param object object to test for lock @param name tag associated with the lock """ if (RUNTIME_ASSERTIONS) { if (Thread.holdsLock(object)) { throw new RuntimeAssertion("Recursive lock of %s", name); } } }
java
public static void assertUnlocked(Object object, String name) { if (RUNTIME_ASSERTIONS) { if (Thread.holdsLock(object)) { throw new RuntimeAssertion("Recursive lock of %s", name); } } }
[ "public", "static", "void", "assertUnlocked", "(", "Object", "object", ",", "String", "name", ")", "{", "if", "(", "RUNTIME_ASSERTIONS", ")", "{", "if", "(", "Thread", ".", "holdsLock", "(", "object", ")", ")", "{", "throw", "new", "RuntimeAssertion", "(", "\"Recursive lock of %s\"", ",", "name", ")", ";", "}", "}", "}" ]
This is an assertion method that can be used by a thread to confirm that the thread isn't already holding lock for an object, before acquiring a lock @param object object to test for lock @param name tag associated with the lock
[ "This", "is", "an", "assertion", "method", "that", "can", "be", "used", "by", "a", "thread", "to", "confirm", "that", "the", "thread", "isn", "t", "already", "holding", "lock", "for", "an", "object", "before", "acquiring", "a", "lock" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Threads.java#L703-L709
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/linsol/qr/LinearSolverQr_ZDRM.java
LinearSolverQr_ZDRM.setMaxSize
public void setMaxSize( int maxRows , int maxCols ) { """ Changes the size of the matrix it can solve for @param maxRows Maximum number of rows in the matrix it will decompose. @param maxCols Maximum number of columns in the matrix it will decompose. """ this.maxRows = maxRows; this.maxCols = maxCols; Q = new ZMatrixRMaj(maxRows,maxRows); Qt = new ZMatrixRMaj(maxRows,maxRows); R = new ZMatrixRMaj(maxRows,maxCols); Y = new ZMatrixRMaj(maxRows,1); Z = new ZMatrixRMaj(maxRows,1); }
java
public void setMaxSize( int maxRows , int maxCols ) { this.maxRows = maxRows; this.maxCols = maxCols; Q = new ZMatrixRMaj(maxRows,maxRows); Qt = new ZMatrixRMaj(maxRows,maxRows); R = new ZMatrixRMaj(maxRows,maxCols); Y = new ZMatrixRMaj(maxRows,1); Z = new ZMatrixRMaj(maxRows,1); }
[ "public", "void", "setMaxSize", "(", "int", "maxRows", ",", "int", "maxCols", ")", "{", "this", ".", "maxRows", "=", "maxRows", ";", "this", ".", "maxCols", "=", "maxCols", ";", "Q", "=", "new", "ZMatrixRMaj", "(", "maxRows", ",", "maxRows", ")", ";", "Qt", "=", "new", "ZMatrixRMaj", "(", "maxRows", ",", "maxRows", ")", ";", "R", "=", "new", "ZMatrixRMaj", "(", "maxRows", ",", "maxCols", ")", ";", "Y", "=", "new", "ZMatrixRMaj", "(", "maxRows", ",", "1", ")", ";", "Z", "=", "new", "ZMatrixRMaj", "(", "maxRows", ",", "1", ")", ";", "}" ]
Changes the size of the matrix it can solve for @param maxRows Maximum number of rows in the matrix it will decompose. @param maxCols Maximum number of columns in the matrix it will decompose.
[ "Changes", "the", "size", "of", "the", "matrix", "it", "can", "solve", "for" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/linsol/qr/LinearSolverQr_ZDRM.java#L70-L80
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java
TasksInner.getAsync
public Observable<TaskInner> getAsync(String resourceGroupName, String registryName, String taskName) { """ Get the properties of a specified task. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param taskName The name of the container registry task. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TaskInner object """ return getWithServiceResponseAsync(resourceGroupName, registryName, taskName).map(new Func1<ServiceResponse<TaskInner>, TaskInner>() { @Override public TaskInner call(ServiceResponse<TaskInner> response) { return response.body(); } }); }
java
public Observable<TaskInner> getAsync(String resourceGroupName, String registryName, String taskName) { return getWithServiceResponseAsync(resourceGroupName, registryName, taskName).map(new Func1<ServiceResponse<TaskInner>, TaskInner>() { @Override public TaskInner call(ServiceResponse<TaskInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TaskInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "taskName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "taskName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "TaskInner", ">", ",", "TaskInner", ">", "(", ")", "{", "@", "Override", "public", "TaskInner", "call", "(", "ServiceResponse", "<", "TaskInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get the properties of a specified task. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param taskName The name of the container registry task. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TaskInner object
[ "Get", "the", "properties", "of", "a", "specified", "task", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java#L268-L275
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/GridLayout.java
GridLayout.createLayoutData
public static LayoutData createLayoutData( Alignment horizontalAlignment, Alignment verticalAlignment, boolean grabExtraHorizontalSpace, boolean grabExtraVerticalSpace) { """ Creates a layout data object for {@code GridLayout}:s that specify the horizontal and vertical alignment for the component in case the cell space is larger than the preferred size of the component. This method also has fields for indicating that the component would like to take more space if available to the container. For example, if the container is assigned is assigned an area of 50x15, but all the child components in the grid together only asks for 40x10, the remaining 10 columns and 5 rows will be empty. If just a single component asks for extra space horizontally and/or vertically, the grid will expand out to fill the entire area and the text space will be assigned to the component that asked for it. @param horizontalAlignment Horizontal alignment strategy @param verticalAlignment Vertical alignment strategy @param grabExtraHorizontalSpace If set to {@code true}, this component will ask to be assigned extra horizontal space if there is any to assign @param grabExtraVerticalSpace If set to {@code true}, this component will ask to be assigned extra vertical space if there is any to assign @return The layout data object containing the specified alignments and size requirements """ return createLayoutData(horizontalAlignment, verticalAlignment, grabExtraHorizontalSpace, grabExtraVerticalSpace, 1, 1); }
java
public static LayoutData createLayoutData( Alignment horizontalAlignment, Alignment verticalAlignment, boolean grabExtraHorizontalSpace, boolean grabExtraVerticalSpace) { return createLayoutData(horizontalAlignment, verticalAlignment, grabExtraHorizontalSpace, grabExtraVerticalSpace, 1, 1); }
[ "public", "static", "LayoutData", "createLayoutData", "(", "Alignment", "horizontalAlignment", ",", "Alignment", "verticalAlignment", ",", "boolean", "grabExtraHorizontalSpace", ",", "boolean", "grabExtraVerticalSpace", ")", "{", "return", "createLayoutData", "(", "horizontalAlignment", ",", "verticalAlignment", ",", "grabExtraHorizontalSpace", ",", "grabExtraVerticalSpace", ",", "1", ",", "1", ")", ";", "}" ]
Creates a layout data object for {@code GridLayout}:s that specify the horizontal and vertical alignment for the component in case the cell space is larger than the preferred size of the component. This method also has fields for indicating that the component would like to take more space if available to the container. For example, if the container is assigned is assigned an area of 50x15, but all the child components in the grid together only asks for 40x10, the remaining 10 columns and 5 rows will be empty. If just a single component asks for extra space horizontally and/or vertically, the grid will expand out to fill the entire area and the text space will be assigned to the component that asked for it. @param horizontalAlignment Horizontal alignment strategy @param verticalAlignment Vertical alignment strategy @param grabExtraHorizontalSpace If set to {@code true}, this component will ask to be assigned extra horizontal space if there is any to assign @param grabExtraVerticalSpace If set to {@code true}, this component will ask to be assigned extra vertical space if there is any to assign @return The layout data object containing the specified alignments and size requirements
[ "Creates", "a", "layout", "data", "object", "for", "{", "@code", "GridLayout", "}", ":", "s", "that", "specify", "the", "horizontal", "and", "vertical", "alignment", "for", "the", "component", "in", "case", "the", "cell", "space", "is", "larger", "than", "the", "preferred", "size", "of", "the", "component", ".", "This", "method", "also", "has", "fields", "for", "indicating", "that", "the", "component", "would", "like", "to", "take", "more", "space", "if", "available", "to", "the", "container", ".", "For", "example", "if", "the", "container", "is", "assigned", "is", "assigned", "an", "area", "of", "50x15", "but", "all", "the", "child", "components", "in", "the", "grid", "together", "only", "asks", "for", "40x10", "the", "remaining", "10", "columns", "and", "5", "rows", "will", "be", "empty", ".", "If", "just", "a", "single", "component", "asks", "for", "extra", "space", "horizontally", "and", "/", "or", "vertically", "the", "grid", "will", "expand", "out", "to", "fill", "the", "entire", "area", "and", "the", "text", "space", "will", "be", "assigned", "to", "the", "component", "that", "asked", "for", "it", "." ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/GridLayout.java#L131-L138
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/FontSelector.java
FontSelector.addFont
public void addFont(Font font) { """ Adds a <CODE>Font</CODE> to be searched for valid characters. @param font the <CODE>Font</CODE> """ if (font.getBaseFont() != null) { fonts.add(font); return; } BaseFont bf = font.getCalculatedBaseFont(true); Font f2 = new Font(bf, font.getSize(), font.getCalculatedStyle(), font.getColor()); fonts.add(f2); }
java
public void addFont(Font font) { if (font.getBaseFont() != null) { fonts.add(font); return; } BaseFont bf = font.getCalculatedBaseFont(true); Font f2 = new Font(bf, font.getSize(), font.getCalculatedStyle(), font.getColor()); fonts.add(f2); }
[ "public", "void", "addFont", "(", "Font", "font", ")", "{", "if", "(", "font", ".", "getBaseFont", "(", ")", "!=", "null", ")", "{", "fonts", ".", "add", "(", "font", ")", ";", "return", ";", "}", "BaseFont", "bf", "=", "font", ".", "getCalculatedBaseFont", "(", "true", ")", ";", "Font", "f2", "=", "new", "Font", "(", "bf", ",", "font", ".", "getSize", "(", ")", ",", "font", ".", "getCalculatedStyle", "(", ")", ",", "font", ".", "getColor", "(", ")", ")", ";", "fonts", ".", "add", "(", "f2", ")", ";", "}" ]
Adds a <CODE>Font</CODE> to be searched for valid characters. @param font the <CODE>Font</CODE>
[ "Adds", "a", "<CODE", ">", "Font<", "/", "CODE", ">", "to", "be", "searched", "for", "valid", "characters", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/FontSelector.java#L72-L80
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java
NetworkInterfacesInner.createOrUpdateAsync
public Observable<NetworkInterfaceInner> createOrUpdateAsync(String resourceGroupName, String networkInterfaceName, NetworkInterfaceInner parameters) { """ Creates or updates a network interface. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @param parameters Parameters supplied to the create or update network interface operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, parameters).map(new Func1<ServiceResponse<NetworkInterfaceInner>, NetworkInterfaceInner>() { @Override public NetworkInterfaceInner call(ServiceResponse<NetworkInterfaceInner> response) { return response.body(); } }); }
java
public Observable<NetworkInterfaceInner> createOrUpdateAsync(String resourceGroupName, String networkInterfaceName, NetworkInterfaceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, parameters).map(new Func1<ServiceResponse<NetworkInterfaceInner>, NetworkInterfaceInner>() { @Override public NetworkInterfaceInner call(ServiceResponse<NetworkInterfaceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NetworkInterfaceInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "networkInterfaceName", ",", "NetworkInterfaceInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkInterfaceName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "NetworkInterfaceInner", ">", ",", "NetworkInterfaceInner", ">", "(", ")", "{", "@", "Override", "public", "NetworkInterfaceInner", "call", "(", "ServiceResponse", "<", "NetworkInterfaceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a network interface. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @param parameters Parameters supplied to the create or update network interface operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "network", "interface", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L520-L527
apache/incubator-druid
core/src/main/java/org/apache/druid/java/util/common/Numbers.java
Numbers.parseBoolean
public static boolean parseBoolean(Object val) { """ Parse the given object as a {@code boolean}. The input object can be a {@link String} or {@link Boolean}. @return {@code true} only if the input is a {@link Boolean} representing {@code true} or a {@link String} of {@code "true"}. @throws NullPointerException if the input is null. @throws ISE if the input is not a string or a number. """ if (val instanceof String) { return Boolean.parseBoolean((String) val); } else if (val instanceof Boolean) { return (boolean) val; } else { if (val == null) { throw new NullPointerException("Input is null"); } else { throw new ISE("Unknown type [%s]", val.getClass()); } } }
java
public static boolean parseBoolean(Object val) { if (val instanceof String) { return Boolean.parseBoolean((String) val); } else if (val instanceof Boolean) { return (boolean) val; } else { if (val == null) { throw new NullPointerException("Input is null"); } else { throw new ISE("Unknown type [%s]", val.getClass()); } } }
[ "public", "static", "boolean", "parseBoolean", "(", "Object", "val", ")", "{", "if", "(", "val", "instanceof", "String", ")", "{", "return", "Boolean", ".", "parseBoolean", "(", "(", "String", ")", "val", ")", ";", "}", "else", "if", "(", "val", "instanceof", "Boolean", ")", "{", "return", "(", "boolean", ")", "val", ";", "}", "else", "{", "if", "(", "val", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Input is null\"", ")", ";", "}", "else", "{", "throw", "new", "ISE", "(", "\"Unknown type [%s]\"", ",", "val", ".", "getClass", "(", ")", ")", ";", "}", "}", "}" ]
Parse the given object as a {@code boolean}. The input object can be a {@link String} or {@link Boolean}. @return {@code true} only if the input is a {@link Boolean} representing {@code true} or a {@link String} of {@code "true"}. @throws NullPointerException if the input is null. @throws ISE if the input is not a string or a number.
[ "Parse", "the", "given", "object", "as", "a", "{", "@code", "boolean", "}", ".", "The", "input", "object", "can", "be", "a", "{", "@link", "String", "}", "or", "{", "@link", "Boolean", "}", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/Numbers.java#L80-L93
undertow-io/undertow
core/src/main/java/io/undertow/server/HttpServerExchange.java
HttpServerExchange.addResponseCommitListener
public void addResponseCommitListener(final ResponseCommitListener listener) { """ Adds a listener that will be invoked on response commit @param listener The response listener """ //technically it is possible to modify the exchange after the response conduit has been created //as the response channel should not be retrieved until it is about to be written to //if we get complaints about this we can add support for it, however it makes the exchange bigger and the connectors more complex addResponseWrapper(new ConduitWrapper<StreamSinkConduit>() { @Override public StreamSinkConduit wrap(ConduitFactory<StreamSinkConduit> factory, HttpServerExchange exchange) { listener.beforeCommit(exchange); return factory.create(); } }); }
java
public void addResponseCommitListener(final ResponseCommitListener listener) { //technically it is possible to modify the exchange after the response conduit has been created //as the response channel should not be retrieved until it is about to be written to //if we get complaints about this we can add support for it, however it makes the exchange bigger and the connectors more complex addResponseWrapper(new ConduitWrapper<StreamSinkConduit>() { @Override public StreamSinkConduit wrap(ConduitFactory<StreamSinkConduit> factory, HttpServerExchange exchange) { listener.beforeCommit(exchange); return factory.create(); } }); }
[ "public", "void", "addResponseCommitListener", "(", "final", "ResponseCommitListener", "listener", ")", "{", "//technically it is possible to modify the exchange after the response conduit has been created", "//as the response channel should not be retrieved until it is about to be written to", "//if we get complaints about this we can add support for it, however it makes the exchange bigger and the connectors more complex", "addResponseWrapper", "(", "new", "ConduitWrapper", "<", "StreamSinkConduit", ">", "(", ")", "{", "@", "Override", "public", "StreamSinkConduit", "wrap", "(", "ConduitFactory", "<", "StreamSinkConduit", ">", "factory", ",", "HttpServerExchange", "exchange", ")", "{", "listener", ".", "beforeCommit", "(", "exchange", ")", ";", "return", "factory", ".", "create", "(", ")", ";", "}", "}", ")", ";", "}" ]
Adds a listener that will be invoked on response commit @param listener The response listener
[ "Adds", "a", "listener", "that", "will", "be", "invoked", "on", "response", "commit" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/HttpServerExchange.java#L1836-L1848
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/inject/annotation/DefaultAnnotationMetadata.java
DefaultAnnotationMetadata.addDefaultAnnotationValues
protected final void addDefaultAnnotationValues(String annotation, Map<CharSequence, Object> values) { """ Adds an annotation directly declared on the element and its member values, if the annotation already exists the data will be merged with existing values replaced. @param annotation The annotation @param values The values """ if (annotation != null) { Map<String, Map<CharSequence, Object>> annotationDefaults = this.annotationDefaultValues; if (annotationDefaults == null) { this.annotationDefaultValues = new HashMap<>(); annotationDefaults = this.annotationDefaultValues; } putValues(annotation, values, annotationDefaults); } }
java
protected final void addDefaultAnnotationValues(String annotation, Map<CharSequence, Object> values) { if (annotation != null) { Map<String, Map<CharSequence, Object>> annotationDefaults = this.annotationDefaultValues; if (annotationDefaults == null) { this.annotationDefaultValues = new HashMap<>(); annotationDefaults = this.annotationDefaultValues; } putValues(annotation, values, annotationDefaults); } }
[ "protected", "final", "void", "addDefaultAnnotationValues", "(", "String", "annotation", ",", "Map", "<", "CharSequence", ",", "Object", ">", "values", ")", "{", "if", "(", "annotation", "!=", "null", ")", "{", "Map", "<", "String", ",", "Map", "<", "CharSequence", ",", "Object", ">", ">", "annotationDefaults", "=", "this", ".", "annotationDefaultValues", ";", "if", "(", "annotationDefaults", "==", "null", ")", "{", "this", ".", "annotationDefaultValues", "=", "new", "HashMap", "<>", "(", ")", ";", "annotationDefaults", "=", "this", ".", "annotationDefaultValues", ";", "}", "putValues", "(", "annotation", ",", "values", ",", "annotationDefaults", ")", ";", "}", "}" ]
Adds an annotation directly declared on the element and its member values, if the annotation already exists the data will be merged with existing values replaced. @param annotation The annotation @param values The values
[ "Adds", "an", "annotation", "directly", "declared", "on", "the", "element", "and", "its", "member", "values", "if", "the", "annotation", "already", "exists", "the", "data", "will", "be", "merged", "with", "existing", "values", "replaced", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/annotation/DefaultAnnotationMetadata.java#L479-L489
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java
RouteFiltersInner.beginUpdateAsync
public Observable<RouteFilterInner> beginUpdateAsync(String resourceGroupName, String routeFilterName, PatchRouteFilter routeFilterParameters) { """ Updates a route filter in a specified resource group. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @param routeFilterParameters Parameters supplied to the update route filter operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RouteFilterInner object """ return beginUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).map(new Func1<ServiceResponse<RouteFilterInner>, RouteFilterInner>() { @Override public RouteFilterInner call(ServiceResponse<RouteFilterInner> response) { return response.body(); } }); }
java
public Observable<RouteFilterInner> beginUpdateAsync(String resourceGroupName, String routeFilterName, PatchRouteFilter routeFilterParameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).map(new Func1<ServiceResponse<RouteFilterInner>, RouteFilterInner>() { @Override public RouteFilterInner call(ServiceResponse<RouteFilterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RouteFilterInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "routeFilterName", ",", "PatchRouteFilter", "routeFilterParameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "routeFilterName", ",", "routeFilterParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "RouteFilterInner", ">", ",", "RouteFilterInner", ">", "(", ")", "{", "@", "Override", "public", "RouteFilterInner", "call", "(", "ServiceResponse", "<", "RouteFilterInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates a route filter in a specified resource group. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @param routeFilterParameters Parameters supplied to the update route filter operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RouteFilterInner object
[ "Updates", "a", "route", "filter", "in", "a", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java#L713-L720
liyiorg/weixin-popular
src/main/java/weixin/popular/api/ScanAPI.java
ScanAPI.productCreate
public static ProductCreateResult productCreate(String accessToken, ProductCreate productCreate) { """ 创建商品 @param accessToken accessToken @param productCreate productCreate @return ProductCreateResult """ return productCreate(accessToken, JsonUtil.toJSONString(productCreate)); }
java
public static ProductCreateResult productCreate(String accessToken, ProductCreate productCreate) { return productCreate(accessToken, JsonUtil.toJSONString(productCreate)); }
[ "public", "static", "ProductCreateResult", "productCreate", "(", "String", "accessToken", ",", "ProductCreate", "productCreate", ")", "{", "return", "productCreate", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "productCreate", ")", ")", ";", "}" ]
创建商品 @param accessToken accessToken @param productCreate productCreate @return ProductCreateResult
[ "创建商品" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ScanAPI.java#L46-L48
pedrovgs/DraggablePanel
draggablepanel/src/main/java/com/github/pedrovgs/DraggableViewCallback.java
DraggableViewCallback.onViewPositionChanged
@Override public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) { """ Override method used to apply different scale and alpha effects while the view is being dragged. @param left position. @param top position. @param dx change in X position from the last call. @param dy change in Y position from the last call. """ if (draggableView.isDragViewAtBottom()) { draggableView.changeDragViewViewAlpha(); } else { draggableView.restoreAlpha(); draggableView.changeDragViewScale(); draggableView.changeDragViewPosition(); draggableView.changeSecondViewAlpha(); draggableView.changeSecondViewPosition(); draggableView.changeBackgroundAlpha(); } }
java
@Override public void onViewPositionChanged(View changedView, int left, int top, int dx, int dy) { if (draggableView.isDragViewAtBottom()) { draggableView.changeDragViewViewAlpha(); } else { draggableView.restoreAlpha(); draggableView.changeDragViewScale(); draggableView.changeDragViewPosition(); draggableView.changeSecondViewAlpha(); draggableView.changeSecondViewPosition(); draggableView.changeBackgroundAlpha(); } }
[ "@", "Override", "public", "void", "onViewPositionChanged", "(", "View", "changedView", ",", "int", "left", ",", "int", "top", ",", "int", "dx", ",", "int", "dy", ")", "{", "if", "(", "draggableView", ".", "isDragViewAtBottom", "(", ")", ")", "{", "draggableView", ".", "changeDragViewViewAlpha", "(", ")", ";", "}", "else", "{", "draggableView", ".", "restoreAlpha", "(", ")", ";", "draggableView", ".", "changeDragViewScale", "(", ")", ";", "draggableView", ".", "changeDragViewPosition", "(", ")", ";", "draggableView", ".", "changeSecondViewAlpha", "(", ")", ";", "draggableView", ".", "changeSecondViewPosition", "(", ")", ";", "draggableView", ".", "changeBackgroundAlpha", "(", ")", ";", "}", "}" ]
Override method used to apply different scale and alpha effects while the view is being dragged. @param left position. @param top position. @param dx change in X position from the last call. @param dy change in Y position from the last call.
[ "Override", "method", "used", "to", "apply", "different", "scale", "and", "alpha", "effects", "while", "the", "view", "is", "being", "dragged", "." ]
train
https://github.com/pedrovgs/DraggablePanel/blob/6b6d1806fa4140113f31307a2571bf02435aa53a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableViewCallback.java#L56-L67
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/JimfsFileStore.java
JimfsFileStore.setAttribute
void setAttribute(File file, String attribute, Object value) { """ Sets the given attribute to the given value for the given file. """ state.checkOpen(); // TODO(cgdecker): Change attribute stuff to avoid the sad boolean parameter attributes.setAttribute(file, attribute, value, false); }
java
void setAttribute(File file, String attribute, Object value) { state.checkOpen(); // TODO(cgdecker): Change attribute stuff to avoid the sad boolean parameter attributes.setAttribute(file, attribute, value, false); }
[ "void", "setAttribute", "(", "File", "file", ",", "String", "attribute", ",", "Object", "value", ")", "{", "state", ".", "checkOpen", "(", ")", ";", "// TODO(cgdecker): Change attribute stuff to avoid the sad boolean parameter", "attributes", ".", "setAttribute", "(", "file", ",", "attribute", ",", "value", ",", "false", ")", ";", "}" ]
Sets the given attribute to the given value for the given file.
[ "Sets", "the", "given", "attribute", "to", "the", "given", "value", "for", "the", "given", "file", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/JimfsFileStore.java#L198-L202
Stratio/stratio-cassandra
src/java/org/apache/cassandra/streaming/messages/StreamInitMessage.java
StreamInitMessage.createMessage
public ByteBuffer createMessage(boolean compress, int version) { """ Create serialized message. @param compress true if message is compressed @param version Streaming protocol version @return serialized message in ByteBuffer format """ int header = 0; // set compression bit. if (compress) header |= 4; // set streaming bit header |= 8; // Setting up the version bit header |= (version << 8); byte[] bytes; try { int size = (int)StreamInitMessage.serializer.serializedSize(this, version); DataOutputBuffer buffer = new DataOutputBuffer(size); StreamInitMessage.serializer.serialize(this, buffer, version); bytes = buffer.getData(); } catch (IOException e) { throw new RuntimeException(e); } assert bytes.length > 0; ByteBuffer buffer = ByteBuffer.allocate(4 + 4 + bytes.length); buffer.putInt(MessagingService.PROTOCOL_MAGIC); buffer.putInt(header); buffer.put(bytes); buffer.flip(); return buffer; }
java
public ByteBuffer createMessage(boolean compress, int version) { int header = 0; // set compression bit. if (compress) header |= 4; // set streaming bit header |= 8; // Setting up the version bit header |= (version << 8); byte[] bytes; try { int size = (int)StreamInitMessage.serializer.serializedSize(this, version); DataOutputBuffer buffer = new DataOutputBuffer(size); StreamInitMessage.serializer.serialize(this, buffer, version); bytes = buffer.getData(); } catch (IOException e) { throw new RuntimeException(e); } assert bytes.length > 0; ByteBuffer buffer = ByteBuffer.allocate(4 + 4 + bytes.length); buffer.putInt(MessagingService.PROTOCOL_MAGIC); buffer.putInt(header); buffer.put(bytes); buffer.flip(); return buffer; }
[ "public", "ByteBuffer", "createMessage", "(", "boolean", "compress", ",", "int", "version", ")", "{", "int", "header", "=", "0", ";", "// set compression bit.", "if", "(", "compress", ")", "header", "|=", "4", ";", "// set streaming bit", "header", "|=", "8", ";", "// Setting up the version bit", "header", "|=", "(", "version", "<<", "8", ")", ";", "byte", "[", "]", "bytes", ";", "try", "{", "int", "size", "=", "(", "int", ")", "StreamInitMessage", ".", "serializer", ".", "serializedSize", "(", "this", ",", "version", ")", ";", "DataOutputBuffer", "buffer", "=", "new", "DataOutputBuffer", "(", "size", ")", ";", "StreamInitMessage", ".", "serializer", ".", "serialize", "(", "this", ",", "buffer", ",", "version", ")", ";", "bytes", "=", "buffer", ".", "getData", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "assert", "bytes", ".", "length", ">", "0", ";", "ByteBuffer", "buffer", "=", "ByteBuffer", ".", "allocate", "(", "4", "+", "4", "+", "bytes", ".", "length", ")", ";", "buffer", ".", "putInt", "(", "MessagingService", ".", "PROTOCOL_MAGIC", ")", ";", "buffer", ".", "putInt", "(", "header", ")", ";", "buffer", ".", "put", "(", "bytes", ")", ";", "buffer", ".", "flip", "(", ")", ";", "return", "buffer", ";", "}" ]
Create serialized message. @param compress true if message is compressed @param version Streaming protocol version @return serialized message in ByteBuffer format
[ "Create", "serialized", "message", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/streaming/messages/StreamInitMessage.java#L66-L97
sockeqwe/sqlbrite-dao
objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java
ObjectMappableProcessor.generateRxMappingMethod
private FieldSpec generateRxMappingMethod(ObjectMappableAnnotatedClass clazz) { """ Generates the field that can be used as RxJava method @param clazz The {@link ObjectMappableAnnotatedClass} @return MethodSpec """ String objectVarName = "item"; String cursorVarName = "cursor"; TypeName elementType = ClassName.get(clazz.getElement().asType()); // new Func1<Cursor, ListsItem>() CodeBlock.Builder initBlockBuilder = CodeBlock.builder() .add("new $L<$L, $L>() {\n", Func1.class.getSimpleName(), Cursor.class.getSimpleName(), elementType) .indent() .add("@Override public $L call($L cursor) {\n", elementType, Cursor.class.getSimpleName()) .indent(); // assign the columns indexes generateColumnIndexCode(initBlockBuilder, clazz.getColumnAnnotatedElements(), cursorVarName); // Instantiate element initBlockBuilder.addStatement("$T $L = new $T()", elementType, objectVarName, elementType); // read cursor into element variable for (ColumnAnnotateable e : clazz.getColumnAnnotatedElements()) { String indexVaName = e.getColumnName() + "Index"; initBlockBuilder.beginControlFlow("if ($L >= 0)", indexVaName); e.generateAssignStatement(initBlockBuilder, objectVarName, cursorVarName, indexVaName); initBlockBuilder.endControlFlow(); } initBlockBuilder.addStatement("return $L", objectVarName) .unindent() .add("}\n") // end call () method .unindent() .add("}") // end anonymous class .build(); ParameterizedTypeName fieldType = ParameterizedTypeName.get(ClassName.get(Func1.class), ClassName.get(Cursor.class), elementType); return FieldSpec.builder(fieldType, "MAPPER", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL) .initializer(initBlockBuilder.build()) .build(); }
java
private FieldSpec generateRxMappingMethod(ObjectMappableAnnotatedClass clazz) { String objectVarName = "item"; String cursorVarName = "cursor"; TypeName elementType = ClassName.get(clazz.getElement().asType()); // new Func1<Cursor, ListsItem>() CodeBlock.Builder initBlockBuilder = CodeBlock.builder() .add("new $L<$L, $L>() {\n", Func1.class.getSimpleName(), Cursor.class.getSimpleName(), elementType) .indent() .add("@Override public $L call($L cursor) {\n", elementType, Cursor.class.getSimpleName()) .indent(); // assign the columns indexes generateColumnIndexCode(initBlockBuilder, clazz.getColumnAnnotatedElements(), cursorVarName); // Instantiate element initBlockBuilder.addStatement("$T $L = new $T()", elementType, objectVarName, elementType); // read cursor into element variable for (ColumnAnnotateable e : clazz.getColumnAnnotatedElements()) { String indexVaName = e.getColumnName() + "Index"; initBlockBuilder.beginControlFlow("if ($L >= 0)", indexVaName); e.generateAssignStatement(initBlockBuilder, objectVarName, cursorVarName, indexVaName); initBlockBuilder.endControlFlow(); } initBlockBuilder.addStatement("return $L", objectVarName) .unindent() .add("}\n") // end call () method .unindent() .add("}") // end anonymous class .build(); ParameterizedTypeName fieldType = ParameterizedTypeName.get(ClassName.get(Func1.class), ClassName.get(Cursor.class), elementType); return FieldSpec.builder(fieldType, "MAPPER", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL) .initializer(initBlockBuilder.build()) .build(); }
[ "private", "FieldSpec", "generateRxMappingMethod", "(", "ObjectMappableAnnotatedClass", "clazz", ")", "{", "String", "objectVarName", "=", "\"item\"", ";", "String", "cursorVarName", "=", "\"cursor\"", ";", "TypeName", "elementType", "=", "ClassName", ".", "get", "(", "clazz", ".", "getElement", "(", ")", ".", "asType", "(", ")", ")", ";", "// new Func1<Cursor, ListsItem>()", "CodeBlock", ".", "Builder", "initBlockBuilder", "=", "CodeBlock", ".", "builder", "(", ")", ".", "add", "(", "\"new $L<$L, $L>() {\\n\"", ",", "Func1", ".", "class", ".", "getSimpleName", "(", ")", ",", "Cursor", ".", "class", ".", "getSimpleName", "(", ")", ",", "elementType", ")", ".", "indent", "(", ")", ".", "add", "(", "\"@Override public $L call($L cursor) {\\n\"", ",", "elementType", ",", "Cursor", ".", "class", ".", "getSimpleName", "(", ")", ")", ".", "indent", "(", ")", ";", "// assign the columns indexes", "generateColumnIndexCode", "(", "initBlockBuilder", ",", "clazz", ".", "getColumnAnnotatedElements", "(", ")", ",", "cursorVarName", ")", ";", "// Instantiate element", "initBlockBuilder", ".", "addStatement", "(", "\"$T $L = new $T()\"", ",", "elementType", ",", "objectVarName", ",", "elementType", ")", ";", "// read cursor into element variable", "for", "(", "ColumnAnnotateable", "e", ":", "clazz", ".", "getColumnAnnotatedElements", "(", ")", ")", "{", "String", "indexVaName", "=", "e", ".", "getColumnName", "(", ")", "+", "\"Index\"", ";", "initBlockBuilder", ".", "beginControlFlow", "(", "\"if ($L >= 0)\"", ",", "indexVaName", ")", ";", "e", ".", "generateAssignStatement", "(", "initBlockBuilder", ",", "objectVarName", ",", "cursorVarName", ",", "indexVaName", ")", ";", "initBlockBuilder", ".", "endControlFlow", "(", ")", ";", "}", "initBlockBuilder", ".", "addStatement", "(", "\"return $L\"", ",", "objectVarName", ")", ".", "unindent", "(", ")", ".", "add", "(", "\"}\\n\"", ")", "// end call () method", ".", "unindent", "(", ")", ".", "add", "(", "\"}\"", ")", "// end anonymous class", ".", "build", "(", ")", ";", "ParameterizedTypeName", "fieldType", "=", "ParameterizedTypeName", ".", "get", "(", "ClassName", ".", "get", "(", "Func1", ".", "class", ")", ",", "ClassName", ".", "get", "(", "Cursor", ".", "class", ")", ",", "elementType", ")", ";", "return", "FieldSpec", ".", "builder", "(", "fieldType", ",", "\"MAPPER\"", ",", "Modifier", ".", "PUBLIC", ",", "Modifier", ".", "STATIC", ",", "Modifier", ".", "FINAL", ")", ".", "initializer", "(", "initBlockBuilder", ".", "build", "(", ")", ")", ".", "build", "(", ")", ";", "}" ]
Generates the field that can be used as RxJava method @param clazz The {@link ObjectMappableAnnotatedClass} @return MethodSpec
[ "Generates", "the", "field", "that", "can", "be", "used", "as", "RxJava", "method" ]
train
https://github.com/sockeqwe/sqlbrite-dao/blob/8d02b76f00bd2f8997a58d33146b98b2eec35452/objectmapper-processor/src/main/java/com/hannesdorfmann/sqlbrite/objectmapper/processor/ObjectMappableProcessor.java#L172-L216
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/instance/NodeShutdownHelper.java
NodeShutdownHelper.shutdownNodeByFiringEvents
public static void shutdownNodeByFiringEvents(Node node, boolean terminate) { """ Shutdowns a node by firing lifecycle events. Do not call this method for every node shutdown scenario since {@link com.hazelcast.core.LifecycleListener}s will end up more than one {@link com.hazelcast.core.LifecycleEvent.LifecycleState#SHUTTING_DOWN} or {@link com.hazelcast.core.LifecycleEvent.LifecycleState#SHUTDOWN} events. @param node Node to shutdown. @param terminate <code>false</code> for graceful shutdown, <code>true</code> for terminate (un-graceful shutdown) """ final HazelcastInstanceImpl hazelcastInstance = node.hazelcastInstance; final LifecycleServiceImpl lifecycleService = hazelcastInstance.getLifecycleService(); lifecycleService.fireLifecycleEvent(LifecycleEvent.LifecycleState.SHUTTING_DOWN); node.shutdown(terminate); lifecycleService.fireLifecycleEvent(LifecycleEvent.LifecycleState.SHUTDOWN); }
java
public static void shutdownNodeByFiringEvents(Node node, boolean terminate) { final HazelcastInstanceImpl hazelcastInstance = node.hazelcastInstance; final LifecycleServiceImpl lifecycleService = hazelcastInstance.getLifecycleService(); lifecycleService.fireLifecycleEvent(LifecycleEvent.LifecycleState.SHUTTING_DOWN); node.shutdown(terminate); lifecycleService.fireLifecycleEvent(LifecycleEvent.LifecycleState.SHUTDOWN); }
[ "public", "static", "void", "shutdownNodeByFiringEvents", "(", "Node", "node", ",", "boolean", "terminate", ")", "{", "final", "HazelcastInstanceImpl", "hazelcastInstance", "=", "node", ".", "hazelcastInstance", ";", "final", "LifecycleServiceImpl", "lifecycleService", "=", "hazelcastInstance", ".", "getLifecycleService", "(", ")", ";", "lifecycleService", ".", "fireLifecycleEvent", "(", "LifecycleEvent", ".", "LifecycleState", ".", "SHUTTING_DOWN", ")", ";", "node", ".", "shutdown", "(", "terminate", ")", ";", "lifecycleService", ".", "fireLifecycleEvent", "(", "LifecycleEvent", ".", "LifecycleState", ".", "SHUTDOWN", ")", ";", "}" ]
Shutdowns a node by firing lifecycle events. Do not call this method for every node shutdown scenario since {@link com.hazelcast.core.LifecycleListener}s will end up more than one {@link com.hazelcast.core.LifecycleEvent.LifecycleState#SHUTTING_DOWN} or {@link com.hazelcast.core.LifecycleEvent.LifecycleState#SHUTDOWN} events. @param node Node to shutdown. @param terminate <code>false</code> for graceful shutdown, <code>true</code> for terminate (un-graceful shutdown)
[ "Shutdowns", "a", "node", "by", "firing", "lifecycle", "events", ".", "Do", "not", "call", "this", "method", "for", "every", "node", "shutdown", "scenario", "since", "{", "@link", "com", ".", "hazelcast", ".", "core", ".", "LifecycleListener", "}", "s", "will", "end", "up", "more", "than", "one", "{", "@link", "com", ".", "hazelcast", ".", "core", ".", "LifecycleEvent", ".", "LifecycleState#SHUTTING_DOWN", "}", "or", "{", "@link", "com", ".", "hazelcast", ".", "core", ".", "LifecycleEvent", ".", "LifecycleState#SHUTDOWN", "}", "events", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/instance/NodeShutdownHelper.java#L40-L46
apache/groovy
src/main/groovy/groovy/lang/GroovyClassLoader.java
GroovyClassLoader.parseClass
public Class parseClass(final String text, final String fileName) throws CompilationFailedException { """ Parses the given text into a Java class capable of being run @param text the text of the script/class to parse @param fileName the file name to use as the name of the class @return the main class defined in the given script """ GroovyCodeSource gcs = AccessController.doPrivileged(new PrivilegedAction<GroovyCodeSource>() { public GroovyCodeSource run() { return new GroovyCodeSource(text, fileName, "/groovy/script"); } }); gcs.setCachable(false); return parseClass(gcs); }
java
public Class parseClass(final String text, final String fileName) throws CompilationFailedException { GroovyCodeSource gcs = AccessController.doPrivileged(new PrivilegedAction<GroovyCodeSource>() { public GroovyCodeSource run() { return new GroovyCodeSource(text, fileName, "/groovy/script"); } }); gcs.setCachable(false); return parseClass(gcs); }
[ "public", "Class", "parseClass", "(", "final", "String", "text", ",", "final", "String", "fileName", ")", "throws", "CompilationFailedException", "{", "GroovyCodeSource", "gcs", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "GroovyCodeSource", ">", "(", ")", "{", "public", "GroovyCodeSource", "run", "(", ")", "{", "return", "new", "GroovyCodeSource", "(", "text", ",", "fileName", ",", "\"/groovy/script\"", ")", ";", "}", "}", ")", ";", "gcs", ".", "setCachable", "(", "false", ")", ";", "return", "parseClass", "(", "gcs", ")", ";", "}" ]
Parses the given text into a Java class capable of being run @param text the text of the script/class to parse @param fileName the file name to use as the name of the class @return the main class defined in the given script
[ "Parses", "the", "given", "text", "into", "a", "Java", "class", "capable", "of", "being", "run" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L244-L252
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/simple/SimpleBase.java
SimpleBase.setRow
public void setRow( int row , int startColumn , double ...values ) { """ <p> Assigns consecutive elements inside a row to the provided array.<br> <br> A(row,offset:(offset + values.length)) = values </p> @param row The row that the array is to be written to. @param startColumn The initial column that the array is written to. @param values Values which are to be written to the row in a matrix. """ ops.setRow(mat,row,startColumn,values); }
java
public void setRow( int row , int startColumn , double ...values ) { ops.setRow(mat,row,startColumn,values); }
[ "public", "void", "setRow", "(", "int", "row", ",", "int", "startColumn", ",", "double", "...", "values", ")", "{", "ops", ".", "setRow", "(", "mat", ",", "row", ",", "startColumn", ",", "values", ")", ";", "}" ]
<p> Assigns consecutive elements inside a row to the provided array.<br> <br> A(row,offset:(offset + values.length)) = values </p> @param row The row that the array is to be written to. @param startColumn The initial column that the array is written to. @param values Values which are to be written to the row in a matrix.
[ "<p", ">", "Assigns", "consecutive", "elements", "inside", "a", "row", "to", "the", "provided", "array", ".", "<br", ">", "<br", ">", "A", "(", "row", "offset", ":", "(", "offset", "+", "values", ".", "length", "))", "=", "values", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleBase.java#L661-L663
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java
HashMap.treeifyBin
final void treeifyBin(Node<K,V>[] tab, int hash) { """ Replaces all linked nodes in bin at index for given hash unless table is too small, in which case resizes instead. """ int n, index; Node<K,V> e; if (tab == null || (n = tab.length) < MIN_TREEIFY_CAPACITY) resize(); else if ((e = tab[index = (n - 1) & hash]) != null) { TreeNode<K,V> hd = null, tl = null; do { TreeNode<K,V> p = replacementTreeNode(e, null); if (tl == null) hd = p; else { p.prev = tl; tl.next = p; } tl = p; } while ((e = e.next) != null); if ((tab[index] = hd) != null) hd.treeify(tab); } }
java
final void treeifyBin(Node<K,V>[] tab, int hash) { int n, index; Node<K,V> e; if (tab == null || (n = tab.length) < MIN_TREEIFY_CAPACITY) resize(); else if ((e = tab[index = (n - 1) & hash]) != null) { TreeNode<K,V> hd = null, tl = null; do { TreeNode<K,V> p = replacementTreeNode(e, null); if (tl == null) hd = p; else { p.prev = tl; tl.next = p; } tl = p; } while ((e = e.next) != null); if ((tab[index] = hd) != null) hd.treeify(tab); } }
[ "final", "void", "treeifyBin", "(", "Node", "<", "K", ",", "V", ">", "[", "]", "tab", ",", "int", "hash", ")", "{", "int", "n", ",", "index", ";", "Node", "<", "K", ",", "V", ">", "e", ";", "if", "(", "tab", "==", "null", "||", "(", "n", "=", "tab", ".", "length", ")", "<", "MIN_TREEIFY_CAPACITY", ")", "resize", "(", ")", ";", "else", "if", "(", "(", "e", "=", "tab", "[", "index", "=", "(", "n", "-", "1", ")", "&", "hash", "]", ")", "!=", "null", ")", "{", "TreeNode", "<", "K", ",", "V", ">", "hd", "=", "null", ",", "tl", "=", "null", ";", "do", "{", "TreeNode", "<", "K", ",", "V", ">", "p", "=", "replacementTreeNode", "(", "e", ",", "null", ")", ";", "if", "(", "tl", "==", "null", ")", "hd", "=", "p", ";", "else", "{", "p", ".", "prev", "=", "tl", ";", "tl", ".", "next", "=", "p", ";", "}", "tl", "=", "p", ";", "}", "while", "(", "(", "e", "=", "e", ".", "next", ")", "!=", "null", ")", ";", "if", "(", "(", "tab", "[", "index", "]", "=", "hd", ")", "!=", "null", ")", "hd", ".", "treeify", "(", "tab", ")", ";", "}", "}" ]
Replaces all linked nodes in bin at index for given hash unless table is too small, in which case resizes instead.
[ "Replaces", "all", "linked", "nodes", "in", "bin", "at", "index", "for", "given", "hash", "unless", "table", "is", "too", "small", "in", "which", "case", "resizes", "instead", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java#L760-L779
mediathekview/MServer
src/main/java/mServer/tool/MserverDatumZeit.java
MserverDatumZeit.formatDate
public static String formatDate(String dateValue, FastDateFormat sdf) { """ formats a date/datetime string to the date format used in DatenFilm @param dateValue the date/datetime value @param sdf the format of dateValue @return the formatted date string """ try { return FDF_OUT_DAY.format(sdf.parse(dateValue)); } catch (ParseException ex) { LOG.debug(String.format("Fehler beim Parsen des Datums %s: %s", dateValue, ex.getMessage())); } return ""; }
java
public static String formatDate(String dateValue, FastDateFormat sdf) { try { return FDF_OUT_DAY.format(sdf.parse(dateValue)); } catch (ParseException ex) { LOG.debug(String.format("Fehler beim Parsen des Datums %s: %s", dateValue, ex.getMessage())); } return ""; }
[ "public", "static", "String", "formatDate", "(", "String", "dateValue", ",", "FastDateFormat", "sdf", ")", "{", "try", "{", "return", "FDF_OUT_DAY", ".", "format", "(", "sdf", ".", "parse", "(", "dateValue", ")", ")", ";", "}", "catch", "(", "ParseException", "ex", ")", "{", "LOG", ".", "debug", "(", "String", ".", "format", "(", "\"Fehler beim Parsen des Datums %s: %s\"", ",", "dateValue", ",", "ex", ".", "getMessage", "(", ")", ")", ")", ";", "}", "return", "\"\"", ";", "}" ]
formats a date/datetime string to the date format used in DatenFilm @param dateValue the date/datetime value @param sdf the format of dateValue @return the formatted date string
[ "formats", "a", "date", "/", "datetime", "string", "to", "the", "date", "format", "used", "in", "DatenFilm" ]
train
https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/tool/MserverDatumZeit.java#L82-L90
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalInfo.java
DateIntervalInfo.genPatternInfo
@Deprecated public static PatternInfo genPatternInfo(String intervalPattern, boolean laterDateFirst) { """ Break interval patterns as 2 part and save them into pattern info. @param intervalPattern interval pattern @param laterDateFirst whether the first date in intervalPattern is earlier date or later date @return pattern info object @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android """ int splitPoint = splitPatternInto2Part(intervalPattern); String firstPart = intervalPattern.substring(0, splitPoint); String secondPart = null; if ( splitPoint < intervalPattern.length() ) { secondPart = intervalPattern.substring(splitPoint, intervalPattern.length()); } return new PatternInfo(firstPart, secondPart, laterDateFirst); }
java
@Deprecated public static PatternInfo genPatternInfo(String intervalPattern, boolean laterDateFirst) { int splitPoint = splitPatternInto2Part(intervalPattern); String firstPart = intervalPattern.substring(0, splitPoint); String secondPart = null; if ( splitPoint < intervalPattern.length() ) { secondPart = intervalPattern.substring(splitPoint, intervalPattern.length()); } return new PatternInfo(firstPart, secondPart, laterDateFirst); }
[ "@", "Deprecated", "public", "static", "PatternInfo", "genPatternInfo", "(", "String", "intervalPattern", ",", "boolean", "laterDateFirst", ")", "{", "int", "splitPoint", "=", "splitPatternInto2Part", "(", "intervalPattern", ")", ";", "String", "firstPart", "=", "intervalPattern", ".", "substring", "(", "0", ",", "splitPoint", ")", ";", "String", "secondPart", "=", "null", ";", "if", "(", "splitPoint", "<", "intervalPattern", ".", "length", "(", ")", ")", "{", "secondPart", "=", "intervalPattern", ".", "substring", "(", "splitPoint", ",", "intervalPattern", ".", "length", "(", ")", ")", ";", "}", "return", "new", "PatternInfo", "(", "firstPart", ",", "secondPart", ",", "laterDateFirst", ")", ";", "}" ]
Break interval patterns as 2 part and save them into pattern info. @param intervalPattern interval pattern @param laterDateFirst whether the first date in intervalPattern is earlier date or later date @return pattern info object @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Break", "interval", "patterns", "as", "2", "part", "and", "save", "them", "into", "pattern", "info", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalInfo.java#L818-L830
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java
AgentProperties.readIaasProperties
public static AgentProperties readIaasProperties( String rawProperties, Logger logger ) throws IOException { """ Creates a new bean from raw properties that will be parsed. @param rawProperties a non-null string @param logger a logger (not null) @return a non-null bean @throws IOException if there were files that failed to be written """ Properties props = Utils.readPropertiesQuietly( rawProperties, logger ); return readIaasProperties( props ); }
java
public static AgentProperties readIaasProperties( String rawProperties, Logger logger ) throws IOException { Properties props = Utils.readPropertiesQuietly( rawProperties, logger ); return readIaasProperties( props ); }
[ "public", "static", "AgentProperties", "readIaasProperties", "(", "String", "rawProperties", ",", "Logger", "logger", ")", "throws", "IOException", "{", "Properties", "props", "=", "Utils", ".", "readPropertiesQuietly", "(", "rawProperties", ",", "logger", ")", ";", "return", "readIaasProperties", "(", "props", ")", ";", "}" ]
Creates a new bean from raw properties that will be parsed. @param rawProperties a non-null string @param logger a logger (not null) @return a non-null bean @throws IOException if there were files that failed to be written
[ "Creates", "a", "new", "bean", "from", "raw", "properties", "that", "will", "be", "parsed", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/AgentProperties.java#L166-L170
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowControlContainerFactory.java
PageFlowControlContainerFactory.getControlContainer
public static synchronized PageFlowControlContainer getControlContainer(HttpServletRequest request, ServletContext servletContext) { """ This method will return the <code>PageFlowControlContainer</code> that is acting as the control container for the page flow runtime. @param request The current request @param servletContext The servlet context @return The <code>pageFLowControlContainer</code> acting as the control container. """ PageFlowControlContainer pfcc = (PageFlowControlContainer) getSessionVar(request, servletContext, PAGEFLOW_CONTROL_CONTAINER); if (pfcc != null) return pfcc; pfcc = new PageFlowControlContainerImpl(); setSessionVar(request,servletContext,PAGEFLOW_CONTROL_CONTAINER,pfcc); return pfcc; }
java
public static synchronized PageFlowControlContainer getControlContainer(HttpServletRequest request, ServletContext servletContext) { PageFlowControlContainer pfcc = (PageFlowControlContainer) getSessionVar(request, servletContext, PAGEFLOW_CONTROL_CONTAINER); if (pfcc != null) return pfcc; pfcc = new PageFlowControlContainerImpl(); setSessionVar(request,servletContext,PAGEFLOW_CONTROL_CONTAINER,pfcc); return pfcc; }
[ "public", "static", "synchronized", "PageFlowControlContainer", "getControlContainer", "(", "HttpServletRequest", "request", ",", "ServletContext", "servletContext", ")", "{", "PageFlowControlContainer", "pfcc", "=", "(", "PageFlowControlContainer", ")", "getSessionVar", "(", "request", ",", "servletContext", ",", "PAGEFLOW_CONTROL_CONTAINER", ")", ";", "if", "(", "pfcc", "!=", "null", ")", "return", "pfcc", ";", "pfcc", "=", "new", "PageFlowControlContainerImpl", "(", ")", ";", "setSessionVar", "(", "request", ",", "servletContext", ",", "PAGEFLOW_CONTROL_CONTAINER", ",", "pfcc", ")", ";", "return", "pfcc", ";", "}" ]
This method will return the <code>PageFlowControlContainer</code> that is acting as the control container for the page flow runtime. @param request The current request @param servletContext The servlet context @return The <code>pageFLowControlContainer</code> acting as the control container.
[ "This", "method", "will", "return", "the", "<code", ">", "PageFlowControlContainer<", "/", "code", ">", "that", "is", "acting", "as", "the", "control", "container", "for", "the", "page", "flow", "runtime", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowControlContainerFactory.java#L40-L49
Impetus/Kundera
src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClientFactory.java
OracleNoSQLClientFactory.populateIndexer
private void populateIndexer(String indexerClass, Client client) { """ Populates {@link Indexer} into {@link IndexManager} @param indexerClass @param client """ if (indexerClass != null && indexerClass.equals(OracleNoSQLInvertedIndexer.class.getName())) { ((OracleNoSQLInvertedIndexer) indexManager.getIndexer()).setKvStore(kvStore); ((OracleNoSQLInvertedIndexer) indexManager.getIndexer()).setHandler(((OracleNoSQLClient) client) .getHandler()); } }
java
private void populateIndexer(String indexerClass, Client client) { if (indexerClass != null && indexerClass.equals(OracleNoSQLInvertedIndexer.class.getName())) { ((OracleNoSQLInvertedIndexer) indexManager.getIndexer()).setKvStore(kvStore); ((OracleNoSQLInvertedIndexer) indexManager.getIndexer()).setHandler(((OracleNoSQLClient) client) .getHandler()); } }
[ "private", "void", "populateIndexer", "(", "String", "indexerClass", ",", "Client", "client", ")", "{", "if", "(", "indexerClass", "!=", "null", "&&", "indexerClass", ".", "equals", "(", "OracleNoSQLInvertedIndexer", ".", "class", ".", "getName", "(", ")", ")", ")", "{", "(", "(", "OracleNoSQLInvertedIndexer", ")", "indexManager", ".", "getIndexer", "(", ")", ")", ".", "setKvStore", "(", "kvStore", ")", ";", "(", "(", "OracleNoSQLInvertedIndexer", ")", "indexManager", ".", "getIndexer", "(", ")", ")", ".", "setHandler", "(", "(", "(", "OracleNoSQLClient", ")", "client", ")", ".", "getHandler", "(", ")", ")", ";", "}", "}" ]
Populates {@link Indexer} into {@link IndexManager} @param indexerClass @param client
[ "Populates", "{", "@link", "Indexer", "}", "into", "{", "@link", "IndexManager", "}" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClientFactory.java#L143-L151
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.listFirewallRulesWithServiceResponseAsync
public Observable<ServiceResponse<Page<FirewallRuleInner>>> listFirewallRulesWithServiceResponseAsync(final String resourceGroupName, final String accountName) { """ Lists the Data Lake Store firewall rules within the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account. @param accountName The name of the Data Lake Store account from which to get the firewall rules. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;FirewallRuleInner&gt; object """ return listFirewallRulesSinglePageAsync(resourceGroupName, accountName) .concatMap(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Observable<ServiceResponse<Page<FirewallRuleInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallRuleInner>>> call(ServiceResponse<Page<FirewallRuleInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listFirewallRulesNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<FirewallRuleInner>>> listFirewallRulesWithServiceResponseAsync(final String resourceGroupName, final String accountName) { return listFirewallRulesSinglePageAsync(resourceGroupName, accountName) .concatMap(new Func1<ServiceResponse<Page<FirewallRuleInner>>, Observable<ServiceResponse<Page<FirewallRuleInner>>>>() { @Override public Observable<ServiceResponse<Page<FirewallRuleInner>>> call(ServiceResponse<Page<FirewallRuleInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listFirewallRulesNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "FirewallRuleInner", ">", ">", ">", "listFirewallRulesWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ")", "{", "return", "listFirewallRulesSinglePageAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "FirewallRuleInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "FirewallRuleInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "FirewallRuleInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "FirewallRuleInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listFirewallRulesNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Lists the Data Lake Store firewall rules within the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account. @param accountName The name of the Data Lake Store account from which to get the firewall rules. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;FirewallRuleInner&gt; object
[ "Lists", "the", "Data", "Lake", "Store", "firewall", "rules", "within", "the", "specified", "Data", "Lake", "Store", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L392-L404
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java
JComponentFactory.newSplashScreen
public static SplashScreen newSplashScreen(final String image, final String text) { """ Factory method for create a {@link SplashScreen}. @param image the image @param text the text @return the new {@link SplashScreen}. """ final SplashScreen splashscreen = new SplashScreen(image, text); return splashscreen; }
java
public static SplashScreen newSplashScreen(final String image, final String text) { final SplashScreen splashscreen = new SplashScreen(image, text); return splashscreen; }
[ "public", "static", "SplashScreen", "newSplashScreen", "(", "final", "String", "image", ",", "final", "String", "text", ")", "{", "final", "SplashScreen", "splashscreen", "=", "new", "SplashScreen", "(", "image", ",", "text", ")", ";", "return", "splashscreen", ";", "}" ]
Factory method for create a {@link SplashScreen}. @param image the image @param text the text @return the new {@link SplashScreen}.
[ "Factory", "method", "for", "create", "a", "{", "@link", "SplashScreen", "}", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java#L298-L302
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakeLine.java
ST_MakeLine.createLine
public static LineString createLine(Geometry pointA, Geometry... optionalPoints) throws SQLException { """ Constructs a LINESTRING from the given POINTs or MULTIPOINTs @param pointA The first POINT or MULTIPOINT @param optionalPoints Optional POINTs or MULTIPOINTs @return The LINESTRING constructed from the given POINTs or MULTIPOINTs @throws SQLException """ if( pointA == null || optionalPoints.length > 0 && optionalPoints[0] == null) { return null; } if (pointA.getNumGeometries() == 1 && !atLeastTwoPoints(optionalPoints, countPoints(pointA))) { throw new SQLException("At least two points are required to make a line."); } List<Coordinate> coordinateList = new LinkedList<Coordinate>(); addCoordinatesToList(pointA, coordinateList); for (Geometry optionalPoint : optionalPoints) { addCoordinatesToList(optionalPoint, coordinateList); } return ((Geometry) pointA).getFactory().createLineString( coordinateList.toArray(new Coordinate[optionalPoints.length])); }
java
public static LineString createLine(Geometry pointA, Geometry... optionalPoints) throws SQLException { if( pointA == null || optionalPoints.length > 0 && optionalPoints[0] == null) { return null; } if (pointA.getNumGeometries() == 1 && !atLeastTwoPoints(optionalPoints, countPoints(pointA))) { throw new SQLException("At least two points are required to make a line."); } List<Coordinate> coordinateList = new LinkedList<Coordinate>(); addCoordinatesToList(pointA, coordinateList); for (Geometry optionalPoint : optionalPoints) { addCoordinatesToList(optionalPoint, coordinateList); } return ((Geometry) pointA).getFactory().createLineString( coordinateList.toArray(new Coordinate[optionalPoints.length])); }
[ "public", "static", "LineString", "createLine", "(", "Geometry", "pointA", ",", "Geometry", "...", "optionalPoints", ")", "throws", "SQLException", "{", "if", "(", "pointA", "==", "null", "||", "optionalPoints", ".", "length", ">", "0", "&&", "optionalPoints", "[", "0", "]", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "pointA", ".", "getNumGeometries", "(", ")", "==", "1", "&&", "!", "atLeastTwoPoints", "(", "optionalPoints", ",", "countPoints", "(", "pointA", ")", ")", ")", "{", "throw", "new", "SQLException", "(", "\"At least two points are required to make a line.\"", ")", ";", "}", "List", "<", "Coordinate", ">", "coordinateList", "=", "new", "LinkedList", "<", "Coordinate", ">", "(", ")", ";", "addCoordinatesToList", "(", "pointA", ",", "coordinateList", ")", ";", "for", "(", "Geometry", "optionalPoint", ":", "optionalPoints", ")", "{", "addCoordinatesToList", "(", "optionalPoint", ",", "coordinateList", ")", ";", "}", "return", "(", "(", "Geometry", ")", "pointA", ")", ".", "getFactory", "(", ")", ".", "createLineString", "(", "coordinateList", ".", "toArray", "(", "new", "Coordinate", "[", "optionalPoints", ".", "length", "]", ")", ")", ";", "}" ]
Constructs a LINESTRING from the given POINTs or MULTIPOINTs @param pointA The first POINT or MULTIPOINT @param optionalPoints Optional POINTs or MULTIPOINTs @return The LINESTRING constructed from the given POINTs or MULTIPOINTs @throws SQLException
[ "Constructs", "a", "LINESTRING", "from", "the", "given", "POINTs", "or", "MULTIPOINTs" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakeLine.java#L57-L71
reactor/reactor-netty
src/main/java/reactor/netty/http/client/HttpClient.java
HttpClient.cookiesWhen
public final HttpClient cookiesWhen(String name, Function<? super Cookie, Mono<? extends Cookie>> cookieBuilder) { """ Apply cookies configuration emitted by the returned Mono before requesting. @param cookieBuilder the cookies {@link Function} to invoke before sending @return a new {@link HttpClient} """ return new HttpClientCookieWhen(this, name, cookieBuilder); }
java
public final HttpClient cookiesWhen(String name, Function<? super Cookie, Mono<? extends Cookie>> cookieBuilder) { return new HttpClientCookieWhen(this, name, cookieBuilder); }
[ "public", "final", "HttpClient", "cookiesWhen", "(", "String", "name", ",", "Function", "<", "?", "super", "Cookie", ",", "Mono", "<", "?", "extends", "Cookie", ">", ">", "cookieBuilder", ")", "{", "return", "new", "HttpClientCookieWhen", "(", "this", ",", "name", ",", "cookieBuilder", ")", ";", "}" ]
Apply cookies configuration emitted by the returned Mono before requesting. @param cookieBuilder the cookies {@link Function} to invoke before sending @return a new {@link HttpClient}
[ "Apply", "cookies", "configuration", "emitted", "by", "the", "returned", "Mono", "before", "requesting", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/http/client/HttpClient.java#L446-L448
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/GelfMessage.java
GelfMessage.toJson
public void toJson(ByteBuffer byteBuffer, String additionalFieldPrefix) { """ Create a JSON representation for this {@link GelfMessage} and write it to the {@link ByteBuffer}. Additional fields are prefixed with {@code additionalFieldPrefix}. @param byteBuffer must not be {@literal null} @param additionalFieldPrefix must not be {@literal null} """ toJson(OutputAccessor.from(byteBuffer), additionalFieldPrefix); }
java
public void toJson(ByteBuffer byteBuffer, String additionalFieldPrefix) { toJson(OutputAccessor.from(byteBuffer), additionalFieldPrefix); }
[ "public", "void", "toJson", "(", "ByteBuffer", "byteBuffer", ",", "String", "additionalFieldPrefix", ")", "{", "toJson", "(", "OutputAccessor", ".", "from", "(", "byteBuffer", ")", ",", "additionalFieldPrefix", ")", ";", "}" ]
Create a JSON representation for this {@link GelfMessage} and write it to the {@link ByteBuffer}. Additional fields are prefixed with {@code additionalFieldPrefix}. @param byteBuffer must not be {@literal null} @param additionalFieldPrefix must not be {@literal null}
[ "Create", "a", "JSON", "representation", "for", "this", "{", "@link", "GelfMessage", "}", "and", "write", "it", "to", "the", "{", "@link", "ByteBuffer", "}", ".", "Additional", "fields", "are", "prefixed", "with", "{", "@code", "additionalFieldPrefix", "}", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/GelfMessage.java#L142-L144
gallandarakhneorg/afc
advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java
RoadNetworkConstants.getSystemDefault
@Pure public static String getSystemDefault(TrafficDirection direction, int valueIndex) { """ Replies the system default string-value for the traffic direction, at the given index in the list of system default values. @param direction is the direction for which the string value should be replied @param valueIndex is the position of the string-value. @return the string-value at the given position, never <code>null</code> @throws IndexOutOfBoundsException is the given index is wrong. @throws IllegalArgumentException is the given direction is wrong. """ // Values from the IGN-BDCarto standard switch (direction) { case DOUBLE_WAY: switch (valueIndex) { case 0: return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_0; case 1: return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_1; default: throw new IndexOutOfBoundsException(); } case NO_ENTRY: switch (valueIndex) { case 0: return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_0; case 1: return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_1; default: throw new IndexOutOfBoundsException(); } case NO_WAY: switch (valueIndex) { case 0: return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_0; case 1: return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_1; default: throw new IndexOutOfBoundsException(); } case ONE_WAY: switch (valueIndex) { case 0: return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_0; case 1: return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_1; default: throw new IndexOutOfBoundsException(); } default: } throw new IllegalArgumentException(); }
java
@Pure public static String getSystemDefault(TrafficDirection direction, int valueIndex) { // Values from the IGN-BDCarto standard switch (direction) { case DOUBLE_WAY: switch (valueIndex) { case 0: return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_0; case 1: return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_1; default: throw new IndexOutOfBoundsException(); } case NO_ENTRY: switch (valueIndex) { case 0: return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_0; case 1: return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_1; default: throw new IndexOutOfBoundsException(); } case NO_WAY: switch (valueIndex) { case 0: return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_0; case 1: return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_1; default: throw new IndexOutOfBoundsException(); } case ONE_WAY: switch (valueIndex) { case 0: return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_0; case 1: return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_1; default: throw new IndexOutOfBoundsException(); } default: } throw new IllegalArgumentException(); }
[ "@", "Pure", "public", "static", "String", "getSystemDefault", "(", "TrafficDirection", "direction", ",", "int", "valueIndex", ")", "{", "// Values from the IGN-BDCarto standard", "switch", "(", "direction", ")", "{", "case", "DOUBLE_WAY", ":", "switch", "(", "valueIndex", ")", "{", "case", "0", ":", "return", "DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_0", ";", "case", "1", ":", "return", "DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_1", ";", "default", ":", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "case", "NO_ENTRY", ":", "switch", "(", "valueIndex", ")", "{", "case", "0", ":", "return", "DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_0", ";", "case", "1", ":", "return", "DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_1", ";", "default", ":", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "case", "NO_WAY", ":", "switch", "(", "valueIndex", ")", "{", "case", "0", ":", "return", "DEFAULT_NO_WAY_TRAFFIC_DIRECTION_0", ";", "case", "1", ":", "return", "DEFAULT_NO_WAY_TRAFFIC_DIRECTION_1", ";", "default", ":", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "case", "ONE_WAY", ":", "switch", "(", "valueIndex", ")", "{", "case", "0", ":", "return", "DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_0", ";", "case", "1", ":", "return", "DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_1", ";", "default", ":", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "default", ":", "}", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}" ]
Replies the system default string-value for the traffic direction, at the given index in the list of system default values. @param direction is the direction for which the string value should be replied @param valueIndex is the position of the string-value. @return the string-value at the given position, never <code>null</code> @throws IndexOutOfBoundsException is the given index is wrong. @throws IllegalArgumentException is the given direction is wrong.
[ "Replies", "the", "system", "default", "string", "-", "value", "for", "the", "traffic", "direction", "at", "the", "given", "index", "in", "the", "list", "of", "system", "default", "values", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L441-L484
RestComm/Restcomm-Connect
restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/SecurityFilter.java
SecurityFilter.filter
@Override public ContainerRequest filter(ContainerRequest cr) { """ We return Access-* headers only in case allowedOrigin is present and equals to the 'Origin' header. """ final DaoManager storage = (DaoManager) servletRequest.getServletContext().getAttribute(DaoManager.class.getName()); AccountsDao accountsDao = storage.getAccountsDao(); UserIdentityContext userIdentityContext = new UserIdentityContext(servletRequest, accountsDao); // exclude recording file https://telestax.atlassian.net/browse/RESTCOMM-1736 logger.info("cr.getPath(): " + cr.getPath()); if (!isUnprotected(cr)) { checkAuthenticatedAccount(userIdentityContext); filterClosedAccounts(userIdentityContext, cr.getPath()); //TODO temporarely disable organization domain validation - https://telestax.atlassian.net/browse/BS-408 // validateOrganizationAccess(userIdentityContext, storage, cr); } String scheme = cr.getAuthenticationScheme(); AccountPrincipal aPrincipal = new AccountPrincipal(userIdentityContext); cr.setSecurityContext(new RCSecContext(aPrincipal, scheme)); return cr; }
java
@Override public ContainerRequest filter(ContainerRequest cr) { final DaoManager storage = (DaoManager) servletRequest.getServletContext().getAttribute(DaoManager.class.getName()); AccountsDao accountsDao = storage.getAccountsDao(); UserIdentityContext userIdentityContext = new UserIdentityContext(servletRequest, accountsDao); // exclude recording file https://telestax.atlassian.net/browse/RESTCOMM-1736 logger.info("cr.getPath(): " + cr.getPath()); if (!isUnprotected(cr)) { checkAuthenticatedAccount(userIdentityContext); filterClosedAccounts(userIdentityContext, cr.getPath()); //TODO temporarely disable organization domain validation - https://telestax.atlassian.net/browse/BS-408 // validateOrganizationAccess(userIdentityContext, storage, cr); } String scheme = cr.getAuthenticationScheme(); AccountPrincipal aPrincipal = new AccountPrincipal(userIdentityContext); cr.setSecurityContext(new RCSecContext(aPrincipal, scheme)); return cr; }
[ "@", "Override", "public", "ContainerRequest", "filter", "(", "ContainerRequest", "cr", ")", "{", "final", "DaoManager", "storage", "=", "(", "DaoManager", ")", "servletRequest", ".", "getServletContext", "(", ")", ".", "getAttribute", "(", "DaoManager", ".", "class", ".", "getName", "(", ")", ")", ";", "AccountsDao", "accountsDao", "=", "storage", ".", "getAccountsDao", "(", ")", ";", "UserIdentityContext", "userIdentityContext", "=", "new", "UserIdentityContext", "(", "servletRequest", ",", "accountsDao", ")", ";", "// exclude recording file https://telestax.atlassian.net/browse/RESTCOMM-1736", "logger", ".", "info", "(", "\"cr.getPath(): \"", "+", "cr", ".", "getPath", "(", ")", ")", ";", "if", "(", "!", "isUnprotected", "(", "cr", ")", ")", "{", "checkAuthenticatedAccount", "(", "userIdentityContext", ")", ";", "filterClosedAccounts", "(", "userIdentityContext", ",", "cr", ".", "getPath", "(", ")", ")", ";", "//TODO temporarely disable organization domain validation - https://telestax.atlassian.net/browse/BS-408", "// validateOrganizationAccess(userIdentityContext, storage, cr);", "}", "String", "scheme", "=", "cr", ".", "getAuthenticationScheme", "(", ")", ";", "AccountPrincipal", "aPrincipal", "=", "new", "AccountPrincipal", "(", "userIdentityContext", ")", ";", "cr", ".", "setSecurityContext", "(", "new", "RCSecContext", "(", "aPrincipal", ",", "scheme", ")", ")", ";", "return", "cr", ";", "}" ]
We return Access-* headers only in case allowedOrigin is present and equals to the 'Origin' header.
[ "We", "return", "Access", "-", "*", "headers", "only", "in", "case", "allowedOrigin", "is", "present", "and", "equals", "to", "the", "Origin", "header", "." ]
train
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/SecurityFilter.java#L61-L78
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.moveChild
protected void moveChild(BaseUIComponent child, BaseUIComponent before) { """ Moves a child to before another component. @param child Child to move @param before Move child to this component. """ child.getParent().addChild(child, before); }
java
protected void moveChild(BaseUIComponent child, BaseUIComponent before) { child.getParent().addChild(child, before); }
[ "protected", "void", "moveChild", "(", "BaseUIComponent", "child", ",", "BaseUIComponent", "before", ")", "{", "child", ".", "getParent", "(", ")", ".", "addChild", "(", "child", ",", "before", ")", ";", "}" ]
Moves a child to before another component. @param child Child to move @param before Move child to this component.
[ "Moves", "a", "child", "to", "before", "another", "component", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L763-L765
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/lock/LockSession.java
LockSession.getLockTable
public LockTable getLockTable(String strDatabaseName, String strRecordName) { """ Get the lock table for this record. @param strRecordName The record to look up. @return The lock table for this record (create if it doesn't exist). """ String strKey = strDatabaseName + ':' + strRecordName; LockTable lockTable = (LockTable)m_htLockTables.get(strKey); if (lockTable == null) { synchronized (m_htLockTables) { if ((lockTable = (LockTable)m_htLockTables.get(strKey)) == null) m_htLockTables.put(strKey, lockTable = new LockTable()); } m_hsMyLockTables.add(lockTable); // Keep track of the lock tables that I used } return lockTable; }
java
public LockTable getLockTable(String strDatabaseName, String strRecordName) { String strKey = strDatabaseName + ':' + strRecordName; LockTable lockTable = (LockTable)m_htLockTables.get(strKey); if (lockTable == null) { synchronized (m_htLockTables) { if ((lockTable = (LockTable)m_htLockTables.get(strKey)) == null) m_htLockTables.put(strKey, lockTable = new LockTable()); } m_hsMyLockTables.add(lockTable); // Keep track of the lock tables that I used } return lockTable; }
[ "public", "LockTable", "getLockTable", "(", "String", "strDatabaseName", ",", "String", "strRecordName", ")", "{", "String", "strKey", "=", "strDatabaseName", "+", "'", "'", "+", "strRecordName", ";", "LockTable", "lockTable", "=", "(", "LockTable", ")", "m_htLockTables", ".", "get", "(", "strKey", ")", ";", "if", "(", "lockTable", "==", "null", ")", "{", "synchronized", "(", "m_htLockTables", ")", "{", "if", "(", "(", "lockTable", "=", "(", "LockTable", ")", "m_htLockTables", ".", "get", "(", "strKey", ")", ")", "==", "null", ")", "m_htLockTables", ".", "put", "(", "strKey", ",", "lockTable", "=", "new", "LockTable", "(", ")", ")", ";", "}", "m_hsMyLockTables", ".", "add", "(", "lockTable", ")", ";", "// Keep track of the lock tables that I used", "}", "return", "lockTable", ";", "}" ]
Get the lock table for this record. @param strRecordName The record to look up. @return The lock table for this record (create if it doesn't exist).
[ "Get", "the", "lock", "table", "for", "this", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/lock/LockSession.java#L181-L195
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java
Collator.getDisplayName
static public String getDisplayName(Locale objectLocale, Locale displayLocale) { """ <strong>[icu]</strong> Returns the name of the collator for the objectLocale, localized for the displayLocale. @param objectLocale the locale of the collator @param displayLocale the locale for the collator's display name @return the display name """ return getShim().getDisplayName(ULocale.forLocale(objectLocale), ULocale.forLocale(displayLocale)); }
java
static public String getDisplayName(Locale objectLocale, Locale displayLocale) { return getShim().getDisplayName(ULocale.forLocale(objectLocale), ULocale.forLocale(displayLocale)); }
[ "static", "public", "String", "getDisplayName", "(", "Locale", "objectLocale", ",", "Locale", "displayLocale", ")", "{", "return", "getShim", "(", ")", ".", "getDisplayName", "(", "ULocale", ".", "forLocale", "(", "objectLocale", ")", ",", "ULocale", ".", "forLocale", "(", "displayLocale", ")", ")", ";", "}" ]
<strong>[icu]</strong> Returns the name of the collator for the objectLocale, localized for the displayLocale. @param objectLocale the locale of the collator @param displayLocale the locale for the collator's display name @return the display name
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "the", "name", "of", "the", "collator", "for", "the", "objectLocale", "localized", "for", "the", "displayLocale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java#L1060-L1063
amsa-code/risky
ais/src/main/java/au/gov/amsa/util/nmea/NmeaMessageParser.java
NmeaMessageParser.parse
public NmeaMessage parse(String line) { """ Return an {@link NmeaMessage} from the given NMEA line. @param line @return """ LinkedHashMap<String, String> tags = Maps.newLinkedHashMap(); String remaining; if (line.startsWith("\\")) { int tagFinish = line.lastIndexOf('\\', line.length() - 1); if (tagFinish == -1) throw new NmeaMessageParseException( "no matching \\ symbol to finish tag block: " + line); if (tagFinish == 0) throw new NmeaMessageParseException("tag block is empty or not terminated"); tags = extractTags(line.substring(1, tagFinish)); remaining = line.substring(tagFinish + 1); } else remaining = line; String[] items; String checksum; if (remaining.length() > 0) { if (!remaining.contains("*")) throw new NmeaMessageParseException("checksum delimiter * not found"); items = getNmeaItems(remaining); // TODO validate message using checksum checksum = line.substring(line.indexOf('*') + 1); } else { items = new String[] {}; // TODO decide what value to put here checksum = ""; } return new NmeaMessage(tags, Arrays.asList(items), checksum); }
java
public NmeaMessage parse(String line) { LinkedHashMap<String, String> tags = Maps.newLinkedHashMap(); String remaining; if (line.startsWith("\\")) { int tagFinish = line.lastIndexOf('\\', line.length() - 1); if (tagFinish == -1) throw new NmeaMessageParseException( "no matching \\ symbol to finish tag block: " + line); if (tagFinish == 0) throw new NmeaMessageParseException("tag block is empty or not terminated"); tags = extractTags(line.substring(1, tagFinish)); remaining = line.substring(tagFinish + 1); } else remaining = line; String[] items; String checksum; if (remaining.length() > 0) { if (!remaining.contains("*")) throw new NmeaMessageParseException("checksum delimiter * not found"); items = getNmeaItems(remaining); // TODO validate message using checksum checksum = line.substring(line.indexOf('*') + 1); } else { items = new String[] {}; // TODO decide what value to put here checksum = ""; } return new NmeaMessage(tags, Arrays.asList(items), checksum); }
[ "public", "NmeaMessage", "parse", "(", "String", "line", ")", "{", "LinkedHashMap", "<", "String", ",", "String", ">", "tags", "=", "Maps", ".", "newLinkedHashMap", "(", ")", ";", "String", "remaining", ";", "if", "(", "line", ".", "startsWith", "(", "\"\\\\\"", ")", ")", "{", "int", "tagFinish", "=", "line", ".", "lastIndexOf", "(", "'", "'", ",", "line", ".", "length", "(", ")", "-", "1", ")", ";", "if", "(", "tagFinish", "==", "-", "1", ")", "throw", "new", "NmeaMessageParseException", "(", "\"no matching \\\\ symbol to finish tag block: \"", "+", "line", ")", ";", "if", "(", "tagFinish", "==", "0", ")", "throw", "new", "NmeaMessageParseException", "(", "\"tag block is empty or not terminated\"", ")", ";", "tags", "=", "extractTags", "(", "line", ".", "substring", "(", "1", ",", "tagFinish", ")", ")", ";", "remaining", "=", "line", ".", "substring", "(", "tagFinish", "+", "1", ")", ";", "}", "else", "remaining", "=", "line", ";", "String", "[", "]", "items", ";", "String", "checksum", ";", "if", "(", "remaining", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "!", "remaining", ".", "contains", "(", "\"*\"", ")", ")", "throw", "new", "NmeaMessageParseException", "(", "\"checksum delimiter * not found\"", ")", ";", "items", "=", "getNmeaItems", "(", "remaining", ")", ";", "// TODO validate message using checksum", "checksum", "=", "line", ".", "substring", "(", "line", ".", "indexOf", "(", "'", "'", ")", "+", "1", ")", ";", "}", "else", "{", "items", "=", "new", "String", "[", "]", "{", "}", ";", "// TODO decide what value to put here", "checksum", "=", "\"\"", ";", "}", "return", "new", "NmeaMessage", "(", "tags", ",", "Arrays", ".", "asList", "(", "items", ")", ",", "checksum", ")", ";", "}" ]
Return an {@link NmeaMessage} from the given NMEA line. @param line @return
[ "Return", "an", "{", "@link", "NmeaMessage", "}", "from", "the", "given", "NMEA", "line", "." ]
train
https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/ais/src/main/java/au/gov/amsa/util/nmea/NmeaMessageParser.java#L26-L57
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java
ToStream.startDTD
public void startDTD(String name, String publicId, String systemId) throws org.xml.sax.SAXException { """ Report the start of DTD declarations, if any. Any declarations are assumed to be in the internal subset unless otherwise indicated. @param name The document type name. @param publicId The declared public identifier for the external DTD subset, or null if none was declared. @param systemId The declared system identifier for the external DTD subset, or null if none was declared. @throws org.xml.sax.SAXException The application may raise an exception. @see #endDTD @see #startEntity """ setDoctypeSystem(systemId); setDoctypePublic(publicId); m_elemContext.m_elementName = name; m_inDoctype = true; }
java
public void startDTD(String name, String publicId, String systemId) throws org.xml.sax.SAXException { setDoctypeSystem(systemId); setDoctypePublic(publicId); m_elemContext.m_elementName = name; m_inDoctype = true; }
[ "public", "void", "startDTD", "(", "String", "name", ",", "String", "publicId", ",", "String", "systemId", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "setDoctypeSystem", "(", "systemId", ")", ";", "setDoctypePublic", "(", "publicId", ")", ";", "m_elemContext", ".", "m_elementName", "=", "name", ";", "m_inDoctype", "=", "true", ";", "}" ]
Report the start of DTD declarations, if any. Any declarations are assumed to be in the internal subset unless otherwise indicated. @param name The document type name. @param publicId The declared public identifier for the external DTD subset, or null if none was declared. @param systemId The declared system identifier for the external DTD subset, or null if none was declared. @throws org.xml.sax.SAXException The application may raise an exception. @see #endDTD @see #startEntity
[ "Report", "the", "start", "of", "DTD", "declarations", "if", "any", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L2666-L2674
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.propertiesConstraint
public StructuredQueryDefinition propertiesConstraint(String constraintName, StructuredQueryDefinition query) { """ Associates a query with the properties of documents (as opposed to the content of documents) with the specified constraint. @param constraintName the constraint definition @param query the query definition @return the StructuredQueryDefinition for the properties constraint query """ checkQuery(query); return new PropertiesConstraintQuery(constraintName, query); }
java
public StructuredQueryDefinition propertiesConstraint(String constraintName, StructuredQueryDefinition query) { checkQuery(query); return new PropertiesConstraintQuery(constraintName, query); }
[ "public", "StructuredQueryDefinition", "propertiesConstraint", "(", "String", "constraintName", ",", "StructuredQueryDefinition", "query", ")", "{", "checkQuery", "(", "query", ")", ";", "return", "new", "PropertiesConstraintQuery", "(", "constraintName", ",", "query", ")", ";", "}" ]
Associates a query with the properties of documents (as opposed to the content of documents) with the specified constraint. @param constraintName the constraint definition @param query the query definition @return the StructuredQueryDefinition for the properties constraint query
[ "Associates", "a", "query", "with", "the", "properties", "of", "documents", "(", "as", "opposed", "to", "the", "content", "of", "documents", ")", "with", "the", "specified", "constraint", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L1009-L1012
fabric8io/kubernetes-client
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/internal/KubeConfigUtils.java
KubeConfigUtils.getUserAuthInfo
public static AuthInfo getUserAuthInfo(Config config, Context context) { """ Returns the current {@link AuthInfo} for the current context and user @param config Config object @param context Context object @return {@link AuthInfo} for current context """ AuthInfo authInfo = null; if (config != null && context != null) { String user = context.getUser(); if (user != null) { List<NamedAuthInfo> users = config.getUsers(); if (users != null) { for (NamedAuthInfo namedAuthInfo : users) { if (user.equals(namedAuthInfo.getName())) { authInfo = namedAuthInfo.getUser(); } } } } } return authInfo; }
java
public static AuthInfo getUserAuthInfo(Config config, Context context) { AuthInfo authInfo = null; if (config != null && context != null) { String user = context.getUser(); if (user != null) { List<NamedAuthInfo> users = config.getUsers(); if (users != null) { for (NamedAuthInfo namedAuthInfo : users) { if (user.equals(namedAuthInfo.getName())) { authInfo = namedAuthInfo.getUser(); } } } } } return authInfo; }
[ "public", "static", "AuthInfo", "getUserAuthInfo", "(", "Config", "config", ",", "Context", "context", ")", "{", "AuthInfo", "authInfo", "=", "null", ";", "if", "(", "config", "!=", "null", "&&", "context", "!=", "null", ")", "{", "String", "user", "=", "context", ".", "getUser", "(", ")", ";", "if", "(", "user", "!=", "null", ")", "{", "List", "<", "NamedAuthInfo", ">", "users", "=", "config", ".", "getUsers", "(", ")", ";", "if", "(", "users", "!=", "null", ")", "{", "for", "(", "NamedAuthInfo", "namedAuthInfo", ":", "users", ")", "{", "if", "(", "user", ".", "equals", "(", "namedAuthInfo", ".", "getName", "(", ")", ")", ")", "{", "authInfo", "=", "namedAuthInfo", ".", "getUser", "(", ")", ";", "}", "}", "}", "}", "}", "return", "authInfo", ";", "}" ]
Returns the current {@link AuthInfo} for the current context and user @param config Config object @param context Context object @return {@link AuthInfo} for current context
[ "Returns", "the", "current", "{", "@link", "AuthInfo", "}", "for", "the", "current", "context", "and", "user" ]
train
https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/internal/KubeConfigUtils.java#L93-L109
leadware/jpersistence-tools
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
DAOValidatorHelper.isExpressionContainPattern
public static boolean isExpressionContainPattern(String expression, String pattern) { """ Methode permettant de verifier si un chemin contient des Fonctions @param expression Chaine a controler @param pattern expression de la fonction @return Resultat de la verification """ try { // Si la chaine est vide : false if(expression == null || expression.trim().length() == 0) { // On retourne false return false; } // Construction d'un Pattern Pattern regex = Pattern.compile(".*" + pattern + ".*"); // On retourne le resultat return regex.matcher(expression).matches(); } catch (PatternSyntaxException e) { // On leve l'exception relative throw new RuntimeException(pattern, e); } }
java
public static boolean isExpressionContainPattern(String expression, String pattern) { try { // Si la chaine est vide : false if(expression == null || expression.trim().length() == 0) { // On retourne false return false; } // Construction d'un Pattern Pattern regex = Pattern.compile(".*" + pattern + ".*"); // On retourne le resultat return regex.matcher(expression).matches(); } catch (PatternSyntaxException e) { // On leve l'exception relative throw new RuntimeException(pattern, e); } }
[ "public", "static", "boolean", "isExpressionContainPattern", "(", "String", "expression", ",", "String", "pattern", ")", "{", "try", "{", "// Si la chaine est vide : false\r", "if", "(", "expression", "==", "null", "||", "expression", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "// On retourne false\r", "return", "false", ";", "}", "// Construction d'un Pattern\r", "Pattern", "regex", "=", "Pattern", ".", "compile", "(", "\".*\"", "+", "pattern", "+", "\".*\"", ")", ";", "// On retourne le resultat\r", "return", "regex", ".", "matcher", "(", "expression", ")", ".", "matches", "(", ")", ";", "}", "catch", "(", "PatternSyntaxException", "e", ")", "{", "// On leve l'exception relative\r", "throw", "new", "RuntimeException", "(", "pattern", ",", "e", ")", ";", "}", "}" ]
Methode permettant de verifier si un chemin contient des Fonctions @param expression Chaine a controler @param pattern expression de la fonction @return Resultat de la verification
[ "Methode", "permettant", "de", "verifier", "si", "un", "chemin", "contient", "des", "Fonctions" ]
train
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L573-L595
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/file/PathOperations.java
PathOperations.renameFile
@Nonnull public static FileIOError renameFile (@Nonnull final Path aSourceFile, @Nonnull final Path aTargetFile) { """ Rename a file. @param aSourceFile The original file name. May not be <code>null</code>. @param aTargetFile The destination file name. May not be <code>null</code>. @return A non-<code>null</code> error code. """ ValueEnforcer.notNull (aSourceFile, "SourceFile"); ValueEnforcer.notNull (aTargetFile, "TargetFile"); final Path aRealSourceFile = _getUnifiedPath (aSourceFile); final Path aRealTargetFile = _getUnifiedPath (aTargetFile); // Does the source file exist? if (!aRealSourceFile.toFile ().isFile ()) return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile); // Are source and target different? if (EqualsHelper.equals (aRealSourceFile, aRealTargetFile)) return EFileIOErrorCode.SOURCE_EQUALS_TARGET.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile); // Does the target file already exist? if (aRealTargetFile.toFile ().exists ()) return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.RENAME_FILE, aRealTargetFile); // Is the source parent directory writable? final Path aSourceParentDir = aRealSourceFile.getParent (); if (aSourceParentDir != null && !Files.isWritable (aSourceParentDir)) return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile); // Is the target parent directory writable? final Path aTargetParentDir = aRealTargetFile.getParent (); if (aTargetParentDir != null && aTargetParentDir.toFile ().exists () && !Files.isWritable (aTargetParentDir)) return EFileIOErrorCode.TARGET_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aRealTargetFile); // Ensure parent of target directory is present PathHelper.ensureParentDirectoryIsPresent (aRealTargetFile); return _perform (EFileIOOperation.RENAME_FILE, PathOperations::_atomicMove, aRealSourceFile, aRealTargetFile); }
java
@Nonnull public static FileIOError renameFile (@Nonnull final Path aSourceFile, @Nonnull final Path aTargetFile) { ValueEnforcer.notNull (aSourceFile, "SourceFile"); ValueEnforcer.notNull (aTargetFile, "TargetFile"); final Path aRealSourceFile = _getUnifiedPath (aSourceFile); final Path aRealTargetFile = _getUnifiedPath (aTargetFile); // Does the source file exist? if (!aRealSourceFile.toFile ().isFile ()) return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile); // Are source and target different? if (EqualsHelper.equals (aRealSourceFile, aRealTargetFile)) return EFileIOErrorCode.SOURCE_EQUALS_TARGET.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile); // Does the target file already exist? if (aRealTargetFile.toFile ().exists ()) return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.RENAME_FILE, aRealTargetFile); // Is the source parent directory writable? final Path aSourceParentDir = aRealSourceFile.getParent (); if (aSourceParentDir != null && !Files.isWritable (aSourceParentDir)) return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile); // Is the target parent directory writable? final Path aTargetParentDir = aRealTargetFile.getParent (); if (aTargetParentDir != null && aTargetParentDir.toFile ().exists () && !Files.isWritable (aTargetParentDir)) return EFileIOErrorCode.TARGET_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aRealTargetFile); // Ensure parent of target directory is present PathHelper.ensureParentDirectoryIsPresent (aRealTargetFile); return _perform (EFileIOOperation.RENAME_FILE, PathOperations::_atomicMove, aRealSourceFile, aRealTargetFile); }
[ "@", "Nonnull", "public", "static", "FileIOError", "renameFile", "(", "@", "Nonnull", "final", "Path", "aSourceFile", ",", "@", "Nonnull", "final", "Path", "aTargetFile", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aSourceFile", ",", "\"SourceFile\"", ")", ";", "ValueEnforcer", ".", "notNull", "(", "aTargetFile", ",", "\"TargetFile\"", ")", ";", "final", "Path", "aRealSourceFile", "=", "_getUnifiedPath", "(", "aSourceFile", ")", ";", "final", "Path", "aRealTargetFile", "=", "_getUnifiedPath", "(", "aTargetFile", ")", ";", "// Does the source file exist?", "if", "(", "!", "aRealSourceFile", ".", "toFile", "(", ")", ".", "isFile", "(", ")", ")", "return", "EFileIOErrorCode", ".", "SOURCE_DOES_NOT_EXIST", ".", "getAsIOError", "(", "EFileIOOperation", ".", "RENAME_FILE", ",", "aRealSourceFile", ")", ";", "// Are source and target different?", "if", "(", "EqualsHelper", ".", "equals", "(", "aRealSourceFile", ",", "aRealTargetFile", ")", ")", "return", "EFileIOErrorCode", ".", "SOURCE_EQUALS_TARGET", ".", "getAsIOError", "(", "EFileIOOperation", ".", "RENAME_FILE", ",", "aRealSourceFile", ")", ";", "// Does the target file already exist?", "if", "(", "aRealTargetFile", ".", "toFile", "(", ")", ".", "exists", "(", ")", ")", "return", "EFileIOErrorCode", ".", "TARGET_ALREADY_EXISTS", ".", "getAsIOError", "(", "EFileIOOperation", ".", "RENAME_FILE", ",", "aRealTargetFile", ")", ";", "// Is the source parent directory writable?", "final", "Path", "aSourceParentDir", "=", "aRealSourceFile", ".", "getParent", "(", ")", ";", "if", "(", "aSourceParentDir", "!=", "null", "&&", "!", "Files", ".", "isWritable", "(", "aSourceParentDir", ")", ")", "return", "EFileIOErrorCode", ".", "SOURCE_PARENT_NOT_WRITABLE", ".", "getAsIOError", "(", "EFileIOOperation", ".", "RENAME_FILE", ",", "aRealSourceFile", ")", ";", "// Is the target parent directory writable?", "final", "Path", "aTargetParentDir", "=", "aRealTargetFile", ".", "getParent", "(", ")", ";", "if", "(", "aTargetParentDir", "!=", "null", "&&", "aTargetParentDir", ".", "toFile", "(", ")", ".", "exists", "(", ")", "&&", "!", "Files", ".", "isWritable", "(", "aTargetParentDir", ")", ")", "return", "EFileIOErrorCode", ".", "TARGET_PARENT_NOT_WRITABLE", ".", "getAsIOError", "(", "EFileIOOperation", ".", "RENAME_FILE", ",", "aRealTargetFile", ")", ";", "// Ensure parent of target directory is present", "PathHelper", ".", "ensureParentDirectoryIsPresent", "(", "aRealTargetFile", ")", ";", "return", "_perform", "(", "EFileIOOperation", ".", "RENAME_FILE", ",", "PathOperations", "::", "_atomicMove", ",", "aRealSourceFile", ",", "aRealTargetFile", ")", ";", "}" ]
Rename a file. @param aSourceFile The original file name. May not be <code>null</code>. @param aTargetFile The destination file name. May not be <code>null</code>. @return A non-<code>null</code> error code.
[ "Rename", "a", "file", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/PathOperations.java#L430-L465
schallee/alib4j
core/src/main/java/net/darkmist/alib/res/PkgRes.java
PkgRes.getStringFor
public static String getStringFor(String name, Object obj) { """ Get a resource as a String. @param name The name of the resource @return The contents of the resource converted to a string with the default encoding. @throws NullPointerException if name or obj are null. ResourceException if the resource cannot be found. """ if(obj == null) throw new NullPointerException("obj is null"); return getStringFor(name,obj.getClass()); }
java
public static String getStringFor(String name, Object obj) { if(obj == null) throw new NullPointerException("obj is null"); return getStringFor(name,obj.getClass()); }
[ "public", "static", "String", "getStringFor", "(", "String", "name", ",", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"obj is null\"", ")", ";", "return", "getStringFor", "(", "name", ",", "obj", ".", "getClass", "(", ")", ")", ";", "}" ]
Get a resource as a String. @param name The name of the resource @return The contents of the resource converted to a string with the default encoding. @throws NullPointerException if name or obj are null. ResourceException if the resource cannot be found.
[ "Get", "a", "resource", "as", "a", "String", "." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/res/PkgRes.java#L312-L317
Microsoft/azure-maven-plugins
azure-maven-plugin-lib/src/main/java/com/microsoft/azure/maven/Utils.java
Utils.copyResources
public static void copyResources(final MavenProject project, final MavenSession session, final MavenResourcesFiltering filtering, final List<Resource> resources, final String targetDirectory) throws IOException { """ Copy resources to target directory using Maven resource filtering so that we don't have to handle recursive directory listing and pattern matching. In order to disable filtering, the "filtering" property is force set to False. @param project @param session @param filtering @param resources @param targetDirectory @throws IOException """ for (final Resource resource : resources) { final String targetPath = resource.getTargetPath() == null ? "" : resource.getTargetPath(); resource.setTargetPath(Paths.get(targetDirectory, targetPath).toString()); resource.setFiltering(false); } final MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, new File(targetDirectory), project, "UTF-8", null, Collections.EMPTY_LIST, session ); // Configure executor mavenResourcesExecution.setEscapeWindowsPaths(true); mavenResourcesExecution.setInjectProjectBuildFilters(false); mavenResourcesExecution.setOverwrite(true); mavenResourcesExecution.setIncludeEmptyDirs(false); mavenResourcesExecution.setSupportMultiLineFiltering(false); // Filter resources try { filtering.filterResources(mavenResourcesExecution); } catch (MavenFilteringException ex) { throw new IOException("Failed to copy resources", ex); } }
java
public static void copyResources(final MavenProject project, final MavenSession session, final MavenResourcesFiltering filtering, final List<Resource> resources, final String targetDirectory) throws IOException { for (final Resource resource : resources) { final String targetPath = resource.getTargetPath() == null ? "" : resource.getTargetPath(); resource.setTargetPath(Paths.get(targetDirectory, targetPath).toString()); resource.setFiltering(false); } final MavenResourcesExecution mavenResourcesExecution = new MavenResourcesExecution( resources, new File(targetDirectory), project, "UTF-8", null, Collections.EMPTY_LIST, session ); // Configure executor mavenResourcesExecution.setEscapeWindowsPaths(true); mavenResourcesExecution.setInjectProjectBuildFilters(false); mavenResourcesExecution.setOverwrite(true); mavenResourcesExecution.setIncludeEmptyDirs(false); mavenResourcesExecution.setSupportMultiLineFiltering(false); // Filter resources try { filtering.filterResources(mavenResourcesExecution); } catch (MavenFilteringException ex) { throw new IOException("Failed to copy resources", ex); } }
[ "public", "static", "void", "copyResources", "(", "final", "MavenProject", "project", ",", "final", "MavenSession", "session", ",", "final", "MavenResourcesFiltering", "filtering", ",", "final", "List", "<", "Resource", ">", "resources", ",", "final", "String", "targetDirectory", ")", "throws", "IOException", "{", "for", "(", "final", "Resource", "resource", ":", "resources", ")", "{", "final", "String", "targetPath", "=", "resource", ".", "getTargetPath", "(", ")", "==", "null", "?", "\"\"", ":", "resource", ".", "getTargetPath", "(", ")", ";", "resource", ".", "setTargetPath", "(", "Paths", ".", "get", "(", "targetDirectory", ",", "targetPath", ")", ".", "toString", "(", ")", ")", ";", "resource", ".", "setFiltering", "(", "false", ")", ";", "}", "final", "MavenResourcesExecution", "mavenResourcesExecution", "=", "new", "MavenResourcesExecution", "(", "resources", ",", "new", "File", "(", "targetDirectory", ")", ",", "project", ",", "\"UTF-8\"", ",", "null", ",", "Collections", ".", "EMPTY_LIST", ",", "session", ")", ";", "// Configure executor\r", "mavenResourcesExecution", ".", "setEscapeWindowsPaths", "(", "true", ")", ";", "mavenResourcesExecution", ".", "setInjectProjectBuildFilters", "(", "false", ")", ";", "mavenResourcesExecution", ".", "setOverwrite", "(", "true", ")", ";", "mavenResourcesExecution", ".", "setIncludeEmptyDirs", "(", "false", ")", ";", "mavenResourcesExecution", ".", "setSupportMultiLineFiltering", "(", "false", ")", ";", "// Filter resources\r", "try", "{", "filtering", ".", "filterResources", "(", "mavenResourcesExecution", ")", ";", "}", "catch", "(", "MavenFilteringException", "ex", ")", "{", "throw", "new", "IOException", "(", "\"Failed to copy resources\"", ",", "ex", ")", ";", "}", "}" ]
Copy resources to target directory using Maven resource filtering so that we don't have to handle recursive directory listing and pattern matching. In order to disable filtering, the "filtering" property is force set to False. @param project @param session @param filtering @param resources @param targetDirectory @throws IOException
[ "Copy", "resources", "to", "target", "directory", "using", "Maven", "resource", "filtering", "so", "that", "we", "don", "t", "have", "to", "handle", "recursive", "directory", "listing", "and", "pattern", "matching", ".", "In", "order", "to", "disable", "filtering", "the", "filtering", "property", "is", "force", "set", "to", "False", "." ]
train
https://github.com/Microsoft/azure-maven-plugins/blob/a254902e820185df1823b1d692c7c1d119490b1e/azure-maven-plugin-lib/src/main/java/com/microsoft/azure/maven/Utils.java#L97-L129
pawelprazak/java-extended
guava/src/main/java/com/bluecatcode/common/base/Environment.java
Environment.getNextAvailablePort
public static int getNextAvailablePort(int fromPort, int toPort) { """ Returns a currently available port number in the specified range. @param fromPort the lower port limit @param toPort the upper port limit @throws IllegalArgumentException if port range is not between {@link #MIN_PORT_NUMBER} and {@link #MAX_PORT_NUMBER} or <code>fromPort</code> if greater than <code>toPort</code>. @return an available port """ if (fromPort < MIN_PORT_NUMBER || toPort > MAX_PORT_NUMBER || fromPort > toPort) { throw new IllegalArgumentException(format("Invalid port range: %d ~ %d", fromPort, toPort)); } int nextPort = fromPort; //noinspection StatementWithEmptyBody while (!isPortAvailable(nextPort++)) { /* Empty */ } return nextPort; }
java
public static int getNextAvailablePort(int fromPort, int toPort) { if (fromPort < MIN_PORT_NUMBER || toPort > MAX_PORT_NUMBER || fromPort > toPort) { throw new IllegalArgumentException(format("Invalid port range: %d ~ %d", fromPort, toPort)); } int nextPort = fromPort; //noinspection StatementWithEmptyBody while (!isPortAvailable(nextPort++)) { /* Empty */ } return nextPort; }
[ "public", "static", "int", "getNextAvailablePort", "(", "int", "fromPort", ",", "int", "toPort", ")", "{", "if", "(", "fromPort", "<", "MIN_PORT_NUMBER", "||", "toPort", ">", "MAX_PORT_NUMBER", "||", "fromPort", ">", "toPort", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\"Invalid port range: %d ~ %d\"", ",", "fromPort", ",", "toPort", ")", ")", ";", "}", "int", "nextPort", "=", "fromPort", ";", "//noinspection StatementWithEmptyBody", "while", "(", "!", "isPortAvailable", "(", "nextPort", "++", ")", ")", "{", "/* Empty */", "}", "return", "nextPort", ";", "}" ]
Returns a currently available port number in the specified range. @param fromPort the lower port limit @param toPort the upper port limit @throws IllegalArgumentException if port range is not between {@link #MIN_PORT_NUMBER} and {@link #MAX_PORT_NUMBER} or <code>fromPort</code> if greater than <code>toPort</code>. @return an available port
[ "Returns", "a", "currently", "available", "port", "number", "in", "the", "specified", "range", "." ]
train
https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/base/Environment.java#L116-L125
google/closure-compiler
src/com/google/javascript/jscomp/CrossChunkCodeMotion.java
CrossChunkCodeMotion.isUndefinedTypeofGuardFor
private boolean isUndefinedTypeofGuardFor(Node expression, Node reference) { """ Is the expression of the form {@code 'undefined' != typeof Ref}? @param expression @param reference Ref node must be equivalent to this node """ if (expression.isNE()) { Node undefinedString = expression.getFirstChild(); Node typeofNode = expression.getLastChild(); return undefinedString.isString() && undefinedString.getString().equals("undefined") && typeofNode.isTypeOf() && typeofNode.getFirstChild().isEquivalentTo(reference); } else { return false; } }
java
private boolean isUndefinedTypeofGuardFor(Node expression, Node reference) { if (expression.isNE()) { Node undefinedString = expression.getFirstChild(); Node typeofNode = expression.getLastChild(); return undefinedString.isString() && undefinedString.getString().equals("undefined") && typeofNode.isTypeOf() && typeofNode.getFirstChild().isEquivalentTo(reference); } else { return false; } }
[ "private", "boolean", "isUndefinedTypeofGuardFor", "(", "Node", "expression", ",", "Node", "reference", ")", "{", "if", "(", "expression", ".", "isNE", "(", ")", ")", "{", "Node", "undefinedString", "=", "expression", ".", "getFirstChild", "(", ")", ";", "Node", "typeofNode", "=", "expression", ".", "getLastChild", "(", ")", ";", "return", "undefinedString", ".", "isString", "(", ")", "&&", "undefinedString", ".", "getString", "(", ")", ".", "equals", "(", "\"undefined\"", ")", "&&", "typeofNode", ".", "isTypeOf", "(", ")", "&&", "typeofNode", ".", "getFirstChild", "(", ")", ".", "isEquivalentTo", "(", "reference", ")", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Is the expression of the form {@code 'undefined' != typeof Ref}? @param expression @param reference Ref node must be equivalent to this node
[ "Is", "the", "expression", "of", "the", "form", "{", "@code", "undefined", "!", "=", "typeof", "Ref", "}", "?" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CrossChunkCodeMotion.java#L711-L722
OpenLiberty/open-liberty
dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/db/Query.java
Query.main3
public static void main3(String args[]) { """ This method was created in VisualAge. @param args java.lang.String[] """ String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver"; String url = "jdbc:db2:sample"; String user = "batra"; String pass = "varunbatra"; String querystring = "Select * from batra.employee"; String fn; String ln; String bd; String sal; try { ConnectionProperties cp = new ConnectionProperties(dbDriver, url, user, pass); Query query = new Query(cp, querystring); QueryResults qs = query.execute(); System.out.println("Number of rows = " + qs.size()); Enumeration e = qs.getRows(); while (e.hasMoreElements()) { QueryRow qr = (QueryRow) e.nextElement(); fn = qr.getValue("FIRSTNME"); ln = qr.getValue("LASTNAME"); bd = qr.getValue("BIRTHDATE"); sal = qr.getValue("SALARY"); System.out.println(fn + " " + ln + " birthdate " + bd + " salary " + sal); } // while /* while (qs.next()) { fn = qs.getValue("FIRSTNME"); ln = qs.getValue("LASTNAME"); bd = qs.getValue("BIRTHDATE"); sal = qs.getValue("SALARY"); System.out.println(fn + " " + ln + " birthdate " + bd + " salary " + sal); } qs.setCurrRow(5); fn = qs.getValue("FIRSTNME"); ln = qs.getValue("LASTNAME"); bd = qs.getValue("BIRTHDATE"); sal = qs.getValue("SALARY"); System.out.println(fn + " " + ln + " birthdate " + bd + " salary " + sal); */ } // try catch (Exception e) { //com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.main3", "414"); System.out.println("Exception:: " + e.getMessage()); } System.out.println("All is Fine!!!!!"); }
java
public static void main3(String args[]) { String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver"; String url = "jdbc:db2:sample"; String user = "batra"; String pass = "varunbatra"; String querystring = "Select * from batra.employee"; String fn; String ln; String bd; String sal; try { ConnectionProperties cp = new ConnectionProperties(dbDriver, url, user, pass); Query query = new Query(cp, querystring); QueryResults qs = query.execute(); System.out.println("Number of rows = " + qs.size()); Enumeration e = qs.getRows(); while (e.hasMoreElements()) { QueryRow qr = (QueryRow) e.nextElement(); fn = qr.getValue("FIRSTNME"); ln = qr.getValue("LASTNAME"); bd = qr.getValue("BIRTHDATE"); sal = qr.getValue("SALARY"); System.out.println(fn + " " + ln + " birthdate " + bd + " salary " + sal); } // while /* while (qs.next()) { fn = qs.getValue("FIRSTNME"); ln = qs.getValue("LASTNAME"); bd = qs.getValue("BIRTHDATE"); sal = qs.getValue("SALARY"); System.out.println(fn + " " + ln + " birthdate " + bd + " salary " + sal); } qs.setCurrRow(5); fn = qs.getValue("FIRSTNME"); ln = qs.getValue("LASTNAME"); bd = qs.getValue("BIRTHDATE"); sal = qs.getValue("SALARY"); System.out.println(fn + " " + ln + " birthdate " + bd + " salary " + sal); */ } // try catch (Exception e) { //com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ws.webcontainer.jsp.tsx.db.Query.main3", "414"); System.out.println("Exception:: " + e.getMessage()); } System.out.println("All is Fine!!!!!"); }
[ "public", "static", "void", "main3", "(", "String", "args", "[", "]", ")", "{", "String", "dbDriver", "=", "\"COM.ibm.db2.jdbc.app.DB2Driver\"", ";", "String", "url", "=", "\"jdbc:db2:sample\"", ";", "String", "user", "=", "\"batra\"", ";", "String", "pass", "=", "\"varunbatra\"", ";", "String", "querystring", "=", "\"Select * from batra.employee\"", ";", "String", "fn", ";", "String", "ln", ";", "String", "bd", ";", "String", "sal", ";", "try", "{", "ConnectionProperties", "cp", "=", "new", "ConnectionProperties", "(", "dbDriver", ",", "url", ",", "user", ",", "pass", ")", ";", "Query", "query", "=", "new", "Query", "(", "cp", ",", "querystring", ")", ";", "QueryResults", "qs", "=", "query", ".", "execute", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"Number of rows = \"", "+", "qs", ".", "size", "(", ")", ")", ";", "Enumeration", "e", "=", "qs", ".", "getRows", "(", ")", ";", "while", "(", "e", ".", "hasMoreElements", "(", ")", ")", "{", "QueryRow", "qr", "=", "(", "QueryRow", ")", "e", ".", "nextElement", "(", ")", ";", "fn", "=", "qr", ".", "getValue", "(", "\"FIRSTNME\"", ")", ";", "ln", "=", "qr", ".", "getValue", "(", "\"LASTNAME\"", ")", ";", "bd", "=", "qr", ".", "getValue", "(", "\"BIRTHDATE\"", ")", ";", "sal", "=", "qr", ".", "getValue", "(", "\"SALARY\"", ")", ";", "System", ".", "out", ".", "println", "(", "fn", "+", "\" \"", "+", "ln", "+", "\" birthdate \"", "+", "bd", "+", "\" salary \"", "+", "sal", ")", ";", "}", "// while", "/*\n while (qs.next())\n {\n fn = qs.getValue(\"FIRSTNME\");\n ln = qs.getValue(\"LASTNAME\");\n bd = qs.getValue(\"BIRTHDATE\");\n sal = qs.getValue(\"SALARY\");\n System.out.println(fn + \" \" + ln +\n \" birthdate \" + bd +\n \" salary \" + sal);\n }\n \n qs.setCurrRow(5);\n fn = qs.getValue(\"FIRSTNME\");\n ln = qs.getValue(\"LASTNAME\");\n bd = qs.getValue(\"BIRTHDATE\");\n sal = qs.getValue(\"SALARY\");\n System.out.println(fn + \" \" + ln +\n \" birthdate \" + bd +\n \" salary \" + sal);\n */", "}", "// try", "catch", "(", "Exception", "e", ")", "{", "//com.ibm.ws.ffdc.FFDCFilter.processException(e, \"com.ibm.ws.webcontainer.jsp.tsx.db.Query.main3\", \"414\");", "System", ".", "out", ".", "println", "(", "\"Exception:: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"All is Fine!!!!!\"", ")", ";", "}" ]
This method was created in VisualAge. @param args java.lang.String[]
[ "This", "method", "was", "created", "in", "VisualAge", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/db/Query.java#L365-L420
luuuis/jcalendar
src/main/java/com/toedter/components/JSpinField.java
JSpinField.setValue
protected void setValue(int newValue, boolean updateTextField, boolean firePropertyChange) { """ Sets the value attribute of the JSpinField object. @param newValue The new value @param updateTextField true if text field should be updated """ int oldValue = value; if (newValue < min) { value = min; } else if (newValue > max) { value = max; } else { value = newValue; } if (updateTextField) { textField.setText(Integer.toString(value)); textField.setForeground(Color.black); } if (firePropertyChange) { firePropertyChange("value", oldValue, value); } }
java
protected void setValue(int newValue, boolean updateTextField, boolean firePropertyChange) { int oldValue = value; if (newValue < min) { value = min; } else if (newValue > max) { value = max; } else { value = newValue; } if (updateTextField) { textField.setText(Integer.toString(value)); textField.setForeground(Color.black); } if (firePropertyChange) { firePropertyChange("value", oldValue, value); } }
[ "protected", "void", "setValue", "(", "int", "newValue", ",", "boolean", "updateTextField", ",", "boolean", "firePropertyChange", ")", "{", "int", "oldValue", "=", "value", ";", "if", "(", "newValue", "<", "min", ")", "{", "value", "=", "min", ";", "}", "else", "if", "(", "newValue", ">", "max", ")", "{", "value", "=", "max", ";", "}", "else", "{", "value", "=", "newValue", ";", "}", "if", "(", "updateTextField", ")", "{", "textField", ".", "setText", "(", "Integer", ".", "toString", "(", "value", ")", ")", ";", "textField", ".", "setForeground", "(", "Color", ".", "black", ")", ";", "}", "if", "(", "firePropertyChange", ")", "{", "firePropertyChange", "(", "\"value\"", ",", "oldValue", ",", "value", ")", ";", "}", "}" ]
Sets the value attribute of the JSpinField object. @param newValue The new value @param updateTextField true if text field should be updated
[ "Sets", "the", "value", "attribute", "of", "the", "JSpinField", "object", "." ]
train
https://github.com/luuuis/jcalendar/blob/442e5bc319d92dee93400e6180ca74a5b6bd7775/src/main/java/com/toedter/components/JSpinField.java#L147-L165
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsADEManager.java
CmsADEManager.saveDetailPages
public boolean saveDetailPages(CmsObject cms, String rootPath, List<CmsDetailPageInfo> detailPages, CmsUUID newId) throws CmsException { """ Saves a list of detail pages.<p> @param cms the cms context @param rootPath the root path @param detailPages the detail pages @param newId the id to use for new detail pages without an id @return true if the detail pages could be successfully saved @throws CmsException if something goes wrong """ CmsADEConfigData configData = lookupConfiguration(cms, rootPath); CmsDetailPageConfigurationWriter configWriter; String originalSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); if (configData.isModuleConfiguration()) { return false; } CmsResource configFile = configData.getResource(); configWriter = new CmsDetailPageConfigurationWriter(cms, configFile); configWriter.updateAndSave(detailPages, newId); return true; } finally { cms.getRequestContext().setSiteRoot(originalSiteRoot); } }
java
public boolean saveDetailPages(CmsObject cms, String rootPath, List<CmsDetailPageInfo> detailPages, CmsUUID newId) throws CmsException { CmsADEConfigData configData = lookupConfiguration(cms, rootPath); CmsDetailPageConfigurationWriter configWriter; String originalSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); if (configData.isModuleConfiguration()) { return false; } CmsResource configFile = configData.getResource(); configWriter = new CmsDetailPageConfigurationWriter(cms, configFile); configWriter.updateAndSave(detailPages, newId); return true; } finally { cms.getRequestContext().setSiteRoot(originalSiteRoot); } }
[ "public", "boolean", "saveDetailPages", "(", "CmsObject", "cms", ",", "String", "rootPath", ",", "List", "<", "CmsDetailPageInfo", ">", "detailPages", ",", "CmsUUID", "newId", ")", "throws", "CmsException", "{", "CmsADEConfigData", "configData", "=", "lookupConfiguration", "(", "cms", ",", "rootPath", ")", ";", "CmsDetailPageConfigurationWriter", "configWriter", ";", "String", "originalSiteRoot", "=", "cms", ".", "getRequestContext", "(", ")", ".", "getSiteRoot", "(", ")", ";", "try", "{", "cms", ".", "getRequestContext", "(", ")", ".", "setSiteRoot", "(", "\"\"", ")", ";", "if", "(", "configData", ".", "isModuleConfiguration", "(", ")", ")", "{", "return", "false", ";", "}", "CmsResource", "configFile", "=", "configData", ".", "getResource", "(", ")", ";", "configWriter", "=", "new", "CmsDetailPageConfigurationWriter", "(", "cms", ",", "configFile", ")", ";", "configWriter", ".", "updateAndSave", "(", "detailPages", ",", "newId", ")", ";", "return", "true", ";", "}", "finally", "{", "cms", ".", "getRequestContext", "(", ")", ".", "setSiteRoot", "(", "originalSiteRoot", ")", ";", "}", "}" ]
Saves a list of detail pages.<p> @param cms the cms context @param rootPath the root path @param detailPages the detail pages @param newId the id to use for new detail pages without an id @return true if the detail pages could be successfully saved @throws CmsException if something goes wrong
[ "Saves", "a", "list", "of", "detail", "pages", ".", "<p", ">", "@param", "cms", "the", "cms", "context", "@param", "rootPath", "the", "root", "path", "@param", "detailPages", "the", "detail", "pages", "@param", "newId", "the", "id", "to", "use", "for", "new", "detail", "pages", "without", "an", "id", "@return", "true", "if", "the", "detail", "pages", "could", "be", "successfully", "saved" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L1168-L1186
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.transformAffine
public Vector4f transformAffine(float x, float y, float z, float w, Vector4f dest) { """ /* (non-Javadoc) @see org.joml.Matrix4fc#transformAffine(float, float, float, float, org.joml.Vector4f) """ dest.x = x; dest.y = y; dest.z = z; dest.w = w; return dest.mulAffine(this, dest); }
java
public Vector4f transformAffine(float x, float y, float z, float w, Vector4f dest) { dest.x = x; dest.y = y; dest.z = z; dest.w = w; return dest.mulAffine(this, dest); }
[ "public", "Vector4f", "transformAffine", "(", "float", "x", ",", "float", "y", ",", "float", "z", ",", "float", "w", ",", "Vector4f", "dest", ")", "{", "dest", ".", "x", "=", "x", ";", "dest", ".", "y", "=", "y", ";", "dest", ".", "z", "=", "z", ";", "dest", ".", "w", "=", "w", ";", "return", "dest", ".", "mulAffine", "(", "this", ",", "dest", ")", ";", "}" ]
/* (non-Javadoc) @see org.joml.Matrix4fc#transformAffine(float, float, float, float, org.joml.Vector4f)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L4650-L4656
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.notEmpty
public static void notEmpty(Object[] array, String message, Object... arguments) { """ Asserts that the {@link Object array} is not empty. The assertion holds if and only if the {@link Object array} is not {@literal null} and contains at least 1 element. @param array {@link Object array} to evaluate. @param message {@link String} containing the message using in the {@link IllegalArgumentException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.IllegalArgumentException if the {@link Object array} is {@literal null} or empty. @see #notEmpty(Object[], RuntimeException) @see java.lang.Object[] """ notEmpty(array, new IllegalArgumentException(format(message, arguments))); }
java
public static void notEmpty(Object[] array, String message, Object... arguments) { notEmpty(array, new IllegalArgumentException(format(message, arguments))); }
[ "public", "static", "void", "notEmpty", "(", "Object", "[", "]", "array", ",", "String", "message", ",", "Object", "...", "arguments", ")", "{", "notEmpty", "(", "array", ",", "new", "IllegalArgumentException", "(", "format", "(", "message", ",", "arguments", ")", ")", ")", ";", "}" ]
Asserts that the {@link Object array} is not empty. The assertion holds if and only if the {@link Object array} is not {@literal null} and contains at least 1 element. @param array {@link Object array} to evaluate. @param message {@link String} containing the message using in the {@link IllegalArgumentException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.IllegalArgumentException if the {@link Object array} is {@literal null} or empty. @see #notEmpty(Object[], RuntimeException) @see java.lang.Object[]
[ "Asserts", "that", "the", "{", "@link", "Object", "array", "}", "is", "not", "empty", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L958-L960
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/io/DataIO.java
DataIO.createTableModel
public static TableModel createTableModel(final CSTable src) { """ Create a r/o data tablemodel @param src @return a table model to the CSTable """ final List<String[]> rows = new ArrayList<String[]>(); for (String[] row : src.rows()) { rows.add(row); } return new TableModel() { @Override public int getColumnCount() { return src.getColumnCount(); } @Override public String getColumnName(int column) { return src.getColumnName(column); } @Override public int getRowCount() { return rows.size(); } @Override public Class<?> getColumnClass(int columnIndex) { return String.class; } @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } @Override public Object getValueAt(int rowIndex, int columnIndex) { return rows.get(rowIndex)[columnIndex]; } @Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { // rows.get(rowIndex)[columnIndex] = (String) aValue; } @Override public void addTableModelListener(TableModelListener l) { } @Override public void removeTableModelListener(TableModelListener l) { } }; }
java
public static TableModel createTableModel(final CSTable src) { final List<String[]> rows = new ArrayList<String[]>(); for (String[] row : src.rows()) { rows.add(row); } return new TableModel() { @Override public int getColumnCount() { return src.getColumnCount(); } @Override public String getColumnName(int column) { return src.getColumnName(column); } @Override public int getRowCount() { return rows.size(); } @Override public Class<?> getColumnClass(int columnIndex) { return String.class; } @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } @Override public Object getValueAt(int rowIndex, int columnIndex) { return rows.get(rowIndex)[columnIndex]; } @Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { // rows.get(rowIndex)[columnIndex] = (String) aValue; } @Override public void addTableModelListener(TableModelListener l) { } @Override public void removeTableModelListener(TableModelListener l) { } }; }
[ "public", "static", "TableModel", "createTableModel", "(", "final", "CSTable", "src", ")", "{", "final", "List", "<", "String", "[", "]", ">", "rows", "=", "new", "ArrayList", "<", "String", "[", "]", ">", "(", ")", ";", "for", "(", "String", "[", "]", "row", ":", "src", ".", "rows", "(", ")", ")", "{", "rows", ".", "add", "(", "row", ")", ";", "}", "return", "new", "TableModel", "(", ")", "{", "@", "Override", "public", "int", "getColumnCount", "(", ")", "{", "return", "src", ".", "getColumnCount", "(", ")", ";", "}", "@", "Override", "public", "String", "getColumnName", "(", "int", "column", ")", "{", "return", "src", ".", "getColumnName", "(", "column", ")", ";", "}", "@", "Override", "public", "int", "getRowCount", "(", ")", "{", "return", "rows", ".", "size", "(", ")", ";", "}", "@", "Override", "public", "Class", "<", "?", ">", "getColumnClass", "(", "int", "columnIndex", ")", "{", "return", "String", ".", "class", ";", "}", "@", "Override", "public", "boolean", "isCellEditable", "(", "int", "rowIndex", ",", "int", "columnIndex", ")", "{", "return", "false", ";", "}", "@", "Override", "public", "Object", "getValueAt", "(", "int", "rowIndex", ",", "int", "columnIndex", ")", "{", "return", "rows", ".", "get", "(", "rowIndex", ")", "[", "columnIndex", "]", ";", "}", "@", "Override", "public", "void", "setValueAt", "(", "Object", "aValue", ",", "int", "rowIndex", ",", "int", "columnIndex", ")", "{", "// rows.get(rowIndex)[columnIndex] = (String) aValue;", "}", "@", "Override", "public", "void", "addTableModelListener", "(", "TableModelListener", "l", ")", "{", "}", "@", "Override", "public", "void", "removeTableModelListener", "(", "TableModelListener", "l", ")", "{", "}", "}", ";", "}" ]
Create a r/o data tablemodel @param src @return a table model to the CSTable
[ "Create", "a", "r", "/", "o", "data", "tablemodel" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/DataIO.java#L497-L548
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.signParams
public static String signParams(SymmetricCrypto crypto, Map<?, ?> params, String separator, String keyValueSeparator, boolean isIgnoreNull) { """ 对参数做签名<br> 参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串 @param crypto 对称加密算法 @param params 参数 @param separator entry之间的连接符 @param keyValueSeparator kv之间的连接符 @param isIgnoreNull 是否忽略null的键和值 @return 签名 @since 4.0.1 """ if (MapUtil.isEmpty(params)) { return null; } String paramsStr = MapUtil.join(MapUtil.sort(params), separator, keyValueSeparator, isIgnoreNull); return crypto.encryptHex(paramsStr); }
java
public static String signParams(SymmetricCrypto crypto, Map<?, ?> params, String separator, String keyValueSeparator, boolean isIgnoreNull) { if (MapUtil.isEmpty(params)) { return null; } String paramsStr = MapUtil.join(MapUtil.sort(params), separator, keyValueSeparator, isIgnoreNull); return crypto.encryptHex(paramsStr); }
[ "public", "static", "String", "signParams", "(", "SymmetricCrypto", "crypto", ",", "Map", "<", "?", ",", "?", ">", "params", ",", "String", "separator", ",", "String", "keyValueSeparator", ",", "boolean", "isIgnoreNull", ")", "{", "if", "(", "MapUtil", ".", "isEmpty", "(", "params", ")", ")", "{", "return", "null", ";", "}", "String", "paramsStr", "=", "MapUtil", ".", "join", "(", "MapUtil", ".", "sort", "(", "params", ")", ",", "separator", ",", "keyValueSeparator", ",", "isIgnoreNull", ")", ";", "return", "crypto", ".", "encryptHex", "(", "paramsStr", ")", ";", "}" ]
对参数做签名<br> 参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串 @param crypto 对称加密算法 @param params 参数 @param separator entry之间的连接符 @param keyValueSeparator kv之间的连接符 @param isIgnoreNull 是否忽略null的键和值 @return 签名 @since 4.0.1
[ "对参数做签名<br", ">", "参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L847-L853
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractCacheService.java
AbstractCacheService.sendInvalidationEvent
@Override public void sendInvalidationEvent(String cacheNameWithPrefix, Data key, String sourceUuid) { """ Sends an invalidation event for given <code>cacheName</code> with specified <code>key</code> from mentioned source with <code>sourceUuid</code>. @param cacheNameWithPrefix the name of the cache that invalidation event is sent for @param key the {@link com.hazelcast.nio.serialization.Data} represents the invalidation event @param sourceUuid an ID that represents the source for invalidation event """ cacheEventHandler.sendInvalidationEvent(cacheNameWithPrefix, key, sourceUuid); }
java
@Override public void sendInvalidationEvent(String cacheNameWithPrefix, Data key, String sourceUuid) { cacheEventHandler.sendInvalidationEvent(cacheNameWithPrefix, key, sourceUuid); }
[ "@", "Override", "public", "void", "sendInvalidationEvent", "(", "String", "cacheNameWithPrefix", ",", "Data", "key", ",", "String", "sourceUuid", ")", "{", "cacheEventHandler", ".", "sendInvalidationEvent", "(", "cacheNameWithPrefix", ",", "key", ",", "sourceUuid", ")", ";", "}" ]
Sends an invalidation event for given <code>cacheName</code> with specified <code>key</code> from mentioned source with <code>sourceUuid</code>. @param cacheNameWithPrefix the name of the cache that invalidation event is sent for @param key the {@link com.hazelcast.nio.serialization.Data} represents the invalidation event @param sourceUuid an ID that represents the source for invalidation event
[ "Sends", "an", "invalidation", "event", "for", "given", "<code", ">", "cacheName<", "/", "code", ">", "with", "specified", "<code", ">", "key<", "/", "code", ">", "from", "mentioned", "source", "with", "<code", ">", "sourceUuid<", "/", "code", ">", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractCacheService.java#L818-L821
jhalterman/lyra
src/main/java/net/jodah/lyra/ConnectionOptions.java
ConnectionOptions.withClientProperties
public ConnectionOptions withClientProperties(Map<String, Object> clientProperties) { """ Sets the client properties. @throws NullPointerException if {@code clientProperties} is null """ factory.setClientProperties(Assert.notNull(clientProperties, "clientProperties")); return this; }
java
public ConnectionOptions withClientProperties(Map<String, Object> clientProperties) { factory.setClientProperties(Assert.notNull(clientProperties, "clientProperties")); return this; }
[ "public", "ConnectionOptions", "withClientProperties", "(", "Map", "<", "String", ",", "Object", ">", "clientProperties", ")", "{", "factory", ".", "setClientProperties", "(", "Assert", ".", "notNull", "(", "clientProperties", ",", "\"clientProperties\"", ")", ")", ";", "return", "this", ";", "}" ]
Sets the client properties. @throws NullPointerException if {@code clientProperties} is null
[ "Sets", "the", "client", "properties", "." ]
train
https://github.com/jhalterman/lyra/blob/ce347a69357fef1b34e92d92a4f9e68792d81255/src/main/java/net/jodah/lyra/ConnectionOptions.java#L181-L184
zaproxy/zaproxy
src/org/zaproxy/zap/spider/Spider.java
Spider.buildUri
private static String buildUri(String scheme, char[] host, int port, String path) { """ Creates a URI (string) with the given scheme, host, port and path. The port is only added if not the default for the given scheme. @param scheme the scheme, {@code http} or {@code https}. @param host the name of the host. @param port the port. @param path the path, should start with {@code /}. @return the URI with the provided components. """ StringBuilder strBuilder = new StringBuilder(150); strBuilder.append(scheme).append("://").append(host); if (!isDefaultPort(scheme, port)) { strBuilder.append(':').append(port); } strBuilder.append(path); return strBuilder.toString(); }
java
private static String buildUri(String scheme, char[] host, int port, String path) { StringBuilder strBuilder = new StringBuilder(150); strBuilder.append(scheme).append("://").append(host); if (!isDefaultPort(scheme, port)) { strBuilder.append(':').append(port); } strBuilder.append(path); return strBuilder.toString(); }
[ "private", "static", "String", "buildUri", "(", "String", "scheme", ",", "char", "[", "]", "host", ",", "int", "port", ",", "String", "path", ")", "{", "StringBuilder", "strBuilder", "=", "new", "StringBuilder", "(", "150", ")", ";", "strBuilder", ".", "append", "(", "scheme", ")", ".", "append", "(", "\"://\"", ")", ".", "append", "(", "host", ")", ";", "if", "(", "!", "isDefaultPort", "(", "scheme", ",", "port", ")", ")", "{", "strBuilder", ".", "append", "(", "'", "'", ")", ".", "append", "(", "port", ")", ";", "}", "strBuilder", ".", "append", "(", "path", ")", ";", "return", "strBuilder", ".", "toString", "(", ")", ";", "}" ]
Creates a URI (string) with the given scheme, host, port and path. The port is only added if not the default for the given scheme. @param scheme the scheme, {@code http} or {@code https}. @param host the name of the host. @param port the port. @param path the path, should start with {@code /}. @return the URI with the provided components.
[ "Creates", "a", "URI", "(", "string", ")", "with", "the", "given", "scheme", "host", "port", "and", "path", ".", "The", "port", "is", "only", "added", "if", "not", "the", "default", "for", "the", "given", "scheme", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/Spider.java#L288-L296
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java
EnvironmentCheck.logFoundJars
protected boolean logFoundJars(Vector v, String desc) { """ Print out report of .jars found in a classpath. Takes the information encoded from a checkPathForJars() call and dumps it out to our PrintWriter. @param v Vector of Hashtables of .jar file info @param desc description to print out in header @return false if OK, true if any .jars were reported as having errors @see #checkPathForJars(String, String[]) """ if ((null == v) || (v.size() < 1)) return false; boolean errors = false; logMsg("#---- BEGIN Listing XML-related jars in: " + desc + " ----"); for (int i = 0; i < v.size(); i++) { Hashtable subhash = (Hashtable) v.elementAt(i); for (Enumeration keys = subhash.keys(); keys.hasMoreElements(); /* no increment portion */ ) { Object key = keys.nextElement(); String keyStr = (String) key; try { if (keyStr.startsWith(ERROR)) { errors = true; } logMsg(keyStr + "=" + subhash.get(keyStr)); } catch (Exception e) { errors = true; logMsg("Reading-" + key + "= threw: " + e.toString()); } } } logMsg("#----- END Listing XML-related jars in: " + desc + " -----"); return errors; }
java
protected boolean logFoundJars(Vector v, String desc) { if ((null == v) || (v.size() < 1)) return false; boolean errors = false; logMsg("#---- BEGIN Listing XML-related jars in: " + desc + " ----"); for (int i = 0; i < v.size(); i++) { Hashtable subhash = (Hashtable) v.elementAt(i); for (Enumeration keys = subhash.keys(); keys.hasMoreElements(); /* no increment portion */ ) { Object key = keys.nextElement(); String keyStr = (String) key; try { if (keyStr.startsWith(ERROR)) { errors = true; } logMsg(keyStr + "=" + subhash.get(keyStr)); } catch (Exception e) { errors = true; logMsg("Reading-" + key + "= threw: " + e.toString()); } } } logMsg("#----- END Listing XML-related jars in: " + desc + " -----"); return errors; }
[ "protected", "boolean", "logFoundJars", "(", "Vector", "v", ",", "String", "desc", ")", "{", "if", "(", "(", "null", "==", "v", ")", "||", "(", "v", ".", "size", "(", ")", "<", "1", ")", ")", "return", "false", ";", "boolean", "errors", "=", "false", ";", "logMsg", "(", "\"#---- BEGIN Listing XML-related jars in: \"", "+", "desc", "+", "\" ----\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "v", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Hashtable", "subhash", "=", "(", "Hashtable", ")", "v", ".", "elementAt", "(", "i", ")", ";", "for", "(", "Enumeration", "keys", "=", "subhash", ".", "keys", "(", ")", ";", "keys", ".", "hasMoreElements", "(", ")", ";", "/* no increment portion */", ")", "{", "Object", "key", "=", "keys", ".", "nextElement", "(", ")", ";", "String", "keyStr", "=", "(", "String", ")", "key", ";", "try", "{", "if", "(", "keyStr", ".", "startsWith", "(", "ERROR", ")", ")", "{", "errors", "=", "true", ";", "}", "logMsg", "(", "keyStr", "+", "\"=\"", "+", "subhash", ".", "get", "(", "keyStr", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "errors", "=", "true", ";", "logMsg", "(", "\"Reading-\"", "+", "key", "+", "\"= threw: \"", "+", "e", ".", "toString", "(", ")", ")", ";", "}", "}", "}", "logMsg", "(", "\"#----- END Listing XML-related jars in: \"", "+", "desc", "+", "\" -----\"", ")", ";", "return", "errors", ";", "}" ]
Print out report of .jars found in a classpath. Takes the information encoded from a checkPathForJars() call and dumps it out to our PrintWriter. @param v Vector of Hashtables of .jar file info @param desc description to print out in header @return false if OK, true if any .jars were reported as having errors @see #checkPathForJars(String, String[])
[ "Print", "out", "report", "of", ".", "jars", "found", "in", "a", "classpath", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L353-L394
KyoriPowered/lunar
src/main/java/net/kyori/lunar/collection/MoreTables.java
MoreTables.computeIfAbsent
public static <R, C, V> /* @Nullable */ V computeIfAbsent(final @NonNull Table<R, C, V> table, final @Nullable R rowKey, final @Nullable C columnKey, final @NonNull BiFunction<? super R, ? super C, ? extends V> valueFunction) { """ Gets the value of {@code rowKey} and {@code columnKey} from {@code table}, or computes the value using {@code valueFunction} and inserts it into the table. @param table the table @param rowKey the row key @param columnKey the column key @param valueFunction the value function @param <R> the row type @param <C> the column type @param <V> the value type @return the value """ /* @Nullable */ V value = table.get(rowKey, columnKey); if(value == null) { value = valueFunction.apply(rowKey, columnKey); table.put(rowKey, columnKey, value); } return value; }
java
public static <R, C, V> /* @Nullable */ V computeIfAbsent(final @NonNull Table<R, C, V> table, final @Nullable R rowKey, final @Nullable C columnKey, final @NonNull BiFunction<? super R, ? super C, ? extends V> valueFunction) { /* @Nullable */ V value = table.get(rowKey, columnKey); if(value == null) { value = valueFunction.apply(rowKey, columnKey); table.put(rowKey, columnKey, value); } return value; }
[ "public", "static", "<", "R", ",", "C", ",", "V", ">", "/* @Nullable */", "V", "computeIfAbsent", "(", "final", "@", "NonNull", "Table", "<", "R", ",", "C", ",", "V", ">", "table", ",", "final", "@", "Nullable", "R", "rowKey", ",", "final", "@", "Nullable", "C", "columnKey", ",", "final", "@", "NonNull", "BiFunction", "<", "?", "super", "R", ",", "?", "super", "C", ",", "?", "extends", "V", ">", "valueFunction", ")", "{", "/* @Nullable */", "V", "value", "=", "table", ".", "get", "(", "rowKey", ",", "columnKey", ")", ";", "if", "(", "value", "==", "null", ")", "{", "value", "=", "valueFunction", ".", "apply", "(", "rowKey", ",", "columnKey", ")", ";", "table", ".", "put", "(", "rowKey", ",", "columnKey", ",", "value", ")", ";", "}", "return", "value", ";", "}" ]
Gets the value of {@code rowKey} and {@code columnKey} from {@code table}, or computes the value using {@code valueFunction} and inserts it into the table. @param table the table @param rowKey the row key @param columnKey the column key @param valueFunction the value function @param <R> the row type @param <C> the column type @param <V> the value type @return the value
[ "Gets", "the", "value", "of", "{", "@code", "rowKey", "}", "and", "{", "@code", "columnKey", "}", "from", "{", "@code", "table", "}", "or", "computes", "the", "value", "using", "{", "@code", "valueFunction", "}", "and", "inserts", "it", "into", "the", "table", "." ]
train
https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/collection/MoreTables.java#L56-L63
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.withTraits
public static Object withTraits(Object self, Class<?>... traits) { """ Dynamically wraps an instance into something which implements the supplied trait classes. It is guaranteed that the returned object will implement the trait interfaces, but the original type of the object is lost (replaced with a proxy). @param self object to be wrapped @param traits a list of trait classes @return a proxy implementing the trait interfaces """ List<Class> interfaces = new ArrayList<Class>(); Collections.addAll(interfaces, traits); return ProxyGenerator.INSTANCE.instantiateDelegate(interfaces, self); }
java
public static Object withTraits(Object self, Class<?>... traits) { List<Class> interfaces = new ArrayList<Class>(); Collections.addAll(interfaces, traits); return ProxyGenerator.INSTANCE.instantiateDelegate(interfaces, self); }
[ "public", "static", "Object", "withTraits", "(", "Object", "self", ",", "Class", "<", "?", ">", "...", "traits", ")", "{", "List", "<", "Class", ">", "interfaces", "=", "new", "ArrayList", "<", "Class", ">", "(", ")", ";", "Collections", ".", "addAll", "(", "interfaces", ",", "traits", ")", ";", "return", "ProxyGenerator", ".", "INSTANCE", ".", "instantiateDelegate", "(", "interfaces", ",", "self", ")", ";", "}" ]
Dynamically wraps an instance into something which implements the supplied trait classes. It is guaranteed that the returned object will implement the trait interfaces, but the original type of the object is lost (replaced with a proxy). @param self object to be wrapped @param traits a list of trait classes @return a proxy implementing the trait interfaces
[ "Dynamically", "wraps", "an", "instance", "into", "something", "which", "implements", "the", "supplied", "trait", "classes", ".", "It", "is", "guaranteed", "that", "the", "returned", "object", "will", "implement", "the", "trait", "interfaces", "but", "the", "original", "type", "of", "the", "object", "is", "lost", "(", "replaced", "with", "a", "proxy", ")", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17614-L17618
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java
ns.update
public static ns update(nitro_service client, ns resource) throws Exception { """ <pre> Use this operation to modify NetScaler Instance. </pre> """ resource.validate("modify"); return ((ns[]) resource.update_resource(client))[0]; }
java
public static ns update(nitro_service client, ns resource) throws Exception { resource.validate("modify"); return ((ns[]) resource.update_resource(client))[0]; }
[ "public", "static", "ns", "update", "(", "nitro_service", "client", ",", "ns", "resource", ")", "throws", "Exception", "{", "resource", ".", "validate", "(", "\"modify\"", ")", ";", "return", "(", "(", "ns", "[", "]", ")", "resource", ".", "update_resource", "(", "client", ")", ")", "[", "0", "]", ";", "}" ]
<pre> Use this operation to modify NetScaler Instance. </pre>
[ "<pre", ">", "Use", "this", "operation", "to", "modify", "NetScaler", "Instance", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java#L849-L853
atomix/catalyst
common/src/main/java/io/atomix/catalyst/util/PropertiesReader.java
PropertiesReader.getFile
public File getFile(String property, File defaultValue) { """ Reads a file property. @param property The property name. @param defaultValue The default value to return if the property is not present @return The property value. """ return getProperty(property, defaultValue, File::new); }
java
public File getFile(String property, File defaultValue) { return getProperty(property, defaultValue, File::new); }
[ "public", "File", "getFile", "(", "String", "property", ",", "File", "defaultValue", ")", "{", "return", "getProperty", "(", "property", ",", "defaultValue", ",", "File", "::", "new", ")", ";", "}" ]
Reads a file property. @param property The property name. @param defaultValue The default value to return if the property is not present @return The property value.
[ "Reads", "a", "file", "property", "." ]
train
https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/common/src/main/java/io/atomix/catalyst/util/PropertiesReader.java#L189-L191
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/Loader.java
Loader.loadClass
@SuppressWarnings("rawtypes") public static Class loadClass(Class loaderClass, String name) throws ClassNotFoundException { """ Load a class. Load a class from the same classloader as the passed <code>loadClass</code>, or if none then use {@link #loadClass(String)} @param loaderClass a similar class, belong in the same classloader of the desired class to load @param name the name of the new class to load @return Class @throws ClassNotFoundException if not able to find the class """ if (loaderClass != null && loaderClass.getClassLoader() != null) return loaderClass.getClassLoader().loadClass(name); return loadClass(name); }
java
@SuppressWarnings("rawtypes") public static Class loadClass(Class loaderClass, String name) throws ClassNotFoundException { if (loaderClass != null && loaderClass.getClassLoader() != null) return loaderClass.getClassLoader().loadClass(name); return loadClass(name); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "Class", "loadClass", "(", "Class", "loaderClass", ",", "String", "name", ")", "throws", "ClassNotFoundException", "{", "if", "(", "loaderClass", "!=", "null", "&&", "loaderClass", ".", "getClassLoader", "(", ")", "!=", "null", ")", "return", "loaderClass", ".", "getClassLoader", "(", ")", ".", "loadClass", "(", "name", ")", ";", "return", "loadClass", "(", "name", ")", ";", "}" ]
Load a class. Load a class from the same classloader as the passed <code>loadClass</code>, or if none then use {@link #loadClass(String)} @param loaderClass a similar class, belong in the same classloader of the desired class to load @param name the name of the new class to load @return Class @throws ClassNotFoundException if not able to find the class
[ "Load", "a", "class", ".", "Load", "a", "class", "from", "the", "same", "classloader", "as", "the", "passed", "<code", ">", "loadClass<", "/", "code", ">", "or", "if", "none", "then", "use", "{", "@link", "#loadClass", "(", "String", ")", "}" ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/Loader.java#L76-L81
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.processLevelRelationships
protected void processLevelRelationships(final ParserData parserData, final Level level, final HashMap<ParserType, String[]> variableMap, final String line, int lineNumber) throws ParsingException { """ Process the relationships parsed for a topic. @param parserData @param level The temporary topic that will be turned into a full topic once fully parsed. @param variableMap The list of variables containing the parsed relationships. @param line The line representing the topic and it's relationships. @param lineNumber The number of the line the relationships are on. @throws ParsingException Thrown if the variables can't be parsed due to incorrect syntax. """ // Process the relationships final String uniqueId = level.getUniqueId(); final ArrayList<Relationship> levelRelationships = new ArrayList<Relationship>(); // Refer-To relationships processRelationshipList(ParserType.REFER_TO, level, variableMap, levelRelationships, lineNumber); // Prerequisite relationships processRelationshipList(ParserType.PREREQUISITE, level, variableMap, levelRelationships, lineNumber); // Link-List relationships processRelationshipList(ParserType.LINKLIST, level, variableMap, levelRelationships, lineNumber); // Next and Previous relationships should only be created internally and shouldn't be specified by the user if (variableMap.containsKey(ParserType.NEXT) || variableMap.containsKey(ParserType.PREVIOUS)) { throw new ParsingException(format(ProcessorConstants.ERROR_TOPIC_NEXT_PREV_MSG, lineNumber, line)); } // Add the relationships to the global list if any exist if (!levelRelationships.isEmpty()) { parserData.getLevelRelationships().put(uniqueId, levelRelationships); } }
java
protected void processLevelRelationships(final ParserData parserData, final Level level, final HashMap<ParserType, String[]> variableMap, final String line, int lineNumber) throws ParsingException { // Process the relationships final String uniqueId = level.getUniqueId(); final ArrayList<Relationship> levelRelationships = new ArrayList<Relationship>(); // Refer-To relationships processRelationshipList(ParserType.REFER_TO, level, variableMap, levelRelationships, lineNumber); // Prerequisite relationships processRelationshipList(ParserType.PREREQUISITE, level, variableMap, levelRelationships, lineNumber); // Link-List relationships processRelationshipList(ParserType.LINKLIST, level, variableMap, levelRelationships, lineNumber); // Next and Previous relationships should only be created internally and shouldn't be specified by the user if (variableMap.containsKey(ParserType.NEXT) || variableMap.containsKey(ParserType.PREVIOUS)) { throw new ParsingException(format(ProcessorConstants.ERROR_TOPIC_NEXT_PREV_MSG, lineNumber, line)); } // Add the relationships to the global list if any exist if (!levelRelationships.isEmpty()) { parserData.getLevelRelationships().put(uniqueId, levelRelationships); } }
[ "protected", "void", "processLevelRelationships", "(", "final", "ParserData", "parserData", ",", "final", "Level", "level", ",", "final", "HashMap", "<", "ParserType", ",", "String", "[", "]", ">", "variableMap", ",", "final", "String", "line", ",", "int", "lineNumber", ")", "throws", "ParsingException", "{", "// Process the relationships", "final", "String", "uniqueId", "=", "level", ".", "getUniqueId", "(", ")", ";", "final", "ArrayList", "<", "Relationship", ">", "levelRelationships", "=", "new", "ArrayList", "<", "Relationship", ">", "(", ")", ";", "// Refer-To relationships", "processRelationshipList", "(", "ParserType", ".", "REFER_TO", ",", "level", ",", "variableMap", ",", "levelRelationships", ",", "lineNumber", ")", ";", "// Prerequisite relationships", "processRelationshipList", "(", "ParserType", ".", "PREREQUISITE", ",", "level", ",", "variableMap", ",", "levelRelationships", ",", "lineNumber", ")", ";", "// Link-List relationships", "processRelationshipList", "(", "ParserType", ".", "LINKLIST", ",", "level", ",", "variableMap", ",", "levelRelationships", ",", "lineNumber", ")", ";", "// Next and Previous relationships should only be created internally and shouldn't be specified by the user", "if", "(", "variableMap", ".", "containsKey", "(", "ParserType", ".", "NEXT", ")", "||", "variableMap", ".", "containsKey", "(", "ParserType", ".", "PREVIOUS", ")", ")", "{", "throw", "new", "ParsingException", "(", "format", "(", "ProcessorConstants", ".", "ERROR_TOPIC_NEXT_PREV_MSG", ",", "lineNumber", ",", "line", ")", ")", ";", "}", "// Add the relationships to the global list if any exist", "if", "(", "!", "levelRelationships", ".", "isEmpty", "(", ")", ")", "{", "parserData", ".", "getLevelRelationships", "(", ")", ".", "put", "(", "uniqueId", ",", "levelRelationships", ")", ";", "}", "}" ]
Process the relationships parsed for a topic. @param parserData @param level The temporary topic that will be turned into a full topic once fully parsed. @param variableMap The list of variables containing the parsed relationships. @param line The line representing the topic and it's relationships. @param lineNumber The number of the line the relationships are on. @throws ParsingException Thrown if the variables can't be parsed due to incorrect syntax.
[ "Process", "the", "relationships", "parsed", "for", "a", "topic", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L1402-L1426
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java
BaseXmlParser.getTagChildren
protected NodeList getTagChildren(String tagName, Element element) { """ Returns the children under the specified tag. Compensates for namespace usage. @param tagName Name of tag whose children are sought. @param element Element to search for tag. @return Node list containing children of tag. """ return element.getNamespaceURI() == null ? element.getElementsByTagName(tagName) : element.getElementsByTagNameNS( element.getNamespaceURI(), tagName); }
java
protected NodeList getTagChildren(String tagName, Element element) { return element.getNamespaceURI() == null ? element.getElementsByTagName(tagName) : element.getElementsByTagNameNS( element.getNamespaceURI(), tagName); }
[ "protected", "NodeList", "getTagChildren", "(", "String", "tagName", ",", "Element", "element", ")", "{", "return", "element", ".", "getNamespaceURI", "(", ")", "==", "null", "?", "element", ".", "getElementsByTagName", "(", "tagName", ")", ":", "element", ".", "getElementsByTagNameNS", "(", "element", ".", "getNamespaceURI", "(", ")", ",", "tagName", ")", ";", "}" ]
Returns the children under the specified tag. Compensates for namespace usage. @param tagName Name of tag whose children are sought. @param element Element to search for tag. @return Node list containing children of tag.
[ "Returns", "the", "children", "under", "the", "specified", "tag", ".", "Compensates", "for", "namespace", "usage", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java#L82-L85
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/cellprocessor/constraint/LengthExact.java
LengthExact.execute
@SuppressWarnings("unchecked") public Object execute(final Object value, final CsvContext context) { """ {@inheritDoc} @throws SuperCsvCellProcessorException {@literal if value is null} @throws SuperCsvConstraintViolationException {@literal if length is < min or length > max} """ if(value == null) { return next.execute(value, context); } final String stringValue = value.toString(); final int length = stringValue.length(); if( !requriedLengths.contains(length)) { final String joinedLength = requriedLengths.stream() .map(String::valueOf).collect(Collectors.joining(", ")); throw createValidationException(context) .messageFormat("the length (%d) of value '%s' not any of required lengths (%s)", length, stringValue, joinedLength) .rejectedValue(stringValue) .messageVariables("length", length) .messageVariables("requiredLengths", getRequiredLengths()) .build(); } return next.execute(stringValue, context); }
java
@SuppressWarnings("unchecked") public Object execute(final Object value, final CsvContext context) { if(value == null) { return next.execute(value, context); } final String stringValue = value.toString(); final int length = stringValue.length(); if( !requriedLengths.contains(length)) { final String joinedLength = requriedLengths.stream() .map(String::valueOf).collect(Collectors.joining(", ")); throw createValidationException(context) .messageFormat("the length (%d) of value '%s' not any of required lengths (%s)", length, stringValue, joinedLength) .rejectedValue(stringValue) .messageVariables("length", length) .messageVariables("requiredLengths", getRequiredLengths()) .build(); } return next.execute(stringValue, context); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "next", ".", "execute", "(", "value", ",", "context", ")", ";", "}", "final", "String", "stringValue", "=", "value", ".", "toString", "(", ")", ";", "final", "int", "length", "=", "stringValue", ".", "length", "(", ")", ";", "if", "(", "!", "requriedLengths", ".", "contains", "(", "length", ")", ")", "{", "final", "String", "joinedLength", "=", "requriedLengths", ".", "stream", "(", ")", ".", "map", "(", "String", "::", "valueOf", ")", ".", "collect", "(", "Collectors", ".", "joining", "(", "\", \"", ")", ")", ";", "throw", "createValidationException", "(", "context", ")", ".", "messageFormat", "(", "\"the length (%d) of value '%s' not any of required lengths (%s)\"", ",", "length", ",", "stringValue", ",", "joinedLength", ")", ".", "rejectedValue", "(", "stringValue", ")", ".", "messageVariables", "(", "\"length\"", ",", "length", ")", ".", "messageVariables", "(", "\"requiredLengths\"", ",", "getRequiredLengths", "(", ")", ")", ".", "build", "(", ")", ";", "}", "return", "next", ".", "execute", "(", "stringValue", ",", "context", ")", ";", "}" ]
{@inheritDoc} @throws SuperCsvCellProcessorException {@literal if value is null} @throws SuperCsvConstraintViolationException {@literal if length is < min or length > max}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/cellprocessor/constraint/LengthExact.java#L67-L92
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/AliasedDiscoveryConfigUtils.java
AliasedDiscoveryConfigUtils.newConfigFor
@SuppressWarnings("unchecked") public static AliasedDiscoveryConfig newConfigFor(String tag) { """ Creates new {@link AliasedDiscoveryConfig} by the given {@code tag}. """ if ("aws".equals(tag)) { return new AwsConfig(); } else if ("gcp".equals(tag)) { return new GcpConfig(); } else if ("azure".equals(tag)) { return new AzureConfig(); } else if ("kubernetes".equals(tag)) { return new KubernetesConfig(); } else if ("eureka".equals(tag)) { return new EurekaConfig(); } else { throw new IllegalArgumentException(String.format("Invalid tag: '%s'", tag)); } }
java
@SuppressWarnings("unchecked") public static AliasedDiscoveryConfig newConfigFor(String tag) { if ("aws".equals(tag)) { return new AwsConfig(); } else if ("gcp".equals(tag)) { return new GcpConfig(); } else if ("azure".equals(tag)) { return new AzureConfig(); } else if ("kubernetes".equals(tag)) { return new KubernetesConfig(); } else if ("eureka".equals(tag)) { return new EurekaConfig(); } else { throw new IllegalArgumentException(String.format("Invalid tag: '%s'", tag)); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "AliasedDiscoveryConfig", "newConfigFor", "(", "String", "tag", ")", "{", "if", "(", "\"aws\"", ".", "equals", "(", "tag", ")", ")", "{", "return", "new", "AwsConfig", "(", ")", ";", "}", "else", "if", "(", "\"gcp\"", ".", "equals", "(", "tag", ")", ")", "{", "return", "new", "GcpConfig", "(", ")", ";", "}", "else", "if", "(", "\"azure\"", ".", "equals", "(", "tag", ")", ")", "{", "return", "new", "AzureConfig", "(", ")", ";", "}", "else", "if", "(", "\"kubernetes\"", ".", "equals", "(", "tag", ")", ")", "{", "return", "new", "KubernetesConfig", "(", ")", ";", "}", "else", "if", "(", "\"eureka\"", ".", "equals", "(", "tag", ")", ")", "{", "return", "new", "EurekaConfig", "(", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"Invalid tag: '%s'\"", ",", "tag", ")", ")", ";", "}", "}" ]
Creates new {@link AliasedDiscoveryConfig} by the given {@code tag}.
[ "Creates", "new", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/AliasedDiscoveryConfigUtils.java#L187-L202
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/RedisChannelHandler.java
RedisChannelHandler.setTimeout
@Deprecated public void setTimeout(long timeout, TimeUnit unit) { """ Set the command timeout for this connection. @param timeout Command timeout. @param unit Unit of time for the timeout. @deprecated since 5.0, use {@link #setTimeout(Duration)} """ setTimeout(Duration.ofNanos(unit.toNanos(timeout))); }
java
@Deprecated public void setTimeout(long timeout, TimeUnit unit) { setTimeout(Duration.ofNanos(unit.toNanos(timeout))); }
[ "@", "Deprecated", "public", "void", "setTimeout", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "setTimeout", "(", "Duration", ".", "ofNanos", "(", "unit", ".", "toNanos", "(", "timeout", ")", ")", ")", ";", "}" ]
Set the command timeout for this connection. @param timeout Command timeout. @param unit Unit of time for the timeout. @deprecated since 5.0, use {@link #setTimeout(Duration)}
[ "Set", "the", "command", "timeout", "for", "this", "connection", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/RedisChannelHandler.java#L111-L114
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/requeststate/NameService.java
NameService.getMap
public Map getMap(String name, boolean create) { """ This method will return the state map associated with the Nameable object if the object has been stored in the <code>NameService</code> and something has been stored into the <code>Map</code>. Otherwise this will return null indicating that the map is empty. If the <code>create</code> parameter is true, we will always return the <code>Map</code> object. @param name The name of the object to return the named object. This must not be null. @param create This will create the map if necessary. @return A Map Object for the named object. This will return null if nothing has been stored in the map and <code>create</code> is false. """ if (name == null) throw new IllegalStateException("name must not be null"); if (_nameMap == null) return null; TrackingObject to = (TrackingObject) _nameMap.get(name); // The object wasn't found if (to == null) return null; // If the object has been reclaimed, then we remove the named object from the map. WeakReference wr = to.getWeakINameable(); INameable o = (INameable) wr.get(); if (o == null) { synchronized (_nameMap) { _nameMap.remove(name); } return null; } if (create) return to; return to.isMapCreated() ? to : null; }
java
public Map getMap(String name, boolean create) { if (name == null) throw new IllegalStateException("name must not be null"); if (_nameMap == null) return null; TrackingObject to = (TrackingObject) _nameMap.get(name); // The object wasn't found if (to == null) return null; // If the object has been reclaimed, then we remove the named object from the map. WeakReference wr = to.getWeakINameable(); INameable o = (INameable) wr.get(); if (o == null) { synchronized (_nameMap) { _nameMap.remove(name); } return null; } if (create) return to; return to.isMapCreated() ? to : null; }
[ "public", "Map", "getMap", "(", "String", "name", ",", "boolean", "create", ")", "{", "if", "(", "name", "==", "null", ")", "throw", "new", "IllegalStateException", "(", "\"name must not be null\"", ")", ";", "if", "(", "_nameMap", "==", "null", ")", "return", "null", ";", "TrackingObject", "to", "=", "(", "TrackingObject", ")", "_nameMap", ".", "get", "(", "name", ")", ";", "// The object wasn't found", "if", "(", "to", "==", "null", ")", "return", "null", ";", "// If the object has been reclaimed, then we remove the named object from the map.", "WeakReference", "wr", "=", "to", ".", "getWeakINameable", "(", ")", ";", "INameable", "o", "=", "(", "INameable", ")", "wr", ".", "get", "(", ")", ";", "if", "(", "o", "==", "null", ")", "{", "synchronized", "(", "_nameMap", ")", "{", "_nameMap", ".", "remove", "(", "name", ")", ";", "}", "return", "null", ";", "}", "if", "(", "create", ")", "return", "to", ";", "return", "to", ".", "isMapCreated", "(", ")", "?", "to", ":", "null", ";", "}" ]
This method will return the state map associated with the Nameable object if the object has been stored in the <code>NameService</code> and something has been stored into the <code>Map</code>. Otherwise this will return null indicating that the map is empty. If the <code>create</code> parameter is true, we will always return the <code>Map</code> object. @param name The name of the object to return the named object. This must not be null. @param create This will create the map if necessary. @return A Map Object for the named object. This will return null if nothing has been stored in the map and <code>create</code> is false.
[ "This", "method", "will", "return", "the", "state", "map", "associated", "with", "the", "Nameable", "object", "if", "the", "object", "has", "been", "stored", "in", "the", "<code", ">", "NameService<", "/", "code", ">", "and", "something", "has", "been", "stored", "into", "the", "<code", ">", "Map<", "/", "code", ">", ".", "Otherwise", "this", "will", "return", "null", "indicating", "that", "the", "map", "is", "empty", ".", "If", "the", "<code", ">", "create<", "/", "code", ">", "parameter", "is", "true", "we", "will", "always", "return", "the", "<code", ">", "Map<", "/", "code", ">", "object", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/requeststate/NameService.java#L243-L267
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java
ExcelWriter.write
@SuppressWarnings( { """ 写出数据,本方法只是将数据写入Workbook中的Sheet,并不写出到文件<br> 写出的起始行为当前行号,可使用{@link #getCurrentRow()}方法调用,根据写出的的行数,当前行号自动增加<br> 样式为默认样式,可使用{@link #getCellStyle()}方法调用后自定义默认样式<br> data中元素支持的类型有: <p> 1. Map,既元素为一个Map,第一个Map的keys作为首行,剩下的行为Map的values,data表示多行 <br> 2. Bean,既元素为一个Bean,第一个Bean的字段名列表会作为首行,剩下的行为Bean的字段值列表,data表示多行 <br> </p> @param data 数据 @param comparator 比较器,用于字段名的排序 @return this @since 3.2.3 """ "rawtypes", "unchecked" }) public ExcelWriter write(Iterable<?> data, Comparator<String> comparator) { Assert.isFalse(this.isClosed, "ExcelWriter has been closed!"); boolean isFirstRow = true; Map<?, ?> map; for (Object obj : data) { if (obj instanceof Map) { map = new TreeMap<>(comparator); map.putAll((Map) obj); } else { map = BeanUtil.beanToMap(obj, new TreeMap<String, Object>(comparator), false, false); } writeRow(map, isFirstRow); if (isFirstRow) { isFirstRow = false; } } return this; }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public ExcelWriter write(Iterable<?> data, Comparator<String> comparator) { Assert.isFalse(this.isClosed, "ExcelWriter has been closed!"); boolean isFirstRow = true; Map<?, ?> map; for (Object obj : data) { if (obj instanceof Map) { map = new TreeMap<>(comparator); map.putAll((Map) obj); } else { map = BeanUtil.beanToMap(obj, new TreeMap<String, Object>(comparator), false, false); } writeRow(map, isFirstRow); if (isFirstRow) { isFirstRow = false; } } return this; }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "ExcelWriter", "write", "(", "Iterable", "<", "?", ">", "data", ",", "Comparator", "<", "String", ">", "comparator", ")", "{", "Assert", ".", "isFalse", "(", "this", ".", "isClosed", ",", "\"ExcelWriter has been closed!\"", ")", ";", "boolean", "isFirstRow", "=", "true", ";", "Map", "<", "?", ",", "?", ">", "map", ";", "for", "(", "Object", "obj", ":", "data", ")", "{", "if", "(", "obj", "instanceof", "Map", ")", "{", "map", "=", "new", "TreeMap", "<>", "(", "comparator", ")", ";", "map", ".", "putAll", "(", "(", "Map", ")", "obj", ")", ";", "}", "else", "{", "map", "=", "BeanUtil", ".", "beanToMap", "(", "obj", ",", "new", "TreeMap", "<", "String", ",", "Object", ">", "(", "comparator", ")", ",", "false", ",", "false", ")", ";", "}", "writeRow", "(", "map", ",", "isFirstRow", ")", ";", "if", "(", "isFirstRow", ")", "{", "isFirstRow", "=", "false", ";", "}", "}", "return", "this", ";", "}" ]
写出数据,本方法只是将数据写入Workbook中的Sheet,并不写出到文件<br> 写出的起始行为当前行号,可使用{@link #getCurrentRow()}方法调用,根据写出的的行数,当前行号自动增加<br> 样式为默认样式,可使用{@link #getCellStyle()}方法调用后自定义默认样式<br> data中元素支持的类型有: <p> 1. Map,既元素为一个Map,第一个Map的keys作为首行,剩下的行为Map的values,data表示多行 <br> 2. Bean,既元素为一个Bean,第一个Bean的字段名列表会作为首行,剩下的行为Bean的字段值列表,data表示多行 <br> </p> @param data 数据 @param comparator 比较器,用于字段名的排序 @return this @since 3.2.3
[ "写出数据,本方法只是将数据写入Workbook中的Sheet,并不写出到文件<br", ">", "写出的起始行为当前行号,可使用", "{", "@link", "#getCurrentRow", "()", "}", "方法调用,根据写出的的行数,当前行号自动增加<br", ">", "样式为默认样式,可使用", "{", "@link", "#getCellStyle", "()", "}", "方法调用后自定义默认样式<br", ">", "data中元素支持的类型有:" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L626-L644
palatable/lambda
src/main/java/com/jnape/palatable/lambda/optics/lenses/CollectionLens.java
CollectionLens.asSet
public static <X, CX extends Collection<X>> Lens.Simple<CX, Set<X>> asSet( Function<? super CX, ? extends CX> copyFn) { """ Convenience static factory method for creating a lens that focuses on an arbitrary {@link Collection} as a {@link Set}. @param copyFn the copying function @param <X> the collection element type @param <CX> the type of the collection @return a lens that focuses on a Collection as a Set """ return simpleLens(HashSet::new, (xsL, xsS) -> { Set<X> missing = new HashSet<>(xsS); missing.removeAll(xsL); CX updated = copyFn.apply(xsL); updated.addAll(missing); updated.retainAll(xsS); return updated; }); }
java
public static <X, CX extends Collection<X>> Lens.Simple<CX, Set<X>> asSet( Function<? super CX, ? extends CX> copyFn) { return simpleLens(HashSet::new, (xsL, xsS) -> { Set<X> missing = new HashSet<>(xsS); missing.removeAll(xsL); CX updated = copyFn.apply(xsL); updated.addAll(missing); updated.retainAll(xsS); return updated; }); }
[ "public", "static", "<", "X", ",", "CX", "extends", "Collection", "<", "X", ">", ">", "Lens", ".", "Simple", "<", "CX", ",", "Set", "<", "X", ">", ">", "asSet", "(", "Function", "<", "?", "super", "CX", ",", "?", "extends", "CX", ">", "copyFn", ")", "{", "return", "simpleLens", "(", "HashSet", "::", "new", ",", "(", "xsL", ",", "xsS", ")", "->", "{", "Set", "<", "X", ">", "missing", "=", "new", "HashSet", "<>", "(", "xsS", ")", ";", "missing", ".", "removeAll", "(", "xsL", ")", ";", "CX", "updated", "=", "copyFn", ".", "apply", "(", "xsL", ")", ";", "updated", ".", "addAll", "(", "missing", ")", ";", "updated", ".", "retainAll", "(", "xsS", ")", ";", "return", "updated", ";", "}", ")", ";", "}" ]
Convenience static factory method for creating a lens that focuses on an arbitrary {@link Collection} as a {@link Set}. @param copyFn the copying function @param <X> the collection element type @param <CX> the type of the collection @return a lens that focuses on a Collection as a Set
[ "Convenience", "static", "factory", "method", "for", "creating", "a", "lens", "that", "focuses", "on", "an", "arbitrary", "{", "@link", "Collection", "}", "as", "a", "{", "@link", "Set", "}", "." ]
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/optics/lenses/CollectionLens.java#L43-L53
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigEvaluator.java
ConfigEvaluator.convertObjectToSingleValue
private Object convertObjectToSingleValue(Object rawValue, ExtendedAttributeDefinition attrDef, EvaluationContext context, int index, boolean ignoreWarnings) throws ConfigEvaluatorException { """ Process and evaluate a raw value. @return the converted value, or null if the value was unresolved """ if (rawValue instanceof String) { return convertStringToSingleValue((String) rawValue, attrDef, context, ignoreWarnings); } else if (rawValue instanceof ConfigElement.Reference) { ConfigElement.Reference reference = processReference((ConfigElement.Reference) rawValue, context, ignoreWarnings); if (attrDef != null && attrDef.getType() == MetaTypeFactory.PID_TYPE) { return evaluateReference(reference.getId(), attrDef, context); } else { return evaluateReference(reference, context); } } else if (rawValue instanceof ConfigElement) { return convertConfigElementToSingleValue((ConfigElement) rawValue, attrDef, context, index, ignoreWarnings); } else { throw new IllegalStateException("Unsupported type: " + rawValue.getClass()); } }
java
private Object convertObjectToSingleValue(Object rawValue, ExtendedAttributeDefinition attrDef, EvaluationContext context, int index, boolean ignoreWarnings) throws ConfigEvaluatorException { if (rawValue instanceof String) { return convertStringToSingleValue((String) rawValue, attrDef, context, ignoreWarnings); } else if (rawValue instanceof ConfigElement.Reference) { ConfigElement.Reference reference = processReference((ConfigElement.Reference) rawValue, context, ignoreWarnings); if (attrDef != null && attrDef.getType() == MetaTypeFactory.PID_TYPE) { return evaluateReference(reference.getId(), attrDef, context); } else { return evaluateReference(reference, context); } } else if (rawValue instanceof ConfigElement) { return convertConfigElementToSingleValue((ConfigElement) rawValue, attrDef, context, index, ignoreWarnings); } else { throw new IllegalStateException("Unsupported type: " + rawValue.getClass()); } }
[ "private", "Object", "convertObjectToSingleValue", "(", "Object", "rawValue", ",", "ExtendedAttributeDefinition", "attrDef", ",", "EvaluationContext", "context", ",", "int", "index", ",", "boolean", "ignoreWarnings", ")", "throws", "ConfigEvaluatorException", "{", "if", "(", "rawValue", "instanceof", "String", ")", "{", "return", "convertStringToSingleValue", "(", "(", "String", ")", "rawValue", ",", "attrDef", ",", "context", ",", "ignoreWarnings", ")", ";", "}", "else", "if", "(", "rawValue", "instanceof", "ConfigElement", ".", "Reference", ")", "{", "ConfigElement", ".", "Reference", "reference", "=", "processReference", "(", "(", "ConfigElement", ".", "Reference", ")", "rawValue", ",", "context", ",", "ignoreWarnings", ")", ";", "if", "(", "attrDef", "!=", "null", "&&", "attrDef", ".", "getType", "(", ")", "==", "MetaTypeFactory", ".", "PID_TYPE", ")", "{", "return", "evaluateReference", "(", "reference", ".", "getId", "(", ")", ",", "attrDef", ",", "context", ")", ";", "}", "else", "{", "return", "evaluateReference", "(", "reference", ",", "context", ")", ";", "}", "}", "else", "if", "(", "rawValue", "instanceof", "ConfigElement", ")", "{", "return", "convertConfigElementToSingleValue", "(", "(", "ConfigElement", ")", "rawValue", ",", "attrDef", ",", "context", ",", "index", ",", "ignoreWarnings", ")", ";", "}", "else", "{", "throw", "new", "IllegalStateException", "(", "\"Unsupported type: \"", "+", "rawValue", ".", "getClass", "(", ")", ")", ";", "}", "}" ]
Process and evaluate a raw value. @return the converted value, or null if the value was unresolved
[ "Process", "and", "evaluate", "a", "raw", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigEvaluator.java#L895-L911
FilteredPush/event_date_qc
src/main/java/org/filteredpush/qc/date/DateUtils.java
DateUtils.eventsAreSameInterval
public static Boolean eventsAreSameInterval(String eventDate, String secondEventDate) { """ Compare two strings that should represent event dates (ingoring time, if not a date range) @param eventDate to compare with second event date @param secondEventDate to compare with @return true if the two provided event dates represent the same interval. """ boolean result = false; try { Interval interval = null; Interval secondInterval = null; interval = DateUtils.extractDateInterval(eventDate); secondInterval = DateUtils.extractDateInterval(secondEventDate); logger.debug(interval.toString()); logger.debug(secondInterval.toString()); result = interval.equals(secondInterval); } catch (IllegalFieldValueException ex) { // field format error, can't parse as date, log at debug level. logger.debug(ex.getMessage()); } catch (Exception e) { logger.error(e.getMessage()); } return result; }
java
public static Boolean eventsAreSameInterval(String eventDate, String secondEventDate) { boolean result = false; try { Interval interval = null; Interval secondInterval = null; interval = DateUtils.extractDateInterval(eventDate); secondInterval = DateUtils.extractDateInterval(secondEventDate); logger.debug(interval.toString()); logger.debug(secondInterval.toString()); result = interval.equals(secondInterval); } catch (IllegalFieldValueException ex) { // field format error, can't parse as date, log at debug level. logger.debug(ex.getMessage()); } catch (Exception e) { logger.error(e.getMessage()); } return result; }
[ "public", "static", "Boolean", "eventsAreSameInterval", "(", "String", "eventDate", ",", "String", "secondEventDate", ")", "{", "boolean", "result", "=", "false", ";", "try", "{", "Interval", "interval", "=", "null", ";", "Interval", "secondInterval", "=", "null", ";", "interval", "=", "DateUtils", ".", "extractDateInterval", "(", "eventDate", ")", ";", "secondInterval", "=", "DateUtils", ".", "extractDateInterval", "(", "secondEventDate", ")", ";", "logger", ".", "debug", "(", "interval", ".", "toString", "(", ")", ")", ";", "logger", ".", "debug", "(", "secondInterval", ".", "toString", "(", ")", ")", ";", "result", "=", "interval", ".", "equals", "(", "secondInterval", ")", ";", "}", "catch", "(", "IllegalFieldValueException", "ex", ")", "{", "// field format error, can't parse as date, log at debug level.", "logger", ".", "debug", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Compare two strings that should represent event dates (ingoring time, if not a date range) @param eventDate to compare with second event date @param secondEventDate to compare with @return true if the two provided event dates represent the same interval.
[ "Compare", "two", "strings", "that", "should", "represent", "event", "dates", "(", "ingoring", "time", "if", "not", "a", "date", "range", ")" ]
train
https://github.com/FilteredPush/event_date_qc/blob/52957a71b94b00b767e37924f976e2c7e8868ff3/src/main/java/org/filteredpush/qc/date/DateUtils.java#L2608-L2625
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/utils/FastDateFormat.java
FastDateFormat.getTimeZoneDisplay
static synchronized String getTimeZoneDisplay(TimeZone tz, boolean daylight, int style, Locale locale) { """ <p>Gets the time zone display name, using a cache for performance.</p> @param tz the zone to query @param daylight true if daylight savings @param style the style to use <code>TimeZone.LONG</code> or <code>TimeZone.SHORT</code> @param locale the locale to use @return the textual name of the time zone """ Object key = new TimeZoneDisplayKey(tz, daylight, style, locale); String value = (String) cTimeZoneDisplayCache.get(key); if (value == null) { // This is a very slow call, so cache the results. value = tz.getDisplayName(daylight, style, locale); cTimeZoneDisplayCache.put(key, value); } return value; }
java
static synchronized String getTimeZoneDisplay(TimeZone tz, boolean daylight, int style, Locale locale) { Object key = new TimeZoneDisplayKey(tz, daylight, style, locale); String value = (String) cTimeZoneDisplayCache.get(key); if (value == null) { // This is a very slow call, so cache the results. value = tz.getDisplayName(daylight, style, locale); cTimeZoneDisplayCache.put(key, value); } return value; }
[ "static", "synchronized", "String", "getTimeZoneDisplay", "(", "TimeZone", "tz", ",", "boolean", "daylight", ",", "int", "style", ",", "Locale", "locale", ")", "{", "Object", "key", "=", "new", "TimeZoneDisplayKey", "(", "tz", ",", "daylight", ",", "style", ",", "locale", ")", ";", "String", "value", "=", "(", "String", ")", "cTimeZoneDisplayCache", ".", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "// This is a very slow call, so cache the results.\r", "value", "=", "tz", ".", "getDisplayName", "(", "daylight", ",", "style", ",", "locale", ")", ";", "cTimeZoneDisplayCache", ".", "put", "(", "key", ",", "value", ")", ";", "}", "return", "value", ";", "}" ]
<p>Gets the time zone display name, using a cache for performance.</p> @param tz the zone to query @param daylight true if daylight savings @param style the style to use <code>TimeZone.LONG</code> or <code>TimeZone.SHORT</code> @param locale the locale to use @return the textual name of the time zone
[ "<p", ">", "Gets", "the", "time", "zone", "display", "name", "using", "a", "cache", "for", "performance", ".", "<", "/", "p", ">" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/FastDateFormat.java#L497-L506
s1-platform/s1
s1-core/src/java/org/s1/ws/SOAPOperation.java
SOAPOperation.getAction
protected String getAction(String service, SOAPMessage msg, HttpServletRequest request) { """ Get SOAPAction, try to get it from first body child name @param service @param msg @param request @return """ if(!request.getMethod().equalsIgnoreCase("post")){ return null; } String a = null; Element action = null; try { action = XMLFormat.getFirstChildElement(msg.getSOAPBody(), null, null); } catch (SOAPException e) { throw S1SystemError.wrap(e); } if(action!=null) a = action.getLocalName(); return a; }
java
protected String getAction(String service, SOAPMessage msg, HttpServletRequest request){ if(!request.getMethod().equalsIgnoreCase("post")){ return null; } String a = null; Element action = null; try { action = XMLFormat.getFirstChildElement(msg.getSOAPBody(), null, null); } catch (SOAPException e) { throw S1SystemError.wrap(e); } if(action!=null) a = action.getLocalName(); return a; }
[ "protected", "String", "getAction", "(", "String", "service", ",", "SOAPMessage", "msg", ",", "HttpServletRequest", "request", ")", "{", "if", "(", "!", "request", ".", "getMethod", "(", ")", ".", "equalsIgnoreCase", "(", "\"post\"", ")", ")", "{", "return", "null", ";", "}", "String", "a", "=", "null", ";", "Element", "action", "=", "null", ";", "try", "{", "action", "=", "XMLFormat", ".", "getFirstChildElement", "(", "msg", ".", "getSOAPBody", "(", ")", ",", "null", ",", "null", ")", ";", "}", "catch", "(", "SOAPException", "e", ")", "{", "throw", "S1SystemError", ".", "wrap", "(", "e", ")", ";", "}", "if", "(", "action", "!=", "null", ")", "a", "=", "action", ".", "getLocalName", "(", ")", ";", "return", "a", ";", "}" ]
Get SOAPAction, try to get it from first body child name @param service @param msg @param request @return
[ "Get", "SOAPAction", "try", "to", "get", "it", "from", "first", "body", "child", "name" ]
train
https://github.com/s1-platform/s1/blob/370101c13fef01af524bc171bcc1a97e5acc76e8/s1-core/src/java/org/s1/ws/SOAPOperation.java#L178-L193
pawelprazak/java-extended
guava/src/main/java/com/bluecatcode/common/contract/Checks.java
Checks.checkUri
public static String checkUri(String uri, @Nullable Object errorMessage) { """ Performs URI check against RFC 2396 specification @param uri the URI to check @return the checked uri @throws IllegalArgumentException if the {@code uri} is invalid @throws NullPointerException if the {@code uri} is null @see Checks#checkUri(String, String, Object...) """ return checkUri(uri, String.valueOf(errorMessage), EMPTY_ERROR_MESSAGE_ARGS); }
java
public static String checkUri(String uri, @Nullable Object errorMessage) { return checkUri(uri, String.valueOf(errorMessage), EMPTY_ERROR_MESSAGE_ARGS); }
[ "public", "static", "String", "checkUri", "(", "String", "uri", ",", "@", "Nullable", "Object", "errorMessage", ")", "{", "return", "checkUri", "(", "uri", ",", "String", ".", "valueOf", "(", "errorMessage", ")", ",", "EMPTY_ERROR_MESSAGE_ARGS", ")", ";", "}" ]
Performs URI check against RFC 2396 specification @param uri the URI to check @return the checked uri @throws IllegalArgumentException if the {@code uri} is invalid @throws NullPointerException if the {@code uri} is null @see Checks#checkUri(String, String, Object...)
[ "Performs", "URI", "check", "against", "RFC", "2396", "specification" ]
train
https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/contract/Checks.java#L448-L450
cdk/cdk
base/silent/src/main/java/org/openscience/cdk/silent/AtomContainerSet.java
AtomContainerSet.setMultiplier
@Override public boolean setMultiplier(IAtomContainer container, Double multiplier) { """ Sets the coefficient of a AtomContainer to a given value. @param container The AtomContainer for which the multiplier is set @param multiplier The new multiplier for the AtomContatiner @return true if multiplier has been set @see #getMultiplier(IAtomContainer) """ for (int i = 0; i < atomContainers.length; i++) { if (atomContainers[i] == container) { multipliers[i] = multiplier; return true; } } return false; }
java
@Override public boolean setMultiplier(IAtomContainer container, Double multiplier) { for (int i = 0; i < atomContainers.length; i++) { if (atomContainers[i] == container) { multipliers[i] = multiplier; return true; } } return false; }
[ "@", "Override", "public", "boolean", "setMultiplier", "(", "IAtomContainer", "container", ",", "Double", "multiplier", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "atomContainers", ".", "length", ";", "i", "++", ")", "{", "if", "(", "atomContainers", "[", "i", "]", "==", "container", ")", "{", "multipliers", "[", "i", "]", "=", "multiplier", ";", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Sets the coefficient of a AtomContainer to a given value. @param container The AtomContainer for which the multiplier is set @param multiplier The new multiplier for the AtomContatiner @return true if multiplier has been set @see #getMultiplier(IAtomContainer)
[ "Sets", "the", "coefficient", "of", "a", "AtomContainer", "to", "a", "given", "value", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/AtomContainerSet.java#L146-L155
shrinkwrap/resolver
maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/bootstrap/MavenRepositorySystem.java
MavenRepositorySystem.resolveArtifact
public ArtifactResult resolveArtifact(final RepositorySystemSession session, final ArtifactRequest request) throws ArtifactResolutionException { """ Resolves an artifact @param session The current Maven session @param request The request to be computed @return The artifact @throws ArtifactResolutionException If the artifact could not be fetched """ return system.resolveArtifact(session, request); }
java
public ArtifactResult resolveArtifact(final RepositorySystemSession session, final ArtifactRequest request) throws ArtifactResolutionException { return system.resolveArtifact(session, request); }
[ "public", "ArtifactResult", "resolveArtifact", "(", "final", "RepositorySystemSession", "session", ",", "final", "ArtifactRequest", "request", ")", "throws", "ArtifactResolutionException", "{", "return", "system", ".", "resolveArtifact", "(", "session", ",", "request", ")", ";", "}" ]
Resolves an artifact @param session The current Maven session @param request The request to be computed @return The artifact @throws ArtifactResolutionException If the artifact could not be fetched
[ "Resolves", "an", "artifact" ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/bootstrap/MavenRepositorySystem.java#L133-L136
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java
PyExpressionGenerator._generate
protected XExpression _generate(XFeatureCall call, IAppendable it, IExtraLanguageGeneratorContext context) { """ Generate the given object. @param call the feature call. @param it the target for the generated content. @param context the context. @return the feature call. """ appendReturnIfExpectedReturnedExpression(it, context); newFeatureCallGenerator(context, it).generate(call); return call; }
java
protected XExpression _generate(XFeatureCall call, IAppendable it, IExtraLanguageGeneratorContext context) { appendReturnIfExpectedReturnedExpression(it, context); newFeatureCallGenerator(context, it).generate(call); return call; }
[ "protected", "XExpression", "_generate", "(", "XFeatureCall", "call", ",", "IAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "appendReturnIfExpectedReturnedExpression", "(", "it", ",", "context", ")", ";", "newFeatureCallGenerator", "(", "context", ",", "it", ")", ".", "generate", "(", "call", ")", ";", "return", "call", ";", "}" ]
Generate the given object. @param call the feature call. @param it the target for the generated content. @param context the context. @return the feature call.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L497-L501
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java
CollectionLiteralsTypeComputer.getCommonSuperType
@Override protected LightweightTypeReference getCommonSuperType(List<LightweightTypeReference> types, ITypeComputationState state) { """ Specializes the super implementation such that is allows an empty list of types. Returns {@code null} for those. {@inheritDoc} """ if (types.isEmpty()) { return null; } LightweightTypeReference result = super.getCommonSuperType(types, state); return result; }
java
@Override protected LightweightTypeReference getCommonSuperType(List<LightweightTypeReference> types, ITypeComputationState state) { if (types.isEmpty()) { return null; } LightweightTypeReference result = super.getCommonSuperType(types, state); return result; }
[ "@", "Override", "protected", "LightweightTypeReference", "getCommonSuperType", "(", "List", "<", "LightweightTypeReference", ">", "types", ",", "ITypeComputationState", "state", ")", "{", "if", "(", "types", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "LightweightTypeReference", "result", "=", "super", ".", "getCommonSuperType", "(", "types", ",", "state", ")", ";", "return", "result", ";", "}" ]
Specializes the super implementation such that is allows an empty list of types. Returns {@code null} for those. {@inheritDoc}
[ "Specializes", "the", "super", "implementation", "such", "that", "is", "allows", "an", "empty", "list", "of", "types", ".", "Returns", "{", "@code", "null", "}", "for", "those", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java#L76-L83
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/RunnableUtils.java
RunnableUtils.runWithSleepThenReturnValueThrowOnInterrupt
public static <T> T runWithSleepThenReturnValueThrowOnInterrupt(long milliseconds, ReturningRunnable<T> runnable) { """ Runs the given {@link ReturningRunnable} object and then causes the current, calling {@link Thread} to sleep for the given number of milliseconds before returning a value. This utility method can be used to simulate a long running, expensive operation. @param <T> {{@link Class} type of the {@link ReturningRunnable} return value. @param milliseconds a long value with the number of milliseconds for the current {@link Thread} to sleep. @param runnable {@link ReturningRunnable} object to run; must not be {@literal null}. @return the value returned by the {@link ReturningRunnable}. @throws IllegalArgumentException if milliseconds is less than equal to 0. @throws SleepDeprivedException if the current {@link Thread} is interrupted while sleeping. @see org.cp.elements.lang.RunnableUtils.ReturningRunnable#run() @see org.cp.elements.lang.concurrent.ThreadUtils#sleep(long, int) """ Assert.isTrue(milliseconds > 0, "Milliseconds [%d] must be greater than 0", milliseconds); T returnValue = runnable.run(); if (!ThreadUtils.sleep(milliseconds, 0)) { throw new SleepDeprivedException(String.format("Failed to wait for [%d] millisecond(s)", milliseconds)); } return returnValue; }
java
public static <T> T runWithSleepThenReturnValueThrowOnInterrupt(long milliseconds, ReturningRunnable<T> runnable) { Assert.isTrue(milliseconds > 0, "Milliseconds [%d] must be greater than 0", milliseconds); T returnValue = runnable.run(); if (!ThreadUtils.sleep(milliseconds, 0)) { throw new SleepDeprivedException(String.format("Failed to wait for [%d] millisecond(s)", milliseconds)); } return returnValue; }
[ "public", "static", "<", "T", ">", "T", "runWithSleepThenReturnValueThrowOnInterrupt", "(", "long", "milliseconds", ",", "ReturningRunnable", "<", "T", ">", "runnable", ")", "{", "Assert", ".", "isTrue", "(", "milliseconds", ">", "0", ",", "\"Milliseconds [%d] must be greater than 0\"", ",", "milliseconds", ")", ";", "T", "returnValue", "=", "runnable", ".", "run", "(", ")", ";", "if", "(", "!", "ThreadUtils", ".", "sleep", "(", "milliseconds", ",", "0", ")", ")", "{", "throw", "new", "SleepDeprivedException", "(", "String", ".", "format", "(", "\"Failed to wait for [%d] millisecond(s)\"", ",", "milliseconds", ")", ")", ";", "}", "return", "returnValue", ";", "}" ]
Runs the given {@link ReturningRunnable} object and then causes the current, calling {@link Thread} to sleep for the given number of milliseconds before returning a value. This utility method can be used to simulate a long running, expensive operation. @param <T> {{@link Class} type of the {@link ReturningRunnable} return value. @param milliseconds a long value with the number of milliseconds for the current {@link Thread} to sleep. @param runnable {@link ReturningRunnable} object to run; must not be {@literal null}. @return the value returned by the {@link ReturningRunnable}. @throws IllegalArgumentException if milliseconds is less than equal to 0. @throws SleepDeprivedException if the current {@link Thread} is interrupted while sleeping. @see org.cp.elements.lang.RunnableUtils.ReturningRunnable#run() @see org.cp.elements.lang.concurrent.ThreadUtils#sleep(long, int)
[ "Runs", "the", "given", "{", "@link", "ReturningRunnable", "}", "object", "and", "then", "causes", "the", "current", "calling", "{", "@link", "Thread", "}", "to", "sleep", "for", "the", "given", "number", "of", "milliseconds", "before", "returning", "a", "value", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RunnableUtils.java#L153-L164
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.accessRestriction_sms_id_PUT
public void accessRestriction_sms_id_PUT(Long id, OvhSmsAccount body) throws IOException { """ Alter this object properties REST: PUT /me/accessRestriction/sms/{id} @param body [required] New object properties @param id [required] The Id of the restriction """ String qPath = "/me/accessRestriction/sms/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void accessRestriction_sms_id_PUT(Long id, OvhSmsAccount body) throws IOException { String qPath = "/me/accessRestriction/sms/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "accessRestriction_sms_id_PUT", "(", "Long", "id", ",", "OvhSmsAccount", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/accessRestriction/sms/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /me/accessRestriction/sms/{id} @param body [required] New object properties @param id [required] The Id of the restriction
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3854-L3858