repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
pravega/pravega
segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/SegmentChunk.java
SegmentChunk.withNewOffset
SegmentChunk withNewOffset(long newOffset) { SegmentChunk ns = new SegmentChunk(this.name, newOffset); ns.setLength(getLength()); if (isSealed()) { ns.markSealed(); } if (!exists()) { ns.markInexistent(); } return ns; }
java
SegmentChunk withNewOffset(long newOffset) { SegmentChunk ns = new SegmentChunk(this.name, newOffset); ns.setLength(getLength()); if (isSealed()) { ns.markSealed(); } if (!exists()) { ns.markInexistent(); } return ns; }
[ "SegmentChunk", "withNewOffset", "(", "long", "newOffset", ")", "{", "SegmentChunk", "ns", "=", "new", "SegmentChunk", "(", "this", ".", "name", ",", "newOffset", ")", ";", "ns", ".", "setLength", "(", "getLength", "(", ")", ")", ";", "if", "(", "isSeale...
Creates a new instance of the SegmentChunk class with the same information as this one, but with a new offset. @param newOffset The new offset. @return A new SegmentChunk.
[ "Creates", "a", "new", "instance", "of", "the", "SegmentChunk", "class", "with", "the", "same", "information", "as", "this", "one", "but", "with", "a", "new", "offset", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/src/main/java/io/pravega/segmentstore/storage/rolling/SegmentChunk.java#L76-L88
aoindustries/aocode-public
src/main/java/com/aoindustries/util/StringUtility.java
StringUtility.countOccurrences
public static int countOccurrences(byte[] buff, int len, String word) { int wordlen=word.length(); int end=len-wordlen; int count=0; Loop: for(int c=0;c<=end;c++) { for(int d=0;d<wordlen;d++) { char ch1=(char)buff[c+d]; if(ch1<='Z' && ch1>='A') ch1+='a'-'A'; char ch2=word.charAt(d); if(ch2<='Z' && ch2>='A') ch2+='a'-'A'; if(ch1!=ch2) continue Loop; } c+=wordlen-1; count++; } return count; }
java
public static int countOccurrences(byte[] buff, int len, String word) { int wordlen=word.length(); int end=len-wordlen; int count=0; Loop: for(int c=0;c<=end;c++) { for(int d=0;d<wordlen;d++) { char ch1=(char)buff[c+d]; if(ch1<='Z' && ch1>='A') ch1+='a'-'A'; char ch2=word.charAt(d); if(ch2<='Z' && ch2>='A') ch2+='a'-'A'; if(ch1!=ch2) continue Loop; } c+=wordlen-1; count++; } return count; }
[ "public", "static", "int", "countOccurrences", "(", "byte", "[", "]", "buff", ",", "int", "len", ",", "String", "word", ")", "{", "int", "wordlen", "=", "word", ".", "length", "(", ")", ";", "int", "end", "=", "len", "-", "wordlen", ";", "int", "co...
Counts how many times a word appears in a line. Case insensitive matching.
[ "Counts", "how", "many", "times", "a", "word", "appears", "in", "a", "line", ".", "Case", "insensitive", "matching", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/StringUtility.java#L307-L324
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/core/CaptureSearchResults.java
CaptureSearchResults.addSearchResult
public void addSearchResult(CaptureSearchResult result, boolean append) { String resultDate = result.getCaptureTimestamp(); if ((firstResultTimestamp == null) || (firstResultTimestamp.compareTo(resultDate) > 0)) { firstResultTimestamp = resultDate; } if ((lastResultTimestamp == null) || (lastResultTimestamp.compareTo(resultDate) < 0)) { lastResultTimestamp = resultDate; } if (append) { if (!results.isEmpty()) { results.getLast().setNextResult(result); result.setPrevResult(results.getLast()); } results.add(result); } else { if (!results.isEmpty()) { results.getFirst().setPrevResult(result); result.setNextResult(results.getFirst()); } results.add(0, result); } }
java
public void addSearchResult(CaptureSearchResult result, boolean append) { String resultDate = result.getCaptureTimestamp(); if ((firstResultTimestamp == null) || (firstResultTimestamp.compareTo(resultDate) > 0)) { firstResultTimestamp = resultDate; } if ((lastResultTimestamp == null) || (lastResultTimestamp.compareTo(resultDate) < 0)) { lastResultTimestamp = resultDate; } if (append) { if (!results.isEmpty()) { results.getLast().setNextResult(result); result.setPrevResult(results.getLast()); } results.add(result); } else { if (!results.isEmpty()) { results.getFirst().setPrevResult(result); result.setNextResult(results.getFirst()); } results.add(0, result); } }
[ "public", "void", "addSearchResult", "(", "CaptureSearchResult", "result", ",", "boolean", "append", ")", "{", "String", "resultDate", "=", "result", ".", "getCaptureTimestamp", "(", ")", ";", "if", "(", "(", "firstResultTimestamp", "==", "null", ")", "||", "(...
Add a result to this results, at either the beginning or the end, depending on the append argument @param result SearchResult to add to this set @param append
[ "Add", "a", "result", "to", "this", "results", "at", "either", "the", "beginning", "or", "the", "end", "depending", "on", "the", "append", "argument" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/CaptureSearchResults.java#L98-L125
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.generateThumbnailWithServiceResponseAsync
public Observable<ServiceResponse<InputStream>> generateThumbnailWithServiceResponseAsync(int width, int height, String url, GenerateThumbnailOptionalParameter generateThumbnailOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final Boolean smartCropping = generateThumbnailOptionalParameter != null ? generateThumbnailOptionalParameter.smartCropping() : null; return generateThumbnailWithServiceResponseAsync(width, height, url, smartCropping); }
java
public Observable<ServiceResponse<InputStream>> generateThumbnailWithServiceResponseAsync(int width, int height, String url, GenerateThumbnailOptionalParameter generateThumbnailOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final Boolean smartCropping = generateThumbnailOptionalParameter != null ? generateThumbnailOptionalParameter.smartCropping() : null; return generateThumbnailWithServiceResponseAsync(width, height, url, smartCropping); }
[ "public", "Observable", "<", "ServiceResponse", "<", "InputStream", ">", ">", "generateThumbnailWithServiceResponseAsync", "(", "int", "width", ",", "int", "height", ",", "String", "url", ",", "GenerateThumbnailOptionalParameter", "generateThumbnailOptionalParameter", ")", ...
This operation generates a thumbnail image with the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart cropping coordinates based on the ROI. Smart cropping helps when you specify an aspect ratio that differs from that of the input image. A successful response contains the thumbnail image binary. If the request failed, the response contains an error code and a message to help determine what went wrong. @param width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. @param url Publicly reachable URL of an image @param generateThumbnailOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the InputStream object
[ "This", "operation", "generates", "a", "thumbnail", "image", "with", "the", "user", "-", "specified", "width", "and", "height", ".", "By", "default", "the", "service", "analyzes", "the", "image", "identifies", "the", "region", "of", "interest", "(", "ROI", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L2114-L2124
linkhub-sdk/popbill.sdk.java
src/main/java/com/popbill/api/fax/FaxServiceImp.java
FaxServiceImp.resendFAX
@Override public String resendFAX(String corpNum, String receiptNum, String sendNum, String senderName, Receiver[] receivers, Date reserveDT) throws PopbillException { return resendFAX(corpNum, receiptNum, sendNum, senderName, receivers, reserveDT, null, null); }
java
@Override public String resendFAX(String corpNum, String receiptNum, String sendNum, String senderName, Receiver[] receivers, Date reserveDT) throws PopbillException { return resendFAX(corpNum, receiptNum, sendNum, senderName, receivers, reserveDT, null, null); }
[ "@", "Override", "public", "String", "resendFAX", "(", "String", "corpNum", ",", "String", "receiptNum", ",", "String", "sendNum", ",", "String", "senderName", ",", "Receiver", "[", "]", "receivers", ",", "Date", "reserveDT", ")", "throws", "PopbillException", ...
/* (non-Javadoc) @see com.popbill.api.FaxService#resendFAX(java.lang.String, java.lang.String, java.lang.String, java.lang.String, com.popbill.api.fax.Receiver[], java.util.Date)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/linkhub-sdk/popbill.sdk.java/blob/63a341fefe96d60a368776638f3d4c81888238b7/src/main/java/com/popbill/api/fax/FaxServiceImp.java#L824-L829
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/FieldCriteria.java
FieldCriteria.buildNotGreaterCriteria
static FieldCriteria buildNotGreaterCriteria(Object anAttribute, Object aValue, UserAlias anAlias) { return new FieldCriteria(anAttribute, aValue, NOT_GREATER, anAlias); }
java
static FieldCriteria buildNotGreaterCriteria(Object anAttribute, Object aValue, UserAlias anAlias) { return new FieldCriteria(anAttribute, aValue, NOT_GREATER, anAlias); }
[ "static", "FieldCriteria", "buildNotGreaterCriteria", "(", "Object", "anAttribute", ",", "Object", "aValue", ",", "UserAlias", "anAlias", ")", "{", "return", "new", "FieldCriteria", "(", "anAttribute", ",", "aValue", ",", "NOT_GREATER", ",", "anAlias", ")", ";", ...
static FieldCriteria buildNotGreaterCriteria(Object anAttribute, Object aValue, String anAlias)
[ "static", "FieldCriteria", "buildNotGreaterCriteria", "(", "Object", "anAttribute", "Object", "aValue", "String", "anAlias", ")" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/FieldCriteria.java#L49-L52
google/gson
gson/src/main/java/com/google/gson/internal/bind/util/ISO8601Utils.java
ISO8601Utils.padInt
private static void padInt(StringBuilder buffer, int value, int length) { String strValue = Integer.toString(value); for (int i = length - strValue.length(); i > 0; i--) { buffer.append('0'); } buffer.append(strValue); }
java
private static void padInt(StringBuilder buffer, int value, int length) { String strValue = Integer.toString(value); for (int i = length - strValue.length(); i > 0; i--) { buffer.append('0'); } buffer.append(strValue); }
[ "private", "static", "void", "padInt", "(", "StringBuilder", "buffer", ",", "int", "value", ",", "int", "length", ")", "{", "String", "strValue", "=", "Integer", ".", "toString", "(", "value", ")", ";", "for", "(", "int", "i", "=", "length", "-", "strV...
Zero pad a number to a specified length @param buffer buffer to use for padding @param value the integer value to pad if necessary. @param length the length of the string we should zero pad
[ "Zero", "pad", "a", "number", "to", "a", "specified", "length" ]
train
https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/internal/bind/util/ISO8601Utils.java#L333-L339
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/MyNumberUtils.java
MyNumberUtils.randomLongBetween
public static long randomLongBetween(long min, long max) { Random rand = new Random(); return min + (long) (rand.nextDouble() * (max - min)); }
java
public static long randomLongBetween(long min, long max) { Random rand = new Random(); return min + (long) (rand.nextDouble() * (max - min)); }
[ "public", "static", "long", "randomLongBetween", "(", "long", "min", ",", "long", "max", ")", "{", "Random", "rand", "=", "new", "Random", "(", ")", ";", "return", "min", "+", "(", "long", ")", "(", "rand", ".", "nextDouble", "(", ")", "*", "(", "m...
Returns a long between interval @param min Minimum value @param max Maximum value @return long number
[ "Returns", "a", "long", "between", "interval" ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyNumberUtils.java#L46-L49
upwork/java-upwork
src/com/Upwork/api/Routers/Hr/Freelancers/Offers.java
Offers.actions
public JSONObject actions(String reference, HashMap<String, String> params) throws JSONException { return oClient.post("/offers/v1/contractors/offers/" + reference, params); }
java
public JSONObject actions(String reference, HashMap<String, String> params) throws JSONException { return oClient.post("/offers/v1/contractors/offers/" + reference, params); }
[ "public", "JSONObject", "actions", "(", "String", "reference", ",", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "oClient", ".", "post", "(", "\"/offers/v1/contractors/offers/\"", "+", "reference", ",", "...
Run a specific action @param reference Offer reference @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Run", "a", "specific", "action" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Freelancers/Offers.java#L76-L78
UrielCh/ovh-java-sdk
ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java
ApiOvhPrice.saas_csp2_license_licenseName_GET
public OvhPrice saas_csp2_license_licenseName_GET(net.minidev.ovh.api.price.saas.csp2.OvhLicenseEnum licenseName) throws IOException { String qPath = "/price/saas/csp2/license/{licenseName}"; StringBuilder sb = path(qPath, licenseName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
java
public OvhPrice saas_csp2_license_licenseName_GET(net.minidev.ovh.api.price.saas.csp2.OvhLicenseEnum licenseName) throws IOException { String qPath = "/price/saas/csp2/license/{licenseName}"; StringBuilder sb = path(qPath, licenseName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrice.class); }
[ "public", "OvhPrice", "saas_csp2_license_licenseName_GET", "(", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "price", ".", "saas", ".", "csp2", ".", "OvhLicenseEnum", "licenseName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/price/saas...
Get the monthly price for an Office 365 license REST: GET /price/saas/csp2/license/{licenseName} @param licenseName [required] License
[ "Get", "the", "monthly", "price", "for", "an", "Office", "365", "license" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L7256-L7261
JodaOrg/joda-time
src/main/java/org/joda/time/format/DateTimeFormatter.java
DateTimeFormatter.printTo
public void printTo(StringBuilder buf, ReadablePartial partial) { try { printTo((Appendable) buf, partial); } catch (IOException ex) { // StringBuilder does not throw IOException } }
java
public void printTo(StringBuilder buf, ReadablePartial partial) { try { printTo((Appendable) buf, partial); } catch (IOException ex) { // StringBuilder does not throw IOException } }
[ "public", "void", "printTo", "(", "StringBuilder", "buf", ",", "ReadablePartial", "partial", ")", "{", "try", "{", "printTo", "(", "(", "Appendable", ")", "buf", ",", "partial", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "// StringBuilder ...
Prints a ReadablePartial. <p> Neither the override chronology nor the override zone are used by this method. @param buf the destination to format to, not null @param partial partial to format
[ "Prints", "a", "ReadablePartial", ".", "<p", ">", "Neither", "the", "override", "chronology", "nor", "the", "override", "zone", "are", "used", "by", "this", "method", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatter.java#L619-L625
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.delete
public boolean delete(String src, boolean recursive) throws IOException { boolean status = deleteInternal(src, null, recursive, true); getEditLog().logSync(false); if (status && auditLog.isInfoEnabled()) { logAuditEvent(getCurrentUGI(), Server.getRemoteIp(), "delete", src, null, null); } return status; }
java
public boolean delete(String src, boolean recursive) throws IOException { boolean status = deleteInternal(src, null, recursive, true); getEditLog().logSync(false); if (status && auditLog.isInfoEnabled()) { logAuditEvent(getCurrentUGI(), Server.getRemoteIp(), "delete", src, null, null); } return status; }
[ "public", "boolean", "delete", "(", "String", "src", ",", "boolean", "recursive", ")", "throws", "IOException", "{", "boolean", "status", "=", "deleteInternal", "(", "src", ",", "null", ",", "recursive", ",", "true", ")", ";", "getEditLog", "(", ")", ".", ...
Remove the indicated filename from namespace. If the filename is a directory (non empty) and recursive is set to false then throw exception.
[ "Remove", "the", "indicated", "filename", "from", "namespace", ".", "If", "the", "filename", "is", "a", "directory", "(", "non", "empty", ")", "and", "recursive", "is", "set", "to", "false", "then", "throw", "exception", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3769-L3778
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.removeAll
@SafeVarargs public static byte[] removeAll(final byte[] a, final byte... elements) { if (N.isNullOrEmpty(a)) { return N.EMPTY_BYTE_ARRAY; } else if (N.isNullOrEmpty(elements)) { return a.clone(); } else if (elements.length == 1) { return removeAllOccurrences(a, elements[0]); } final ByteList list = ByteList.of(a.clone()); list.removeAll(ByteList.of(elements)); return list.trimToSize().array(); }
java
@SafeVarargs public static byte[] removeAll(final byte[] a, final byte... elements) { if (N.isNullOrEmpty(a)) { return N.EMPTY_BYTE_ARRAY; } else if (N.isNullOrEmpty(elements)) { return a.clone(); } else if (elements.length == 1) { return removeAllOccurrences(a, elements[0]); } final ByteList list = ByteList.of(a.clone()); list.removeAll(ByteList.of(elements)); return list.trimToSize().array(); }
[ "@", "SafeVarargs", "public", "static", "byte", "[", "]", "removeAll", "(", "final", "byte", "[", "]", "a", ",", "final", "byte", "...", "elements", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "a", ")", ")", "{", "return", "N", ".", "EMPTY...
Returns a new array with removes all the occurrences of specified elements from <code>a</code> @param a @param elements @return @see Collection#removeAll(Collection)
[ "Returns", "a", "new", "array", "with", "removes", "all", "the", "occurrences", "of", "specified", "elements", "from", "<code", ">", "a<", "/", "code", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L23397-L23410
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionsInner.java
VirtualMachineScaleSetExtensionsInner.createOrUpdateAsync
public Observable<VirtualMachineScaleSetExtensionInner> createOrUpdateAsync(String resourceGroupName, String vmScaleSetName, String vmssExtensionName, VirtualMachineScaleSetExtensionInner extensionParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).map(new Func1<ServiceResponse<VirtualMachineScaleSetExtensionInner>, VirtualMachineScaleSetExtensionInner>() { @Override public VirtualMachineScaleSetExtensionInner call(ServiceResponse<VirtualMachineScaleSetExtensionInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineScaleSetExtensionInner> createOrUpdateAsync(String resourceGroupName, String vmScaleSetName, String vmssExtensionName, VirtualMachineScaleSetExtensionInner extensionParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters).map(new Func1<ServiceResponse<VirtualMachineScaleSetExtensionInner>, VirtualMachineScaleSetExtensionInner>() { @Override public VirtualMachineScaleSetExtensionInner call(ServiceResponse<VirtualMachineScaleSetExtensionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineScaleSetExtensionInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "String", "vmssExtensionName", ",", "VirtualMachineScaleSetExtensionInner", "extensionParameters", ")", "{"...
The operation to create or update an extension. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set where the extension should be create or updated. @param vmssExtensionName The name of the VM scale set extension. @param extensionParameters Parameters supplied to the Create VM scale set Extension operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "The", "operation", "to", "create", "or", "update", "an", "extension", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionsInner.java#L135-L142
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java
TemperatureConversion.convertToFarenheit
public static double convertToFarenheit (TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return temperature; case CELSIUS: return convertCelsiusToFarenheit(temperature); case KELVIN: return convertKelvinToFarenheit(temperature); case RANKINE: return convertRankineToFarenheit(temperature); default: throw(new RuntimeException("Invalid termpature conversion")); } }
java
public static double convertToFarenheit (TemperatureScale from, double temperature) { switch(from) { case FARENHEIT: return temperature; case CELSIUS: return convertCelsiusToFarenheit(temperature); case KELVIN: return convertKelvinToFarenheit(temperature); case RANKINE: return convertRankineToFarenheit(temperature); default: throw(new RuntimeException("Invalid termpature conversion")); } }
[ "public", "static", "double", "convertToFarenheit", "(", "TemperatureScale", "from", ",", "double", "temperature", ")", "{", "switch", "(", "from", ")", "{", "case", "FARENHEIT", ":", "return", "temperature", ";", "case", "CELSIUS", ":", "return", "convertCelsiu...
Convert a temperature value from another temperature scale into the Farenheit temperature scale. @param from TemperatureScale @param temperature value from other scale @return converted temperature value in degrees Farenheit
[ "Convert", "a", "temperature", "value", "from", "another", "temperature", "scale", "into", "the", "Farenheit", "temperature", "scale", "." ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L97-L112
kite-sdk/kite
kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/avro/AvroUtils.java
AvroUtils.readAvroEntity
public static <T> T readAvroEntity(byte[] bytes, DatumReader<T> reader) { Decoder decoder = new DecoderFactory().binaryDecoder(bytes, null); return AvroUtils.<T> readAvroEntity(decoder, reader); }
java
public static <T> T readAvroEntity(byte[] bytes, DatumReader<T> reader) { Decoder decoder = new DecoderFactory().binaryDecoder(bytes, null); return AvroUtils.<T> readAvroEntity(decoder, reader); }
[ "public", "static", "<", "T", ">", "T", "readAvroEntity", "(", "byte", "[", "]", "bytes", ",", "DatumReader", "<", "T", ">", "reader", ")", "{", "Decoder", "decoder", "=", "new", "DecoderFactory", "(", ")", ".", "binaryDecoder", "(", "bytes", ",", "nul...
Given a byte array and a DatumReader, decode an avro entity from the byte array. Decodes using the avro BinaryDecoder. Return the constructed entity. @param bytes The byte array to decode the entity from. @param reader The DatumReader that will decode the byte array. @return The Avro entity.
[ "Given", "a", "byte", "array", "and", "a", "DatumReader", "decode", "an", "avro", "entity", "from", "the", "byte", "array", ".", "Decodes", "using", "the", "avro", "BinaryDecoder", ".", "Return", "the", "constructed", "entity", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/avro/AvroUtils.java#L65-L68
facebook/fresco
native-filters/src/main/java/com/facebook/imagepipeline/nativecode/NativeBlurFilter.java
NativeBlurFilter.iterativeBoxBlur
public static void iterativeBoxBlur(Bitmap bitmap, int iterations, int blurRadius) { Preconditions.checkNotNull(bitmap); Preconditions.checkArgument(iterations > 0); Preconditions.checkArgument(blurRadius > 0); nativeIterativeBoxBlur(bitmap, iterations, blurRadius); }
java
public static void iterativeBoxBlur(Bitmap bitmap, int iterations, int blurRadius) { Preconditions.checkNotNull(bitmap); Preconditions.checkArgument(iterations > 0); Preconditions.checkArgument(blurRadius > 0); nativeIterativeBoxBlur(bitmap, iterations, blurRadius); }
[ "public", "static", "void", "iterativeBoxBlur", "(", "Bitmap", "bitmap", ",", "int", "iterations", ",", "int", "blurRadius", ")", "{", "Preconditions", ".", "checkNotNull", "(", "bitmap", ")", ";", "Preconditions", ".", "checkArgument", "(", "iterations", ">", ...
This is a fast, native implementation of an iterative box blur. The algorithm runs in-place on the provided bitmap and therefore has a very small memory footprint. <p> The iterative box blur has the nice property that it approximates the Gaussian blur very quickly. Usually iterations=3 is sufficient such that the casual observer cannot tell the difference. <p> The edge pixels are repeated such that the bitmap still has a well-defined border. <p> Asymptotic runtime: O(width * height * iterations) <p> Asymptotic memory: O(radius + max(width, height)) @param bitmap The targeted bitmap that will be blurred in-place. Each dimension must not be greater than 65536. @param iterations The number of iterations to run. Must be greater than 0 and not greater than 65536. @param blurRadius The given blur radius. Must be greater than 0 and not greater than 65536.
[ "This", "is", "a", "fast", "native", "implementation", "of", "an", "iterative", "box", "blur", ".", "The", "algorithm", "runs", "in", "-", "place", "on", "the", "provided", "bitmap", "and", "therefore", "has", "a", "very", "small", "memory", "footprint", "...
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/native-filters/src/main/java/com/facebook/imagepipeline/nativecode/NativeBlurFilter.java#L44-L50
cdk/cdk
tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java
ForceFieldConfigurator.setAtom
private IAtom setAtom(IAtom atom, String ID) throws NoSuchAtomTypeException { IAtomType at = null; String key = ""; List<?> data = null; Double value = null; at = getAtomType(ID); if (atom.getSymbol() == null) { atom.setSymbol(at.getSymbol()); } atom.setAtomTypeName(at.getAtomTypeName()); atom.setFormalNeighbourCount(at.getFormalNeighbourCount()); key = "vdw" + ID; data = (List) parameterSet.get(key); value = (Double) data.get(0); key = "charge" + ID; if (parameterSet.containsKey(key)) { data = (List) parameterSet.get(key); value = (Double) data.get(0); atom.setCharge(value.doubleValue()); } Object color = at.getProperty("org.openscience.cdk.renderer.color"); if (color != null) { atom.setProperty("org.openscience.cdk.renderer.color", color); } if (at.getAtomicNumber() != 0) { atom.setAtomicNumber(at.getAtomicNumber()); } if (at.getExactMass() > 0.0) { atom.setExactMass(at.getExactMass()); } return atom; }
java
private IAtom setAtom(IAtom atom, String ID) throws NoSuchAtomTypeException { IAtomType at = null; String key = ""; List<?> data = null; Double value = null; at = getAtomType(ID); if (atom.getSymbol() == null) { atom.setSymbol(at.getSymbol()); } atom.setAtomTypeName(at.getAtomTypeName()); atom.setFormalNeighbourCount(at.getFormalNeighbourCount()); key = "vdw" + ID; data = (List) parameterSet.get(key); value = (Double) data.get(0); key = "charge" + ID; if (parameterSet.containsKey(key)) { data = (List) parameterSet.get(key); value = (Double) data.get(0); atom.setCharge(value.doubleValue()); } Object color = at.getProperty("org.openscience.cdk.renderer.color"); if (color != null) { atom.setProperty("org.openscience.cdk.renderer.color", color); } if (at.getAtomicNumber() != 0) { atom.setAtomicNumber(at.getAtomicNumber()); } if (at.getExactMass() > 0.0) { atom.setExactMass(at.getExactMass()); } return atom; }
[ "private", "IAtom", "setAtom", "(", "IAtom", "atom", ",", "String", "ID", ")", "throws", "NoSuchAtomTypeException", "{", "IAtomType", "at", "=", "null", ";", "String", "key", "=", "\"\"", ";", "List", "<", "?", ">", "data", "=", "null", ";", "Double", ...
Assigns an atom type to an atom @param atom The atom to be aasigned @param ID the atom type id @exception NoSuchAtomTypeException atomType is not known @return the assigned atom
[ "Assigns", "an", "atom", "type", "to", "an", "atom" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/ForceFieldConfigurator.java#L354-L386
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/PeerGroup.java
PeerGroup.waitForPeersOfVersion
public ListenableFuture<List<Peer>> waitForPeersOfVersion(final int numPeers, final long protocolVersion) { List<Peer> foundPeers = findPeersOfAtLeastVersion(protocolVersion); if (foundPeers.size() >= numPeers) { return Futures.immediateFuture(foundPeers); } final SettableFuture<List<Peer>> future = SettableFuture.create(); addConnectedEventListener(new PeerConnectedEventListener() { @Override public void onPeerConnected(Peer peer, int peerCount) { final List<Peer> peers = findPeersOfAtLeastVersion(protocolVersion); if (peers.size() >= numPeers) { future.set(peers); removeConnectedEventListener(this); } } }); return future; }
java
public ListenableFuture<List<Peer>> waitForPeersOfVersion(final int numPeers, final long protocolVersion) { List<Peer> foundPeers = findPeersOfAtLeastVersion(protocolVersion); if (foundPeers.size() >= numPeers) { return Futures.immediateFuture(foundPeers); } final SettableFuture<List<Peer>> future = SettableFuture.create(); addConnectedEventListener(new PeerConnectedEventListener() { @Override public void onPeerConnected(Peer peer, int peerCount) { final List<Peer> peers = findPeersOfAtLeastVersion(protocolVersion); if (peers.size() >= numPeers) { future.set(peers); removeConnectedEventListener(this); } } }); return future; }
[ "public", "ListenableFuture", "<", "List", "<", "Peer", ">", ">", "waitForPeersOfVersion", "(", "final", "int", "numPeers", ",", "final", "long", "protocolVersion", ")", "{", "List", "<", "Peer", ">", "foundPeers", "=", "findPeersOfAtLeastVersion", "(", "protoco...
Returns a future that is triggered when there are at least the requested number of connected peers that support the given protocol version or higher. To block immediately, just call get() on the result. @param numPeers How many peers to wait for. @param protocolVersion The protocol version the awaited peers must implement (or better). @return a future that will be triggered when the number of connected peers implementing protocolVersion or higher is greater than or equals numPeers
[ "Returns", "a", "future", "that", "is", "triggered", "when", "there", "are", "at", "least", "the", "requested", "number", "of", "connected", "peers", "that", "support", "the", "given", "protocol", "version", "or", "higher", ".", "To", "block", "immediately", ...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/PeerGroup.java#L1898-L1915
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/resource/DirectoryUtils.java
DirectoryUtils.sendRequestedBlobs
public static boolean sendRequestedBlobs(HttpServerExchange exchange) { ByteBuffer buffer = null; String type = null; String etag = null; String quotedEtag = null; if ("css".equals(exchange.getQueryString())) { buffer = Blobs.FILE_CSS_BUFFER.duplicate(); type = "text/css"; etag = Blobs.FILE_CSS_ETAG; quotedEtag = Blobs.FILE_CSS_ETAG_QUOTED; } else if ("js".equals(exchange.getQueryString())) { buffer = Blobs.FILE_JS_BUFFER.duplicate(); type = "application/javascript"; etag = Blobs.FILE_JS_ETAG; quotedEtag = Blobs.FILE_JS_ETAG_QUOTED; } if (buffer != null) { if(!ETagUtils.handleIfNoneMatch(exchange, new ETag(false, etag), false)) { exchange.setStatusCode(StatusCodes.NOT_MODIFIED); return true; } exchange.getResponseHeaders().put(Headers.CONTENT_LENGTH, String.valueOf(buffer.limit())); exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, type); exchange.getResponseHeaders().put(Headers.ETAG, quotedEtag); if (Methods.HEAD.equals(exchange.getRequestMethod())) { exchange.endExchange(); return true; } exchange.getResponseSender().send(buffer); return true; } return false; }
java
public static boolean sendRequestedBlobs(HttpServerExchange exchange) { ByteBuffer buffer = null; String type = null; String etag = null; String quotedEtag = null; if ("css".equals(exchange.getQueryString())) { buffer = Blobs.FILE_CSS_BUFFER.duplicate(); type = "text/css"; etag = Blobs.FILE_CSS_ETAG; quotedEtag = Blobs.FILE_CSS_ETAG_QUOTED; } else if ("js".equals(exchange.getQueryString())) { buffer = Blobs.FILE_JS_BUFFER.duplicate(); type = "application/javascript"; etag = Blobs.FILE_JS_ETAG; quotedEtag = Blobs.FILE_JS_ETAG_QUOTED; } if (buffer != null) { if(!ETagUtils.handleIfNoneMatch(exchange, new ETag(false, etag), false)) { exchange.setStatusCode(StatusCodes.NOT_MODIFIED); return true; } exchange.getResponseHeaders().put(Headers.CONTENT_LENGTH, String.valueOf(buffer.limit())); exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, type); exchange.getResponseHeaders().put(Headers.ETAG, quotedEtag); if (Methods.HEAD.equals(exchange.getRequestMethod())) { exchange.endExchange(); return true; } exchange.getResponseSender().send(buffer); return true; } return false; }
[ "public", "static", "boolean", "sendRequestedBlobs", "(", "HttpServerExchange", "exchange", ")", "{", "ByteBuffer", "buffer", "=", "null", ";", "String", "type", "=", "null", ";", "String", "etag", "=", "null", ";", "String", "quotedEtag", "=", "null", ";", ...
Serve static resource for the directory listing @param exchange The exchange @return true if resources were served
[ "Serve", "static", "resource", "for", "the", "directory", "listing" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/resource/DirectoryUtils.java#L54-L91
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildClassSerializedForm
public void buildClassSerializedForm(XMLNode node, Content packageSerializedTree) { Content classSerializedTree = writer.getClassSerializedHeader(); ClassDoc[] classes = currentPackage.allClasses(false); Arrays.sort(classes); for (ClassDoc classDoc : classes) { currentClass = classDoc; fieldWriter = writer.getSerialFieldWriter(currentClass); methodWriter = writer.getSerialMethodWriter(currentClass); if (currentClass.isClass() && currentClass.isSerializable()) { if (!serialClassInclude(currentClass)) { continue; } Content classTree = writer.getClassHeader(currentClass); buildChildren(node, classTree); classSerializedTree.addContent(classTree); } } packageSerializedTree.addContent(classSerializedTree); }
java
public void buildClassSerializedForm(XMLNode node, Content packageSerializedTree) { Content classSerializedTree = writer.getClassSerializedHeader(); ClassDoc[] classes = currentPackage.allClasses(false); Arrays.sort(classes); for (ClassDoc classDoc : classes) { currentClass = classDoc; fieldWriter = writer.getSerialFieldWriter(currentClass); methodWriter = writer.getSerialMethodWriter(currentClass); if (currentClass.isClass() && currentClass.isSerializable()) { if (!serialClassInclude(currentClass)) { continue; } Content classTree = writer.getClassHeader(currentClass); buildChildren(node, classTree); classSerializedTree.addContent(classTree); } } packageSerializedTree.addContent(classSerializedTree); }
[ "public", "void", "buildClassSerializedForm", "(", "XMLNode", "node", ",", "Content", "packageSerializedTree", ")", "{", "Content", "classSerializedTree", "=", "writer", ".", "getClassSerializedHeader", "(", ")", ";", "ClassDoc", "[", "]", "classes", "=", "currentPa...
Build the class serialized form. @param node the XML element that specifies which components to document @param packageSerializedTree content tree to which the documentation will be added
[ "Build", "the", "class", "serialized", "form", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L214-L232
EdwardRaff/JSAT
JSAT/src/jsat/DataSet.java
DataSet.getDataWeights
public Vec getDataWeights() { final int N = this.size(); if(N == 0) return new DenseVector(0); //assume everyone has the same weight until proven otherwise. double weight = getWeight(0); double[] weights_copy = null; for(int i = 1; i < N; i++) { double w_i = getWeight(i); if(weights_copy != null || weight != w_i) { if(weights_copy==null)//need to init storage place { weights_copy = new double[N]; Arrays.fill(weights_copy, 0, i, weight); } weights_copy[i] = w_i; } } if(weights_copy == null) return new ConstantVector(weight, size()); else return new DenseVector(weights_copy); }
java
public Vec getDataWeights() { final int N = this.size(); if(N == 0) return new DenseVector(0); //assume everyone has the same weight until proven otherwise. double weight = getWeight(0); double[] weights_copy = null; for(int i = 1; i < N; i++) { double w_i = getWeight(i); if(weights_copy != null || weight != w_i) { if(weights_copy==null)//need to init storage place { weights_copy = new double[N]; Arrays.fill(weights_copy, 0, i, weight); } weights_copy[i] = w_i; } } if(weights_copy == null) return new ConstantVector(weight, size()); else return new DenseVector(weights_copy); }
[ "public", "Vec", "getDataWeights", "(", ")", "{", "final", "int", "N", "=", "this", ".", "size", "(", ")", ";", "if", "(", "N", "==", "0", ")", "return", "new", "DenseVector", "(", "0", ")", ";", "//assume everyone has the same weight until proven otherwise....
This method returns the weight of each data point in a single Vector. When all data points have the same weight, this will return a vector that uses fixed memory instead of allocating a full double backed array. @return a vector that will return the weight for each data point with the same corresponding index.
[ "This", "method", "returns", "the", "weight", "of", "each", "data", "point", "in", "a", "single", "Vector", ".", "When", "all", "data", "points", "have", "the", "same", "weight", "this", "will", "return", "a", "vector", "that", "uses", "fixed", "memory", ...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L880-L907
casbin/jcasbin
src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java
DefaultRoleManager.deleteLink
@Override public void deleteLink(String name1, String name2, String... domain) { if (domain.length == 1) { name1 = domain[0] + "::" + name1; name2 = domain[0] + "::" + name2; } else if (domain.length > 1) { throw new Error("error: domain should be 1 parameter"); } if (!hasRole(name1) || !hasRole(name2)) { throw new Error("error: name1 or name2 does not exist"); } Role role1 = createRole(name1); Role role2 = createRole(name2); role1.deleteRole(role2); }
java
@Override public void deleteLink(String name1, String name2, String... domain) { if (domain.length == 1) { name1 = domain[0] + "::" + name1; name2 = domain[0] + "::" + name2; } else if (domain.length > 1) { throw new Error("error: domain should be 1 parameter"); } if (!hasRole(name1) || !hasRole(name2)) { throw new Error("error: name1 or name2 does not exist"); } Role role1 = createRole(name1); Role role2 = createRole(name2); role1.deleteRole(role2); }
[ "@", "Override", "public", "void", "deleteLink", "(", "String", "name1", ",", "String", "name2", ",", "String", "...", "domain", ")", "{", "if", "(", "domain", ".", "length", "==", "1", ")", "{", "name1", "=", "domain", "[", "0", "]", "+", "\"::\"", ...
deleteLink deletes the inheritance link between role: name1 and role: name2. aka role: name1 does not inherit role: name2 any more. domain is a prefix to the roles.
[ "deleteLink", "deletes", "the", "inheritance", "link", "between", "role", ":", "name1", "and", "role", ":", "name2", ".", "aka", "role", ":", "name1", "does", "not", "inherit", "role", ":", "name2", "any", "more", ".", "domain", "is", "a", "prefix", "to"...
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/rbac/DefaultRoleManager.java#L85-L101
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getHierarchicalEntityRoles
public List<EntityRole> getHierarchicalEntityRoles(UUID appId, String versionId, UUID hEntityId) { return getHierarchicalEntityRolesWithServiceResponseAsync(appId, versionId, hEntityId).toBlocking().single().body(); }
java
public List<EntityRole> getHierarchicalEntityRoles(UUID appId, String versionId, UUID hEntityId) { return getHierarchicalEntityRolesWithServiceResponseAsync(appId, versionId, hEntityId).toBlocking().single().body(); }
[ "public", "List", "<", "EntityRole", ">", "getHierarchicalEntityRoles", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "hEntityId", ")", "{", "return", "getHierarchicalEntityRolesWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "hEntityI...
Get All Entity Roles for a given entity. @param appId The application ID. @param versionId The version ID. @param hEntityId The hierarchical entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;EntityRole&gt; object if successful.
[ "Get", "All", "Entity", "Roles", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L9339-L9341
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/RubyObject.java
RubyObject.send
public static <E> E send(Object o, String methodName, Float arg) { return send(o, methodName, (Object) arg); }
java
public static <E> E send(Object o, String methodName, Float arg) { return send(o, methodName, (Object) arg); }
[ "public", "static", "<", "E", ">", "E", "send", "(", "Object", "o", ",", "String", "methodName", ",", "Float", "arg", ")", "{", "return", "send", "(", "o", ",", "methodName", ",", "(", "Object", ")", "arg", ")", ";", "}" ]
Executes a method of any Object by Java reflection. @param o an Object @param methodName name of the method @param arg a Float @return the result of the method called
[ "Executes", "a", "method", "of", "any", "Object", "by", "Java", "reflection", "." ]
train
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyObject.java#L255-L257
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/parser/PdfContentStreamProcessor.java
PdfContentStreamProcessor.registerContentOperator
public void registerContentOperator(String operatorString, ContentOperator operator) { if (operators.containsKey(operatorString)) { throw new IllegalArgumentException("Operator " + operatorString + " already registered"); } operators.put(operatorString, operator); }
java
public void registerContentOperator(String operatorString, ContentOperator operator) { if (operators.containsKey(operatorString)) { throw new IllegalArgumentException("Operator " + operatorString + " already registered"); } operators.put(operatorString, operator); }
[ "public", "void", "registerContentOperator", "(", "String", "operatorString", ",", "ContentOperator", "operator", ")", "{", "if", "(", "operators", ".", "containsKey", "(", "operatorString", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Operator...
Registers a content operator that will be called when the specified operator string is encountered during content processing. Each operator may be registered only once (it is not legal to have multiple operators with the same operatorString) @param operatorString the operator id @param operator the operator that will receive notification when the operator is encountered @since 2.1.8
[ "Registers", "a", "content", "operator", "that", "will", "be", "called", "when", "the", "specified", "operator", "string", "is", "encountered", "during", "content", "processing", ".", "Each", "operator", "may", "be", "registered", "only", "once", "(", "it", "i...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/parser/PdfContentStreamProcessor.java#L142-L147
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/transform/XMLTransformerFactory.java
XMLTransformerFactory.makeTransformerFactorySecure
public static void makeTransformerFactorySecure (@Nonnull final TransformerFactory aFactory, @Nullable final String... aAllowedExternalSchemes) { ValueEnforcer.notNull (aFactory, "Factory"); try { aFactory.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); final String sCombinedSchemes = StringHelper.getImplodedNonEmpty (',', aAllowedExternalSchemes); if (sCombinedSchemes.length () > 0) { aFactory.setAttribute (XMLConstants.ACCESS_EXTERNAL_DTD, sCombinedSchemes); aFactory.setAttribute (XMLConstants.ACCESS_EXTERNAL_STYLESHEET, sCombinedSchemes); // external schema is unknown } } catch (final TransformerConfigurationException ex) { throw new InitializationException ("Failed to secure XML TransformerFactory", ex); } }
java
public static void makeTransformerFactorySecure (@Nonnull final TransformerFactory aFactory, @Nullable final String... aAllowedExternalSchemes) { ValueEnforcer.notNull (aFactory, "Factory"); try { aFactory.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true); final String sCombinedSchemes = StringHelper.getImplodedNonEmpty (',', aAllowedExternalSchemes); if (sCombinedSchemes.length () > 0) { aFactory.setAttribute (XMLConstants.ACCESS_EXTERNAL_DTD, sCombinedSchemes); aFactory.setAttribute (XMLConstants.ACCESS_EXTERNAL_STYLESHEET, sCombinedSchemes); // external schema is unknown } } catch (final TransformerConfigurationException ex) { throw new InitializationException ("Failed to secure XML TransformerFactory", ex); } }
[ "public", "static", "void", "makeTransformerFactorySecure", "(", "@", "Nonnull", "final", "TransformerFactory", "aFactory", ",", "@", "Nullable", "final", "String", "...", "aAllowedExternalSchemes", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aFactory", ",", "\...
Set the secure processing feature to a {@link TransformerFactory}. See https://docs.oracle.com/javase/tutorial/jaxp/properties/properties.html for details. @param aFactory The factory to secure. May not be <code>null</code>. @param aAllowedExternalSchemes Optional external URL schemes that are allowed to be accessed (as in "file" or "http") @since 9.1.2
[ "Set", "the", "secure", "processing", "feature", "to", "a", "{", "@link", "TransformerFactory", "}", ".", "See", "https", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "tutorial", "/", "jaxp", "/", "properties", "/", "properties", "."...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/transform/XMLTransformerFactory.java#L96-L117
jayantk/jklol
src/com/jayantkrish/jklol/util/IntMultimap.java
IntMultimap.invertFrom
public static IntMultimap invertFrom(Multimap<? extends Integer, ? extends Integer> map) { if (map instanceof IntMultimap) { IntMultimap other = (IntMultimap) map; // This is unnecessary, but it makes this method easier to implement. other.reindexItems(); int[] newSortedKeys = Arrays.copyOf(other.sortedValues, other.sortedValues.length); int[] newSortedValues = Arrays.copyOf(other.sortedKeys, other.sortedKeys.length); ArrayUtils.sortKeyValuePairs(newSortedKeys, newSortedValues, 0, newSortedKeys.length); return new IntMultimap(newSortedKeys, newSortedValues); } else { IntMultimap inverse = IntMultimap.create(); Multimaps.invertFrom(map, inverse); return inverse; } }
java
public static IntMultimap invertFrom(Multimap<? extends Integer, ? extends Integer> map) { if (map instanceof IntMultimap) { IntMultimap other = (IntMultimap) map; // This is unnecessary, but it makes this method easier to implement. other.reindexItems(); int[] newSortedKeys = Arrays.copyOf(other.sortedValues, other.sortedValues.length); int[] newSortedValues = Arrays.copyOf(other.sortedKeys, other.sortedKeys.length); ArrayUtils.sortKeyValuePairs(newSortedKeys, newSortedValues, 0, newSortedKeys.length); return new IntMultimap(newSortedKeys, newSortedValues); } else { IntMultimap inverse = IntMultimap.create(); Multimaps.invertFrom(map, inverse); return inverse; } }
[ "public", "static", "IntMultimap", "invertFrom", "(", "Multimap", "<", "?", "extends", "Integer", ",", "?", "extends", "Integer", ">", "map", ")", "{", "if", "(", "map", "instanceof", "IntMultimap", ")", "{", "IntMultimap", "other", "=", "(", "IntMultimap", ...
Creates a new multimap that reverses the keys and values in {@code map}. @param map @return
[ "Creates", "a", "new", "multimap", "that", "reverses", "the", "keys", "and", "values", "in", "{", "@code", "map", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/util/IntMultimap.java#L126-L143
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbCollections.java
TmdbCollections.getCollectionInfo
public CollectionInfo getCollectionInfo(int collectionId, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, collectionId); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.COLLECTION).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, CollectionInfo.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get collection information", url, ex); } }
java
public CollectionInfo getCollectionInfo(int collectionId, String language) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, collectionId); parameters.add(Param.LANGUAGE, language); URL url = new ApiUrl(apiKey, MethodBase.COLLECTION).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, CollectionInfo.class); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get collection information", url, ex); } }
[ "public", "CollectionInfo", "getCollectionInfo", "(", "int", "collectionId", ",", "String", "language", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", "."...
This method is used to retrieve all of the basic information about a movie collection. You can get the ID needed for this method by making a getMovieInfo request for the belongs_to_collection. @param collectionId @param language @return @throws MovieDbException
[ "This", "method", "is", "used", "to", "retrieve", "all", "of", "the", "basic", "information", "about", "a", "movie", "collection", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbCollections.java#L67-L80
cloudfoundry/uaa
server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/idp/IdpMetadataGenerator.java
IdpMetadataGenerator.getDiscoveryURL
protected String getDiscoveryURL(String entityBaseURL, String entityAlias) { if (extendedMetadata != null && extendedMetadata.getIdpDiscoveryURL() != null && extendedMetadata.getIdpDiscoveryURL().length() > 0) { return extendedMetadata.getIdpDiscoveryURL(); } else { return getServerURL(entityBaseURL, entityAlias, getSAMLDiscoveryPath()); } }
java
protected String getDiscoveryURL(String entityBaseURL, String entityAlias) { if (extendedMetadata != null && extendedMetadata.getIdpDiscoveryURL() != null && extendedMetadata.getIdpDiscoveryURL().length() > 0) { return extendedMetadata.getIdpDiscoveryURL(); } else { return getServerURL(entityBaseURL, entityAlias, getSAMLDiscoveryPath()); } }
[ "protected", "String", "getDiscoveryURL", "(", "String", "entityBaseURL", ",", "String", "entityAlias", ")", "{", "if", "(", "extendedMetadata", "!=", "null", "&&", "extendedMetadata", ".", "getIdpDiscoveryURL", "(", ")", "!=", "null", "&&", "extendedMetadata", "....
Provides set discovery request url or generates a default when none was provided. Primarily value set on extenedMetadata property idpDiscoveryURL is used, when empty local property customDiscoveryURL is used, when empty URL is automatically generated. @param entityBaseURL base URL for generation of endpoints @param entityAlias alias of entity, or null when there's no alias required @return URL to use for IDP discovery request
[ "Provides", "set", "discovery", "request", "url", "or", "generates", "a", "default", "when", "none", "was", "provided", ".", "Primarily", "value", "set", "on", "extenedMetadata", "property", "idpDiscoveryURL", "is", "used", "when", "empty", "local", "property", ...
train
https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/idp/IdpMetadataGenerator.java#L775-L782
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java
WebUtilities.updateBeanValue
public static void updateBeanValue(final WComponent component, final boolean visibleOnly) { // Do not process if component is invisble and ignore visible is true. Will ignore entire branch from this point. if (!component.isVisible() && visibleOnly) { return; } if (component instanceof WBeanComponent) { ((WBeanComponent) component).updateBeanValue(); } // These components recursively update bean values themselves, // as they have special requirements due to repeating data. if (component instanceof WDataTable || component instanceof WTable || component instanceof WRepeater) { return; } if (component instanceof Container) { for (int i = ((Container) component).getChildCount() - 1; i >= 0; i--) { updateBeanValue(((Container) component).getChildAt(i), visibleOnly); } } }
java
public static void updateBeanValue(final WComponent component, final boolean visibleOnly) { // Do not process if component is invisble and ignore visible is true. Will ignore entire branch from this point. if (!component.isVisible() && visibleOnly) { return; } if (component instanceof WBeanComponent) { ((WBeanComponent) component).updateBeanValue(); } // These components recursively update bean values themselves, // as they have special requirements due to repeating data. if (component instanceof WDataTable || component instanceof WTable || component instanceof WRepeater) { return; } if (component instanceof Container) { for (int i = ((Container) component).getChildCount() - 1; i >= 0; i--) { updateBeanValue(((Container) component).getChildAt(i), visibleOnly); } } }
[ "public", "static", "void", "updateBeanValue", "(", "final", "WComponent", "component", ",", "final", "boolean", "visibleOnly", ")", "{", "// Do not process if component is invisble and ignore visible is true. Will ignore entire branch from this point.", "if", "(", "!", "componen...
Updates the bean value with the current value of the component and all its bean-bound children. @param component the component whose contents need to be copied to the bean. @param visibleOnly - whether to include visible components only.
[ "Updates", "the", "bean", "value", "with", "the", "current", "value", "of", "the", "component", "and", "all", "its", "bean", "-", "bound", "children", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java#L672-L693
looly/hutool
hutool-db/src/main/java/cn/hutool/db/dialect/impl/AnsiSqlDialect.java
AnsiSqlDialect.wrapPageSql
protected SqlBuilder wrapPageSql(SqlBuilder find, Page page) { // limit A offset B 表示:A就是你需要多少行,B就是查询的起点位置。 return find.append(" limit ").append(page.getPageSize()).append(" offset ").append(page.getStartPosition()); }
java
protected SqlBuilder wrapPageSql(SqlBuilder find, Page page) { // limit A offset B 表示:A就是你需要多少行,B就是查询的起点位置。 return find.append(" limit ").append(page.getPageSize()).append(" offset ").append(page.getStartPosition()); }
[ "protected", "SqlBuilder", "wrapPageSql", "(", "SqlBuilder", "find", ",", "Page", "page", ")", "{", "// limit A offset B 表示:A就是你需要多少行,B就是查询的起点位置。", "return", "find", ".", "append", "(", "\" limit \"", ")", ".", "append", "(", "page", ".", "getPageSize", "(", ")", ...
根据不同数据库在查询SQL语句基础上包装其分页的语句<br> 各自数据库通过重写此方法实现最小改动情况下修改分页语句 @param find 标准查询语句 @param page 分页对象 @return 分页语句 @since 3.2.3
[ "根据不同数据库在查询SQL语句基础上包装其分页的语句<br", ">", "各自数据库通过重写此方法实现最小改动情况下修改分页语句" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/dialect/impl/AnsiSqlDialect.java#L134-L137
bullhorn/sdk-rest
src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java
StandardBullhornData.handleQueryForEntityEditHistoryFieldChange
protected <T extends EditHistoryEntity> FieldChangeListWrapper handleQueryForEntityEditHistoryFieldChange(Class<T> entityType, String where, Set<String> fieldSet, QueryParams params) { Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEditHistoryFieldChangeQuery(BullhornEntityInfo.getTypesRestEntityName(entityType), where, fieldSet, params); String url = restUrlFactory.assembleQueryUrl(params); return this.performGetRequest(url, FieldChangeListWrapper.class, uriVariables); }
java
protected <T extends EditHistoryEntity> FieldChangeListWrapper handleQueryForEntityEditHistoryFieldChange(Class<T> entityType, String where, Set<String> fieldSet, QueryParams params) { Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEditHistoryFieldChangeQuery(BullhornEntityInfo.getTypesRestEntityName(entityType), where, fieldSet, params); String url = restUrlFactory.assembleQueryUrl(params); return this.performGetRequest(url, FieldChangeListWrapper.class, uriVariables); }
[ "protected", "<", "T", "extends", "EditHistoryEntity", ">", "FieldChangeListWrapper", "handleQueryForEntityEditHistoryFieldChange", "(", "Class", "<", "T", ">", "entityType", ",", "String", "where", ",", "Set", "<", "String", ">", "fieldSet", ",", "QueryParams", "pa...
Makes the "query" api call for EditHistoryFieldChange <p> <p> HTTP Method: GET @param entityType the EditHistoryEntity type @param where a SQL type where clause @param fieldSet the fields to return, if null or emtpy will default to "*" all @param params optional QueryParams. @return a FieldChangeWrapper containing the records plus some additional information
[ "Makes", "the", "query", "api", "call", "for", "EditHistoryFieldChange", "<p", ">", "<p", ">", "HTTP", "Method", ":", "GET" ]
train
https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java#L983-L989
jkrasnay/sqlbuilder
src/main/java/ca/krasnay/sqlbuilder/orm/ReflectionUtils.java
ReflectionUtils.getFieldValueWithPath
public static Object getFieldValueWithPath(Object object, String path) { int lastDot = path.lastIndexOf('.'); if (lastDot > -1) { String parentPath = path.substring(0, lastDot); String field = path.substring(lastDot + 1); Object parentObject = getFieldValueWithPath(object, parentPath); if (parentObject == null) { return null; } else { return getFieldValue(parentObject, field); } } else { return getFieldValue(object, path); } }
java
public static Object getFieldValueWithPath(Object object, String path) { int lastDot = path.lastIndexOf('.'); if (lastDot > -1) { String parentPath = path.substring(0, lastDot); String field = path.substring(lastDot + 1); Object parentObject = getFieldValueWithPath(object, parentPath); if (parentObject == null) { return null; } else { return getFieldValue(parentObject, field); } } else { return getFieldValue(object, path); } }
[ "public", "static", "Object", "getFieldValueWithPath", "(", "Object", "object", ",", "String", "path", ")", "{", "int", "lastDot", "=", "path", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "lastDot", ">", "-", "1", ")", "{", "String", "paren...
Returns the value of a field identified using a path from the parent. @param object Parent object. @param path Path to identify the field. May contain one or more dots, e.g. "address.city". @return The value of the field, or null if any of the path components are null.
[ "Returns", "the", "value", "of", "a", "field", "identified", "using", "a", "path", "from", "the", "parent", "." ]
train
https://github.com/jkrasnay/sqlbuilder/blob/8e6acedc51cfad0527263376af51e1ef052f7147/src/main/java/ca/krasnay/sqlbuilder/orm/ReflectionUtils.java#L106-L126
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_option_option_GET
public OvhOption serviceName_option_option_GET(String serviceName, net.minidev.ovh.api.vps.OvhVpsOptionEnum option) throws IOException { String qPath = "/vps/{serviceName}/option/{option}"; StringBuilder sb = path(qPath, serviceName, option); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOption.class); }
java
public OvhOption serviceName_option_option_GET(String serviceName, net.minidev.ovh.api.vps.OvhVpsOptionEnum option) throws IOException { String qPath = "/vps/{serviceName}/option/{option}"; StringBuilder sb = path(qPath, serviceName, option); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOption.class); }
[ "public", "OvhOption", "serviceName_option_option_GET", "(", "String", "serviceName", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "vps", ".", "OvhVpsOptionEnum", "option", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vps/{serviceName...
Get this object properties REST: GET /vps/{serviceName}/option/{option} @param serviceName [required] The internal name of your VPS offer @param option [required] The option name
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L1050-L1055
tango-controls/JTango
server/src/main/java/org/tango/logging/LoggingManager.java
LoggingManager.setLoggingLevel
public void setLoggingLevel(final String deviceName, final int loggingLevel) { System.out.println("set logging level " + deviceName + "-" + LoggingLevel.getLevelFromInt(loggingLevel)); logger.debug("set logging level to {} on {}", LoggingLevel.getLevelFromInt(loggingLevel), deviceName); if (rootLoggingLevel < loggingLevel) { setRootLoggingLevel(loggingLevel); } // setLoggingLevel(loggingLevel); loggingLevels.put(deviceName, loggingLevel); for (final DeviceAppender appender : deviceAppenders.values()) { if (deviceName.equalsIgnoreCase(appender.getDeviceName())) { appender.setLevel(loggingLevel); break; } } for (final FileAppender appender : fileAppenders.values()) { if (deviceName.equalsIgnoreCase(appender.getDeviceName())) { appender.setLevel(loggingLevel); break; } } }
java
public void setLoggingLevel(final String deviceName, final int loggingLevel) { System.out.println("set logging level " + deviceName + "-" + LoggingLevel.getLevelFromInt(loggingLevel)); logger.debug("set logging level to {} on {}", LoggingLevel.getLevelFromInt(loggingLevel), deviceName); if (rootLoggingLevel < loggingLevel) { setRootLoggingLevel(loggingLevel); } // setLoggingLevel(loggingLevel); loggingLevels.put(deviceName, loggingLevel); for (final DeviceAppender appender : deviceAppenders.values()) { if (deviceName.equalsIgnoreCase(appender.getDeviceName())) { appender.setLevel(loggingLevel); break; } } for (final FileAppender appender : fileAppenders.values()) { if (deviceName.equalsIgnoreCase(appender.getDeviceName())) { appender.setLevel(loggingLevel); break; } } }
[ "public", "void", "setLoggingLevel", "(", "final", "String", "deviceName", ",", "final", "int", "loggingLevel", ")", "{", "System", ".", "out", ".", "println", "(", "\"set logging level \"", "+", "deviceName", "+", "\"-\"", "+", "LoggingLevel", ".", "getLevelFro...
Set the logging level of a device @param deviceName the device name @param loggingLevel the level
[ "Set", "the", "logging", "level", "of", "a", "device" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/logging/LoggingManager.java#L103-L123
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/pkcs/PrivateKeyInfo.java
PrivateKeyInfo.toASN1Object
public DERObject toASN1Object() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new DERInteger(0)); v.add(algId); v.add(new DEROctetString(privKey)); if (attributes != null) { v.add(new DERTaggedObject(false, 0, attributes)); } return new DERSequence(v); }
java
public DERObject toASN1Object() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new DERInteger(0)); v.add(algId); v.add(new DEROctetString(privKey)); if (attributes != null) { v.add(new DERTaggedObject(false, 0, attributes)); } return new DERSequence(v); }
[ "public", "DERObject", "toASN1Object", "(", ")", "{", "ASN1EncodableVector", "v", "=", "new", "ASN1EncodableVector", "(", ")", ";", "v", ".", "add", "(", "new", "DERInteger", "(", "0", ")", ")", ";", "v", ".", "add", "(", "algId", ")", ";", "v", ".",...
write out an RSA private key with it's asscociated information as described in PKCS8. <pre> PrivateKeyInfo ::= SEQUENCE { version Version, privateKeyAlgorithm AlgorithmIdentifier {{PrivateKeyAlgorithms}}, privateKey PrivateKey, attributes [0] IMPLICIT Attributes OPTIONAL } Version ::= INTEGER {v1(0)} (v1,...) PrivateKey ::= OCTET STRING Attributes ::= SET OF Attribute </pre>
[ "write", "out", "an", "RSA", "private", "key", "with", "it", "s", "asscociated", "information", "as", "described", "in", "PKCS8", ".", "<pre", ">", "PrivateKeyInfo", "::", "=", "SEQUENCE", "{", "version", "Version", "privateKeyAlgorithm", "AlgorithmIdentifier", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/pkcs/PrivateKeyInfo.java#L136-L150
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java
WhiteboxImpl.createInstance
private static <T> T createInstance(Constructor<T> constructor, Object... arguments) throws Exception { if (constructor == null) { throw new IllegalArgumentException("Constructor cannot be null"); } constructor.setAccessible(true); T createdObject = null; try { if (constructor.isVarArgs()) { Class<?>[] parameterTypes = constructor.getParameterTypes(); final int varArgsIndex = parameterTypes.length - 1; Class<?> varArgsType = parameterTypes[varArgsIndex].getComponentType(); Object varArgsArrayInstance = createAndPopulateVarArgsArray(varArgsType, varArgsIndex, arguments); Object[] completeArgumentList = new Object[parameterTypes.length]; System.arraycopy(arguments, 0, completeArgumentList, 0, varArgsIndex); completeArgumentList[completeArgumentList.length - 1] = varArgsArrayInstance; createdObject = constructor.newInstance(completeArgumentList); } else { createdObject = constructor.newInstance(arguments); } } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof Exception) { throw (Exception) cause; } else if (cause instanceof Error) { throw (Error) cause; } } return createdObject; }
java
private static <T> T createInstance(Constructor<T> constructor, Object... arguments) throws Exception { if (constructor == null) { throw new IllegalArgumentException("Constructor cannot be null"); } constructor.setAccessible(true); T createdObject = null; try { if (constructor.isVarArgs()) { Class<?>[] parameterTypes = constructor.getParameterTypes(); final int varArgsIndex = parameterTypes.length - 1; Class<?> varArgsType = parameterTypes[varArgsIndex].getComponentType(); Object varArgsArrayInstance = createAndPopulateVarArgsArray(varArgsType, varArgsIndex, arguments); Object[] completeArgumentList = new Object[parameterTypes.length]; System.arraycopy(arguments, 0, completeArgumentList, 0, varArgsIndex); completeArgumentList[completeArgumentList.length - 1] = varArgsArrayInstance; createdObject = constructor.newInstance(completeArgumentList); } else { createdObject = constructor.newInstance(arguments); } } catch (InvocationTargetException e) { Throwable cause = e.getCause(); if (cause instanceof Exception) { throw (Exception) cause; } else if (cause instanceof Error) { throw (Error) cause; } } return createdObject; }
[ "private", "static", "<", "T", ">", "T", "createInstance", "(", "Constructor", "<", "T", ">", "constructor", ",", "Object", "...", "arguments", ")", "throws", "Exception", "{", "if", "(", "constructor", "==", "null", ")", "{", "throw", "new", "IllegalArgum...
Creates the instance. @param <T> the generic type @param constructor the constructor @param arguments the arguments @return the t @throws Exception the exception
[ "Creates", "the", "instance", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1396-L1425
oboehm/jfachwert
src/main/java/de/jfachwert/bank/GeldbetragFactory.java
GeldbetragFactory.create
@Override public Geldbetrag create() { if (currency == null) { throw new LocalizedMonetaryException("currency missing", number); } return Geldbetrag.valueOf(number, currency, context); }
java
@Override public Geldbetrag create() { if (currency == null) { throw new LocalizedMonetaryException("currency missing", number); } return Geldbetrag.valueOf(number, currency, context); }
[ "@", "Override", "public", "Geldbetrag", "create", "(", ")", "{", "if", "(", "currency", "==", "null", ")", "{", "throw", "new", "LocalizedMonetaryException", "(", "\"currency missing\"", ",", "number", ")", ";", "}", "return", "Geldbetrag", ".", "valueOf", ...
Erzeugt einen neuen {@link Geldbetrag} anhand der eingestellten Daten. @return den entsprechenden {@link Geldbetrag}. @see #getAmountType()
[ "Erzeugt", "einen", "neuen", "{", "@link", "Geldbetrag", "}", "anhand", "der", "eingestellten", "Daten", "." ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/GeldbetragFactory.java#L165-L171
oboehm/jfachwert
src/main/java/de/jfachwert/pruefung/exception/InvalidValueException.java
InvalidValueException.getLocalizedMessage
@Override public String getLocalizedMessage() { String localizedContext = getLocalizedString(context); if (value == null) { return getLocalizedMessage("pruefung.missingvalue.exception.message", localizedContext); } if (range == null) { return getLocalizedMessage("pruefung.invalidvalue.exception.message", value.toString(), localizedContext); } return getLocalizedMessage("pruefung.invalidrange.exception.message", value.toString(), localizedContext, range); }
java
@Override public String getLocalizedMessage() { String localizedContext = getLocalizedString(context); if (value == null) { return getLocalizedMessage("pruefung.missingvalue.exception.message", localizedContext); } if (range == null) { return getLocalizedMessage("pruefung.invalidvalue.exception.message", value.toString(), localizedContext); } return getLocalizedMessage("pruefung.invalidrange.exception.message", value.toString(), localizedContext, range); }
[ "@", "Override", "public", "String", "getLocalizedMessage", "(", ")", "{", "String", "localizedContext", "=", "getLocalizedString", "(", "context", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "getLocalizedMessage", "(", "\"pruefung.missingvalue...
Im Gegensatz {@code getMessage()} wird hier die Beschreibung auf deutsch zurueckgegeben, wenn die Loacale auf Deutsch steht. @return lokalisierte Beschreibung
[ "Im", "Gegensatz", "{", "@code", "getMessage", "()", "}", "wird", "hier", "die", "Beschreibung", "auf", "deutsch", "zurueckgegeben", "wenn", "die", "Loacale", "auf", "Deutsch", "steht", "." ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/pruefung/exception/InvalidValueException.java#L96-L106
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/EnforceTrifocalGeometry.java
EnforceTrifocalGeometry.computeErrorVector
public void computeErrorVector( DMatrixRMaj A , DMatrixRMaj errors ) { errors.reshape(A.numRows,1); CommonOps_DDRM.mult(A,vectorT,errors); }
java
public void computeErrorVector( DMatrixRMaj A , DMatrixRMaj errors ) { errors.reshape(A.numRows,1); CommonOps_DDRM.mult(A,vectorT,errors); }
[ "public", "void", "computeErrorVector", "(", "DMatrixRMaj", "A", ",", "DMatrixRMaj", "errors", ")", "{", "errors", ".", "reshape", "(", "A", ".", "numRows", ",", "1", ")", ";", "CommonOps_DDRM", ".", "mult", "(", "A", ",", "vectorT", ",", "errors", ")", ...
Returns the algebraic error vector. error = A*U*x. length = number of observations
[ "Returns", "the", "algebraic", "error", "vector", ".", "error", "=", "A", "*", "U", "*", "x", ".", "length", "=", "number", "of", "observations" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/EnforceTrifocalGeometry.java#L123-L126
kiswanij/jk-util
src/main/java/com/jk/util/java/JKCompileUtil.java
JKCompileUtil.compileJavaClass
public static boolean compileJavaClass(String sourceCode) { try { String fileName = getClassName(sourceCode).concat(".java"); logger.info("Compiling Java Class ({})", fileName); File rootDir = JKIOUtil.createTempDirectory(); String packageDir = getPackageDir(sourceCode); File sourceFile ; if(packageDir!=null) { File file=new File(rootDir,packageDir); file.mkdirs(); sourceFile=new File(file, fileName); }else { sourceFile=new File(rootDir, fileName); } JKIOUtil.writeDataToFile(sourceCode, sourceFile); // Compile source file. JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager standardJavaFileManager = compiler.getStandardFileManager(null, null, null); standardJavaFileManager.setLocation(StandardLocation.CLASS_PATH, getClassPath()); standardJavaFileManager.setLocation(StandardLocation.SOURCE_PATH, Arrays.asList(rootDir)); List<String> options = new ArrayList<String>(); options.add("-Xlint:unchecked"); CompilationTask compilationTask = compiler.getTask(null, standardJavaFileManager, null, options, null, standardJavaFileManager.getJavaFileObjectsFromFiles(JK.toList(sourceFile))); return compilationTask.call(); } catch (IOException e) { JK.throww(e); return false; } // if (compiler.run(System.in, System.out, System.err, sourceFile.getPath()) != 0) { // JK.error("Compilation failed, check stack trace"); // } }
java
public static boolean compileJavaClass(String sourceCode) { try { String fileName = getClassName(sourceCode).concat(".java"); logger.info("Compiling Java Class ({})", fileName); File rootDir = JKIOUtil.createTempDirectory(); String packageDir = getPackageDir(sourceCode); File sourceFile ; if(packageDir!=null) { File file=new File(rootDir,packageDir); file.mkdirs(); sourceFile=new File(file, fileName); }else { sourceFile=new File(rootDir, fileName); } JKIOUtil.writeDataToFile(sourceCode, sourceFile); // Compile source file. JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager standardJavaFileManager = compiler.getStandardFileManager(null, null, null); standardJavaFileManager.setLocation(StandardLocation.CLASS_PATH, getClassPath()); standardJavaFileManager.setLocation(StandardLocation.SOURCE_PATH, Arrays.asList(rootDir)); List<String> options = new ArrayList<String>(); options.add("-Xlint:unchecked"); CompilationTask compilationTask = compiler.getTask(null, standardJavaFileManager, null, options, null, standardJavaFileManager.getJavaFileObjectsFromFiles(JK.toList(sourceFile))); return compilationTask.call(); } catch (IOException e) { JK.throww(e); return false; } // if (compiler.run(System.in, System.out, System.err, sourceFile.getPath()) != 0) { // JK.error("Compilation failed, check stack trace"); // } }
[ "public", "static", "boolean", "compileJavaClass", "(", "String", "sourceCode", ")", "{", "try", "{", "String", "fileName", "=", "getClassName", "(", "sourceCode", ")", ".", "concat", "(", "\".java\"", ")", ";", "logger", ".", "info", "(", "\"Compiling Java Cl...
Compile java class. @param sourceCode the source code @throws IOException
[ "Compile", "java", "class", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/java/JKCompileUtil.java#L50-L91
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/scalar/FailureFunction.java
FailureFunction.failWithException
@Description("Decodes json to an exception and throws it") @ScalarFunction(value = "fail", hidden = true) @SqlType("unknown") public static boolean failWithException(@SqlType(StandardTypes.JSON) Slice failureInfoSlice) { FailureInfo failureInfo = JSON_CODEC.fromJson(failureInfoSlice.getBytes()); // wrap the failure in a new exception to append the current stack trace throw new PrestoException(StandardErrorCode.GENERIC_USER_ERROR, failureInfo.toException()); }
java
@Description("Decodes json to an exception and throws it") @ScalarFunction(value = "fail", hidden = true) @SqlType("unknown") public static boolean failWithException(@SqlType(StandardTypes.JSON) Slice failureInfoSlice) { FailureInfo failureInfo = JSON_CODEC.fromJson(failureInfoSlice.getBytes()); // wrap the failure in a new exception to append the current stack trace throw new PrestoException(StandardErrorCode.GENERIC_USER_ERROR, failureInfo.toException()); }
[ "@", "Description", "(", "\"Decodes json to an exception and throws it\"", ")", "@", "ScalarFunction", "(", "value", "=", "\"fail\"", ",", "hidden", "=", "true", ")", "@", "SqlType", "(", "\"unknown\"", ")", "public", "static", "boolean", "failWithException", "(", ...
We shouldn't be using UNKNOWN as an explicit type. This will be fixed when we fix type inference
[ "We", "shouldn", "t", "be", "using", "UNKNOWN", "as", "an", "explicit", "type", ".", "This", "will", "be", "fixed", "when", "we", "fix", "type", "inference" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/scalar/FailureFunction.java#L33-L41
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java
URLUtil.toUrlForHttp
public static URL toUrlForHttp(String urlStr, URLStreamHandler handler) { Assert.notBlank(urlStr, "Url is blank !"); // 去掉url中的空白符,防止空白符导致的异常 urlStr = StrUtil.cleanBlank(urlStr); return URLUtil.url(urlStr, handler); }
java
public static URL toUrlForHttp(String urlStr, URLStreamHandler handler) { Assert.notBlank(urlStr, "Url is blank !"); // 去掉url中的空白符,防止空白符导致的异常 urlStr = StrUtil.cleanBlank(urlStr); return URLUtil.url(urlStr, handler); }
[ "public", "static", "URL", "toUrlForHttp", "(", "String", "urlStr", ",", "URLStreamHandler", "handler", ")", "{", "Assert", ".", "notBlank", "(", "urlStr", ",", "\"Url is blank !\"", ")", ";", "// 去掉url中的空白符,防止空白符导致的异常\r", "urlStr", "=", "StrUtil", ".", "cleanBlan...
将URL字符串转换为URL对象,并做必要验证 @param urlStr URL字符串 @param handler {@link URLStreamHandler} @return URL @since 4.1.9
[ "将URL字符串转换为URL对象,并做必要验证" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L119-L124
wcm-io/wcm-io-tooling
maven/plugins/wcmio-content-package-maven-plugin/src/main/java/io/wcm/maven/plugins/contentpackage/ArtifactHelper.java
ArtifactHelper.getArtifactFromMavenCoordinates
private Artifact getArtifactFromMavenCoordinates(final String artifact) throws MojoFailureException { String[] parts = StringUtils.split(artifact, ":"); String version; String packaging = null; String classifier = null; switch (parts.length) { case 3: // groupId:artifactId:version version = parts[2]; break; case 4: // groupId:artifactId:packaging:version packaging = parts[2]; version = parts[3]; break; case 5: // groupId:artifactId:packaging:classifier:version packaging = parts[2]; classifier = parts[3]; version = parts[4]; break; default: throw new MojoFailureException("Invalid artifact: " + artifact); } String groupId = parts[0]; String artifactId = parts[1]; return createArtifact(artifactId, groupId, version, packaging, classifier); }
java
private Artifact getArtifactFromMavenCoordinates(final String artifact) throws MojoFailureException { String[] parts = StringUtils.split(artifact, ":"); String version; String packaging = null; String classifier = null; switch (parts.length) { case 3: // groupId:artifactId:version version = parts[2]; break; case 4: // groupId:artifactId:packaging:version packaging = parts[2]; version = parts[3]; break; case 5: // groupId:artifactId:packaging:classifier:version packaging = parts[2]; classifier = parts[3]; version = parts[4]; break; default: throw new MojoFailureException("Invalid artifact: " + artifact); } String groupId = parts[0]; String artifactId = parts[1]; return createArtifact(artifactId, groupId, version, packaging, classifier); }
[ "private", "Artifact", "getArtifactFromMavenCoordinates", "(", "final", "String", "artifact", ")", "throws", "MojoFailureException", "{", "String", "[", "]", "parts", "=", "StringUtils", ".", "split", "(", "artifact", ",", "\":\"", ")", ";", "String", "version", ...
Parse coordinates following definition from https://maven.apache.org/pom.html#Maven_Coordinates @param artifact Artifact coordinates @return Artifact object @throws MojoFailureException if coordinates are semantically invalid
[ "Parse", "coordinates", "following", "definition", "from", "https", ":", "//", "maven", ".", "apache", ".", "org", "/", "pom", ".", "html#Maven_Coordinates" ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/maven/plugins/wcmio-content-package-maven-plugin/src/main/java/io/wcm/maven/plugins/contentpackage/ArtifactHelper.java#L83-L118
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkapp/MkAppTreeNode.java
MkAppTreeNode.adjustEntry
@Override public boolean adjustEntry(MkAppEntry entry, DBID routingObjectID, double parentDistance, AbstractMTree<O, MkAppTreeNode<O>, MkAppEntry, ?> mTree) { super.adjustEntry(entry, routingObjectID, parentDistance, mTree); // entry.setKnnDistanceApproximation(knnDistanceApproximation()); return true; // TODO: improve }
java
@Override public boolean adjustEntry(MkAppEntry entry, DBID routingObjectID, double parentDistance, AbstractMTree<O, MkAppTreeNode<O>, MkAppEntry, ?> mTree) { super.adjustEntry(entry, routingObjectID, parentDistance, mTree); // entry.setKnnDistanceApproximation(knnDistanceApproximation()); return true; // TODO: improve }
[ "@", "Override", "public", "boolean", "adjustEntry", "(", "MkAppEntry", "entry", ",", "DBID", "routingObjectID", ",", "double", "parentDistance", ",", "AbstractMTree", "<", "O", ",", "MkAppTreeNode", "<", "O", ">", ",", "MkAppEntry", ",", "?", ">", "mTree", ...
Adjusts the parameters of the entry representing this node. @param entry the entry representing this node @param routingObjectID the id of the (new) routing object of this node @param parentDistance the distance from the routing object of this node to the routing object of the parent node @param mTree the M-Tree object holding this node
[ "Adjusts", "the", "parameters", "of", "the", "entry", "representing", "this", "node", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkapp/MkAppTreeNode.java#L107-L112
aol/cyclops
cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java
LazyReact.fromStreamAsync
public <U> FutureStream<U> fromStreamAsync(final Stream<? extends Supplier<U>> actions) { return constructFutures(actions.map(next -> CompletableFuture.supplyAsync(next, getExecutor()))); }
java
public <U> FutureStream<U> fromStreamAsync(final Stream<? extends Supplier<U>> actions) { return constructFutures(actions.map(next -> CompletableFuture.supplyAsync(next, getExecutor()))); }
[ "public", "<", "U", ">", "FutureStream", "<", "U", ">", "fromStreamAsync", "(", "final", "Stream", "<", "?", "extends", "Supplier", "<", "U", ">", ">", "actions", ")", "{", "return", "constructFutures", "(", "actions", ".", "map", "(", "next", "->", "C...
/* Build an FutureStream that reacts Asynchronously to the Suppliers within the specified Stream <pre> {@code Stream<Supplier<Data>> stream = Stream.of(this::load1,this::looad2,this::load3); LazyReact().fromStreamAsync(stream) .map(this::process) .forEach(this::save) } </pre> @param actions Stream to react to @return FutureStream @see com.oath.cyclops.react.stream.BaseSimpleReact#react(java.util.stream.Stream)
[ "/", "*", "Build", "an", "FutureStream", "that", "reacts", "Asynchronously", "to", "the", "Suppliers", "within", "the", "specified", "Stream" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/futurestream/LazyReact.java#L645-L648
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/acl/ACLProperties.java
ACLProperties.getOwner
public static HierarchicalProperty getOwner(NodeImpl node) throws RepositoryException { HierarchicalProperty ownerProperty = new HierarchicalProperty(PropertyConstants.OWNER); HierarchicalProperty href = new HierarchicalProperty(new QName("DAV:", "href")); href.setValue(node.getACL().getOwner()); ownerProperty.addChild(href); return ownerProperty; }
java
public static HierarchicalProperty getOwner(NodeImpl node) throws RepositoryException { HierarchicalProperty ownerProperty = new HierarchicalProperty(PropertyConstants.OWNER); HierarchicalProperty href = new HierarchicalProperty(new QName("DAV:", "href")); href.setValue(node.getACL().getOwner()); ownerProperty.addChild(href); return ownerProperty; }
[ "public", "static", "HierarchicalProperty", "getOwner", "(", "NodeImpl", "node", ")", "throws", "RepositoryException", "{", "HierarchicalProperty", "ownerProperty", "=", "new", "HierarchicalProperty", "(", "PropertyConstants", ".", "OWNER", ")", ";", "HierarchicalProperty...
Transform owner got from node's {@link AccessControlList} to tree like {@link HierarchicalProperty} instance to use in PROPFIND response body @param node @return {@link HierarchicalProperty} representation of node owner @throws RepositoryException
[ "Transform", "owner", "got", "from", "node", "s", "{" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/acl/ACLProperties.java#L176-L186
liyiorg/weixin-popular
src/main/java/weixin/popular/api/ScanAPI.java
ScanAPI.productGet
public static ProductGetResult productGet(String accessToken, ProductGet productGet) { return productGet(accessToken, JsonUtil.toJSONString(productGet)); }
java
public static ProductGetResult productGet(String accessToken, ProductGet productGet) { return productGet(accessToken, JsonUtil.toJSONString(productGet)); }
[ "public", "static", "ProductGetResult", "productGet", "(", "String", "accessToken", ",", "ProductGet", "productGet", ")", "{", "return", "productGet", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "productGet", ")", ")", ";", "}" ]
查询商品信息 @param accessToken accessToken @param productGet productGet @return ProductGetResult
[ "查询商品信息" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ScanAPI.java#L162-L164
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.parseConditionalStartEventForEventSubprocess
public ConditionalEventDefinition parseConditionalStartEventForEventSubprocess(Element element, ActivityImpl conditionalActivity, boolean interrupting) { conditionalActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_CONDITIONAL); ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition(element, conditionalActivity); conditionalEventDefinition.setInterrupting(interrupting); addEventSubscriptionDeclaration(conditionalEventDefinition, conditionalActivity.getEventScope(), element); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseConditionalStartEventForEventSubprocess(element, conditionalActivity, interrupting); } return conditionalEventDefinition; }
java
public ConditionalEventDefinition parseConditionalStartEventForEventSubprocess(Element element, ActivityImpl conditionalActivity, boolean interrupting) { conditionalActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_CONDITIONAL); ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition(element, conditionalActivity); conditionalEventDefinition.setInterrupting(interrupting); addEventSubscriptionDeclaration(conditionalEventDefinition, conditionalActivity.getEventScope(), element); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseConditionalStartEventForEventSubprocess(element, conditionalActivity, interrupting); } return conditionalEventDefinition; }
[ "public", "ConditionalEventDefinition", "parseConditionalStartEventForEventSubprocess", "(", "Element", "element", ",", "ActivityImpl", "conditionalActivity", ",", "boolean", "interrupting", ")", "{", "conditionalActivity", ".", "getProperties", "(", ")", ".", "set", "(", ...
Parses the given element as conditional start event of an event subprocess. @param element the XML element which contains the conditional event information @param interrupting indicates if the event is interrupting or not @param conditionalActivity the conditional event activity @return
[ "Parses", "the", "given", "element", "as", "conditional", "start", "event", "of", "an", "event", "subprocess", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L3498-L3510
playframework/play-ebean
play-ebean/src/main/java/play/db/ebean/EbeanParsedConfig.java
EbeanParsedConfig.parseFromConfig
public static EbeanParsedConfig parseFromConfig(Config config) { Config playEbeanConfig = config.getConfig("play.ebean"); String defaultDatasource = playEbeanConfig.getString("defaultDatasource"); String ebeanConfigKey = playEbeanConfig.getString("config"); Map<String, List<String>> datasourceModels = new HashMap<>(); if (config.hasPath(ebeanConfigKey)) { Config ebeanConfig = config.getConfig(ebeanConfigKey); ebeanConfig.root().forEach((key, raw) -> { List<String> models; if (raw.valueType() == ConfigValueType.STRING) { // Support legacy comma separated string models = Arrays.asList(((String) raw.unwrapped()).split(",")); } else { models = ebeanConfig.getStringList(key); } datasourceModels.put(key, models); }); } return new EbeanParsedConfig(defaultDatasource, datasourceModels); }
java
public static EbeanParsedConfig parseFromConfig(Config config) { Config playEbeanConfig = config.getConfig("play.ebean"); String defaultDatasource = playEbeanConfig.getString("defaultDatasource"); String ebeanConfigKey = playEbeanConfig.getString("config"); Map<String, List<String>> datasourceModels = new HashMap<>(); if (config.hasPath(ebeanConfigKey)) { Config ebeanConfig = config.getConfig(ebeanConfigKey); ebeanConfig.root().forEach((key, raw) -> { List<String> models; if (raw.valueType() == ConfigValueType.STRING) { // Support legacy comma separated string models = Arrays.asList(((String) raw.unwrapped()).split(",")); } else { models = ebeanConfig.getStringList(key); } datasourceModels.put(key, models); }); } return new EbeanParsedConfig(defaultDatasource, datasourceModels); }
[ "public", "static", "EbeanParsedConfig", "parseFromConfig", "(", "Config", "config", ")", "{", "Config", "playEbeanConfig", "=", "config", ".", "getConfig", "(", "\"play.ebean\"", ")", ";", "String", "defaultDatasource", "=", "playEbeanConfig", ".", "getString", "("...
Parse a play configuration. @param config play configuration @return ebean parsed configuration @see com.typesafe.config.Config
[ "Parse", "a", "play", "configuration", "." ]
train
https://github.com/playframework/play-ebean/blob/ca8dcb8865a06b949d40e05f050238979fd2f9a3/play-ebean/src/main/java/play/db/ebean/EbeanParsedConfig.java#L43-L65
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_secondaryDnsDomains_domain_DELETE
public void serviceName_secondaryDnsDomains_domain_DELETE(String serviceName, String domain) throws IOException { String qPath = "/dedicated/server/{serviceName}/secondaryDnsDomains/{domain}"; StringBuilder sb = path(qPath, serviceName, domain); exec(qPath, "DELETE", sb.toString(), null); }
java
public void serviceName_secondaryDnsDomains_domain_DELETE(String serviceName, String domain) throws IOException { String qPath = "/dedicated/server/{serviceName}/secondaryDnsDomains/{domain}"; StringBuilder sb = path(qPath, serviceName, domain); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "serviceName_secondaryDnsDomains_domain_DELETE", "(", "String", "serviceName", ",", "String", "domain", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/secondaryDnsDomains/{domain}\"", ";", "StringBuilder", "sb", ...
remove this domain REST: DELETE /dedicated/server/{serviceName}/secondaryDnsDomains/{domain} @param serviceName [required] The internal name of your dedicated server @param domain [required] domain on slave server
[ "remove", "this", "domain" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1976-L1980
Impetus/Kundera
src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBClient.java
KuduDBClient.populatePartialRow
private void populatePartialRow(PartialRow row, EntityMetadata entityMetadata, Object entity) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata() .getMetamodel(entityMetadata.getPersistenceUnit()); Class entityClazz = entityMetadata.getEntityClazz(); EntityType entityType = metaModel.entity(entityClazz); Set<Attribute> attributes = entityType.getAttributes(); Iterator<Attribute> iterator = attributes.iterator(); iterateAndPopulateRow(row, entity, metaModel, iterator); }
java
private void populatePartialRow(PartialRow row, EntityMetadata entityMetadata, Object entity) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata() .getMetamodel(entityMetadata.getPersistenceUnit()); Class entityClazz = entityMetadata.getEntityClazz(); EntityType entityType = metaModel.entity(entityClazz); Set<Attribute> attributes = entityType.getAttributes(); Iterator<Attribute> iterator = attributes.iterator(); iterateAndPopulateRow(row, entity, metaModel, iterator); }
[ "private", "void", "populatePartialRow", "(", "PartialRow", "row", ",", "EntityMetadata", "entityMetadata", ",", "Object", "entity", ")", "{", "MetamodelImpl", "metaModel", "=", "(", "MetamodelImpl", ")", "kunderaMetadata", ".", "getApplicationMetadata", "(", ")", "...
Populate partial row. @param row the row @param entityMetadata the entity metadata @param entity the entity
[ "Populate", "partial", "row", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBClient.java#L662-L671
craftercms/core
src/main/java/org/craftercms/core/util/XmlUtils.java
XmlUtils.selectObject
public static Object selectObject(Node node, String xpathQuery) { Object result = node.selectObject(xpathQuery); if (result != null && result instanceof Collection && ((Collection) result).isEmpty()) { return null; } else { return result; } }
java
public static Object selectObject(Node node, String xpathQuery) { Object result = node.selectObject(xpathQuery); if (result != null && result instanceof Collection && ((Collection) result).isEmpty()) { return null; } else { return result; } }
[ "public", "static", "Object", "selectObject", "(", "Node", "node", ",", "String", "xpathQuery", ")", "{", "Object", "result", "=", "node", ".", "selectObject", "(", "xpathQuery", ")", ";", "if", "(", "result", "!=", "null", "&&", "result", "instanceof", "C...
Executes an XPath query to retrieve an object. Normally, if the XPath result doesn't have a result, an empty collection is returned. This object checks that case and returns null accordingly.
[ "Executes", "an", "XPath", "query", "to", "retrieve", "an", "object", ".", "Normally", "if", "the", "XPath", "result", "doesn", "t", "have", "a", "result", "an", "empty", "collection", "is", "returned", ".", "This", "object", "checks", "that", "case", "and...
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L46-L53
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/BaseServerResponseException.java
BaseServerResponseException.addResponseHeader
public BaseServerResponseException addResponseHeader(String theName, String theValue) { Validate.notBlank(theName, "theName must not be null or empty"); Validate.notBlank(theValue, "theValue must not be null or empty"); if (getResponseHeaders().containsKey(theName) == false) { getResponseHeaders().put(theName, new ArrayList<>()); } getResponseHeaders().get(theName).add(theValue); return this; }
java
public BaseServerResponseException addResponseHeader(String theName, String theValue) { Validate.notBlank(theName, "theName must not be null or empty"); Validate.notBlank(theValue, "theValue must not be null or empty"); if (getResponseHeaders().containsKey(theName) == false) { getResponseHeaders().put(theName, new ArrayList<>()); } getResponseHeaders().get(theName).add(theValue); return this; }
[ "public", "BaseServerResponseException", "addResponseHeader", "(", "String", "theName", ",", "String", "theValue", ")", "{", "Validate", ".", "notBlank", "(", "theName", ",", "\"theName must not be null or empty\"", ")", ";", "Validate", ".", "notBlank", "(", "theValu...
Add a header which will be added to any responses @param theName The header name @param theValue The header value @return Returns a reference to <code>this</code> for easy method chaining @since 2.0
[ "Add", "a", "header", "which", "will", "be", "added", "to", "any", "responses" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/BaseServerResponseException.java#L193-L201
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RepositoryFileApi.java
RepositoryFileApi.getFileInfo
public RepositoryFile getFileInfo(Object projectIdOrPath, String filePath, String ref) throws GitLabApiException { Form form = new Form(); addFormParam(form, "ref", ref, true); Response response = head(Response.Status.OK, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(filePath)); RepositoryFile file = new RepositoryFile(); file.setBlobId(response.getHeaderString("X-Gitlab-Blob-Id")); file.setCommitId(response.getHeaderString("X-Gitlab-Commit-Id")); file.setEncoding(response.getHeaderString("X-Gitlab-Encoding")); file.setFileName(response.getHeaderString("X-Gitlab-File-Name")); file.setFilePath(response.getHeaderString("X-Gitlab-File-Path")); file.setLastCommitId(response.getHeaderString("X-Gitlab-Last-Commit-Id")); file.setRef(response.getHeaderString("X-Gitlab-Ref")); String sizeStr = response.getHeaderString("X-Gitlab-Size"); file.setSize(sizeStr != null ? Integer.valueOf(sizeStr) : -1); return (file); }
java
public RepositoryFile getFileInfo(Object projectIdOrPath, String filePath, String ref) throws GitLabApiException { Form form = new Form(); addFormParam(form, "ref", ref, true); Response response = head(Response.Status.OK, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(filePath)); RepositoryFile file = new RepositoryFile(); file.setBlobId(response.getHeaderString("X-Gitlab-Blob-Id")); file.setCommitId(response.getHeaderString("X-Gitlab-Commit-Id")); file.setEncoding(response.getHeaderString("X-Gitlab-Encoding")); file.setFileName(response.getHeaderString("X-Gitlab-File-Name")); file.setFilePath(response.getHeaderString("X-Gitlab-File-Path")); file.setLastCommitId(response.getHeaderString("X-Gitlab-Last-Commit-Id")); file.setRef(response.getHeaderString("X-Gitlab-Ref")); String sizeStr = response.getHeaderString("X-Gitlab-Size"); file.setSize(sizeStr != null ? Integer.valueOf(sizeStr) : -1); return (file); }
[ "public", "RepositoryFile", "getFileInfo", "(", "Object", "projectIdOrPath", ",", "String", "filePath", ",", "String", "ref", ")", "throws", "GitLabApiException", "{", "Form", "form", "=", "new", "Form", "(", ")", ";", "addFormParam", "(", "form", ",", "\"ref\...
Get information on a file in the repository. Allows you to receive information about file in repository like name, size. Only works with GitLab 11.1.0+, returns an empty object for earlier versions of GitLab. <pre><code>GitLab Endpoint: HEAD /projects/:id/repository/files</code></pre> @param projectIdOrPath the id, path of the project, or a Project instance holding the project ID or path @param filePath (required) - Full path to the file. Ex. lib/class.rb @param ref (required) - The name of branch, tag or commit @return a RepositoryFile instance with the file info @throws GitLabApiException if any exception occurs @since GitLab-11.1.0
[ "Get", "information", "on", "a", "file", "in", "the", "repository", ".", "Allows", "you", "to", "receive", "information", "about", "file", "in", "repository", "like", "name", "size", ".", "Only", "works", "with", "GitLab", "11", ".", "1", ".", "0", "+", ...
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryFileApi.java#L60-L80
ops4j/org.ops4j.base
ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java
ZipExploder.processFile
@Deprecated public void processFile(String zipName, String destDir) throws IOException { //Delegation to preferred method processFile(new File(zipName), new File(destDir)); }
java
@Deprecated public void processFile(String zipName, String destDir) throws IOException { //Delegation to preferred method processFile(new File(zipName), new File(destDir)); }
[ "@", "Deprecated", "public", "void", "processFile", "(", "String", "zipName", ",", "String", "destDir", ")", "throws", "IOException", "{", "//Delegation to preferred method", "processFile", "(", "new", "File", "(", "zipName", ")", ",", "new", "File", "(", "destD...
Explode source ZIP or JAR file into a target directory @param zipName names of source file @param destDir target directory name (should already exist) @exception IOException error creating a target file @deprecated use {@link #processFile(File, File)} for a type save variant
[ "Explode", "source", "ZIP", "or", "JAR", "file", "into", "a", "target", "directory" ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/ZipExploder.java#L219-L223
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.powerOff
public OperationStatusResponseInner powerOff(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) { return powerOffWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body(); }
java
public OperationStatusResponseInner powerOff(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) { return powerOffWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body(); }
[ "public", "OperationStatusResponseInner", "powerOff", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "List", "<", "String", ">", "instanceIds", ")", "{", "return", "powerOffWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetNam...
Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceIds The virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatusResponseInner object if successful.
[ "Power", "off", "(", "stop", ")", "one", "or", "more", "virtual", "machines", "in", "a", "VM", "scale", "set", ".", "Note", "that", "resources", "are", "still", "attached", "and", "you", "are", "getting", "charged", "for", "the", "resources", ".", "Inste...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L1798-L1800
ACRA/acra
acra-core/src/main/java/org/acra/attachment/AcraContentProvider.java
AcraContentProvider.openFile
@NonNull @Override public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException { final File file = getFileForUri(uri); if (file == null || !file.exists()) throw new FileNotFoundException("File represented by uri " + uri + " could not be found"); if (ACRA.DEV_LOGGING) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { ACRA.log.d(ACRA.LOG_TAG, getCallingPackage() + " opened " + file.getPath()); } else { ACRA.log.d(ACRA.LOG_TAG, file.getPath() + " was opened by an application"); } } return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); }
java
@NonNull @Override public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode) throws FileNotFoundException { final File file = getFileForUri(uri); if (file == null || !file.exists()) throw new FileNotFoundException("File represented by uri " + uri + " could not be found"); if (ACRA.DEV_LOGGING) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { ACRA.log.d(ACRA.LOG_TAG, getCallingPackage() + " opened " + file.getPath()); } else { ACRA.log.d(ACRA.LOG_TAG, file.getPath() + " was opened by an application"); } } return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY); }
[ "@", "NonNull", "@", "Override", "public", "ParcelFileDescriptor", "openFile", "(", "@", "NonNull", "Uri", "uri", ",", "@", "NonNull", "String", "mode", ")", "throws", "FileNotFoundException", "{", "final", "File", "file", "=", "getFileForUri", "(", "uri", ")"...
Open a file for read @param uri the file uri @param mode ignored @return a {@link ParcelFileDescriptor} for the File @throws FileNotFoundException if the file cannot be resolved
[ "Open", "a", "file", "for", "read" ]
train
https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/attachment/AcraContentProvider.java#L178-L191
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java
Scanner.findInLine
public String findInLine(Pattern pattern) { ensureOpen(); if (pattern == null) throw new NullPointerException(); clearCaches(); // Expand buffer to include the next newline or end of input int endPosition = 0; saveState(); while (true) { String token = findPatternInBuffer(separatorPattern(), 0); if (token != null) { endPosition = matcher.start(); break; // up to next newline } if (needInput) { readInput(); } else { endPosition = buf.limit(); break; // up to end of input } } revertState(); int horizonForLine = endPosition - position; // If there is nothing between the current pos and the next // newline simply return null, invoking findWithinHorizon // with "horizon=0" will scan beyond the line bound. if (horizonForLine == 0) return null; // Search for the pattern return findWithinHorizon(pattern, horizonForLine); }
java
public String findInLine(Pattern pattern) { ensureOpen(); if (pattern == null) throw new NullPointerException(); clearCaches(); // Expand buffer to include the next newline or end of input int endPosition = 0; saveState(); while (true) { String token = findPatternInBuffer(separatorPattern(), 0); if (token != null) { endPosition = matcher.start(); break; // up to next newline } if (needInput) { readInput(); } else { endPosition = buf.limit(); break; // up to end of input } } revertState(); int horizonForLine = endPosition - position; // If there is nothing between the current pos and the next // newline simply return null, invoking findWithinHorizon // with "horizon=0" will scan beyond the line bound. if (horizonForLine == 0) return null; // Search for the pattern return findWithinHorizon(pattern, horizonForLine); }
[ "public", "String", "findInLine", "(", "Pattern", "pattern", ")", "{", "ensureOpen", "(", ")", ";", "if", "(", "pattern", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "clearCaches", "(", ")", ";", "// Expand buffer to include the n...
Attempts to find the next occurrence of the specified pattern ignoring delimiters. If the pattern is found before the next line separator, the scanner advances past the input that matched and returns the string that matched the pattern. If no such pattern is detected in the input up to the next line separator, then <code>null</code> is returned and the scanner's position is unchanged. This method may block waiting for input that matches the pattern. <p>Since this method continues to search through the input looking for the specified pattern, it may buffer all of the input searching for the desired token if no line separators are present. @param pattern the pattern to scan for @return the text that matched the specified pattern @throws IllegalStateException if this scanner is closed
[ "Attempts", "to", "find", "the", "next", "occurrence", "of", "the", "specified", "pattern", "ignoring", "delimiters", ".", "If", "the", "pattern", "is", "found", "before", "the", "next", "line", "separator", "the", "scanner", "advances", "past", "the", "input"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1559-L1589
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java
MethodDelegation.toMethodReturnOf
public static MethodDelegation toMethodReturnOf(String name, MethodGraph.Compiler methodGraphCompiler) { return withDefaultConfiguration().toMethodReturnOf(name, methodGraphCompiler); }
java
public static MethodDelegation toMethodReturnOf(String name, MethodGraph.Compiler methodGraphCompiler) { return withDefaultConfiguration().toMethodReturnOf(name, methodGraphCompiler); }
[ "public", "static", "MethodDelegation", "toMethodReturnOf", "(", "String", "name", ",", "MethodGraph", ".", "Compiler", "methodGraphCompiler", ")", "{", "return", "withDefaultConfiguration", "(", ")", ".", "toMethodReturnOf", "(", "name", ",", "methodGraphCompiler", "...
Delegates any intercepted method to invoke a method on an instance that is returned by a parameterless method of the given name. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method is either public or non-private and in the same package as the instrumented type. Private methods can only be used as a delegation target if the delegation is targeting the instrumented type. @param name The name of the method that returns the delegation target. @param methodGraphCompiler The method graph compiler to use. @return A delegation that redirects invocations to the return value of a method that is declared by the instrumented type.
[ "Delegates", "any", "intercepted", "method", "to", "invoke", "a", "method", "on", "an", "instance", "that", "is", "returned", "by", "a", "parameterless", "method", "of", "the", "given", "name", ".", "To", "be", "considered", "a", "valid", "delegation", "targ...
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java#L525-L527
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/decomposition/bidiagonal/BidiagonalDecompositionRow_DDRM.java
BidiagonalDecompositionRow_DDRM.getV
@Override public DMatrixRMaj getV(DMatrixRMaj V , boolean transpose , boolean compact ) { V = handleV(V, transpose, compact,m,n,min); CommonOps_DDRM.setIdentity(V); // UBV.print(); // todo the very first multiplication can be avoided by setting to the rank1update output for( int j = min-1; j >= 0; j-- ) { u[j+1] = 1; for( int i = j+2; i < n; i++ ) { u[i] = UBV.get(j,i); } if( transpose ) QrHelperFunctions_DDRM.rank1UpdateMultL(V, u, gammasV[j], j + 1, j + 1, n); else QrHelperFunctions_DDRM.rank1UpdateMultR(V, u, gammasV[j], j + 1, j + 1, n, this.b); } return V; }
java
@Override public DMatrixRMaj getV(DMatrixRMaj V , boolean transpose , boolean compact ) { V = handleV(V, transpose, compact,m,n,min); CommonOps_DDRM.setIdentity(V); // UBV.print(); // todo the very first multiplication can be avoided by setting to the rank1update output for( int j = min-1; j >= 0; j-- ) { u[j+1] = 1; for( int i = j+2; i < n; i++ ) { u[i] = UBV.get(j,i); } if( transpose ) QrHelperFunctions_DDRM.rank1UpdateMultL(V, u, gammasV[j], j + 1, j + 1, n); else QrHelperFunctions_DDRM.rank1UpdateMultR(V, u, gammasV[j], j + 1, j + 1, n, this.b); } return V; }
[ "@", "Override", "public", "DMatrixRMaj", "getV", "(", "DMatrixRMaj", "V", ",", "boolean", "transpose", ",", "boolean", "compact", ")", "{", "V", "=", "handleV", "(", "V", ",", "transpose", ",", "compact", ",", "m", ",", "n", ",", "min", ")", ";", "C...
Returns the orthogonal V matrix. @param V If not null then the results will be stored here. Otherwise a new matrix will be created. @return The extracted Q matrix.
[ "Returns", "the", "orthogonal", "V", "matrix", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/bidiagonal/BidiagonalDecompositionRow_DDRM.java#L234-L254
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java
CompressorHttp2ConnectionEncoder.newCompressor
private EmbeddedChannel newCompressor(ChannelHandlerContext ctx, Http2Headers headers, boolean endOfStream) throws Http2Exception { if (endOfStream) { return null; } CharSequence encoding = headers.get(CONTENT_ENCODING); if (encoding == null) { encoding = IDENTITY; } final EmbeddedChannel compressor = newContentCompressor(ctx, encoding); if (compressor != null) { CharSequence targetContentEncoding = getTargetContentEncoding(encoding); if (IDENTITY.contentEqualsIgnoreCase(targetContentEncoding)) { headers.remove(CONTENT_ENCODING); } else { headers.set(CONTENT_ENCODING, targetContentEncoding); } // The content length will be for the decompressed data. Since we will compress the data // this content-length will not be correct. Instead of queuing messages or delaying sending // header frames...just remove the content-length header headers.remove(CONTENT_LENGTH); } return compressor; }
java
private EmbeddedChannel newCompressor(ChannelHandlerContext ctx, Http2Headers headers, boolean endOfStream) throws Http2Exception { if (endOfStream) { return null; } CharSequence encoding = headers.get(CONTENT_ENCODING); if (encoding == null) { encoding = IDENTITY; } final EmbeddedChannel compressor = newContentCompressor(ctx, encoding); if (compressor != null) { CharSequence targetContentEncoding = getTargetContentEncoding(encoding); if (IDENTITY.contentEqualsIgnoreCase(targetContentEncoding)) { headers.remove(CONTENT_ENCODING); } else { headers.set(CONTENT_ENCODING, targetContentEncoding); } // The content length will be for the decompressed data. Since we will compress the data // this content-length will not be correct. Instead of queuing messages or delaying sending // header frames...just remove the content-length header headers.remove(CONTENT_LENGTH); } return compressor; }
[ "private", "EmbeddedChannel", "newCompressor", "(", "ChannelHandlerContext", "ctx", ",", "Http2Headers", "headers", ",", "boolean", "endOfStream", ")", "throws", "Http2Exception", "{", "if", "(", "endOfStream", ")", "{", "return", "null", ";", "}", "CharSequence", ...
Checks if a new compressor object is needed for the stream identified by {@code streamId}. This method will modify the {@code content-encoding} header contained in {@code headers}. @param ctx the context. @param headers Object representing headers which are to be written @param endOfStream Indicates if the stream has ended @return The channel used to compress data. @throws Http2Exception if any problems occur during initialization.
[ "Checks", "if", "a", "new", "compressor", "object", "is", "needed", "for", "the", "stream", "identified", "by", "{", "@code", "streamId", "}", ".", "This", "method", "will", "modify", "the", "{", "@code", "content", "-", "encoding", "}", "header", "contain...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java#L238-L264
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Widgets.java
Widgets.newActionLabel
public static Label newActionLabel (String text, String style, ClickHandler onClick) { return makeActionLabel(newLabel(text, style), onClick); }
java
public static Label newActionLabel (String text, String style, ClickHandler onClick) { return makeActionLabel(newLabel(text, style), onClick); }
[ "public", "static", "Label", "newActionLabel", "(", "String", "text", ",", "String", "style", ",", "ClickHandler", "onClick", ")", "{", "return", "makeActionLabel", "(", "newLabel", "(", "text", ",", "style", ")", ",", "onClick", ")", ";", "}" ]
Creates a label that triggers an action using the supplied text and handler. The label will be styled as specified with an additional style that configures the mouse pointer and adds underline to the text.
[ "Creates", "a", "label", "that", "triggers", "an", "action", "using", "the", "supplied", "text", "and", "handler", ".", "The", "label", "will", "be", "styled", "as", "specified", "with", "an", "additional", "style", "that", "configures", "the", "mouse", "poi...
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L204-L207
real-logic/agrona
agrona/src/main/java/org/agrona/IoUtil.java
IoUtil.createEmptyFile
public static FileChannel createEmptyFile(final File file, final long length, final boolean fillWithZeros) { ensureDirectoryExists(file.getParentFile(), file.getParent()); FileChannel templateFile = null; try { final RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw"); randomAccessFile.setLength(length); templateFile = randomAccessFile.getChannel(); if (fillWithZeros) { fill(templateFile, 0, length, (byte)0); } } catch (final IOException ex) { LangUtil.rethrowUnchecked(ex); } return templateFile; }
java
public static FileChannel createEmptyFile(final File file, final long length, final boolean fillWithZeros) { ensureDirectoryExists(file.getParentFile(), file.getParent()); FileChannel templateFile = null; try { final RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw"); randomAccessFile.setLength(length); templateFile = randomAccessFile.getChannel(); if (fillWithZeros) { fill(templateFile, 0, length, (byte)0); } } catch (final IOException ex) { LangUtil.rethrowUnchecked(ex); } return templateFile; }
[ "public", "static", "FileChannel", "createEmptyFile", "(", "final", "File", "file", ",", "final", "long", "length", ",", "final", "boolean", "fillWithZeros", ")", "{", "ensureDirectoryExists", "(", "file", ".", "getParentFile", "(", ")", ",", "file", ".", "get...
Create an empty file, and optionally fill with 0s, and return the {@link FileChannel} @param file to create @param length of the file to create @param fillWithZeros to the length of the file to force allocation. @return {@link java.nio.channels.FileChannel} for the file
[ "Create", "an", "empty", "file", "and", "optionally", "fill", "with", "0s", "and", "return", "the", "{", "@link", "FileChannel", "}" ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/IoUtil.java#L246-L268
Harium/keel
src/main/java/com/harium/keel/core/helper/ColorHelper.java
ColorHelper.fromHSV
public static int fromHSV(float h, float s, float v, int a) { float r = v; float g = v; float b = v; int i; float f, p, q, t; if (s == 0) { // achromatic (grey) int ri = (int) (r * 0xff); int gi = (int) (g * 0xff); int bi = (int) (b * 0xff); return getRGB(ri, gi, bi); } h /= 60; // sector 0 to 5 i = (int) Math.floor(h); f = h - i; // factorial part of h p = v * (1 - s); q = v * (1 - s * f); t = v * (1 - s * (1 - f)); switch (i) { case 0: r = v; g = t; b = p; break; case 1: r = q; g = v; b = p; break; case 2: r = p; g = v; b = t; break; case 3: r = p; g = q; b = v; break; case 4: r = t; g = p; b = v; break; // case 5: default: r = v; g = p; b = q; break; } int ri = (int) (r * 0xff); int gi = (int) (g * 0xff); int bi = (int) (b * 0xff); return getARGB(ri, gi, bi, a); }
java
public static int fromHSV(float h, float s, float v, int a) { float r = v; float g = v; float b = v; int i; float f, p, q, t; if (s == 0) { // achromatic (grey) int ri = (int) (r * 0xff); int gi = (int) (g * 0xff); int bi = (int) (b * 0xff); return getRGB(ri, gi, bi); } h /= 60; // sector 0 to 5 i = (int) Math.floor(h); f = h - i; // factorial part of h p = v * (1 - s); q = v * (1 - s * f); t = v * (1 - s * (1 - f)); switch (i) { case 0: r = v; g = t; b = p; break; case 1: r = q; g = v; b = p; break; case 2: r = p; g = v; b = t; break; case 3: r = p; g = q; b = v; break; case 4: r = t; g = p; b = v; break; // case 5: default: r = v; g = p; b = q; break; } int ri = (int) (r * 0xff); int gi = (int) (g * 0xff); int bi = (int) (b * 0xff); return getARGB(ri, gi, bi, a); }
[ "public", "static", "int", "fromHSV", "(", "float", "h", ",", "float", "s", ",", "float", "v", ",", "int", "a", ")", "{", "float", "r", "=", "v", ";", "float", "g", "=", "v", ";", "float", "b", "=", "v", ";", "int", "i", ";", "float", "f", ...
Method to transform from HSV to ARGB Source from: https://www.cs.rit.edu/~ncs/color/t_convert.html @param h - hue @param s - saturation @param v - brightness @param a - alpha @return rgb color
[ "Method", "to", "transform", "from", "HSV", "to", "ARGB", "Source", "from", ":", "https", ":", "//", "www", ".", "cs", ".", "rit", ".", "edu", "/", "~ncs", "/", "color", "/", "t_convert", ".", "html" ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/core/helper/ColorHelper.java#L314-L377
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java
ClustersInner.beginExecuteScriptActionsAsync
public Observable<Void> beginExecuteScriptActionsAsync(String resourceGroupName, String clusterName, ExecuteScriptActionParameters parameters) { return beginExecuteScriptActionsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginExecuteScriptActionsAsync(String resourceGroupName, String clusterName, ExecuteScriptActionParameters parameters) { return beginExecuteScriptActionsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginExecuteScriptActionsAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "ExecuteScriptActionParameters", "parameters", ")", "{", "return", "beginExecuteScriptActionsWithServiceResponseAsync", "(", "res...
Executes script actions on the specified HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param parameters The parameters for executing script actions. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Executes", "script", "actions", "on", "the", "specified", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L1822-L1829
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbDiscover.java
TmdbDiscover.getDiscoverTV
public ResultList<TVBasic> getDiscoverTV(Discover discover) throws MovieDbException { URL url = new ApiUrl(apiKey, MethodBase.DISCOVER).subMethod(MethodSub.TV).buildUrl(discover.getParams()); String webpage = httpTools.getRequest(url); WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, webpage); return wrapper.getResultsList(); }
java
public ResultList<TVBasic> getDiscoverTV(Discover discover) throws MovieDbException { URL url = new ApiUrl(apiKey, MethodBase.DISCOVER).subMethod(MethodSub.TV).buildUrl(discover.getParams()); String webpage = httpTools.getRequest(url); WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, webpage); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "TVBasic", ">", "getDiscoverTV", "(", "Discover", "discover", ")", "throws", "MovieDbException", "{", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "DISCOVER", ")", ".", "subMethod", "(", "MethodSub", ...
Discover movies by different types of data like average rating, number of votes, genres and certifications. @param discover A discover object containing the search criteria required @return @throws MovieDbException
[ "Discover", "movies", "by", "different", "types", "of", "data", "like", "average", "rating", "number", "of", "votes", "genres", "and", "certifications", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbDiscover.java#L72-L77
aws/aws-sdk-java
aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/UpdateMethodResult.java
UpdateMethodResult.withRequestModels
public UpdateMethodResult withRequestModels(java.util.Map<String, String> requestModels) { setRequestModels(requestModels); return this; }
java
public UpdateMethodResult withRequestModels(java.util.Map<String, String> requestModels) { setRequestModels(requestModels); return this; }
[ "public", "UpdateMethodResult", "withRequestModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "requestModels", ")", "{", "setRequestModels", "(", "requestModels", ")", ";", "return", "this", ";", "}" ]
<p> A key-value map specifying data schemas, represented by <a>Model</a> resources, (as the mapped value) of the request payloads of given content types (as the mapping key). </p> @param requestModels A key-value map specifying data schemas, represented by <a>Model</a> resources, (as the mapped value) of the request payloads of given content types (as the mapping key). @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "key", "-", "value", "map", "specifying", "data", "schemas", "represented", "by", "<a", ">", "Model<", "/", "a", ">", "resources", "(", "as", "the", "mapped", "value", ")", "of", "the", "request", "payloads", "of", "given", "content", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/UpdateMethodResult.java#L614-L617
termsuite/termsuite-core
src/main/java/fr/univnantes/termsuite/utils/TermUtils.java
TermUtils.getPosition
public static int getPosition(Term subTerm, Term term) { int startingIndex = -1; int j = 0; for(int i=0; i<term.getWords().size(); i++) { if(term.getWords().get(i).equals(subTerm.getWords().get(j))) { j++; if(startingIndex == -1) startingIndex = i; } else { startingIndex = -1; j = 0; } if(j == subTerm.getWords().size()) return startingIndex; } return -1; }
java
public static int getPosition(Term subTerm, Term term) { int startingIndex = -1; int j = 0; for(int i=0; i<term.getWords().size(); i++) { if(term.getWords().get(i).equals(subTerm.getWords().get(j))) { j++; if(startingIndex == -1) startingIndex = i; } else { startingIndex = -1; j = 0; } if(j == subTerm.getWords().size()) return startingIndex; } return -1; }
[ "public", "static", "int", "getPosition", "(", "Term", "subTerm", ",", "Term", "term", ")", "{", "int", "startingIndex", "=", "-", "1", ";", "int", "j", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "term", ".", "getWords", "(",...
Finds the index of appearance of a term's sub-term. @param subTerm the inner term, must be included in <code>term</code> @param term the container term. @return the starting index of <code>subTerm</code> in <code>term</code>. -1 otherwise.
[ "Finds", "the", "index", "of", "appearance", "of", "a", "term", "s", "sub", "-", "term", "." ]
train
https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/utils/TermUtils.java#L125-L141
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemMetadataProvider.java
FileSystemMetadataProvider.checkExists
private static void checkExists(FileSystem fs, Path location) { try { if (!fs.exists(location)) { throw new DatasetNotFoundException( "Descriptor location does not exist: " + location); } } catch (IOException ex) { throw new DatasetIOException( "Cannot access descriptor location: " + location, ex); } }
java
private static void checkExists(FileSystem fs, Path location) { try { if (!fs.exists(location)) { throw new DatasetNotFoundException( "Descriptor location does not exist: " + location); } } catch (IOException ex) { throw new DatasetIOException( "Cannot access descriptor location: " + location, ex); } }
[ "private", "static", "void", "checkExists", "(", "FileSystem", "fs", ",", "Path", "location", ")", "{", "try", "{", "if", "(", "!", "fs", ".", "exists", "(", "location", ")", ")", "{", "throw", "new", "DatasetNotFoundException", "(", "\"Descriptor location d...
Precondition-style static validation that a dataset exists @param fs A FileSystem where the metadata should be stored @param location The Path where the metadata should be stored @throws org.kitesdk.data.DatasetNotFoundException if the descriptor location is missing @throws org.kitesdk.data.DatasetIOException if any IOException is thrown
[ "Precondition", "-", "style", "static", "validation", "that", "a", "dataset", "exists" ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemMetadataProvider.java#L575-L585
SeaCloudsEU/SeaCloudsPlatform
sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/ProviderRest.java
ProviderRest.getProviderByUuid
@GET @Path("{uuid}") @Produces(MediaType.APPLICATION_XML) public Response getProviderByUuid(@PathParam("uuid") String provider_uuid) throws IOException, JAXBException { logger.debug("StartOf getProviderByUuid - REQUEST for /providers/" + provider_uuid); try { ProviderHelper providerRestService = getProviderHelper(); String serializedProvider = providerRestService.getProviderByUUID(provider_uuid); if (serializedProvider!=null){ logger.debug("EndOf getProviderByUuid"); return buildResponse(200, serializedProvider); }else{ logger.debug("EndOf getProviderByUuid"); return buildResponse(404, printError(404, "There is no provider with uuid " + provider_uuid + " in the SLA Repository Database")); } } catch (HelperException e) { logger.info("getProviderByUuid exception:"+e.getMessage()); return buildResponse(e); } }
java
@GET @Path("{uuid}") @Produces(MediaType.APPLICATION_XML) public Response getProviderByUuid(@PathParam("uuid") String provider_uuid) throws IOException, JAXBException { logger.debug("StartOf getProviderByUuid - REQUEST for /providers/" + provider_uuid); try { ProviderHelper providerRestService = getProviderHelper(); String serializedProvider = providerRestService.getProviderByUUID(provider_uuid); if (serializedProvider!=null){ logger.debug("EndOf getProviderByUuid"); return buildResponse(200, serializedProvider); }else{ logger.debug("EndOf getProviderByUuid"); return buildResponse(404, printError(404, "There is no provider with uuid " + provider_uuid + " in the SLA Repository Database")); } } catch (HelperException e) { logger.info("getProviderByUuid exception:"+e.getMessage()); return buildResponse(e); } }
[ "@", "GET", "@", "Path", "(", "\"{uuid}\"", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_XML", ")", "public", "Response", "getProviderByUuid", "(", "@", "PathParam", "(", "\"uuid\"", ")", "String", "provider_uuid", ")", "throws", "IOException", ",...
Gets the information of an specific provider If the provider it is not in the database, it returns 404 with empty payload <pre> GET /providers/{uuid} Request: GET /providers HTTP/1.1 Response: {@code <?xml version="1.0" encoding="UTF-8"?> <provider> <uuid>fc923960-03fe-41eb-8a21-a56709f9370f</uuid> <name>provider-prueba</name> </provider> } </pre> Example: <li>curl http://localhost:8080/sla-service/providers/fc923960-03f e-41eb-8a21-a56709f9370f</li> @param uuid of the provider @return XML information with the different details of the provider
[ "Gets", "the", "information", "of", "an", "specific", "provider", "If", "the", "provider", "it", "is", "not", "in", "the", "database", "it", "returns", "404", "with", "empty", "payload" ]
train
https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/ProviderRest.java#L147-L171
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteCompositeEntity
public OperationStatus deleteCompositeEntity(UUID appId, String versionId, UUID cEntityId) { return deleteCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId).toBlocking().single().body(); }
java
public OperationStatus deleteCompositeEntity(UUID appId, String versionId, UUID cEntityId) { return deleteCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId).toBlocking().single().body(); }
[ "public", "OperationStatus", "deleteCompositeEntity", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ")", "{", "return", "deleteCompositeEntityWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "cEntityId", ")", ".", "toBlocki...
Deletes a composite entity extractor from the application. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Deletes", "a", "composite", "entity", "extractor", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4127-L4129
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ClassLoadingServiceImpl.java
ClassLoadingServiceImpl.listenForLibraryChanges
private void listenForLibraryChanges(String libid, AppClassLoader acl) { // ensure this loader is removed from the canonical store when the library is updated new WeakLibraryListener(libid, acl.getKey().getId(), acl, bundleContext) { @Override protected void update() { Object cl = get(); if (cl instanceof AppClassLoader && aclStore != null) aclStore.remove((AppClassLoader) cl); deregister(); } }; }
java
private void listenForLibraryChanges(String libid, AppClassLoader acl) { // ensure this loader is removed from the canonical store when the library is updated new WeakLibraryListener(libid, acl.getKey().getId(), acl, bundleContext) { @Override protected void update() { Object cl = get(); if (cl instanceof AppClassLoader && aclStore != null) aclStore.remove((AppClassLoader) cl); deregister(); } }; }
[ "private", "void", "listenForLibraryChanges", "(", "String", "libid", ",", "AppClassLoader", "acl", ")", "{", "// ensure this loader is removed from the canonical store when the library is updated", "new", "WeakLibraryListener", "(", "libid", ",", "acl", ".", "getKey", "(", ...
create a listener to remove a loader from the canonical store on library update
[ "create", "a", "listener", "to", "remove", "a", "loader", "from", "the", "canonical", "store", "on", "library", "update" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ClassLoadingServiceImpl.java#L508-L519
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/xml/MultipleLoaderClassResolver.java
MultipleLoaderClassResolver.classForName
@SuppressWarnings({"unchecked", "rawtypes"}) public Class classForName(String className, Map loaderMap) throws ClassNotFoundException { Collection<ClassLoader> loaders = null; // add context-classloader loaders = new HashSet<ClassLoader>(); loaders.add(Thread.currentThread().getContextClassLoader()); if (loaderMap != null && !loaderMap.isEmpty()) { loaders.addAll(loaderMap.values()); } Class clazz = null; ClassNotFoundException lastCause = null; for (Iterator<ClassLoader> it = loaders.iterator(); it.hasNext();) { ClassLoader loader = it.next(); try { clazz = loader.loadClass(className); return clazz; } catch (ClassNotFoundException fqcnException) { lastCause = fqcnException; try { if (className.indexOf('.') == -1) { clazz = loader.loadClass("java.lang." + className); return clazz; } } catch (ClassNotFoundException defaultClassException) { lastCause = defaultClassException; // try next loader. } } } // can't load class at end. throw lastCause; }
java
@SuppressWarnings({"unchecked", "rawtypes"}) public Class classForName(String className, Map loaderMap) throws ClassNotFoundException { Collection<ClassLoader> loaders = null; // add context-classloader loaders = new HashSet<ClassLoader>(); loaders.add(Thread.currentThread().getContextClassLoader()); if (loaderMap != null && !loaderMap.isEmpty()) { loaders.addAll(loaderMap.values()); } Class clazz = null; ClassNotFoundException lastCause = null; for (Iterator<ClassLoader> it = loaders.iterator(); it.hasNext();) { ClassLoader loader = it.next(); try { clazz = loader.loadClass(className); return clazz; } catch (ClassNotFoundException fqcnException) { lastCause = fqcnException; try { if (className.indexOf('.') == -1) { clazz = loader.loadClass("java.lang." + className); return clazz; } } catch (ClassNotFoundException defaultClassException) { lastCause = defaultClassException; // try next loader. } } } // can't load class at end. throw lastCause; }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "Class", "classForName", "(", "String", "className", ",", "Map", "loaderMap", ")", "throws", "ClassNotFoundException", "{", "Collection", "<", "ClassLoader", ">", "loaders...
Loads class from multiple ClassLoader. If this method can not load target class, it tries to add package java.lang(default package) and load target class. Still, if it can not the class, throws ClassNotFoundException. (behavior is put together on DefaultClassResolver.) @param className class name -- that wants to load it. @param loaderMap map -- that has VALUES ClassLoader (KEYS are arbitary). @return loaded class from ClassLoader defined loaderMap.
[ "Loads", "class", "from", "multiple", "ClassLoader", "." ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/MultipleLoaderClassResolver.java#L30-L62
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java
DirectoryServiceClient.updateServiceInstance
public void updateServiceInstance(ProvidedServiceInstance instance, final RegistrationCallback cb, Object context){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.UpdateServiceInstance); UpdateServiceInstanceProtocol p = new UpdateServiceInstanceProtocol(instance); ProtocolCallback pcb = new ProtocolCallback(){ @Override public void call(boolean result, Response response, ErrorCode error, Object ctx) { cb.call(result, error, ctx); } }; connection.submitCallbackRequest(header, p, pcb, context); }
java
public void updateServiceInstance(ProvidedServiceInstance instance, final RegistrationCallback cb, Object context){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.UpdateServiceInstance); UpdateServiceInstanceProtocol p = new UpdateServiceInstanceProtocol(instance); ProtocolCallback pcb = new ProtocolCallback(){ @Override public void call(boolean result, Response response, ErrorCode error, Object ctx) { cb.call(result, error, ctx); } }; connection.submitCallbackRequest(header, p, pcb, context); }
[ "public", "void", "updateServiceInstance", "(", "ProvidedServiceInstance", "instance", ",", "final", "RegistrationCallback", "cb", ",", "Object", "context", ")", "{", "ProtocolHeader", "header", "=", "new", "ProtocolHeader", "(", ")", ";", "header", ".", "setType", ...
Update the ServiceInstance with callback. @param instance the ServiceInstance. @param cb the Callback. @param context the context object.
[ "Update", "the", "ServiceInstance", "with", "callback", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L565-L580
alkacon/opencms-core
src/org/opencms/widgets/A_CmsHtmlWidget.java
A_CmsHtmlWidget.buildOpenCmsButtonRow
protected String buildOpenCmsButtonRow(I_CmsWidgetDialog widgetDialog, String paramId) { StringBuffer result = new StringBuffer(2048); // flag indicating if at least one button is active boolean buttonsActive = false; // generate button row start HTML result.append(buildOpenCmsButtonRow(CmsWorkplace.HTML_START, widgetDialog)); // build the link buttons if (getHtmlWidgetOption().showLinkDialog()) { result.append( widgetDialog.button( "javascript:setActiveEditor('" + paramId + "');openLinkDialog('" + Messages.get().getBundle(widgetDialog.getLocale()).key(Messages.GUI_BUTTON_LINKTO_0) + "');", null, "link", "button.linkto", widgetDialog.getButtonStyle())); buttonsActive = true; } if (getHtmlWidgetOption().showAnchorDialog()) { result.append( widgetDialog.button( "javascript:setActiveEditor('" + paramId + "');openAnchorDialog('" + Messages.get().getBundle(widgetDialog.getLocale()).key( Messages.ERR_EDITOR_MESSAGE_NOSELECTION_0) + "');", null, "anchor", Messages.GUI_BUTTON_ANCHOR_0, widgetDialog.getButtonStyle())); buttonsActive = true; } if (!buttonsActive) { // no active buttons to show, return empty String return ""; } // generate button row end HTML result.append(buildOpenCmsButtonRow(CmsWorkplace.HTML_END, widgetDialog)); // show the active buttons return result.toString(); }
java
protected String buildOpenCmsButtonRow(I_CmsWidgetDialog widgetDialog, String paramId) { StringBuffer result = new StringBuffer(2048); // flag indicating if at least one button is active boolean buttonsActive = false; // generate button row start HTML result.append(buildOpenCmsButtonRow(CmsWorkplace.HTML_START, widgetDialog)); // build the link buttons if (getHtmlWidgetOption().showLinkDialog()) { result.append( widgetDialog.button( "javascript:setActiveEditor('" + paramId + "');openLinkDialog('" + Messages.get().getBundle(widgetDialog.getLocale()).key(Messages.GUI_BUTTON_LINKTO_0) + "');", null, "link", "button.linkto", widgetDialog.getButtonStyle())); buttonsActive = true; } if (getHtmlWidgetOption().showAnchorDialog()) { result.append( widgetDialog.button( "javascript:setActiveEditor('" + paramId + "');openAnchorDialog('" + Messages.get().getBundle(widgetDialog.getLocale()).key( Messages.ERR_EDITOR_MESSAGE_NOSELECTION_0) + "');", null, "anchor", Messages.GUI_BUTTON_ANCHOR_0, widgetDialog.getButtonStyle())); buttonsActive = true; } if (!buttonsActive) { // no active buttons to show, return empty String return ""; } // generate button row end HTML result.append(buildOpenCmsButtonRow(CmsWorkplace.HTML_END, widgetDialog)); // show the active buttons return result.toString(); }
[ "protected", "String", "buildOpenCmsButtonRow", "(", "I_CmsWidgetDialog", "widgetDialog", ",", "String", "paramId", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "2048", ")", ";", "// flag indicating if at least one button is active", "boolean", "bu...
Returns the HTML for the OpenCms specific button row for galleries and links.<p> Use this method to generate a button row with OpenCms specific dialog buttons in the {@link org.opencms.widgets.I_CmsWidget#getDialogWidget(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter)} method to obtain the buttons.<p> Overwrite the method if the integrated editor needs a specific button generation (e.g. add format select or toggle source code button) or if some buttons should not be available.<p> @param widgetDialog the dialog where the widget is used on @param paramId the id of the current widget @return the html String for the OpenCms specific button row
[ "Returns", "the", "HTML", "for", "the", "OpenCms", "specific", "button", "row", "for", "galleries", "and", "links", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/A_CmsHtmlWidget.java#L151-L202
LearnLib/automatalib
util/src/main/java/net/automatalib/util/automata/transducers/StateLocalInputMealyUtil.java
StateLocalInputMealyUtil.partialToObservableOutput
public static <I, O> StateLocalInputMealyMachine<Integer, I, ?, OutputAndLocalInputs<I, O>> partialToObservableOutput( StateLocalInputMealyMachine<Integer, I, ?, O> reference) { return partialToObservableOutput(reference, reference.size()); }
java
public static <I, O> StateLocalInputMealyMachine<Integer, I, ?, OutputAndLocalInputs<I, O>> partialToObservableOutput( StateLocalInputMealyMachine<Integer, I, ?, O> reference) { return partialToObservableOutput(reference, reference.size()); }
[ "public", "static", "<", "I", ",", "O", ">", "StateLocalInputMealyMachine", "<", "Integer", ",", "I", ",", "?", ",", "OutputAndLocalInputs", "<", "I", ",", "O", ">", ">", "partialToObservableOutput", "(", "StateLocalInputMealyMachine", "<", "Integer", ",", "I"...
Convenience method for {@link #partialToObservableOutput(StateLocalInputMealyMachine, Object)}, where the size of the given reference is used as the new sink state. @param reference the (partial) mealy to transform @param <I> input symbol type @param <O> output symbol type @return see {@link #partialToObservableOutput(StateLocalInputMealyMachine, Object)}.
[ "Convenience", "method", "for", "{", "@link", "#partialToObservableOutput", "(", "StateLocalInputMealyMachine", "Object", ")", "}", "where", "the", "size", "of", "the", "given", "reference", "is", "used", "as", "the", "new", "sink", "state", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/transducers/StateLocalInputMealyUtil.java#L53-L56
pinterest/secor
src/main/java/com/pinterest/secor/util/ReflectionUtil.java
ReflectionUtil.createFileReader
public static FileReader createFileReader(String className, LogFilePath logFilePath, CompressionCodec codec, SecorConfig config) throws Exception { return createFileReaderWriterFactory(className, config).BuildFileReader(logFilePath, codec); }
java
public static FileReader createFileReader(String className, LogFilePath logFilePath, CompressionCodec codec, SecorConfig config) throws Exception { return createFileReaderWriterFactory(className, config).BuildFileReader(logFilePath, codec); }
[ "public", "static", "FileReader", "createFileReader", "(", "String", "className", ",", "LogFilePath", "logFilePath", ",", "CompressionCodec", "codec", ",", "SecorConfig", "config", ")", "throws", "Exception", "{", "return", "createFileReaderWriterFactory", "(", "classNa...
Use the FileReaderWriterFactory specified by className to build a FileReader @param className the class name of a subclass of FileReaderWriterFactory to create a FileReader from @param logFilePath the LogFilePath that the returned FileReader should read from @param codec an instance CompressionCodec to decompress the file being read, or null for no compression @param config The SecorCondig to initialize the FileReader with @return a FileReader specialised to read the type of files supported by the FileReaderWriterFactory @throws Exception on error
[ "Use", "the", "FileReaderWriterFactory", "specified", "by", "className", "to", "build", "a", "FileReader" ]
train
https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ReflectionUtil.java#L169-L174
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.exportObjects2Excel
public void exportObjects2Excel(List<?> data, Class clazz, boolean isWriteHeader, OutputStream os) throws Excel4JException, IOException { try (Workbook workbook = exportExcelNoTemplateHandler(data, clazz, isWriteHeader, null, true)) { workbook.write(os); } }
java
public void exportObjects2Excel(List<?> data, Class clazz, boolean isWriteHeader, OutputStream os) throws Excel4JException, IOException { try (Workbook workbook = exportExcelNoTemplateHandler(data, clazz, isWriteHeader, null, true)) { workbook.write(os); } }
[ "public", "void", "exportObjects2Excel", "(", "List", "<", "?", ">", "data", ",", "Class", "clazz", ",", "boolean", "isWriteHeader", ",", "OutputStream", "os", ")", "throws", "Excel4JException", ",", "IOException", "{", "try", "(", "Workbook", "workbook", "=",...
无模板、基于注解的数据导出 @param data 待导出数据 @param clazz {@link com.github.crab2died.annotation.ExcelField}映射对象Class @param isWriteHeader 是否写入表头 @param os 生成的Excel待输出数据流 @throws Excel4JException 异常 @throws IOException 异常 @author Crab2Died
[ "无模板、基于注解的数据导出" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L1058-L1064
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.getDataFromLine
public static String[] getDataFromLine(final String line, final String seperator) { return getDataFromLine(line, seperator, false); }
java
public static String[] getDataFromLine(final String line, final String seperator) { return getDataFromLine(line, seperator, false); }
[ "public", "static", "String", "[", "]", "getDataFromLine", "(", "final", "String", "line", ",", "final", "String", "seperator", ")", "{", "return", "getDataFromLine", "(", "line", ",", "seperator", ",", "false", ")", ";", "}" ]
Gets the data from line. @param line the line @param seperator the seperator @return the data from line
[ "Gets", "the", "data", "from", "line", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L206-L209
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/partition/ToolBarData.java
ToolBarData.addMonth
public static Date addMonth(Date date, int amt) { return addDateField(date,Calendar.MONTH,amt); }
java
public static Date addMonth(Date date, int amt) { return addDateField(date,Calendar.MONTH,amt); }
[ "public", "static", "Date", "addMonth", "(", "Date", "date", ",", "int", "amt", ")", "{", "return", "addDateField", "(", "date", ",", "Calendar", ".", "MONTH", ",", "amt", ")", ";", "}" ]
Increment a Date object by +/- some months @param date Date to +/- some months from @param amt number of months to add/remove @return new Date object offset by the indicated months
[ "Increment", "a", "Date", "object", "by", "+", "/", "-", "some", "months" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/partition/ToolBarData.java#L173-L175
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java
GeometryExtrude.extractWalls
public static MultiPolygon extractWalls(LineString lineString, double height) { GeometryFactory factory = lineString.getFactory(); //Extract the walls Coordinate[] coords = lineString.getCoordinates(); Polygon[] walls = new Polygon[coords.length - 1]; for (int i = 0; i < coords.length - 1; i++) { walls[i] = extrudeEdge(coords[i], coords[i + 1], height, factory); } return lineString.getFactory().createMultiPolygon(walls); }
java
public static MultiPolygon extractWalls(LineString lineString, double height) { GeometryFactory factory = lineString.getFactory(); //Extract the walls Coordinate[] coords = lineString.getCoordinates(); Polygon[] walls = new Polygon[coords.length - 1]; for (int i = 0; i < coords.length - 1; i++) { walls[i] = extrudeEdge(coords[i], coords[i + 1], height, factory); } return lineString.getFactory().createMultiPolygon(walls); }
[ "public", "static", "MultiPolygon", "extractWalls", "(", "LineString", "lineString", ",", "double", "height", ")", "{", "GeometryFactory", "factory", "=", "lineString", ".", "getFactory", "(", ")", ";", "//Extract the walls ", "Coordinate", "[", "]", "coords"...
Extrude the LineString as a set of walls. @param lineString @param height @return
[ "Extrude", "the", "LineString", "as", "a", "set", "of", "walls", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java#L170-L179
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/cr/crvserver_stats.java
crvserver_stats.get
public static crvserver_stats get(nitro_service service, String name) throws Exception{ crvserver_stats obj = new crvserver_stats(); obj.set_name(name); crvserver_stats response = (crvserver_stats) obj.stat_resource(service); return response; }
java
public static crvserver_stats get(nitro_service service, String name) throws Exception{ crvserver_stats obj = new crvserver_stats(); obj.set_name(name); crvserver_stats response = (crvserver_stats) obj.stat_resource(service); return response; }
[ "public", "static", "crvserver_stats", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "crvserver_stats", "obj", "=", "new", "crvserver_stats", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "crv...
Use this API to fetch statistics of crvserver_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "crvserver_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/cr/crvserver_stats.java#L249-L254
fracpete/multisearch-weka-package
src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java
PerformanceCache.get
public Performance get(int cv, Point<Object> values) { return m_Cache.get(getID(cv, values)); }
java
public Performance get(int cv, Point<Object> values) { return m_Cache.get(getID(cv, values)); }
[ "public", "Performance", "get", "(", "int", "cv", ",", "Point", "<", "Object", ">", "values", ")", "{", "return", "m_Cache", ".", "get", "(", "getID", "(", "cv", ",", "values", ")", ")", ";", "}" ]
returns a cached performance object, null if not yet in the cache. @param cv the number of folds in the cross-validation @param values the point in the space @return the cached performance item, null if not in cache
[ "returns", "a", "cached", "performance", "object", "null", "if", "not", "yet", "in", "the", "cache", "." ]
train
https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java#L80-L82
bazaarvoice/jersey-hmac-auth
common/src/main/java/com/bazaarvoice/auth/hmac/server/AbstractAuthenticator.java
AbstractAuthenticator.validateSignature
private boolean validateSignature(Credentials credentials, String secretKey) { String clientSignature = credentials.getSignature(); String serverSignature = createSignature(credentials, secretKey); return MessageDigest.isEqual(clientSignature.getBytes(), serverSignature.getBytes()); }
java
private boolean validateSignature(Credentials credentials, String secretKey) { String clientSignature = credentials.getSignature(); String serverSignature = createSignature(credentials, secretKey); return MessageDigest.isEqual(clientSignature.getBytes(), serverSignature.getBytes()); }
[ "private", "boolean", "validateSignature", "(", "Credentials", "credentials", ",", "String", "secretKey", ")", "{", "String", "clientSignature", "=", "credentials", ".", "getSignature", "(", ")", ";", "String", "serverSignature", "=", "createSignature", "(", "creden...
Validate the signature on the request by generating a new signature here and making sure they match. The only way for them to match is if both signature are generated using the same secret key. If they match, this means that the requester has a valid secret key and can be a trusted source. @param credentials the credentials specified on the request @param secretKey the secret key that will be used to generate the signature @return true if the signature is valid
[ "Validate", "the", "signature", "on", "the", "request", "by", "generating", "a", "new", "signature", "here", "and", "making", "sure", "they", "match", ".", "The", "only", "way", "for", "them", "to", "match", "is", "if", "both", "signature", "are", "generat...
train
https://github.com/bazaarvoice/jersey-hmac-auth/blob/17e2a40a4b7b783de4d77ad97f8a623af6baf688/common/src/main/java/com/bazaarvoice/auth/hmac/server/AbstractAuthenticator.java#L117-L121
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/server/RemoteSessionServer.java
RemoteSessionServer.startupServer
public static RemoteSessionServer startupServer(Map<String,Object> properties) { RemoteSessionServer remoteServer = null; Utility.getLogger().info("Starting RemoteSession server"); try { remoteServer = new RemoteSessionServer(null, null, null); } catch (RemoteException ex) { ex.printStackTrace(); } return remoteServer; }
java
public static RemoteSessionServer startupServer(Map<String,Object> properties) { RemoteSessionServer remoteServer = null; Utility.getLogger().info("Starting RemoteSession server"); try { remoteServer = new RemoteSessionServer(null, null, null); } catch (RemoteException ex) { ex.printStackTrace(); } return remoteServer; }
[ "public", "static", "RemoteSessionServer", "startupServer", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "RemoteSessionServer", "remoteServer", "=", "null", ";", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"Starting Remot...
Start up the remote server. @param properties The properties to use on setup.
[ "Start", "up", "the", "remote", "server", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/server/RemoteSessionServer.java#L77-L89
rholder/fauxflake
fauxflake-core/src/main/java/com/github/rholder/fauxflake/provider/boundary/FlakeEncodingProvider.java
FlakeEncodingProvider.encodeAsString
@Override public String encodeAsString(long time, int sequence) { StringBuilder s = new StringBuilder(32); ByteBuffer bb = ByteBuffer.wrap(encodeAsBytes(time, sequence)); s.append(leftPad(toHexString(bb.getLong()), 16, '0')); s.append(leftPad(toHexString(bb.getLong()), 16, '0')); return s.toString(); }
java
@Override public String encodeAsString(long time, int sequence) { StringBuilder s = new StringBuilder(32); ByteBuffer bb = ByteBuffer.wrap(encodeAsBytes(time, sequence)); s.append(leftPad(toHexString(bb.getLong()), 16, '0')); s.append(leftPad(toHexString(bb.getLong()), 16, '0')); return s.toString(); }
[ "@", "Override", "public", "String", "encodeAsString", "(", "long", "time", ",", "int", "sequence", ")", "{", "StringBuilder", "s", "=", "new", "StringBuilder", "(", "32", ")", ";", "ByteBuffer", "bb", "=", "ByteBuffer", ".", "wrap", "(", "encodeAsBytes", ...
Return the 32 character left padded hex version of the given id. These can be lexicographically sorted. @param time a time value to encode @param sequence a sequence value to encode @return 32 character left padded hex version of the given id
[ "Return", "the", "32", "character", "left", "padded", "hex", "version", "of", "the", "given", "id", ".", "These", "can", "be", "lexicographically", "sorted", "." ]
train
https://github.com/rholder/fauxflake/blob/54631faefdaf6b0b4d27b365f18c085771575cb3/fauxflake-core/src/main/java/com/github/rholder/fauxflake/provider/boundary/FlakeEncodingProvider.java#L99-L107
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/EmailPasswordResetNotificationImpl.java
EmailPasswordResetNotificationImpl.formatBody
private String formatBody(URL resetUrl, ILocalAccountPerson account, Locale locale) { final STGroup group = new STGroupDir(templateDir, '$', '$'); final ST template = group.getInstanceOf(templateName); String name = findDisplayNameFromLocalAccountPerson(account); template.add("displayName", name); template.add("url", resetUrl.toString()); return template.render(); }
java
private String formatBody(URL resetUrl, ILocalAccountPerson account, Locale locale) { final STGroup group = new STGroupDir(templateDir, '$', '$'); final ST template = group.getInstanceOf(templateName); String name = findDisplayNameFromLocalAccountPerson(account); template.add("displayName", name); template.add("url", resetUrl.toString()); return template.render(); }
[ "private", "String", "formatBody", "(", "URL", "resetUrl", ",", "ILocalAccountPerson", "account", ",", "Locale", "locale", ")", "{", "final", "STGroup", "group", "=", "new", "STGroupDir", "(", "templateDir", ",", "'", "'", ",", "'", "'", ")", ";", "final",...
Get the body content of the email. @param resetUrl the password reset URL @param account the user account that has had its password reset @param locale the locale of the user who reset the password @return The message body as a string.
[ "Get", "the", "body", "content", "of", "the", "email", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/EmailPasswordResetNotificationImpl.java#L119-L128
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java
DocumentImpl.insertChildAt
@Override public Node insertChildAt(Node toInsert, int index) { if (toInsert instanceof Element && getDocumentElement() != null) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one root element allowed"); } if (toInsert instanceof DocumentType && getDoctype() != null) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one DOCTYPE element allowed"); } return super.insertChildAt(toInsert, index); }
java
@Override public Node insertChildAt(Node toInsert, int index) { if (toInsert instanceof Element && getDocumentElement() != null) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one root element allowed"); } if (toInsert instanceof DocumentType && getDoctype() != null) { throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, "Only one DOCTYPE element allowed"); } return super.insertChildAt(toInsert, index); }
[ "@", "Override", "public", "Node", "insertChildAt", "(", "Node", "toInsert", ",", "int", "index", ")", "{", "if", "(", "toInsert", "instanceof", "Element", "&&", "getDocumentElement", "(", ")", "!=", "null", ")", "{", "throw", "new", "DOMException", "(", "...
Document elements may have at most one root element and at most one DTD element.
[ "Document", "elements", "may", "have", "at", "most", "one", "root", "element", "and", "at", "most", "one", "DTD", "element", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/DocumentImpl.java#L419-L429
syphr42/prom
src/main/java/org/syphr/prom/ManagedProperties.java
ManagedProperties.setValue
private boolean setValue(String propertyName, String value, boolean sync) throws NullPointerException { gatekeeper.signIn(); try { ChangeStack<String> stack = properties.get(propertyName); if (stack == null) { ChangeStack<String> newStack = new ChangeStack<String>(value, sync); stack = properties.putIfAbsent(propertyName, newStack); if (stack == null) { return true; } } return sync ? stack.sync(value) : stack.push(value); } finally { gatekeeper.signOut(); } }
java
private boolean setValue(String propertyName, String value, boolean sync) throws NullPointerException { gatekeeper.signIn(); try { ChangeStack<String> stack = properties.get(propertyName); if (stack == null) { ChangeStack<String> newStack = new ChangeStack<String>(value, sync); stack = properties.putIfAbsent(propertyName, newStack); if (stack == null) { return true; } } return sync ? stack.sync(value) : stack.push(value); } finally { gatekeeper.signOut(); } }
[ "private", "boolean", "setValue", "(", "String", "propertyName", ",", "String", "value", ",", "boolean", "sync", ")", "throws", "NullPointerException", "{", "gatekeeper", ".", "signIn", "(", ")", ";", "try", "{", "ChangeStack", "<", "String", ">", "stack", "...
Push or sync the given value to the appropriate stack. This method will create a new stack if this property has never had a value before. @param propertyName the property whose value will be set @param value the value to set @param sync a flag to determine whether the value is {@link ChangeStack#sync(Object) synced} or simply {@link ChangeStack#push(Object) pushed} @return <code>true</code> if the value of the given property changed as a result of this call; <code>false</code> otherwise @throws NullPointerException if the given value is <code>null</code>
[ "Push", "or", "sync", "the", "given", "value", "to", "the", "appropriate", "stack", ".", "This", "method", "will", "create", "a", "new", "stack", "if", "this", "property", "has", "never", "had", "a", "value", "before", "." ]
train
https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L367-L390
UrielCh/ovh-java-sdk
ovh-java-sdk-veeamCloudConnect/src/main/java/net/minidev/ovh/api/ApiOvhVeeamCloudConnect.java
ApiOvhVeeamCloudConnect.serviceName_backupRepository_inventoryName_upgradeQuota_POST
public ArrayList<OvhTask> serviceName_backupRepository_inventoryName_upgradeQuota_POST(String serviceName, String inventoryName, Long newQuota) throws IOException { String qPath = "/veeamCloudConnect/{serviceName}/backupRepository/{inventoryName}/upgradeQuota"; StringBuilder sb = path(qPath, serviceName, inventoryName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "newQuota", newQuota); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t2); }
java
public ArrayList<OvhTask> serviceName_backupRepository_inventoryName_upgradeQuota_POST(String serviceName, String inventoryName, Long newQuota) throws IOException { String qPath = "/veeamCloudConnect/{serviceName}/backupRepository/{inventoryName}/upgradeQuota"; StringBuilder sb = path(qPath, serviceName, inventoryName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "newQuota", newQuota); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "OvhTask", ">", "serviceName_backupRepository_inventoryName_upgradeQuota_POST", "(", "String", "serviceName", ",", "String", "inventoryName", ",", "Long", "newQuota", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/veeamCloudConn...
Change your quota REST: POST /veeamCloudConnect/{serviceName}/backupRepository/{inventoryName}/upgradeQuota @param newQuota [required] my new quota in GB @param serviceName [required] Domain of the service @param inventoryName [required] The inventory name of your backup repository
[ "Change", "your", "quota" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-veeamCloudConnect/src/main/java/net/minidev/ovh/api/ApiOvhVeeamCloudConnect.java#L116-L123
ppiastucki/recast4j
detour/src/main/java/org/recast4j/detour/DetourCommon.java
DetourCommon.pointInPolygon
static boolean pointInPolygon(float[] pt, float[] verts, int nverts) { // TODO: Replace pnpoly with triArea2D tests? int i, j; boolean c = false; for (i = 0, j = nverts - 1; i < nverts; j = i++) { int vi = i * 3; int vj = j * 3; if (((verts[vi + 2] > pt[2]) != (verts[vj + 2] > pt[2])) && (pt[0] < (verts[vj + 0] - verts[vi + 0]) * (pt[2] - verts[vi + 2]) / (verts[vj + 2] - verts[vi + 2]) + verts[vi + 0])) { c = !c; } } return c; }
java
static boolean pointInPolygon(float[] pt, float[] verts, int nverts) { // TODO: Replace pnpoly with triArea2D tests? int i, j; boolean c = false; for (i = 0, j = nverts - 1; i < nverts; j = i++) { int vi = i * 3; int vj = j * 3; if (((verts[vi + 2] > pt[2]) != (verts[vj + 2] > pt[2])) && (pt[0] < (verts[vj + 0] - verts[vi + 0]) * (pt[2] - verts[vi + 2]) / (verts[vj + 2] - verts[vi + 2]) + verts[vi + 0])) { c = !c; } } return c; }
[ "static", "boolean", "pointInPolygon", "(", "float", "[", "]", "pt", ",", "float", "[", "]", "verts", ",", "int", "nverts", ")", "{", "// TODO: Replace pnpoly with triArea2D tests?", "int", "i", ",", "j", ";", "boolean", "c", "=", "false", ";", "for", "(",...
/ All points are projected onto the xz-plane, so the y-values are ignored.
[ "/", "All", "points", "are", "projected", "onto", "the", "xz", "-", "plane", "so", "the", "y", "-", "values", "are", "ignored", "." ]
train
https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/DetourCommon.java#L354-L367
zaproxy/zaproxy
src/org/zaproxy/zap/view/ScanPanel.java
ScanPanel.scanNode
public void scanNode(SiteNode node, boolean incPort, User user) { log.debug("scanNode" + prefix + " node=" + node.getNodeName()); this.setTabFocus(); nodeSelected(node, incPort); if (currentSite != null && this.getStartScanButton().isEnabled()) { startScan(node, false, false, null, user); } }
java
public void scanNode(SiteNode node, boolean incPort, User user) { log.debug("scanNode" + prefix + " node=" + node.getNodeName()); this.setTabFocus(); nodeSelected(node, incPort); if (currentSite != null && this.getStartScanButton().isEnabled()) { startScan(node, false, false, null, user); } }
[ "public", "void", "scanNode", "(", "SiteNode", "node", ",", "boolean", "incPort", ",", "User", "user", ")", "{", "log", ".", "debug", "(", "\"scanNode\"", "+", "prefix", "+", "\" node=\"", "+", "node", ".", "getNodeName", "(", ")", ")", ";", "this", "....
Scans a node (URL). If a User is specified, the scan should be done from the point of view of the user. @param node the node @param incPort the inc port @param user the user
[ "Scans", "a", "node", "(", "URL", ")", ".", "If", "a", "User", "is", "specified", "the", "scan", "should", "be", "done", "from", "the", "point", "of", "view", "of", "the", "user", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/ScanPanel.java#L470-L477
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/ArrayELResolver.java
ArrayELResolver.setValue
@Override public void setValue(ELContext context, Object base, Object property, Object value) { if (context == null) { throw new NullPointerException("context is null"); } if (isResolvable(base)) { if (readOnly) { throw new PropertyNotWritableException("resolver is read-only"); } Array.set(base, toIndex(base, property), value); context.setPropertyResolved(true); } }
java
@Override public void setValue(ELContext context, Object base, Object property, Object value) { if (context == null) { throw new NullPointerException("context is null"); } if (isResolvable(base)) { if (readOnly) { throw new PropertyNotWritableException("resolver is read-only"); } Array.set(base, toIndex(base, property), value); context.setPropertyResolved(true); } }
[ "@", "Override", "public", "void", "setValue", "(", "ELContext", "context", ",", "Object", "base", ",", "Object", "property", ",", "Object", "value", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"co...
If the base object is a Java language array, attempts to set the value at the given index with the given value. The index is specified by the property argument, and coerced into an integer. If the coercion could not be performed, an IllegalArgumentException is thrown. If the index is out of bounds, a PropertyNotFoundException is thrown. If the base is a Java language array, the propertyResolved property of the ELContext object must be set to true by this resolver, before returning. If this property is not true after this method is called, the caller can safely assume no value was set. If this resolver was constructed in read-only mode, this method will always throw PropertyNotWritableException. @param context The context of this evaluation. @param base The array to analyze. Only bases that are a Java language array are handled by this resolver. @param property The index of the element in the array to return the acceptable type for. Will be coerced into an integer, but otherwise ignored by this resolver. @param value The value to be set at the given index. @throws PropertyNotFoundException if the given index is out of bounds for this array. @throws ClassCastException if the class of the specified element prevents it from being added to this array. @throws NullPointerException if context is null @throws IllegalArgumentException if the property could not be coerced into an integer, or if some aspect of the specified element prevents it from being added to this array. @throws PropertyNotWritableException if this resolver was constructed in read-only mode. @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
[ "If", "the", "base", "object", "is", "a", "Java", "language", "array", "attempts", "to", "set", "the", "value", "at", "the", "given", "index", "with", "the", "given", "value", ".", "The", "index", "is", "specified", "by", "the", "property", "argument", "...
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/ArrayELResolver.java#L245-L257
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.sortThis
public static <T, L extends List<T>> L sortThis(L list, final Predicate2<? super T, ? super T> predicate) { return Iterate.sortThis(list, new Comparator<T>() { public int compare(T o1, T o2) { if (predicate.accept(o1, o2)) { return -1; } if (predicate.accept(o2, o1)) { return 1; } return 0; } }); }
java
public static <T, L extends List<T>> L sortThis(L list, final Predicate2<? super T, ? super T> predicate) { return Iterate.sortThis(list, new Comparator<T>() { public int compare(T o1, T o2) { if (predicate.accept(o1, o2)) { return -1; } if (predicate.accept(o2, o1)) { return 1; } return 0; } }); }
[ "public", "static", "<", "T", ",", "L", "extends", "List", "<", "T", ">", ">", "L", "sortThis", "(", "L", "list", ",", "final", "Predicate2", "<", "?", "super", "T", ",", "?", "super", "T", ">", "predicate", ")", "{", "return", "Iterate", ".", "s...
SortThis is a mutating method. The List passed in is also returned.
[ "SortThis", "is", "a", "mutating", "method", ".", "The", "List", "passed", "in", "is", "also", "returned", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L896-L913
stripe/stripe-java
src/main/java/com/stripe/model/SubscriptionItem.java
SubscriptionItem.usageRecordSummaries
public UsageRecordSummaryCollection usageRecordSummaries() throws StripeException { return usageRecordSummaries((Map<String, Object>) null, (RequestOptions) null); }
java
public UsageRecordSummaryCollection usageRecordSummaries() throws StripeException { return usageRecordSummaries((Map<String, Object>) null, (RequestOptions) null); }
[ "public", "UsageRecordSummaryCollection", "usageRecordSummaries", "(", ")", "throws", "StripeException", "{", "return", "usageRecordSummaries", "(", "(", "Map", "<", "String", ",", "Object", ">", ")", "null", ",", "(", "RequestOptions", ")", "null", ")", ";", "}...
For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that’s been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the billing plan’s month of September). <p>The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn’t ended yet. Since new usage records can still be added, the returned summary information for the subscription item’s ID should be seen as unstable until the subscription billing period ends.
[ "For", "the", "specified", "subscription", "item", "returns", "a", "list", "of", "summary", "objects", ".", "Each", "object", "in", "the", "list", "provides", "usage", "information", "that’s", "been", "summarized", "from", "multiple", "usage", "records", "and", ...
train
https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/SubscriptionItem.java#L268-L270
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcSession.java
CmsUgcSession.addContentValues
protected void addContentValues(CmsXmlContent content, Locale locale, Map<String, String> contentValues) throws CmsXmlException { if (!content.hasLocale(locale)) { content.addLocale(m_cms, locale); } List<String> paths = new ArrayList<String>(contentValues.keySet()); // first delete all null values // use reverse index ordering for similar elements Collections.sort(paths, new PathComparator(true)); String lastDelete = "///"; for (String path : paths) { // skip values where the parent node has been deleted if ((contentValues.get(path) == null) && !path.startsWith(lastDelete)) { lastDelete = path; deleteContentValue(content, locale, path); } } // now add the new or changed values // use regular ordering Collections.sort(paths, new PathComparator(false)); for (String path : paths) { String value = contentValues.get(path); if (value != null) { addContentValue(content, locale, path, value); } } }
java
protected void addContentValues(CmsXmlContent content, Locale locale, Map<String, String> contentValues) throws CmsXmlException { if (!content.hasLocale(locale)) { content.addLocale(m_cms, locale); } List<String> paths = new ArrayList<String>(contentValues.keySet()); // first delete all null values // use reverse index ordering for similar elements Collections.sort(paths, new PathComparator(true)); String lastDelete = "///"; for (String path : paths) { // skip values where the parent node has been deleted if ((contentValues.get(path) == null) && !path.startsWith(lastDelete)) { lastDelete = path; deleteContentValue(content, locale, path); } } // now add the new or changed values // use regular ordering Collections.sort(paths, new PathComparator(false)); for (String path : paths) { String value = contentValues.get(path); if (value != null) { addContentValue(content, locale, path, value); } } }
[ "protected", "void", "addContentValues", "(", "CmsXmlContent", "content", ",", "Locale", "locale", ",", "Map", "<", "String", ",", "String", ">", "contentValues", ")", "throws", "CmsXmlException", "{", "if", "(", "!", "content", ".", "hasLocale", "(", "locale"...
Adds the given values to the content document.<p> @param content the content document @param locale the content locale @param contentValues the values @throws CmsXmlException if writing the XML fails
[ "Adds", "the", "given", "values", "to", "the", "content", "document", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L597-L625
zaproxy/zaproxy
src/org/zaproxy/zap/extension/api/ApiImplementor.java
ApiImplementor.handleApiAction
public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException { throw new ApiException(ApiException.Type.BAD_ACTION, name); }
java
public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException { throw new ApiException(ApiException.Type.BAD_ACTION, name); }
[ "public", "ApiResponse", "handleApiAction", "(", "String", "name", ",", "JSONObject", "params", ")", "throws", "ApiException", "{", "throw", "new", "ApiException", "(", "ApiException", ".", "Type", ".", "BAD_ACTION", ",", "name", ")", ";", "}" ]
Override if implementing one or more actions @param name the name of the requested action @param params the API request parameters @return the API response @throws ApiException if an error occurred while handling the API action endpoint
[ "Override", "if", "implementing", "one", "or", "more", "actions" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/api/ApiImplementor.java#L335-L337
BlueBrain/bluima
modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/annotationviewer/BlueAnnotationViewGenerator.java
BlueAnnotationViewGenerator.writeToFile
private void writeToFile(String filename, File outputDir) { File outFile = new File(outputDir, filename); OutputStream os; try { os = new FileOutputStream(outFile); } catch (FileNotFoundException e) { throw new UIMARuntimeException(e); } InputStream is = null; try { is = ResourceHelper.getInputStream("viewer/" + filename); byte[] buf = new byte[1024]; int numRead; while ((numRead = is.read(buf)) > 0) { os.write(buf, 0, numRead); } } catch (IOException e) { throw new UIMARuntimeException(e); } finally { try { is.close(); } catch (IOException e) { // ignore close errors } try { os.close(); } catch (IOException e) { // ignore close errors } } }
java
private void writeToFile(String filename, File outputDir) { File outFile = new File(outputDir, filename); OutputStream os; try { os = new FileOutputStream(outFile); } catch (FileNotFoundException e) { throw new UIMARuntimeException(e); } InputStream is = null; try { is = ResourceHelper.getInputStream("viewer/" + filename); byte[] buf = new byte[1024]; int numRead; while ((numRead = is.read(buf)) > 0) { os.write(buf, 0, numRead); } } catch (IOException e) { throw new UIMARuntimeException(e); } finally { try { is.close(); } catch (IOException e) { // ignore close errors } try { os.close(); } catch (IOException e) { // ignore close errors } } }
[ "private", "void", "writeToFile", "(", "String", "filename", ",", "File", "outputDir", ")", "{", "File", "outFile", "=", "new", "File", "(", "outputDir", ",", "filename", ")", ";", "OutputStream", "os", ";", "try", "{", "os", "=", "new", "FileOutputStream"...
Writes a resource file to disk. The resource file is looked up in the classpath @param filename name of the file, to be looked up in the classpath, under the same package as this class. @return outputDir directory of output file. Output file will be named the same as the <code>filename</code> parameter.
[ "Writes", "a", "resource", "file", "to", "disk", ".", "The", "resource", "file", "is", "looked", "up", "in", "the", "classpath" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/annotationviewer/BlueAnnotationViewGenerator.java#L134-L164