repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP12Reader.java
MPP12Reader.processCustomValueLists
private void processCustomValueLists() throws IOException { """ This method extracts and collates the value list information for custom column value lists. """ DirectoryEntry taskDir = (DirectoryEntry) m_projectDir.getEntry("TBkndTask"); Props taskProps = new Props12(m_inputStreamFactory.getInstance(taskDir, "Props")); CustomFieldValueReader12 reader = new CustomFieldValueReader12(m_file.getProjectProperties(), m_file.getCustomFields(), m_outlineCodeVarMeta, m_outlineCodeVarData, m_outlineCodeFixedData, m_outlineCodeFixedData2, taskProps); reader.process(); }
java
private void processCustomValueLists() throws IOException { DirectoryEntry taskDir = (DirectoryEntry) m_projectDir.getEntry("TBkndTask"); Props taskProps = new Props12(m_inputStreamFactory.getInstance(taskDir, "Props")); CustomFieldValueReader12 reader = new CustomFieldValueReader12(m_file.getProjectProperties(), m_file.getCustomFields(), m_outlineCodeVarMeta, m_outlineCodeVarData, m_outlineCodeFixedData, m_outlineCodeFixedData2, taskProps); reader.process(); }
[ "private", "void", "processCustomValueLists", "(", ")", "throws", "IOException", "{", "DirectoryEntry", "taskDir", "=", "(", "DirectoryEntry", ")", "m_projectDir", ".", "getEntry", "(", "\"TBkndTask\"", ")", ";", "Props", "taskProps", "=", "new", "Props12", "(", "m_inputStreamFactory", ".", "getInstance", "(", "taskDir", ",", "\"Props\"", ")", ")", ";", "CustomFieldValueReader12", "reader", "=", "new", "CustomFieldValueReader12", "(", "m_file", ".", "getProjectProperties", "(", ")", ",", "m_file", ".", "getCustomFields", "(", ")", ",", "m_outlineCodeVarMeta", ",", "m_outlineCodeVarData", ",", "m_outlineCodeFixedData", ",", "m_outlineCodeFixedData2", ",", "taskProps", ")", ";", "reader", ".", "process", "(", ")", ";", "}" ]
This method extracts and collates the value list information for custom column value lists.
[ "This", "method", "extracts", "and", "collates", "the", "value", "list", "information", "for", "custom", "column", "value", "lists", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP12Reader.java#L199-L206
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/common/InterfaceUtils.java
InterfaceUtils.isSubtype
public static boolean isSubtype(String className, String... superClasses) { """ Test if the given class is a subtype of ONE of the super classes given. <br/> The following test that the class is a subclass of Hashtable. <pre> boolean isHashtable = InterfaceUtils.isSubtype( classThatCouldBeAHashTable, "java.util.Hashtable"); </pre> @param className Class to test @param superClasses If classes extends or implements those classes @return """ for(String potentialSuperClass : superClasses) { try { if(Hierarchy.isSubtype(className, potentialSuperClass)) { return true; } } catch (ClassNotFoundException e) { AnalysisContext.reportMissingClass(e); } } return false; }
java
public static boolean isSubtype(String className, String... superClasses) { for(String potentialSuperClass : superClasses) { try { if(Hierarchy.isSubtype(className, potentialSuperClass)) { return true; } } catch (ClassNotFoundException e) { AnalysisContext.reportMissingClass(e); } } return false; }
[ "public", "static", "boolean", "isSubtype", "(", "String", "className", ",", "String", "...", "superClasses", ")", "{", "for", "(", "String", "potentialSuperClass", ":", "superClasses", ")", "{", "try", "{", "if", "(", "Hierarchy", ".", "isSubtype", "(", "className", ",", "potentialSuperClass", ")", ")", "{", "return", "true", ";", "}", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "AnalysisContext", ".", "reportMissingClass", "(", "e", ")", ";", "}", "}", "return", "false", ";", "}" ]
Test if the given class is a subtype of ONE of the super classes given. <br/> The following test that the class is a subclass of Hashtable. <pre> boolean isHashtable = InterfaceUtils.isSubtype( classThatCouldBeAHashTable, "java.util.Hashtable"); </pre> @param className Class to test @param superClasses If classes extends or implements those classes @return
[ "Test", "if", "the", "given", "class", "is", "a", "subtype", "of", "ONE", "of", "the", "super", "classes", "given", ".", "<br", "/", ">", "The", "following", "test", "that", "the", "class", "is", "a", "subclass", "of", "Hashtable", ".", "<pre", ">", "boolean", "isHashtable", "=", "InterfaceUtils", ".", "isSubtype", "(", "classThatCouldBeAHashTable", "java", ".", "util", ".", "Hashtable", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/common/InterfaceUtils.java#L54-L65
beangle/beangle3
struts/s2/src/main/java/org/beangle/struts2/view/component/UIBean.java
UIBean.processLabel
protected String processLabel(String label, String name) { """ Process label,convert empty to null @param label @param name @return """ if (null != label) { if (Strings.isEmpty(label)) return null; else return getText(label); } else return getText(name); }
java
protected String processLabel(String label, String name) { if (null != label) { if (Strings.isEmpty(label)) return null; else return getText(label); } else return getText(name); }
[ "protected", "String", "processLabel", "(", "String", "label", ",", "String", "name", ")", "{", "if", "(", "null", "!=", "label", ")", "{", "if", "(", "Strings", ".", "isEmpty", "(", "label", ")", ")", "return", "null", ";", "else", "return", "getText", "(", "label", ")", ";", "}", "else", "return", "getText", "(", "name", ")", ";", "}" ]
Process label,convert empty to null @param label @param name @return
[ "Process", "label", "convert", "empty", "to", "null" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/view/component/UIBean.java#L191-L196
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201811/inventoryservice/CreateAdUnits.java
CreateAdUnits.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { """ Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors. """ // Get the InventoryService. InventoryServiceInterface inventoryService = adManagerServices.get(session, InventoryServiceInterface.class); // Get the NetworkService. NetworkServiceInterface networkService = adManagerServices.get(session, NetworkServiceInterface.class); // Set the parent ad unit's ID for all ad units to be created under. String parentAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId(); // Create a 300x250 web ad unit size. Size webSize = new Size(); webSize.setWidth(300); webSize.setHeight(250); webSize.setIsAspectRatio(false); AdUnitSize webAdUnitSize = new AdUnitSize(); webAdUnitSize.setSize(webSize); webAdUnitSize.setEnvironmentType(EnvironmentType.BROWSER); // Create a 640x360v video ad unit size with a companion. Size videoSize = new Size(); videoSize.setWidth(640); videoSize.setHeight(360); videoSize.setIsAspectRatio(false); AdUnitSize videoAdUnitSize = new AdUnitSize(); videoAdUnitSize.setSize(videoSize); videoAdUnitSize.setCompanions(new AdUnitSize[] {webAdUnitSize}); videoAdUnitSize.setEnvironmentType(EnvironmentType.VIDEO_PLAYER); // Create a web ad unit. AdUnit webAdUnit = new AdUnit(); webAdUnit.setName("web_ad_unit_" + new Random().nextInt(Integer.MAX_VALUE)); webAdUnit.setDescription(webAdUnit.getName()); webAdUnit.setParentId(parentAdUnitId); webAdUnit.setTargetWindow(AdUnitTargetWindow.BLANK); webAdUnit.setAdUnitSizes(new AdUnitSize[] {webAdUnitSize}); // Create a video ad unit. AdUnit videoAdUnit = new AdUnit(); videoAdUnit.setName("video_ad_unit_" + new Random().nextInt(Integer.MAX_VALUE)); videoAdUnit.setDescription(videoAdUnit.getName()); videoAdUnit.setParentId(parentAdUnitId); videoAdUnit.setTargetWindow(AdUnitTargetWindow.BLANK); videoAdUnit.setAdUnitSizes(new AdUnitSize[] {videoAdUnitSize}); // Create the ad units on the server. AdUnit[] adUnits = inventoryService.createAdUnits(new AdUnit[] {webAdUnit, videoAdUnit}); for (AdUnit adUnit : adUnits) { System.out.printf( "An ad unit with ID '%s', name '%s' was created.%n", adUnit.getId(), adUnit.getName()); } }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the InventoryService. InventoryServiceInterface inventoryService = adManagerServices.get(session, InventoryServiceInterface.class); // Get the NetworkService. NetworkServiceInterface networkService = adManagerServices.get(session, NetworkServiceInterface.class); // Set the parent ad unit's ID for all ad units to be created under. String parentAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId(); // Create a 300x250 web ad unit size. Size webSize = new Size(); webSize.setWidth(300); webSize.setHeight(250); webSize.setIsAspectRatio(false); AdUnitSize webAdUnitSize = new AdUnitSize(); webAdUnitSize.setSize(webSize); webAdUnitSize.setEnvironmentType(EnvironmentType.BROWSER); // Create a 640x360v video ad unit size with a companion. Size videoSize = new Size(); videoSize.setWidth(640); videoSize.setHeight(360); videoSize.setIsAspectRatio(false); AdUnitSize videoAdUnitSize = new AdUnitSize(); videoAdUnitSize.setSize(videoSize); videoAdUnitSize.setCompanions(new AdUnitSize[] {webAdUnitSize}); videoAdUnitSize.setEnvironmentType(EnvironmentType.VIDEO_PLAYER); // Create a web ad unit. AdUnit webAdUnit = new AdUnit(); webAdUnit.setName("web_ad_unit_" + new Random().nextInt(Integer.MAX_VALUE)); webAdUnit.setDescription(webAdUnit.getName()); webAdUnit.setParentId(parentAdUnitId); webAdUnit.setTargetWindow(AdUnitTargetWindow.BLANK); webAdUnit.setAdUnitSizes(new AdUnitSize[] {webAdUnitSize}); // Create a video ad unit. AdUnit videoAdUnit = new AdUnit(); videoAdUnit.setName("video_ad_unit_" + new Random().nextInt(Integer.MAX_VALUE)); videoAdUnit.setDescription(videoAdUnit.getName()); videoAdUnit.setParentId(parentAdUnitId); videoAdUnit.setTargetWindow(AdUnitTargetWindow.BLANK); videoAdUnit.setAdUnitSizes(new AdUnitSize[] {videoAdUnitSize}); // Create the ad units on the server. AdUnit[] adUnits = inventoryService.createAdUnits(new AdUnit[] {webAdUnit, videoAdUnit}); for (AdUnit adUnit : adUnits) { System.out.printf( "An ad unit with ID '%s', name '%s' was created.%n", adUnit.getId(), adUnit.getName()); } }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "// Get the InventoryService.", "InventoryServiceInterface", "inventoryService", "=", "adManagerServices", ".", "get", "(", "session", ",", "InventoryServiceInterface", ".", "class", ")", ";", "// Get the NetworkService.", "NetworkServiceInterface", "networkService", "=", "adManagerServices", ".", "get", "(", "session", ",", "NetworkServiceInterface", ".", "class", ")", ";", "// Set the parent ad unit's ID for all ad units to be created under.", "String", "parentAdUnitId", "=", "networkService", ".", "getCurrentNetwork", "(", ")", ".", "getEffectiveRootAdUnitId", "(", ")", ";", "// Create a 300x250 web ad unit size.", "Size", "webSize", "=", "new", "Size", "(", ")", ";", "webSize", ".", "setWidth", "(", "300", ")", ";", "webSize", ".", "setHeight", "(", "250", ")", ";", "webSize", ".", "setIsAspectRatio", "(", "false", ")", ";", "AdUnitSize", "webAdUnitSize", "=", "new", "AdUnitSize", "(", ")", ";", "webAdUnitSize", ".", "setSize", "(", "webSize", ")", ";", "webAdUnitSize", ".", "setEnvironmentType", "(", "EnvironmentType", ".", "BROWSER", ")", ";", "// Create a 640x360v video ad unit size with a companion.", "Size", "videoSize", "=", "new", "Size", "(", ")", ";", "videoSize", ".", "setWidth", "(", "640", ")", ";", "videoSize", ".", "setHeight", "(", "360", ")", ";", "videoSize", ".", "setIsAspectRatio", "(", "false", ")", ";", "AdUnitSize", "videoAdUnitSize", "=", "new", "AdUnitSize", "(", ")", ";", "videoAdUnitSize", ".", "setSize", "(", "videoSize", ")", ";", "videoAdUnitSize", ".", "setCompanions", "(", "new", "AdUnitSize", "[", "]", "{", "webAdUnitSize", "}", ")", ";", "videoAdUnitSize", ".", "setEnvironmentType", "(", "EnvironmentType", ".", "VIDEO_PLAYER", ")", ";", "// Create a web ad unit.", "AdUnit", "webAdUnit", "=", "new", "AdUnit", "(", ")", ";", "webAdUnit", ".", "setName", "(", "\"web_ad_unit_\"", "+", "new", "Random", "(", ")", ".", "nextInt", "(", "Integer", ".", "MAX_VALUE", ")", ")", ";", "webAdUnit", ".", "setDescription", "(", "webAdUnit", ".", "getName", "(", ")", ")", ";", "webAdUnit", ".", "setParentId", "(", "parentAdUnitId", ")", ";", "webAdUnit", ".", "setTargetWindow", "(", "AdUnitTargetWindow", ".", "BLANK", ")", ";", "webAdUnit", ".", "setAdUnitSizes", "(", "new", "AdUnitSize", "[", "]", "{", "webAdUnitSize", "}", ")", ";", "// Create a video ad unit.", "AdUnit", "videoAdUnit", "=", "new", "AdUnit", "(", ")", ";", "videoAdUnit", ".", "setName", "(", "\"video_ad_unit_\"", "+", "new", "Random", "(", ")", ".", "nextInt", "(", "Integer", ".", "MAX_VALUE", ")", ")", ";", "videoAdUnit", ".", "setDescription", "(", "videoAdUnit", ".", "getName", "(", ")", ")", ";", "videoAdUnit", ".", "setParentId", "(", "parentAdUnitId", ")", ";", "videoAdUnit", ".", "setTargetWindow", "(", "AdUnitTargetWindow", ".", "BLANK", ")", ";", "videoAdUnit", ".", "setAdUnitSizes", "(", "new", "AdUnitSize", "[", "]", "{", "videoAdUnitSize", "}", ")", ";", "// Create the ad units on the server.", "AdUnit", "[", "]", "adUnits", "=", "inventoryService", ".", "createAdUnits", "(", "new", "AdUnit", "[", "]", "{", "webAdUnit", ",", "videoAdUnit", "}", ")", ";", "for", "(", "AdUnit", "adUnit", ":", "adUnits", ")", "{", "System", ".", "out", ".", "printf", "(", "\"An ad unit with ID '%s', name '%s' was created.%n\"", ",", "adUnit", ".", "getId", "(", ")", ",", "adUnit", ".", "getName", "(", ")", ")", ";", "}", "}" ]
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201811/inventoryservice/CreateAdUnits.java#L55-L112
javamelody/javamelody
javamelody-swing/src/main/java/net/bull/javamelody/swing/MDateDocument.java
MDateDocument.getDisplayDateFormat
public static SimpleDateFormat getDisplayDateFormat() { """ Retourne la valeur de la propriété displayDateFormat. @return SimpleDateFormat """ if (displayDateFormat == null) { // NOPMD String pattern = getDateFormat().toPattern(); // si le pattern contient seulement 2 chiffres pour l'année on en met 4 // parce que c'est plus clair à l'affichage // mais en saisie on peut toujours n'en mettre que deux qui seront alors interprétés (avec le siècle) if (pattern.indexOf("yy") != -1 && pattern.indexOf("yyyy") == -1) { pattern = new StringBuilder(pattern).insert(pattern.indexOf("yy"), "yy").toString(); } displayDateFormat = new SimpleDateFormat(pattern, Locale.getDefault()); // NOPMD } return displayDateFormat; // NOPMD }
java
public static SimpleDateFormat getDisplayDateFormat() { if (displayDateFormat == null) { // NOPMD String pattern = getDateFormat().toPattern(); // si le pattern contient seulement 2 chiffres pour l'année on en met 4 // parce que c'est plus clair à l'affichage // mais en saisie on peut toujours n'en mettre que deux qui seront alors interprétés (avec le siècle) if (pattern.indexOf("yy") != -1 && pattern.indexOf("yyyy") == -1) { pattern = new StringBuilder(pattern).insert(pattern.indexOf("yy"), "yy").toString(); } displayDateFormat = new SimpleDateFormat(pattern, Locale.getDefault()); // NOPMD } return displayDateFormat; // NOPMD }
[ "public", "static", "SimpleDateFormat", "getDisplayDateFormat", "(", ")", "{", "if", "(", "displayDateFormat", "==", "null", ")", "{", "// NOPMD\r", "String", "pattern", "=", "getDateFormat", "(", ")", ".", "toPattern", "(", ")", ";", "// si le pattern contient seulement 2 chiffres pour l'année on en met 4\r", "// parce que c'est plus clair à l'affichage\r", "// mais en saisie on peut toujours n'en mettre que deux qui seront alors interprétés (avec le siècle)\r", "if", "(", "pattern", ".", "indexOf", "(", "\"yy\"", ")", "!=", "-", "1", "&&", "pattern", ".", "indexOf", "(", "\"yyyy\"", ")", "==", "-", "1", ")", "{", "pattern", "=", "new", "StringBuilder", "(", "pattern", ")", ".", "insert", "(", "pattern", ".", "indexOf", "(", "\"yy\"", ")", ",", "\"yy\"", ")", ".", "toString", "(", ")", ";", "}", "displayDateFormat", "=", "new", "SimpleDateFormat", "(", "pattern", ",", "Locale", ".", "getDefault", "(", ")", ")", ";", "// NOPMD\r", "}", "return", "displayDateFormat", ";", "// NOPMD\r", "}" ]
Retourne la valeur de la propriété displayDateFormat. @return SimpleDateFormat
[ "Retourne", "la", "valeur", "de", "la", "propriété", "displayDateFormat", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/MDateDocument.java#L141-L155
mangstadt/biweekly
src/main/java/biweekly/component/ICalComponent.java
ICalComponent.setProperty
public <T extends ICalProperty> List<T> setProperty(Class<T> clazz, T property) { """ Replaces all existing properties of the given class with a single property instance. If the property instance is null, then all instances of that property will be removed. @param clazz the property class (e.g. "DateStart.class") @param property the property or null to remove all properties of the given class @param <T> the property class @return the replaced properties (this list is immutable) """ List<ICalProperty> replaced = properties.replace(clazz, property); return castList(replaced, clazz); }
java
public <T extends ICalProperty> List<T> setProperty(Class<T> clazz, T property) { List<ICalProperty> replaced = properties.replace(clazz, property); return castList(replaced, clazz); }
[ "public", "<", "T", "extends", "ICalProperty", ">", "List", "<", "T", ">", "setProperty", "(", "Class", "<", "T", ">", "clazz", ",", "T", "property", ")", "{", "List", "<", "ICalProperty", ">", "replaced", "=", "properties", ".", "replace", "(", "clazz", ",", "property", ")", ";", "return", "castList", "(", "replaced", ",", "clazz", ")", ";", "}" ]
Replaces all existing properties of the given class with a single property instance. If the property instance is null, then all instances of that property will be removed. @param clazz the property class (e.g. "DateStart.class") @param property the property or null to remove all properties of the given class @param <T> the property class @return the replaced properties (this list is immutable)
[ "Replaces", "all", "existing", "properties", "of", "the", "given", "class", "with", "a", "single", "property", "instance", ".", "If", "the", "property", "instance", "is", "null", "then", "all", "instances", "of", "that", "property", "will", "be", "removed", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/ICalComponent.java#L132-L135
lightblueseas/vintage-time
src/main/java/de/alpharogroup/date/ParseDateExtensions.java
ParseDateExtensions.parseToDate
public static Date parseToDate(final String date, final String format) throws ParseException { """ Parses the String date to a date object. For example: USA-Format is : yyyy-MM-dd @param date The Date as String @param format The Format for the Date to parse @return The parsed Date @throws ParseException occurs when their are problems with parsing the String to Date. """ final DateFormat df = new SimpleDateFormat(format); Date parsedDate = null; parsedDate = df.parse(date); return parsedDate; }
java
public static Date parseToDate(final String date, final String format) throws ParseException { final DateFormat df = new SimpleDateFormat(format); Date parsedDate = null; parsedDate = df.parse(date); return parsedDate; }
[ "public", "static", "Date", "parseToDate", "(", "final", "String", "date", ",", "final", "String", "format", ")", "throws", "ParseException", "{", "final", "DateFormat", "df", "=", "new", "SimpleDateFormat", "(", "format", ")", ";", "Date", "parsedDate", "=", "null", ";", "parsedDate", "=", "df", ".", "parse", "(", "date", ")", ";", "return", "parsedDate", ";", "}" ]
Parses the String date to a date object. For example: USA-Format is : yyyy-MM-dd @param date The Date as String @param format The Format for the Date to parse @return The parsed Date @throws ParseException occurs when their are problems with parsing the String to Date.
[ "Parses", "the", "String", "date", "to", "a", "date", "object", ".", "For", "example", ":", "USA", "-", "Format", "is", ":", "yyyy", "-", "MM", "-", "dd" ]
train
https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/ParseDateExtensions.java#L84-L90
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java
PartitionContextBuilder.put
public PartitionContextBuilder put(String key, Object value) { """ Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not allowed. @return this """ _map.put(key, value); return this; }
java
public PartitionContextBuilder put(String key, Object value) { _map.put(key, value); return this; }
[ "public", "PartitionContextBuilder", "put", "(", "String", "key", ",", "Object", "value", ")", "{", "_map", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds the specified key and value to the partition context. Null keys or values and duplicate keys are not allowed. @return this
[ "Adds", "the", "specified", "key", "and", "value", "to", "the", "partition", "context", ".", "Null", "keys", "or", "values", "and", "duplicate", "keys", "are", "not", "allowed", "." ]
train
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/PartitionContextBuilder.java#L41-L44
aws/aws-sdk-java
aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/buffered/SendQueueBuffer.java
SendQueueBuffer.submitOutboundRequest
@SuppressWarnings("unchecked") <OBT extends OutboundBatchTask<R, Result>, R extends AmazonWebServiceRequest, Result> QueueBufferFuture<R, Result> submitOutboundRequest(Object operationLock, OBT[] openOutboundBatchTask, R request, final Semaphore inflightOperationBatches, QueueBufferCallback<R, Result> callback) { """ Submits an outbound request for delivery to the queue associated with this buffer. <p> @param operationLock the lock synchronizing calls for the call type ( {@code sendMessage}, {@code deleteMessage}, {@code changeMessageVisibility} ) @param openOutboundBatchTask the open batch task for this call type @param request the request to submit @param inflightOperationBatches the permits controlling the batches for this type of request @return never null @throws AmazonClientException (see the various outbound calls for details) """ /* * Callers add requests to a single batch task (openOutboundBatchTask) until it is full or * maxBatchOpenMs elapses. The total number of batch task in flight is controlled by the * inflightOperationBatch semaphore capped at maxInflightOutboundBatches. */ QueueBufferFuture<R, Result> theFuture = null; try { synchronized (operationLock) { if (openOutboundBatchTask[0] == null || ((theFuture = openOutboundBatchTask[0].addRequest(request, callback))) == null) { OBT obt = (OBT) newOutboundBatchTask(request); inflightOperationBatches.acquire(); openOutboundBatchTask[0] = obt; // Register a listener for the event signaling that the // batch task has completed (successfully or not). openOutboundBatchTask[0].setOnCompleted(new Listener<OutboundBatchTask<R, Result>>() { @Override public void invoke(OutboundBatchTask<R, Result> task) { inflightOperationBatches.release(); } }); if (log.isTraceEnabled()) { log.trace("Queue " + qUrl + " created new batch for " + request.getClass().toString() + " " + inflightOperationBatches.availablePermits() + " free slots remain"); } theFuture = openOutboundBatchTask[0].addRequest(request, callback); executor.execute(openOutboundBatchTask[0]); if (null == theFuture) { // this can happen only if the request itself is flawed, // so that it can't be added to any batch, even a brand // new one throw new AmazonClientException("Failed to schedule request " + request + " for execution"); } } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); AmazonClientException toThrow = new AmazonClientException("Interrupted while waiting for lock."); toThrow.initCause(e); throw toThrow; } return theFuture; }
java
@SuppressWarnings("unchecked") <OBT extends OutboundBatchTask<R, Result>, R extends AmazonWebServiceRequest, Result> QueueBufferFuture<R, Result> submitOutboundRequest(Object operationLock, OBT[] openOutboundBatchTask, R request, final Semaphore inflightOperationBatches, QueueBufferCallback<R, Result> callback) { /* * Callers add requests to a single batch task (openOutboundBatchTask) until it is full or * maxBatchOpenMs elapses. The total number of batch task in flight is controlled by the * inflightOperationBatch semaphore capped at maxInflightOutboundBatches. */ QueueBufferFuture<R, Result> theFuture = null; try { synchronized (operationLock) { if (openOutboundBatchTask[0] == null || ((theFuture = openOutboundBatchTask[0].addRequest(request, callback))) == null) { OBT obt = (OBT) newOutboundBatchTask(request); inflightOperationBatches.acquire(); openOutboundBatchTask[0] = obt; // Register a listener for the event signaling that the // batch task has completed (successfully or not). openOutboundBatchTask[0].setOnCompleted(new Listener<OutboundBatchTask<R, Result>>() { @Override public void invoke(OutboundBatchTask<R, Result> task) { inflightOperationBatches.release(); } }); if (log.isTraceEnabled()) { log.trace("Queue " + qUrl + " created new batch for " + request.getClass().toString() + " " + inflightOperationBatches.availablePermits() + " free slots remain"); } theFuture = openOutboundBatchTask[0].addRequest(request, callback); executor.execute(openOutboundBatchTask[0]); if (null == theFuture) { // this can happen only if the request itself is flawed, // so that it can't be added to any batch, even a brand // new one throw new AmazonClientException("Failed to schedule request " + request + " for execution"); } } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); AmazonClientException toThrow = new AmazonClientException("Interrupted while waiting for lock."); toThrow.initCause(e); throw toThrow; } return theFuture; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "<", "OBT", "extends", "OutboundBatchTask", "<", "R", ",", "Result", ">", ",", "R", "extends", "AmazonWebServiceRequest", ",", "Result", ">", "QueueBufferFuture", "<", "R", ",", "Result", ">", "submitOutboundRequest", "(", "Object", "operationLock", ",", "OBT", "[", "]", "openOutboundBatchTask", ",", "R", "request", ",", "final", "Semaphore", "inflightOperationBatches", ",", "QueueBufferCallback", "<", "R", ",", "Result", ">", "callback", ")", "{", "/*\n * Callers add requests to a single batch task (openOutboundBatchTask) until it is full or\n * maxBatchOpenMs elapses. The total number of batch task in flight is controlled by the\n * inflightOperationBatch semaphore capped at maxInflightOutboundBatches.\n */", "QueueBufferFuture", "<", "R", ",", "Result", ">", "theFuture", "=", "null", ";", "try", "{", "synchronized", "(", "operationLock", ")", "{", "if", "(", "openOutboundBatchTask", "[", "0", "]", "==", "null", "||", "(", "(", "theFuture", "=", "openOutboundBatchTask", "[", "0", "]", ".", "addRequest", "(", "request", ",", "callback", ")", ")", ")", "==", "null", ")", "{", "OBT", "obt", "=", "(", "OBT", ")", "newOutboundBatchTask", "(", "request", ")", ";", "inflightOperationBatches", ".", "acquire", "(", ")", ";", "openOutboundBatchTask", "[", "0", "]", "=", "obt", ";", "// Register a listener for the event signaling that the", "// batch task has completed (successfully or not).", "openOutboundBatchTask", "[", "0", "]", ".", "setOnCompleted", "(", "new", "Listener", "<", "OutboundBatchTask", "<", "R", ",", "Result", ">", ">", "(", ")", "{", "@", "Override", "public", "void", "invoke", "(", "OutboundBatchTask", "<", "R", ",", "Result", ">", "task", ")", "{", "inflightOperationBatches", ".", "release", "(", ")", ";", "}", "}", ")", ";", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ")", "{", "log", ".", "trace", "(", "\"Queue \"", "+", "qUrl", "+", "\" created new batch for \"", "+", "request", ".", "getClass", "(", ")", ".", "toString", "(", ")", "+", "\" \"", "+", "inflightOperationBatches", ".", "availablePermits", "(", ")", "+", "\" free slots remain\"", ")", ";", "}", "theFuture", "=", "openOutboundBatchTask", "[", "0", "]", ".", "addRequest", "(", "request", ",", "callback", ")", ";", "executor", ".", "execute", "(", "openOutboundBatchTask", "[", "0", "]", ")", ";", "if", "(", "null", "==", "theFuture", ")", "{", "// this can happen only if the request itself is flawed,", "// so that it can't be added to any batch, even a brand", "// new one", "throw", "new", "AmazonClientException", "(", "\"Failed to schedule request \"", "+", "request", "+", "\" for execution\"", ")", ";", "}", "}", "}", "}", "catch", "(", "InterruptedException", "e", ")", "{", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "AmazonClientException", "toThrow", "=", "new", "AmazonClientException", "(", "\"Interrupted while waiting for lock.\"", ")", ";", "toThrow", ".", "initCause", "(", "e", ")", ";", "throw", "toThrow", ";", "}", "return", "theFuture", ";", "}" ]
Submits an outbound request for delivery to the queue associated with this buffer. <p> @param operationLock the lock synchronizing calls for the call type ( {@code sendMessage}, {@code deleteMessage}, {@code changeMessageVisibility} ) @param openOutboundBatchTask the open batch task for this call type @param request the request to submit @param inflightOperationBatches the permits controlling the batches for this type of request @return never null @throws AmazonClientException (see the various outbound calls for details)
[ "Submits", "an", "outbound", "request", "for", "delivery", "to", "the", "queue", "associated", "with", "this", "buffer", ".", "<p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/buffered/SendQueueBuffer.java#L240-L294
intellimate/Izou
src/main/java/org/intellimate/izou/output/OutputManager.java
OutputManager.addOutputExtension
public void addOutputExtension(OutputExtensionModel<?, ?> outputExtension) throws IllegalIDException { """ adds output extension to desired outputPlugin <p> adds output extension to desired outputPlugin, so that the output-plugin can start and stop the outputExtension task as needed. The outputExtension is specific to the output-plugin @param outputExtension the outputExtension to be added @throws IllegalIDException not yet implemented """ if (outputExtensions.containsKey(outputExtension.getPluginId())) { outputExtensions.get(outputExtension.getPluginId()).add(outputExtension); } else { IdentifiableSet<OutputExtensionModel<?, ?>> outputExtensionList = new IdentifiableSet<>(); outputExtensionList.add(outputExtension); outputExtensions.put(outputExtension.getPluginId(), outputExtensionList); } IdentificationManager.getInstance().getIdentification(outputExtension) .ifPresent(id -> outputPlugins.stream() .filter(outputPlugin -> outputPlugin.getID().equals(outputExtension.getPluginId())) .forEach(outputPlugin -> outputPlugin.outputExtensionAdded(id))); }
java
public void addOutputExtension(OutputExtensionModel<?, ?> outputExtension) throws IllegalIDException { if (outputExtensions.containsKey(outputExtension.getPluginId())) { outputExtensions.get(outputExtension.getPluginId()).add(outputExtension); } else { IdentifiableSet<OutputExtensionModel<?, ?>> outputExtensionList = new IdentifiableSet<>(); outputExtensionList.add(outputExtension); outputExtensions.put(outputExtension.getPluginId(), outputExtensionList); } IdentificationManager.getInstance().getIdentification(outputExtension) .ifPresent(id -> outputPlugins.stream() .filter(outputPlugin -> outputPlugin.getID().equals(outputExtension.getPluginId())) .forEach(outputPlugin -> outputPlugin.outputExtensionAdded(id))); }
[ "public", "void", "addOutputExtension", "(", "OutputExtensionModel", "<", "?", ",", "?", ">", "outputExtension", ")", "throws", "IllegalIDException", "{", "if", "(", "outputExtensions", ".", "containsKey", "(", "outputExtension", ".", "getPluginId", "(", ")", ")", ")", "{", "outputExtensions", ".", "get", "(", "outputExtension", ".", "getPluginId", "(", ")", ")", ".", "add", "(", "outputExtension", ")", ";", "}", "else", "{", "IdentifiableSet", "<", "OutputExtensionModel", "<", "?", ",", "?", ">", ">", "outputExtensionList", "=", "new", "IdentifiableSet", "<>", "(", ")", ";", "outputExtensionList", ".", "add", "(", "outputExtension", ")", ";", "outputExtensions", ".", "put", "(", "outputExtension", ".", "getPluginId", "(", ")", ",", "outputExtensionList", ")", ";", "}", "IdentificationManager", ".", "getInstance", "(", ")", ".", "getIdentification", "(", "outputExtension", ")", ".", "ifPresent", "(", "id", "->", "outputPlugins", ".", "stream", "(", ")", ".", "filter", "(", "outputPlugin", "->", "outputPlugin", ".", "getID", "(", ")", ".", "equals", "(", "outputExtension", ".", "getPluginId", "(", ")", ")", ")", ".", "forEach", "(", "outputPlugin", "->", "outputPlugin", ".", "outputExtensionAdded", "(", "id", ")", ")", ")", ";", "}" ]
adds output extension to desired outputPlugin <p> adds output extension to desired outputPlugin, so that the output-plugin can start and stop the outputExtension task as needed. The outputExtension is specific to the output-plugin @param outputExtension the outputExtension to be added @throws IllegalIDException not yet implemented
[ "adds", "output", "extension", "to", "desired", "outputPlugin", "<p", ">", "adds", "output", "extension", "to", "desired", "outputPlugin", "so", "that", "the", "output", "-", "plugin", "can", "start", "and", "stop", "the", "outputExtension", "task", "as", "needed", ".", "The", "outputExtension", "is", "specific", "to", "the", "output", "-", "plugin" ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/output/OutputManager.java#L101-L113
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java
PMContext.getParameter
public Object getParameter(String paramid, Object def) { """ Look for a parameter in the context with the given name. If parmeter is null, return def @param paramid parameter id @param def default value @return parameter value or def if null """ final Object v = getParameter(paramid); if (v == null) { return def; } else { return v; } }
java
public Object getParameter(String paramid, Object def) { final Object v = getParameter(paramid); if (v == null) { return def; } else { return v; } }
[ "public", "Object", "getParameter", "(", "String", "paramid", ",", "Object", "def", ")", "{", "final", "Object", "v", "=", "getParameter", "(", "paramid", ")", ";", "if", "(", "v", "==", "null", ")", "{", "return", "def", ";", "}", "else", "{", "return", "v", ";", "}", "}" ]
Look for a parameter in the context with the given name. If parmeter is null, return def @param paramid parameter id @param def default value @return parameter value or def if null
[ "Look", "for", "a", "parameter", "in", "the", "context", "with", "the", "given", "name", ".", "If", "parmeter", "is", "null", "return", "def" ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/PMContext.java#L276-L283
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
ExceptionUtils.getStackFrameList
@GwtIncompatible("incompatible method") static List<String> getStackFrameList(final Throwable t) { """ <p>Produces a <code>List</code> of stack frames - the message is not included. Only the trace of the specified exception is returned, any caused by trace is stripped.</p> <p>This works in most cases - it will only fail if the exception message contains a line that starts with: <code>&quot;&nbsp;&nbsp;&nbsp;at&quot;.</code></p> @param t is any throwable @return List of stack frames """ final String stackTrace = getStackTrace(t); final String linebreak = System.lineSeparator(); final StringTokenizer frames = new StringTokenizer(stackTrace, linebreak); final List<String> list = new ArrayList<>(); boolean traceStarted = false; while (frames.hasMoreTokens()) { final String token = frames.nextToken(); // Determine if the line starts with <whitespace>at final int at = token.indexOf("at"); if (at != -1 && token.substring(0, at).trim().isEmpty()) { traceStarted = true; list.add(token); } else if (traceStarted) { break; } } return list; }
java
@GwtIncompatible("incompatible method") static List<String> getStackFrameList(final Throwable t) { final String stackTrace = getStackTrace(t); final String linebreak = System.lineSeparator(); final StringTokenizer frames = new StringTokenizer(stackTrace, linebreak); final List<String> list = new ArrayList<>(); boolean traceStarted = false; while (frames.hasMoreTokens()) { final String token = frames.nextToken(); // Determine if the line starts with <whitespace>at final int at = token.indexOf("at"); if (at != -1 && token.substring(0, at).trim().isEmpty()) { traceStarted = true; list.add(token); } else if (traceStarted) { break; } } return list; }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "static", "List", "<", "String", ">", "getStackFrameList", "(", "final", "Throwable", "t", ")", "{", "final", "String", "stackTrace", "=", "getStackTrace", "(", "t", ")", ";", "final", "String", "linebreak", "=", "System", ".", "lineSeparator", "(", ")", ";", "final", "StringTokenizer", "frames", "=", "new", "StringTokenizer", "(", "stackTrace", ",", "linebreak", ")", ";", "final", "List", "<", "String", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "boolean", "traceStarted", "=", "false", ";", "while", "(", "frames", ".", "hasMoreTokens", "(", ")", ")", "{", "final", "String", "token", "=", "frames", ".", "nextToken", "(", ")", ";", "// Determine if the line starts with <whitespace>at", "final", "int", "at", "=", "token", ".", "indexOf", "(", "\"at\"", ")", ";", "if", "(", "at", "!=", "-", "1", "&&", "token", ".", "substring", "(", "0", ",", "at", ")", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "traceStarted", "=", "true", ";", "list", ".", "add", "(", "token", ")", ";", "}", "else", "if", "(", "traceStarted", ")", "{", "break", ";", "}", "}", "return", "list", ";", "}" ]
<p>Produces a <code>List</code> of stack frames - the message is not included. Only the trace of the specified exception is returned, any caused by trace is stripped.</p> <p>This works in most cases - it will only fail if the exception message contains a line that starts with: <code>&quot;&nbsp;&nbsp;&nbsp;at&quot;.</code></p> @param t is any throwable @return List of stack frames
[ "<p", ">", "Produces", "a", "<code", ">", "List<", "/", "code", ">", "of", "stack", "frames", "-", "the", "message", "is", "not", "included", ".", "Only", "the", "trace", "of", "the", "specified", "exception", "is", "returned", "any", "caused", "by", "trace", "is", "stripped", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java#L656-L675
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/read/RowRangeAdapter.java
RowRangeAdapter.rangeSetToByteStringRange
@VisibleForTesting void rangeSetToByteStringRange(RangeSet<RowKeyWrapper> guavaRangeSet, Query query) { """ Convert guava's {@link RangeSet} to Bigtable's {@link ByteStringRange}. Please note that this will convert boundless ranges into unset key cases. """ for (Range<RowKeyWrapper> guavaRange : guavaRangeSet.asRanges()) { // Is it a point? if (guavaRange.hasLowerBound() && guavaRange.lowerBoundType() == BoundType.CLOSED && guavaRange.hasUpperBound() && guavaRange.upperBoundType() == BoundType.CLOSED && guavaRange.lowerEndpoint().equals(guavaRange.upperEndpoint())) { query.rowKey(guavaRange.lowerEndpoint().getKey()); } else { ByteStringRange byteRange = ByteStringRange.unbounded(); // Handle start key if (guavaRange.hasLowerBound()) { switch (guavaRange.lowerBoundType()) { case CLOSED: byteRange.startClosed(guavaRange.lowerEndpoint().getKey()); break; case OPEN: byteRange.startOpen(guavaRange.lowerEndpoint().getKey()); break; default: throw new IllegalArgumentException("Unexpected lower bound type: " + guavaRange.lowerBoundType()); } } // handle end key if (guavaRange.hasUpperBound()) { switch (guavaRange.upperBoundType()) { case CLOSED: byteRange.endClosed(guavaRange.upperEndpoint().getKey()); break; case OPEN: byteRange.endOpen(guavaRange.upperEndpoint().getKey()); break; default: throw new IllegalArgumentException("Unexpected upper bound type: " + guavaRange.upperBoundType()); } } query.range(byteRange); } } }
java
@VisibleForTesting void rangeSetToByteStringRange(RangeSet<RowKeyWrapper> guavaRangeSet, Query query) { for (Range<RowKeyWrapper> guavaRange : guavaRangeSet.asRanges()) { // Is it a point? if (guavaRange.hasLowerBound() && guavaRange.lowerBoundType() == BoundType.CLOSED && guavaRange.hasUpperBound() && guavaRange.upperBoundType() == BoundType.CLOSED && guavaRange.lowerEndpoint().equals(guavaRange.upperEndpoint())) { query.rowKey(guavaRange.lowerEndpoint().getKey()); } else { ByteStringRange byteRange = ByteStringRange.unbounded(); // Handle start key if (guavaRange.hasLowerBound()) { switch (guavaRange.lowerBoundType()) { case CLOSED: byteRange.startClosed(guavaRange.lowerEndpoint().getKey()); break; case OPEN: byteRange.startOpen(guavaRange.lowerEndpoint().getKey()); break; default: throw new IllegalArgumentException("Unexpected lower bound type: " + guavaRange.lowerBoundType()); } } // handle end key if (guavaRange.hasUpperBound()) { switch (guavaRange.upperBoundType()) { case CLOSED: byteRange.endClosed(guavaRange.upperEndpoint().getKey()); break; case OPEN: byteRange.endOpen(guavaRange.upperEndpoint().getKey()); break; default: throw new IllegalArgumentException("Unexpected upper bound type: " + guavaRange.upperBoundType()); } } query.range(byteRange); } } }
[ "@", "VisibleForTesting", "void", "rangeSetToByteStringRange", "(", "RangeSet", "<", "RowKeyWrapper", ">", "guavaRangeSet", ",", "Query", "query", ")", "{", "for", "(", "Range", "<", "RowKeyWrapper", ">", "guavaRange", ":", "guavaRangeSet", ".", "asRanges", "(", ")", ")", "{", "// Is it a point?", "if", "(", "guavaRange", ".", "hasLowerBound", "(", ")", "&&", "guavaRange", ".", "lowerBoundType", "(", ")", "==", "BoundType", ".", "CLOSED", "&&", "guavaRange", ".", "hasUpperBound", "(", ")", "&&", "guavaRange", ".", "upperBoundType", "(", ")", "==", "BoundType", ".", "CLOSED", "&&", "guavaRange", ".", "lowerEndpoint", "(", ")", ".", "equals", "(", "guavaRange", ".", "upperEndpoint", "(", ")", ")", ")", "{", "query", ".", "rowKey", "(", "guavaRange", ".", "lowerEndpoint", "(", ")", ".", "getKey", "(", ")", ")", ";", "}", "else", "{", "ByteStringRange", "byteRange", "=", "ByteStringRange", ".", "unbounded", "(", ")", ";", "// Handle start key", "if", "(", "guavaRange", ".", "hasLowerBound", "(", ")", ")", "{", "switch", "(", "guavaRange", ".", "lowerBoundType", "(", ")", ")", "{", "case", "CLOSED", ":", "byteRange", ".", "startClosed", "(", "guavaRange", ".", "lowerEndpoint", "(", ")", ".", "getKey", "(", ")", ")", ";", "break", ";", "case", "OPEN", ":", "byteRange", ".", "startOpen", "(", "guavaRange", ".", "lowerEndpoint", "(", ")", ".", "getKey", "(", ")", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected lower bound type: \"", "+", "guavaRange", ".", "lowerBoundType", "(", ")", ")", ";", "}", "}", "// handle end key", "if", "(", "guavaRange", ".", "hasUpperBound", "(", ")", ")", "{", "switch", "(", "guavaRange", ".", "upperBoundType", "(", ")", ")", "{", "case", "CLOSED", ":", "byteRange", ".", "endClosed", "(", "guavaRange", ".", "upperEndpoint", "(", ")", ".", "getKey", "(", ")", ")", ";", "break", ";", "case", "OPEN", ":", "byteRange", ".", "endOpen", "(", "guavaRange", ".", "upperEndpoint", "(", ")", ".", "getKey", "(", ")", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected upper bound type: \"", "+", "guavaRange", ".", "upperBoundType", "(", ")", ")", ";", "}", "}", "query", ".", "range", "(", "byteRange", ")", ";", "}", "}", "}" ]
Convert guava's {@link RangeSet} to Bigtable's {@link ByteStringRange}. Please note that this will convert boundless ranges into unset key cases.
[ "Convert", "guava", "s", "{" ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/read/RowRangeAdapter.java#L131-L176
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/spi/DistributedMapFactory.java
DistributedMapFactory.getMap
@Deprecated public static DistributedMap getMap(String name, Properties properties) { """ Returns the DistributedMap instance specified by the given id, using the the parameters specified in properties. If the given instance has not yet been created, then a new instance is created using the parameters specified in the properties object. <br>Properties: <table role="presentation"> <tr><td>com.ibm.ws.cache.CacheConfig.CACHE_SIZE</td><td>integer the maximum number of cache entries</td></tr> <tr><td>com.ibm.ws.cache.CacheConfig.ENABLE_DISK_OFFLOAD</td><td> boolean true to enable disk offload</td></tr> <tr><td>com.ibm.ws.cache.CacheConfig.DISK_OFFLOAD_LOCATION</td><td>directory to contain offloaded cache entries</td></tr> </table> @param name instance name of the DistributedMap @param properties @return A DistributedMap instance @see DistributedObjectCacheFactory @deprecated Use DistributedObjectCacheFactory @ibm-private-in-use """ return DistributedObjectCacheFactory.getMap(name, properties); }
java
@Deprecated public static DistributedMap getMap(String name, Properties properties) { return DistributedObjectCacheFactory.getMap(name, properties); }
[ "@", "Deprecated", "public", "static", "DistributedMap", "getMap", "(", "String", "name", ",", "Properties", "properties", ")", "{", "return", "DistributedObjectCacheFactory", ".", "getMap", "(", "name", ",", "properties", ")", ";", "}" ]
Returns the DistributedMap instance specified by the given id, using the the parameters specified in properties. If the given instance has not yet been created, then a new instance is created using the parameters specified in the properties object. <br>Properties: <table role="presentation"> <tr><td>com.ibm.ws.cache.CacheConfig.CACHE_SIZE</td><td>integer the maximum number of cache entries</td></tr> <tr><td>com.ibm.ws.cache.CacheConfig.ENABLE_DISK_OFFLOAD</td><td> boolean true to enable disk offload</td></tr> <tr><td>com.ibm.ws.cache.CacheConfig.DISK_OFFLOAD_LOCATION</td><td>directory to contain offloaded cache entries</td></tr> </table> @param name instance name of the DistributedMap @param properties @return A DistributedMap instance @see DistributedObjectCacheFactory @deprecated Use DistributedObjectCacheFactory @ibm-private-in-use
[ "Returns", "the", "DistributedMap", "instance", "specified", "by", "the", "given", "id", "using", "the", "the", "parameters", "specified", "in", "properties", ".", "If", "the", "given", "instance", "has", "not", "yet", "been", "created", "then", "a", "new", "instance", "is", "created", "using", "the", "parameters", "specified", "in", "the", "properties", "object", ".", "<br", ">", "Properties", ":", "<table", "role", "=", "presentation", ">", "<tr", ">", "<td", ">", "com", ".", "ibm", ".", "ws", ".", "cache", ".", "CacheConfig", ".", "CACHE_SIZE<", "/", "td", ">", "<td", ">", "integer", "the", "maximum", "number", "of", "cache", "entries<", "/", "td", ">", "<", "/", "tr", ">", "<tr", ">", "<td", ">", "com", ".", "ibm", ".", "ws", ".", "cache", ".", "CacheConfig", ".", "ENABLE_DISK_OFFLOAD<", "/", "td", ">", "<td", ">", "boolean", "true", "to", "enable", "disk", "offload<", "/", "td", ">", "<", "/", "tr", ">", "<tr", ">", "<td", ">", "com", ".", "ibm", ".", "ws", ".", "cache", ".", "CacheConfig", ".", "DISK_OFFLOAD_LOCATION<", "/", "td", ">", "<td", ">", "directory", "to", "contain", "offloaded", "cache", "entries<", "/", "td", ">", "<", "/", "tr", ">", "<", "/", "table", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/spi/DistributedMapFactory.java#L64-L67
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfCopy.java
PdfCopy.copyStream
protected PdfStream copyStream(PRStream in) throws IOException, BadPdfFormatException { """ Translate a PRStream to a PdfStream. The data part copies itself. """ PRStream out = new PRStream(in, null); for (Iterator it = in.getKeys().iterator(); it.hasNext();) { PdfName key = (PdfName) it.next(); PdfObject value = in.get(key); out.put(key, copyObject(value)); } return out; }
java
protected PdfStream copyStream(PRStream in) throws IOException, BadPdfFormatException { PRStream out = new PRStream(in, null); for (Iterator it = in.getKeys().iterator(); it.hasNext();) { PdfName key = (PdfName) it.next(); PdfObject value = in.get(key); out.put(key, copyObject(value)); } return out; }
[ "protected", "PdfStream", "copyStream", "(", "PRStream", "in", ")", "throws", "IOException", ",", "BadPdfFormatException", "{", "PRStream", "out", "=", "new", "PRStream", "(", "in", ",", "null", ")", ";", "for", "(", "Iterator", "it", "=", "in", ".", "getKeys", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "PdfName", "key", "=", "(", "PdfName", ")", "it", ".", "next", "(", ")", ";", "PdfObject", "value", "=", "in", ".", "get", "(", "key", ")", ";", "out", ".", "put", "(", "key", ",", "copyObject", "(", "value", ")", ")", ";", "}", "return", "out", ";", "}" ]
Translate a PRStream to a PdfStream. The data part copies itself.
[ "Translate", "a", "PRStream", "to", "a", "PdfStream", ".", "The", "data", "part", "copies", "itself", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfCopy.java#L243-L253
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java
DestinationManager.getDestination
public DestinationHandler getDestination(JsDestinationAddress destinationAddr, boolean includeInvisible) throws SITemporaryDestinationNotFoundException, SIResourceException, SINotPossibleInCurrentConfigurationException { """ This method provides lookup of a destination by its address. If the destination is not found, it throws SIDestinationNotFoundException. @param destinationAddr @return Destination @throws SIDestinationNotFoundException @throws SIMPNullParameterException @throws SIMPDestinationCorruptException """ return getDestination(destinationAddr.getDestinationName(), destinationAddr.getBusName(), includeInvisible, false); }
java
public DestinationHandler getDestination(JsDestinationAddress destinationAddr, boolean includeInvisible) throws SITemporaryDestinationNotFoundException, SIResourceException, SINotPossibleInCurrentConfigurationException { return getDestination(destinationAddr.getDestinationName(), destinationAddr.getBusName(), includeInvisible, false); }
[ "public", "DestinationHandler", "getDestination", "(", "JsDestinationAddress", "destinationAddr", ",", "boolean", "includeInvisible", ")", "throws", "SITemporaryDestinationNotFoundException", ",", "SIResourceException", ",", "SINotPossibleInCurrentConfigurationException", "{", "return", "getDestination", "(", "destinationAddr", ".", "getDestinationName", "(", ")", ",", "destinationAddr", ".", "getBusName", "(", ")", ",", "includeInvisible", ",", "false", ")", ";", "}" ]
This method provides lookup of a destination by its address. If the destination is not found, it throws SIDestinationNotFoundException. @param destinationAddr @return Destination @throws SIDestinationNotFoundException @throws SIMPNullParameterException @throws SIMPDestinationCorruptException
[ "This", "method", "provides", "lookup", "of", "a", "destination", "by", "its", "address", ".", "If", "the", "destination", "is", "not", "found", "it", "throws", "SIDestinationNotFoundException", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1116-L1124
Jasig/uPortal
uPortal-tenants/src/main/java/org/apereo/portal/tenants/TenantService.java
TenantService.validateAttribute
public void validateAttribute(final String key, final String value) throws Exception { """ Throws an exception if any {@linkITenantOperationsListener} indicates that the specified value isn't allowable for the specified attribute. @throws Exception @since 4.3 """ for (ITenantOperationsListener listener : tenantOperationsListeners) { // Will throw an exception if not valid listener.validateAttribute(key, value); } }
java
public void validateAttribute(final String key, final String value) throws Exception { for (ITenantOperationsListener listener : tenantOperationsListeners) { // Will throw an exception if not valid listener.validateAttribute(key, value); } }
[ "public", "void", "validateAttribute", "(", "final", "String", "key", ",", "final", "String", "value", ")", "throws", "Exception", "{", "for", "(", "ITenantOperationsListener", "listener", ":", "tenantOperationsListeners", ")", "{", "// Will throw an exception if not valid", "listener", ".", "validateAttribute", "(", "key", ",", "value", ")", ";", "}", "}" ]
Throws an exception if any {@linkITenantOperationsListener} indicates that the specified value isn't allowable for the specified attribute. @throws Exception @since 4.3
[ "Throws", "an", "exception", "if", "any", "{", "@linkITenantOperationsListener", "}", "indicates", "that", "the", "specified", "value", "isn", "t", "allowable", "for", "the", "specified", "attribute", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-tenants/src/main/java/org/apereo/portal/tenants/TenantService.java#L374-L379
jtmelton/appsensor
appsensor-core/src/main/java/org/owasp/appsensor/core/storage/EventStore.java
EventStore.isMatchingEvent
protected boolean isMatchingEvent(SearchCriteria criteria, Event event) { """ A finder for Event objects in the EventStore @param criteria the {@link org.owasp.appsensor.core.criteria.SearchCriteria} object to search by @param event the {@link Event} object to match on @return true or false depending on the matching of the search criteria to the event """ boolean match = false; User user = criteria.getUser(); DetectionPoint detectionPoint = criteria.getDetectionPoint(); Rule rule = criteria.getRule(); Collection<String> detectionSystemIds = criteria.getDetectionSystemIds(); DateTime earliest = DateUtils.fromString(criteria.getEarliest()); // check user match if user specified boolean userMatch = (user != null) ? user.equals(event.getUser()) : true; // check detection system match if detection systems specified boolean detectionSystemMatch = (detectionSystemIds != null && detectionSystemIds.size() > 0) ? detectionSystemIds.contains(event.getDetectionSystem().getDetectionSystemId()) : true; // check detection point match if detection point specified boolean detectionPointMatch = (detectionPoint != null) ? detectionPoint.typeAndThresholdMatches(event.getDetectionPoint()) : true; // check rule match if rule specified boolean ruleMatch = (rule != null) ? rule.typeAndThresholdContainsDetectionPoint(event.getDetectionPoint()) : true; DateTime eventTimestamp = DateUtils.fromString(event.getTimestamp()); boolean earliestMatch = (earliest != null) ? (earliest.isBefore(eventTimestamp) || earliest.isEqual(eventTimestamp)) : true; if (userMatch && detectionSystemMatch && detectionPointMatch && ruleMatch && earliestMatch) { match = true; } return match; }
java
protected boolean isMatchingEvent(SearchCriteria criteria, Event event) { boolean match = false; User user = criteria.getUser(); DetectionPoint detectionPoint = criteria.getDetectionPoint(); Rule rule = criteria.getRule(); Collection<String> detectionSystemIds = criteria.getDetectionSystemIds(); DateTime earliest = DateUtils.fromString(criteria.getEarliest()); // check user match if user specified boolean userMatch = (user != null) ? user.equals(event.getUser()) : true; // check detection system match if detection systems specified boolean detectionSystemMatch = (detectionSystemIds != null && detectionSystemIds.size() > 0) ? detectionSystemIds.contains(event.getDetectionSystem().getDetectionSystemId()) : true; // check detection point match if detection point specified boolean detectionPointMatch = (detectionPoint != null) ? detectionPoint.typeAndThresholdMatches(event.getDetectionPoint()) : true; // check rule match if rule specified boolean ruleMatch = (rule != null) ? rule.typeAndThresholdContainsDetectionPoint(event.getDetectionPoint()) : true; DateTime eventTimestamp = DateUtils.fromString(event.getTimestamp()); boolean earliestMatch = (earliest != null) ? (earliest.isBefore(eventTimestamp) || earliest.isEqual(eventTimestamp)) : true; if (userMatch && detectionSystemMatch && detectionPointMatch && ruleMatch && earliestMatch) { match = true; } return match; }
[ "protected", "boolean", "isMatchingEvent", "(", "SearchCriteria", "criteria", ",", "Event", "event", ")", "{", "boolean", "match", "=", "false", ";", "User", "user", "=", "criteria", ".", "getUser", "(", ")", ";", "DetectionPoint", "detectionPoint", "=", "criteria", ".", "getDetectionPoint", "(", ")", ";", "Rule", "rule", "=", "criteria", ".", "getRule", "(", ")", ";", "Collection", "<", "String", ">", "detectionSystemIds", "=", "criteria", ".", "getDetectionSystemIds", "(", ")", ";", "DateTime", "earliest", "=", "DateUtils", ".", "fromString", "(", "criteria", ".", "getEarliest", "(", ")", ")", ";", "// check user match if user specified", "boolean", "userMatch", "=", "(", "user", "!=", "null", ")", "?", "user", ".", "equals", "(", "event", ".", "getUser", "(", ")", ")", ":", "true", ";", "// check detection system match if detection systems specified", "boolean", "detectionSystemMatch", "=", "(", "detectionSystemIds", "!=", "null", "&&", "detectionSystemIds", ".", "size", "(", ")", ">", "0", ")", "?", "detectionSystemIds", ".", "contains", "(", "event", ".", "getDetectionSystem", "(", ")", ".", "getDetectionSystemId", "(", ")", ")", ":", "true", ";", "// check detection point match if detection point specified", "boolean", "detectionPointMatch", "=", "(", "detectionPoint", "!=", "null", ")", "?", "detectionPoint", ".", "typeAndThresholdMatches", "(", "event", ".", "getDetectionPoint", "(", ")", ")", ":", "true", ";", "// check rule match if rule specified", "boolean", "ruleMatch", "=", "(", "rule", "!=", "null", ")", "?", "rule", ".", "typeAndThresholdContainsDetectionPoint", "(", "event", ".", "getDetectionPoint", "(", ")", ")", ":", "true", ";", "DateTime", "eventTimestamp", "=", "DateUtils", ".", "fromString", "(", "event", ".", "getTimestamp", "(", ")", ")", ";", "boolean", "earliestMatch", "=", "(", "earliest", "!=", "null", ")", "?", "(", "earliest", ".", "isBefore", "(", "eventTimestamp", ")", "||", "earliest", ".", "isEqual", "(", "eventTimestamp", ")", ")", ":", "true", ";", "if", "(", "userMatch", "&&", "detectionSystemMatch", "&&", "detectionPointMatch", "&&", "ruleMatch", "&&", "earliestMatch", ")", "{", "match", "=", "true", ";", "}", "return", "match", ";", "}" ]
A finder for Event objects in the EventStore @param criteria the {@link org.owasp.appsensor.core.criteria.SearchCriteria} object to search by @param event the {@link Event} object to match on @return true or false depending on the matching of the search criteria to the event
[ "A", "finder", "for", "Event", "objects", "in", "the", "EventStore" ]
train
https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/appsensor-core/src/main/java/org/owasp/appsensor/core/storage/EventStore.java#L126-L161
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java
GitFlowGraphMonitor.addDataNode
private void addDataNode(DiffEntry change) { """ Add a {@link DataNode} to the {@link FlowGraph}. The method uses the {@link FlowGraphConfigurationKeys#DATA_NODE_CLASS} config to instantiate a {@link DataNode} from the node config file. @param change """ if (checkFilePath(change.getNewPath(), NODE_FILE_DEPTH)) { Path nodeFilePath = new Path(this.repositoryDir, change.getNewPath()); try { Config config = loadNodeFileWithOverrides(nodeFilePath); Class dataNodeClass = Class.forName(ConfigUtils.getString(config, FlowGraphConfigurationKeys.DATA_NODE_CLASS, FlowGraphConfigurationKeys.DEFAULT_DATA_NODE_CLASS)); DataNode dataNode = (DataNode) GobblinConstructorUtils.invokeLongestConstructor(dataNodeClass, config); if (!this.flowGraph.addDataNode(dataNode)) { log.warn("Could not add DataNode {} to FlowGraph; skipping", dataNode.getId()); } else { log.info("Added Datanode {} to FlowGraph", dataNode.getId()); } } catch (Exception e) { log.warn("Could not add DataNode defined in {} due to exception {}", change.getNewPath(), e.getMessage()); } } }
java
private void addDataNode(DiffEntry change) { if (checkFilePath(change.getNewPath(), NODE_FILE_DEPTH)) { Path nodeFilePath = new Path(this.repositoryDir, change.getNewPath()); try { Config config = loadNodeFileWithOverrides(nodeFilePath); Class dataNodeClass = Class.forName(ConfigUtils.getString(config, FlowGraphConfigurationKeys.DATA_NODE_CLASS, FlowGraphConfigurationKeys.DEFAULT_DATA_NODE_CLASS)); DataNode dataNode = (DataNode) GobblinConstructorUtils.invokeLongestConstructor(dataNodeClass, config); if (!this.flowGraph.addDataNode(dataNode)) { log.warn("Could not add DataNode {} to FlowGraph; skipping", dataNode.getId()); } else { log.info("Added Datanode {} to FlowGraph", dataNode.getId()); } } catch (Exception e) { log.warn("Could not add DataNode defined in {} due to exception {}", change.getNewPath(), e.getMessage()); } } }
[ "private", "void", "addDataNode", "(", "DiffEntry", "change", ")", "{", "if", "(", "checkFilePath", "(", "change", ".", "getNewPath", "(", ")", ",", "NODE_FILE_DEPTH", ")", ")", "{", "Path", "nodeFilePath", "=", "new", "Path", "(", "this", ".", "repositoryDir", ",", "change", ".", "getNewPath", "(", ")", ")", ";", "try", "{", "Config", "config", "=", "loadNodeFileWithOverrides", "(", "nodeFilePath", ")", ";", "Class", "dataNodeClass", "=", "Class", ".", "forName", "(", "ConfigUtils", ".", "getString", "(", "config", ",", "FlowGraphConfigurationKeys", ".", "DATA_NODE_CLASS", ",", "FlowGraphConfigurationKeys", ".", "DEFAULT_DATA_NODE_CLASS", ")", ")", ";", "DataNode", "dataNode", "=", "(", "DataNode", ")", "GobblinConstructorUtils", ".", "invokeLongestConstructor", "(", "dataNodeClass", ",", "config", ")", ";", "if", "(", "!", "this", ".", "flowGraph", ".", "addDataNode", "(", "dataNode", ")", ")", "{", "log", ".", "warn", "(", "\"Could not add DataNode {} to FlowGraph; skipping\"", ",", "dataNode", ".", "getId", "(", ")", ")", ";", "}", "else", "{", "log", ".", "info", "(", "\"Added Datanode {} to FlowGraph\"", ",", "dataNode", ".", "getId", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "warn", "(", "\"Could not add DataNode defined in {} due to exception {}\"", ",", "change", ".", "getNewPath", "(", ")", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}" ]
Add a {@link DataNode} to the {@link FlowGraph}. The method uses the {@link FlowGraphConfigurationKeys#DATA_NODE_CLASS} config to instantiate a {@link DataNode} from the node config file. @param change
[ "Add", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java#L176-L193
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java
DfuServiceInitiator.setBinOrHex
@Deprecated public DfuServiceInitiator setBinOrHex(@FileType final int fileType, @NonNull final Uri uri) { """ Sets the URI of the BIN or HEX file containing the new firmware. For DFU Bootloader version 0.5 or newer the init file must be specified using one of {@link #setInitFile(Uri)} methods. @param fileType the file type, a bit field created from: <ul> <li>{@link DfuBaseService#TYPE_APPLICATION} - the Application will be sent</li> <li>{@link DfuBaseService#TYPE_SOFT_DEVICE} - he Soft Device will be sent</li> <li>{@link DfuBaseService#TYPE_BOOTLOADER} - the Bootloader will be sent</li> </ul> @param uri the URI of the file @return the builder """ if (fileType == DfuBaseService.TYPE_AUTO) throw new UnsupportedOperationException("You must specify the file type"); return init(uri, null, 0, fileType, DfuBaseService.MIME_TYPE_OCTET_STREAM); }
java
@Deprecated public DfuServiceInitiator setBinOrHex(@FileType final int fileType, @NonNull final Uri uri) { if (fileType == DfuBaseService.TYPE_AUTO) throw new UnsupportedOperationException("You must specify the file type"); return init(uri, null, 0, fileType, DfuBaseService.MIME_TYPE_OCTET_STREAM); }
[ "@", "Deprecated", "public", "DfuServiceInitiator", "setBinOrHex", "(", "@", "FileType", "final", "int", "fileType", ",", "@", "NonNull", "final", "Uri", "uri", ")", "{", "if", "(", "fileType", "==", "DfuBaseService", ".", "TYPE_AUTO", ")", "throw", "new", "UnsupportedOperationException", "(", "\"You must specify the file type\"", ")", ";", "return", "init", "(", "uri", ",", "null", ",", "0", ",", "fileType", ",", "DfuBaseService", ".", "MIME_TYPE_OCTET_STREAM", ")", ";", "}" ]
Sets the URI of the BIN or HEX file containing the new firmware. For DFU Bootloader version 0.5 or newer the init file must be specified using one of {@link #setInitFile(Uri)} methods. @param fileType the file type, a bit field created from: <ul> <li>{@link DfuBaseService#TYPE_APPLICATION} - the Application will be sent</li> <li>{@link DfuBaseService#TYPE_SOFT_DEVICE} - he Soft Device will be sent</li> <li>{@link DfuBaseService#TYPE_BOOTLOADER} - the Bootloader will be sent</li> </ul> @param uri the URI of the file @return the builder
[ "Sets", "the", "URI", "of", "the", "BIN", "or", "HEX", "file", "containing", "the", "new", "firmware", ".", "For", "DFU", "Bootloader", "version", "0", ".", "5", "or", "newer", "the", "init", "file", "must", "be", "specified", "using", "one", "of", "{", "@link", "#setInitFile", "(", "Uri", ")", "}", "methods", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L622-L627
nguillaumin/slick2d-maven
slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/GradientEditor.java
GradientEditor.checkPoint
private boolean checkPoint(int mx, int my, ControlPoint pt) { """ Check if there is a control point at the specified mouse location @param mx The mouse x coordinate @param my The mouse y coordinate @param pt The point to check agianst @return True if the mouse point conincides with the control point """ int dx = (int) Math.abs((10+(width * pt.pos)) - mx); int dy = Math.abs((y+barHeight+7)-my); if ((dx < 5) && (dy < 7)) { return true; } return false; }
java
private boolean checkPoint(int mx, int my, ControlPoint pt) { int dx = (int) Math.abs((10+(width * pt.pos)) - mx); int dy = Math.abs((y+barHeight+7)-my); if ((dx < 5) && (dy < 7)) { return true; } return false; }
[ "private", "boolean", "checkPoint", "(", "int", "mx", ",", "int", "my", ",", "ControlPoint", "pt", ")", "{", "int", "dx", "=", "(", "int", ")", "Math", ".", "abs", "(", "(", "10", "+", "(", "width", "*", "pt", ".", "pos", ")", ")", "-", "mx", ")", ";", "int", "dy", "=", "Math", ".", "abs", "(", "(", "y", "+", "barHeight", "+", "7", ")", "-", "my", ")", ";", "if", "(", "(", "dx", "<", "5", ")", "&&", "(", "dy", "<", "7", ")", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}" ]
Check if there is a control point at the specified mouse location @param mx The mouse x coordinate @param my The mouse y coordinate @param pt The point to check agianst @return True if the mouse point conincides with the control point
[ "Check", "if", "there", "is", "a", "control", "point", "at", "the", "specified", "mouse", "location" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-peditor/src/main/java/org/newdawn/slick/tools/peditor/GradientEditor.java#L164-L173
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java
ImageLoading.loadBitmapOptimized
public static Bitmap loadBitmapOptimized(Uri uri, Context context) throws ImageLoadException { """ Loading bitmap with optimized loaded size less than 1.4 MPX @param uri content uri for bitmap @param context Application Context @return loaded bitmap (always not null) @throws ImageLoadException if it is unable to load file """ return loadBitmapOptimized(uri, context, MAX_PIXELS); }
java
public static Bitmap loadBitmapOptimized(Uri uri, Context context) throws ImageLoadException { return loadBitmapOptimized(uri, context, MAX_PIXELS); }
[ "public", "static", "Bitmap", "loadBitmapOptimized", "(", "Uri", "uri", ",", "Context", "context", ")", "throws", "ImageLoadException", "{", "return", "loadBitmapOptimized", "(", "uri", ",", "context", ",", "MAX_PIXELS", ")", ";", "}" ]
Loading bitmap with optimized loaded size less than 1.4 MPX @param uri content uri for bitmap @param context Application Context @return loaded bitmap (always not null) @throws ImageLoadException if it is unable to load file
[ "Loading", "bitmap", "with", "optimized", "loaded", "size", "less", "than", "1", ".", "4", "MPX" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L97-L99
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunck.java
HornSchunck.innerAverageFlow
protected static void innerAverageFlow( ImageFlow flow , ImageFlow averageFlow ) { """ Computes average flow using an 8-connect neighborhood for the inner image """ int endX = flow.width-1; int endY = flow.height-1; for( int y = 1; y < endY; y++ ) { int index = flow.width*y + 1; for( int x = 1; x < endX; x++ , index++) { ImageFlow.D average = averageFlow.data[index]; ImageFlow.D f0 = flow.data[index-1]; ImageFlow.D f1 = flow.data[index+1]; ImageFlow.D f2 = flow.data[index-flow.width]; ImageFlow.D f3 = flow.data[index+flow.width]; ImageFlow.D f4 = flow.data[index-1-flow.width]; ImageFlow.D f5 = flow.data[index+1-flow.width]; ImageFlow.D f6 = flow.data[index-1+flow.width]; ImageFlow.D f7 = flow.data[index+1+flow.width]; average.x = 0.1666667f*(f0.x + f1.x + f2.x + f3.x) + 0.08333333f*(f4.x + f5.x + f6.x + f7.x); average.y = 0.1666667f*(f0.y + f1.y + f2.y + f3.y) + 0.08333333f*(f4.y + f5.y + f6.y + f7.y); } } }
java
protected static void innerAverageFlow( ImageFlow flow , ImageFlow averageFlow ) { int endX = flow.width-1; int endY = flow.height-1; for( int y = 1; y < endY; y++ ) { int index = flow.width*y + 1; for( int x = 1; x < endX; x++ , index++) { ImageFlow.D average = averageFlow.data[index]; ImageFlow.D f0 = flow.data[index-1]; ImageFlow.D f1 = flow.data[index+1]; ImageFlow.D f2 = flow.data[index-flow.width]; ImageFlow.D f3 = flow.data[index+flow.width]; ImageFlow.D f4 = flow.data[index-1-flow.width]; ImageFlow.D f5 = flow.data[index+1-flow.width]; ImageFlow.D f6 = flow.data[index-1+flow.width]; ImageFlow.D f7 = flow.data[index+1+flow.width]; average.x = 0.1666667f*(f0.x + f1.x + f2.x + f3.x) + 0.08333333f*(f4.x + f5.x + f6.x + f7.x); average.y = 0.1666667f*(f0.y + f1.y + f2.y + f3.y) + 0.08333333f*(f4.y + f5.y + f6.y + f7.y); } } }
[ "protected", "static", "void", "innerAverageFlow", "(", "ImageFlow", "flow", ",", "ImageFlow", "averageFlow", ")", "{", "int", "endX", "=", "flow", ".", "width", "-", "1", ";", "int", "endY", "=", "flow", ".", "height", "-", "1", ";", "for", "(", "int", "y", "=", "1", ";", "y", "<", "endY", ";", "y", "++", ")", "{", "int", "index", "=", "flow", ".", "width", "*", "y", "+", "1", ";", "for", "(", "int", "x", "=", "1", ";", "x", "<", "endX", ";", "x", "++", ",", "index", "++", ")", "{", "ImageFlow", ".", "D", "average", "=", "averageFlow", ".", "data", "[", "index", "]", ";", "ImageFlow", ".", "D", "f0", "=", "flow", ".", "data", "[", "index", "-", "1", "]", ";", "ImageFlow", ".", "D", "f1", "=", "flow", ".", "data", "[", "index", "+", "1", "]", ";", "ImageFlow", ".", "D", "f2", "=", "flow", ".", "data", "[", "index", "-", "flow", ".", "width", "]", ";", "ImageFlow", ".", "D", "f3", "=", "flow", ".", "data", "[", "index", "+", "flow", ".", "width", "]", ";", "ImageFlow", ".", "D", "f4", "=", "flow", ".", "data", "[", "index", "-", "1", "-", "flow", ".", "width", "]", ";", "ImageFlow", ".", "D", "f5", "=", "flow", ".", "data", "[", "index", "+", "1", "-", "flow", ".", "width", "]", ";", "ImageFlow", ".", "D", "f6", "=", "flow", ".", "data", "[", "index", "-", "1", "+", "flow", ".", "width", "]", ";", "ImageFlow", ".", "D", "f7", "=", "flow", ".", "data", "[", "index", "+", "1", "+", "flow", ".", "width", "]", ";", "average", ".", "x", "=", "0.1666667f", "*", "(", "f0", ".", "x", "+", "f1", ".", "x", "+", "f2", ".", "x", "+", "f3", ".", "x", ")", "+", "0.08333333f", "*", "(", "f4", ".", "x", "+", "f5", ".", "x", "+", "f6", ".", "x", "+", "f7", ".", "x", ")", ";", "average", ".", "y", "=", "0.1666667f", "*", "(", "f0", ".", "y", "+", "f1", ".", "y", "+", "f2", ".", "y", "+", "f3", ".", "y", ")", "+", "0.08333333f", "*", "(", "f4", ".", "y", "+", "f5", ".", "y", "+", "f6", ".", "y", "+", "f7", ".", "y", ")", ";", "}", "}", "}" ]
Computes average flow using an 8-connect neighborhood for the inner image
[ "Computes", "average", "flow", "using", "an", "8", "-", "connect", "neighborhood", "for", "the", "inner", "image" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunck.java#L125-L149
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java
DoublesSketch.getCompactStorageBytes
public static int getCompactStorageBytes(final int k, final long n) { """ Returns the number of bytes a DoublesSketch would require to store in compact form given the values of <i>k</i> and <i>n</i>. The compact form is not updatable. @param k the size configuration parameter for the sketch @param n the number of items input into the sketch @return the number of bytes required to store this sketch in compact form. """ if (n == 0) { return 8; } final int metaPreLongs = DoublesSketch.MAX_PRELONGS + 2; //plus min, max return ((metaPreLongs + Util.computeRetainedItems(k, n)) << 3); }
java
public static int getCompactStorageBytes(final int k, final long n) { if (n == 0) { return 8; } final int metaPreLongs = DoublesSketch.MAX_PRELONGS + 2; //plus min, max return ((metaPreLongs + Util.computeRetainedItems(k, n)) << 3); }
[ "public", "static", "int", "getCompactStorageBytes", "(", "final", "int", "k", ",", "final", "long", "n", ")", "{", "if", "(", "n", "==", "0", ")", "{", "return", "8", ";", "}", "final", "int", "metaPreLongs", "=", "DoublesSketch", ".", "MAX_PRELONGS", "+", "2", ";", "//plus min, max", "return", "(", "(", "metaPreLongs", "+", "Util", ".", "computeRetainedItems", "(", "k", ",", "n", ")", ")", "<<", "3", ")", ";", "}" ]
Returns the number of bytes a DoublesSketch would require to store in compact form given the values of <i>k</i> and <i>n</i>. The compact form is not updatable. @param k the size configuration parameter for the sketch @param n the number of items input into the sketch @return the number of bytes required to store this sketch in compact form.
[ "Returns", "the", "number", "of", "bytes", "a", "DoublesSketch", "would", "require", "to", "store", "in", "compact", "form", "given", "the", "values", "of", "<i", ">", "k<", "/", "i", ">", "and", "<i", ">", "n<", "/", "i", ">", ".", "The", "compact", "form", "is", "not", "updatable", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java#L630-L634
sd4324530/fastweixin
src/main/java/com/github/sd4324530/fastweixin/util/JSONUtil.java
JSONUtil.toBean
public static <T> T toBean(String jsonStr, Class<T> beanClass) { """ 将json字符串,转换成指定java bean @param jsonStr json串对象 @param beanClass 指定的bean @param <T> 任意bean的类型 @return 转换后的java bean对象 """ requireNonNull(jsonStr, "jsonStr is null"); JSONObject jo = JSON.parseObject(jsonStr); jo.put(JSON.DEFAULT_TYPE_KEY, beanClass.getName()); return JSON.parseObject(jo.toJSONString(), beanClass); }
java
public static <T> T toBean(String jsonStr, Class<T> beanClass) { requireNonNull(jsonStr, "jsonStr is null"); JSONObject jo = JSON.parseObject(jsonStr); jo.put(JSON.DEFAULT_TYPE_KEY, beanClass.getName()); return JSON.parseObject(jo.toJSONString(), beanClass); }
[ "public", "static", "<", "T", ">", "T", "toBean", "(", "String", "jsonStr", ",", "Class", "<", "T", ">", "beanClass", ")", "{", "requireNonNull", "(", "jsonStr", ",", "\"jsonStr is null\"", ")", ";", "JSONObject", "jo", "=", "JSON", ".", "parseObject", "(", "jsonStr", ")", ";", "jo", ".", "put", "(", "JSON", ".", "DEFAULT_TYPE_KEY", ",", "beanClass", ".", "getName", "(", ")", ")", ";", "return", "JSON", ".", "parseObject", "(", "jo", ".", "toJSONString", "(", ")", ",", "beanClass", ")", ";", "}" ]
将json字符串,转换成指定java bean @param jsonStr json串对象 @param beanClass 指定的bean @param <T> 任意bean的类型 @return 转换后的java bean对象
[ "将json字符串,转换成指定java", "bean" ]
train
https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/util/JSONUtil.java#L62-L67
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/PointTrackerKltPyramid.java
PointTrackerKltPyramid.addTrack
public PointTrack addTrack( double x , double y ) { """ Creates a new feature track at the specified location. Must only be called after {@link #process(ImageGray)} has been called. It can fail if there is insufficient texture @param x x-coordinate @param y y-coordinate @return the new track if successful or null if no new track could be created """ if( !input.isInBounds((int)x,(int)y)) return null; // grow the number of tracks if needed if( unused.isEmpty() ) addTrackToUnused(); // TODO make sure the feature is inside the image PyramidKltFeature t = unused.remove(unused.size() - 1); t.setPosition((float)x,(float)y); tracker.setDescription(t); PointTrack p = (PointTrack)t.cookie; p.set(x,y); if( checkValidSpawn(p) ) { active.add(t); return p; } return null; }
java
public PointTrack addTrack( double x , double y ) { if( !input.isInBounds((int)x,(int)y)) return null; // grow the number of tracks if needed if( unused.isEmpty() ) addTrackToUnused(); // TODO make sure the feature is inside the image PyramidKltFeature t = unused.remove(unused.size() - 1); t.setPosition((float)x,(float)y); tracker.setDescription(t); PointTrack p = (PointTrack)t.cookie; p.set(x,y); if( checkValidSpawn(p) ) { active.add(t); return p; } return null; }
[ "public", "PointTrack", "addTrack", "(", "double", "x", ",", "double", "y", ")", "{", "if", "(", "!", "input", ".", "isInBounds", "(", "(", "int", ")", "x", ",", "(", "int", ")", "y", ")", ")", "return", "null", ";", "// grow the number of tracks if needed", "if", "(", "unused", ".", "isEmpty", "(", ")", ")", "addTrackToUnused", "(", ")", ";", "// TODO make sure the feature is inside the image", "PyramidKltFeature", "t", "=", "unused", ".", "remove", "(", "unused", ".", "size", "(", ")", "-", "1", ")", ";", "t", ".", "setPosition", "(", "(", "float", ")", "x", ",", "(", "float", ")", "y", ")", ";", "tracker", ".", "setDescription", "(", "t", ")", ";", "PointTrack", "p", "=", "(", "PointTrack", ")", "t", ".", "cookie", ";", "p", ".", "set", "(", "x", ",", "y", ")", ";", "if", "(", "checkValidSpawn", "(", "p", ")", ")", "{", "active", ".", "add", "(", "t", ")", ";", "return", "p", ";", "}", "return", "null", ";", "}" ]
Creates a new feature track at the specified location. Must only be called after {@link #process(ImageGray)} has been called. It can fail if there is insufficient texture @param x x-coordinate @param y y-coordinate @return the new track if successful or null if no new track could be created
[ "Creates", "a", "new", "feature", "track", "at", "the", "specified", "location", ".", "Must", "only", "be", "called", "after", "{", "@link", "#process", "(", "ImageGray", ")", "}", "has", "been", "called", ".", "It", "can", "fail", "if", "there", "is", "insufficient", "texture" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/PointTrackerKltPyramid.java#L139-L162
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java
FeatureScopes.createNestedTypeLiteralScope
protected IScope createNestedTypeLiteralScope( EObject featureCall, LightweightTypeReference enclosingType, JvmDeclaredType rawEnclosingType, IScope parent, IFeatureScopeSession session) { """ Create a scope that returns nested types. @param featureCall the feature call that is currently processed by the scoping infrastructure @param enclosingType the enclosing type including type parameters for the nested type literal scope. @param rawEnclosingType the raw type that is used to query the nested types. @param parent the parent scope. Is never null. @param session the currently known scope session. Is never null. """ return new NestedTypeLiteralScope(parent, session, asAbstractFeatureCall(featureCall), enclosingType, rawEnclosingType); }
java
protected IScope createNestedTypeLiteralScope( EObject featureCall, LightweightTypeReference enclosingType, JvmDeclaredType rawEnclosingType, IScope parent, IFeatureScopeSession session) { return new NestedTypeLiteralScope(parent, session, asAbstractFeatureCall(featureCall), enclosingType, rawEnclosingType); }
[ "protected", "IScope", "createNestedTypeLiteralScope", "(", "EObject", "featureCall", ",", "LightweightTypeReference", "enclosingType", ",", "JvmDeclaredType", "rawEnclosingType", ",", "IScope", "parent", ",", "IFeatureScopeSession", "session", ")", "{", "return", "new", "NestedTypeLiteralScope", "(", "parent", ",", "session", ",", "asAbstractFeatureCall", "(", "featureCall", ")", ",", "enclosingType", ",", "rawEnclosingType", ")", ";", "}" ]
Create a scope that returns nested types. @param featureCall the feature call that is currently processed by the scoping infrastructure @param enclosingType the enclosing type including type parameters for the nested type literal scope. @param rawEnclosingType the raw type that is used to query the nested types. @param parent the parent scope. Is never null. @param session the currently known scope session. Is never null.
[ "Create", "a", "scope", "that", "returns", "nested", "types", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/scoping/batch/FeatureScopes.java#L600-L607
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/user/UserTable.java
UserTable.typeCheck
protected void typeCheck(GeoPackageDataType expected, TColumn column) { """ Check for the expected data type @param expected expected data type @param column user column """ GeoPackageDataType actual = column.getDataType(); if (actual == null || !actual.equals(expected)) { throw new GeoPackageException("Unexpected " + column.getName() + " column data type was found for table '" + tableName + "', expected: " + expected.name() + ", actual: " + (actual != null ? actual.name() : "null")); } }
java
protected void typeCheck(GeoPackageDataType expected, TColumn column) { GeoPackageDataType actual = column.getDataType(); if (actual == null || !actual.equals(expected)) { throw new GeoPackageException("Unexpected " + column.getName() + " column data type was found for table '" + tableName + "', expected: " + expected.name() + ", actual: " + (actual != null ? actual.name() : "null")); } }
[ "protected", "void", "typeCheck", "(", "GeoPackageDataType", "expected", ",", "TColumn", "column", ")", "{", "GeoPackageDataType", "actual", "=", "column", ".", "getDataType", "(", ")", ";", "if", "(", "actual", "==", "null", "||", "!", "actual", ".", "equals", "(", "expected", ")", ")", "{", "throw", "new", "GeoPackageException", "(", "\"Unexpected \"", "+", "column", ".", "getName", "(", ")", "+", "\" column data type was found for table '\"", "+", "tableName", "+", "\"', expected: \"", "+", "expected", ".", "name", "(", ")", "+", "\", actual: \"", "+", "(", "actual", "!=", "null", "?", "actual", ".", "name", "(", ")", ":", "\"null\"", ")", ")", ";", "}", "}" ]
Check for the expected data type @param expected expected data type @param column user column
[ "Check", "for", "the", "expected", "data", "type" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/user/UserTable.java#L175-L184
prestodb/presto
presto-main/src/main/java/com/facebook/presto/metadata/FunctionManager.java
FunctionManager.lookupFunction
public FunctionHandle lookupFunction(String name, List<TypeSignatureProvider> parameterTypes) { """ Lookup up a function with name and fully bound types. This can only be used for builtin functions. {@link #resolveFunction(Session, QualifiedName, List)} should be used for dynamically registered functions. @throws PrestoException if function could not be found """ return staticFunctionNamespace.lookupFunction(QualifiedName.of(name), parameterTypes); }
java
public FunctionHandle lookupFunction(String name, List<TypeSignatureProvider> parameterTypes) { return staticFunctionNamespace.lookupFunction(QualifiedName.of(name), parameterTypes); }
[ "public", "FunctionHandle", "lookupFunction", "(", "String", "name", ",", "List", "<", "TypeSignatureProvider", ">", "parameterTypes", ")", "{", "return", "staticFunctionNamespace", ".", "lookupFunction", "(", "QualifiedName", ".", "of", "(", "name", ")", ",", "parameterTypes", ")", ";", "}" ]
Lookup up a function with name and fully bound types. This can only be used for builtin functions. {@link #resolveFunction(Session, QualifiedName, List)} should be used for dynamically registered functions. @throws PrestoException if function could not be found
[ "Lookup", "up", "a", "function", "with", "name", "and", "fully", "bound", "types", ".", "This", "can", "only", "be", "used", "for", "builtin", "functions", ".", "{", "@link", "#resolveFunction", "(", "Session", "QualifiedName", "List", ")", "}", "should", "be", "used", "for", "dynamically", "registered", "functions", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/metadata/FunctionManager.java#L119-L122
robocup-atan/atan
src/main/java/com/github/robocup_atan/atan/model/XPMImage.java
XPMImage.getTile
public String getTile(int x, int y) { """ Gets a tile of the XPM Image. @param x Between 0 and 31. @param y Between 0 and 7. @return An XPM image string defining an 8*8 image. """ if ((x > getArrayWidth()) || (y > getArrayHeight()) || (x < 0) || (y < 0)) { throw new IllegalArgumentException(); } return image[x][y]; }
java
public String getTile(int x, int y) { if ((x > getArrayWidth()) || (y > getArrayHeight()) || (x < 0) || (y < 0)) { throw new IllegalArgumentException(); } return image[x][y]; }
[ "public", "String", "getTile", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "(", "x", ">", "getArrayWidth", "(", ")", ")", "||", "(", "y", ">", "getArrayHeight", "(", ")", ")", "||", "(", "x", "<", "0", ")", "||", "(", "y", "<", "0", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "image", "[", "x", "]", "[", "y", "]", ";", "}" ]
Gets a tile of the XPM Image. @param x Between 0 and 31. @param y Between 0 and 7. @return An XPM image string defining an 8*8 image.
[ "Gets", "a", "tile", "of", "the", "XPM", "Image", "." ]
train
https://github.com/robocup-atan/atan/blob/52237b468b09ba5b7c52d290984dbe0326c96df7/src/main/java/com/github/robocup_atan/atan/model/XPMImage.java#L86-L91
code4everything/util
src/main/java/com/zhazhapan/util/Checker.java
Checker.checkNull
public static Double checkNull(Double value, Double elseValue) { """ 检查Double是否为null @param value 值 @param elseValue 为null返回的值 @return {@link Double} @since 1.0.8 """ return isNull(value) ? elseValue : value; }
java
public static Double checkNull(Double value, Double elseValue) { return isNull(value) ? elseValue : value; }
[ "public", "static", "Double", "checkNull", "(", "Double", "value", ",", "Double", "elseValue", ")", "{", "return", "isNull", "(", "value", ")", "?", "elseValue", ":", "value", ";", "}" ]
检查Double是否为null @param value 值 @param elseValue 为null返回的值 @return {@link Double} @since 1.0.8
[ "检查Double是否为null" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L1171-L1173
geomajas/geomajas-project-client-gwt2
common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java
StyleUtil.createFill
public static FillInfo createFill(String color, float opacity) { """ Creates a fill with the specified CSS parameters. @param color the color @param opacity the opacity @return the fill """ FillInfo fillInfo = new FillInfo(); if (color != null) { fillInfo.getCssParameterList().add(createCssParameter("fill", color)); } fillInfo.getCssParameterList().add(createCssParameter("fill-opacity", opacity)); return fillInfo; }
java
public static FillInfo createFill(String color, float opacity) { FillInfo fillInfo = new FillInfo(); if (color != null) { fillInfo.getCssParameterList().add(createCssParameter("fill", color)); } fillInfo.getCssParameterList().add(createCssParameter("fill-opacity", opacity)); return fillInfo; }
[ "public", "static", "FillInfo", "createFill", "(", "String", "color", ",", "float", "opacity", ")", "{", "FillInfo", "fillInfo", "=", "new", "FillInfo", "(", ")", ";", "if", "(", "color", "!=", "null", ")", "{", "fillInfo", ".", "getCssParameterList", "(", ")", ".", "add", "(", "createCssParameter", "(", "\"fill\"", ",", "color", ")", ")", ";", "}", "fillInfo", ".", "getCssParameterList", "(", ")", ".", "add", "(", "createCssParameter", "(", "\"fill-opacity\"", ",", "opacity", ")", ")", ";", "return", "fillInfo", ";", "}" ]
Creates a fill with the specified CSS parameters. @param color the color @param opacity the opacity @return the fill
[ "Creates", "a", "fill", "with", "the", "specified", "CSS", "parameters", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/util/StyleUtil.java#L227-L234
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/component/ComponentUpdater.java
ComponentUpdater.createWithoutCommit
public ComponentDto createWithoutCommit(DbSession dbSession, NewComponent newComponent, @Nullable Integer userId) { """ Create component without committing. Don't forget to call commitAndIndex(...) when ready to commit. """ checkKeyFormat(newComponent.qualifier(), newComponent.key()); ComponentDto componentDto = createRootComponent(dbSession, newComponent); if (isRootProject(componentDto)) { createMainBranch(dbSession, componentDto.uuid()); } removeDuplicatedProjects(dbSession, componentDto.getDbKey()); handlePermissionTemplate(dbSession, componentDto, userId); return componentDto; }
java
public ComponentDto createWithoutCommit(DbSession dbSession, NewComponent newComponent, @Nullable Integer userId) { checkKeyFormat(newComponent.qualifier(), newComponent.key()); ComponentDto componentDto = createRootComponent(dbSession, newComponent); if (isRootProject(componentDto)) { createMainBranch(dbSession, componentDto.uuid()); } removeDuplicatedProjects(dbSession, componentDto.getDbKey()); handlePermissionTemplate(dbSession, componentDto, userId); return componentDto; }
[ "public", "ComponentDto", "createWithoutCommit", "(", "DbSession", "dbSession", ",", "NewComponent", "newComponent", ",", "@", "Nullable", "Integer", "userId", ")", "{", "checkKeyFormat", "(", "newComponent", ".", "qualifier", "(", ")", ",", "newComponent", ".", "key", "(", ")", ")", ";", "ComponentDto", "componentDto", "=", "createRootComponent", "(", "dbSession", ",", "newComponent", ")", ";", "if", "(", "isRootProject", "(", "componentDto", ")", ")", "{", "createMainBranch", "(", "dbSession", ",", "componentDto", ".", "uuid", "(", ")", ")", ";", "}", "removeDuplicatedProjects", "(", "dbSession", ",", "componentDto", ".", "getDbKey", "(", ")", ")", ";", "handlePermissionTemplate", "(", "dbSession", ",", "componentDto", ",", "userId", ")", ";", "return", "componentDto", ";", "}" ]
Create component without committing. Don't forget to call commitAndIndex(...) when ready to commit.
[ "Create", "component", "without", "committing", ".", "Don", "t", "forget", "to", "call", "commitAndIndex", "(", "...", ")", "when", "ready", "to", "commit", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentUpdater.java#L87-L96
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/HSMDependenceMeasure.java
HSMDependenceMeasure.countAboveThreshold
private int countAboveThreshold(int[][] mat, double threshold) { """ Count the number of cells above the threshold. @param mat Matrix @param threshold Threshold @return Number of elements above the threshold. """ int ret = 0; for(int i = 0; i < mat.length; i++) { int[] row = mat[i]; for(int j = 0; j < row.length; j++) { if(row[j] >= threshold) { ret++; } } } return ret; }
java
private int countAboveThreshold(int[][] mat, double threshold) { int ret = 0; for(int i = 0; i < mat.length; i++) { int[] row = mat[i]; for(int j = 0; j < row.length; j++) { if(row[j] >= threshold) { ret++; } } } return ret; }
[ "private", "int", "countAboveThreshold", "(", "int", "[", "]", "[", "]", "mat", ",", "double", "threshold", ")", "{", "int", "ret", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mat", ".", "length", ";", "i", "++", ")", "{", "int", "[", "]", "row", "=", "mat", "[", "i", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "row", ".", "length", ";", "j", "++", ")", "{", "if", "(", "row", "[", "j", "]", ">=", "threshold", ")", "{", "ret", "++", ";", "}", "}", "}", "return", "ret", ";", "}" ]
Count the number of cells above the threshold. @param mat Matrix @param threshold Threshold @return Number of elements above the threshold.
[ "Count", "the", "number", "of", "cells", "above", "the", "threshold", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/HSMDependenceMeasure.java#L147-L158
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java
AbstractLog.mandatoryWarning
public void mandatoryWarning(LintCategory lc, DiagnosticPosition pos, Warning warningKey) { """ Report a warning. @param lc The lint category for the diagnostic @param pos The source position at which to report the warning. @param warningKey The key for the localized warning message. """ report(diags.mandatoryWarning(lc, source, pos, warningKey)); }
java
public void mandatoryWarning(LintCategory lc, DiagnosticPosition pos, Warning warningKey) { report(diags.mandatoryWarning(lc, source, pos, warningKey)); }
[ "public", "void", "mandatoryWarning", "(", "LintCategory", "lc", ",", "DiagnosticPosition", "pos", ",", "Warning", "warningKey", ")", "{", "report", "(", "diags", ".", "mandatoryWarning", "(", "lc", ",", "source", ",", "pos", ",", "warningKey", ")", ")", ";", "}" ]
Report a warning. @param lc The lint category for the diagnostic @param pos The source position at which to report the warning. @param warningKey The key for the localized warning message.
[ "Report", "a", "warning", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java#L317-L319
strator-dev/greenpepper-open
extensions-external/fit/src/main/java/com/greenpepper/extensions/fit/Fit.java
Fit.isAFitInterpreter
public static boolean isAFitInterpreter(SystemUnderDevelopment sud, String name) { """ <p>isAFitInterpreter.</p> @param sud a {@link com.greenpepper.systemunderdevelopment.SystemUnderDevelopment} object. @param name a {@link java.lang.String} object. @return a boolean. """ try { Object target = sud.getFixture(name).getTarget(); if (target instanceof fit.Fixture && !target.getClass().equals(ActionFixture.class)) return true; } catch (Throwable t) { } return false; }
java
public static boolean isAFitInterpreter(SystemUnderDevelopment sud, String name) { try { Object target = sud.getFixture(name).getTarget(); if (target instanceof fit.Fixture && !target.getClass().equals(ActionFixture.class)) return true; } catch (Throwable t) { } return false; }
[ "public", "static", "boolean", "isAFitInterpreter", "(", "SystemUnderDevelopment", "sud", ",", "String", "name", ")", "{", "try", "{", "Object", "target", "=", "sud", ".", "getFixture", "(", "name", ")", ".", "getTarget", "(", ")", ";", "if", "(", "target", "instanceof", "fit", ".", "Fixture", "&&", "!", "target", ".", "getClass", "(", ")", ".", "equals", "(", "ActionFixture", ".", "class", ")", ")", "return", "true", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "}", "return", "false", ";", "}" ]
<p>isAFitInterpreter.</p> @param sud a {@link com.greenpepper.systemunderdevelopment.SystemUnderDevelopment} object. @param name a {@link java.lang.String} object. @return a boolean.
[ "<p", ">", "isAFitInterpreter", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/extensions-external/fit/src/main/java/com/greenpepper/extensions/fit/Fit.java#L75-L88
mojohaus/jaxb2-maven-plugin
src/main/java/org/codehaus/mojo/jaxb2/shared/Validate.java
Validate.notEmpty
public static void notEmpty(final String aString, final String argumentName) { """ Validates that the supplied object is not null, and throws an IllegalArgumentException otherwise. @param aString The string to validate for emptyness. @param argumentName The argument name of the object to validate. If supplied (i.e. non-{@code null}), this value is used in composing a better exception message. """ // Check sanity notNull(aString, argumentName); if (aString.length() == 0) { throw new IllegalArgumentException(getMessage("empty", argumentName)); } }
java
public static void notEmpty(final String aString, final String argumentName) { // Check sanity notNull(aString, argumentName); if (aString.length() == 0) { throw new IllegalArgumentException(getMessage("empty", argumentName)); } }
[ "public", "static", "void", "notEmpty", "(", "final", "String", "aString", ",", "final", "String", "argumentName", ")", "{", "// Check sanity", "notNull", "(", "aString", ",", "argumentName", ")", ";", "if", "(", "aString", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "getMessage", "(", "\"empty\"", ",", "argumentName", ")", ")", ";", "}", "}" ]
Validates that the supplied object is not null, and throws an IllegalArgumentException otherwise. @param aString The string to validate for emptyness. @param argumentName The argument name of the object to validate. If supplied (i.e. non-{@code null}), this value is used in composing a better exception message.
[ "Validates", "that", "the", "supplied", "object", "is", "not", "null", "and", "throws", "an", "IllegalArgumentException", "otherwise", "." ]
train
https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/Validate.java#L57-L65
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.getEndpointHealthAsync
public Observable<Page<EndpointHealthDataInner>> getEndpointHealthAsync(final String resourceGroupName, final String iotHubName) { """ Get the health for routing endpoints. Get the health for routing endpoints. @param resourceGroupName the String value @param iotHubName the String value @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;EndpointHealthDataInner&gt; object """ return getEndpointHealthWithServiceResponseAsync(resourceGroupName, iotHubName) .map(new Func1<ServiceResponse<Page<EndpointHealthDataInner>>, Page<EndpointHealthDataInner>>() { @Override public Page<EndpointHealthDataInner> call(ServiceResponse<Page<EndpointHealthDataInner>> response) { return response.body(); } }); }
java
public Observable<Page<EndpointHealthDataInner>> getEndpointHealthAsync(final String resourceGroupName, final String iotHubName) { return getEndpointHealthWithServiceResponseAsync(resourceGroupName, iotHubName) .map(new Func1<ServiceResponse<Page<EndpointHealthDataInner>>, Page<EndpointHealthDataInner>>() { @Override public Page<EndpointHealthDataInner> call(ServiceResponse<Page<EndpointHealthDataInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "EndpointHealthDataInner", ">", ">", "getEndpointHealthAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "iotHubName", ")", "{", "return", "getEndpointHealthWithServiceResponseAsync", "(", "resourceGroupName", ",", "iotHubName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "EndpointHealthDataInner", ">", ">", ",", "Page", "<", "EndpointHealthDataInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "EndpointHealthDataInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "EndpointHealthDataInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get the health for routing endpoints. Get the health for routing endpoints. @param resourceGroupName the String value @param iotHubName the String value @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;EndpointHealthDataInner&gt; object
[ "Get", "the", "health", "for", "routing", "endpoints", ".", "Get", "the", "health", "for", "routing", "endpoints", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L2473-L2481
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java
CommonOps_DDF4.fill
public static void fill( DMatrix4 a , double v ) { """ <p> Sets every element in the vector to the specified value.<br> <br> a<sub>i</sub> = value <p> @param a A vector whose elements are about to be set. Modified. @param v The value each element will have. """ a.a1 = v; a.a2 = v; a.a3 = v; a.a4 = v; }
java
public static void fill( DMatrix4 a , double v ) { a.a1 = v; a.a2 = v; a.a3 = v; a.a4 = v; }
[ "public", "static", "void", "fill", "(", "DMatrix4", "a", ",", "double", "v", ")", "{", "a", ".", "a1", "=", "v", ";", "a", ".", "a2", "=", "v", ";", "a", ".", "a3", "=", "v", ";", "a", ".", "a4", "=", "v", ";", "}" ]
<p> Sets every element in the vector to the specified value.<br> <br> a<sub>i</sub> = value <p> @param a A vector whose elements are about to be set. Modified. @param v The value each element will have.
[ "<p", ">", "Sets", "every", "element", "in", "the", "vector", "to", "the", "specified", "value", ".", "<br", ">", "<br", ">", "a<sub", ">", "i<", "/", "sub", ">", "=", "value", "<p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java#L1609-L1614
line/armeria
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
ServerBuilder.accessLogFormat
public ServerBuilder accessLogFormat(String accessLogFormat) { """ Sets the format of this {@link Server}'s access log. The specified {@code accessLogFormat} would be parsed by {@link AccessLogWriter#custom(String)}. """ return accessLogWriter(AccessLogWriter.custom(requireNonNull(accessLogFormat, "accessLogFormat")), true); }
java
public ServerBuilder accessLogFormat(String accessLogFormat) { return accessLogWriter(AccessLogWriter.custom(requireNonNull(accessLogFormat, "accessLogFormat")), true); }
[ "public", "ServerBuilder", "accessLogFormat", "(", "String", "accessLogFormat", ")", "{", "return", "accessLogWriter", "(", "AccessLogWriter", ".", "custom", "(", "requireNonNull", "(", "accessLogFormat", ",", "\"accessLogFormat\"", ")", ")", ",", "true", ")", ";", "}" ]
Sets the format of this {@link Server}'s access log. The specified {@code accessLogFormat} would be parsed by {@link AccessLogWriter#custom(String)}.
[ "Sets", "the", "format", "of", "this", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L695-L698
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerNumeric
public void registerNumeric(int beginTotal, int endTotal, int beginDecimal, int endDecimal, Class <?> javaType) { """ Override multiple numeric bindings, both begin and end are inclusive @param beginTotal inclusive start of range @param endTotal inclusive end of range @param beginDecimal inclusive start of range @param endDecimal inclusive end of range @param javaType java type """ for (int total = beginTotal; total <= endTotal; total++) { for (int decimal = beginDecimal; decimal <= endDecimal; decimal++) { registerNumeric(total, decimal, javaType); } } }
java
public void registerNumeric(int beginTotal, int endTotal, int beginDecimal, int endDecimal, Class <?> javaType) { for (int total = beginTotal; total <= endTotal; total++) { for (int decimal = beginDecimal; decimal <= endDecimal; decimal++) { registerNumeric(total, decimal, javaType); } } }
[ "public", "void", "registerNumeric", "(", "int", "beginTotal", ",", "int", "endTotal", ",", "int", "beginDecimal", ",", "int", "endDecimal", ",", "Class", "<", "?", ">", "javaType", ")", "{", "for", "(", "int", "total", "=", "beginTotal", ";", "total", "<=", "endTotal", ";", "total", "++", ")", "{", "for", "(", "int", "decimal", "=", "beginDecimal", ";", "decimal", "<=", "endDecimal", ";", "decimal", "++", ")", "{", "registerNumeric", "(", "total", ",", "decimal", ",", "javaType", ")", ";", "}", "}", "}" ]
Override multiple numeric bindings, both begin and end are inclusive @param beginTotal inclusive start of range @param endTotal inclusive end of range @param beginDecimal inclusive start of range @param endDecimal inclusive end of range @param javaType java type
[ "Override", "multiple", "numeric", "bindings", "both", "begin", "and", "end", "are", "inclusive" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L458-L464
dain/leveldb
leveldb/src/main/java/org/iq80/leveldb/util/Slice.java
Slice.setByte
public void setByte(int index, int value) { """ Sets the specified byte at the specified absolute {@code index} in this buffer. The 24 high-order bits of the specified value are ignored. @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or {@code index + 1} is greater than {@code this.capacity} """ checkPositionIndexes(index, index + SIZE_OF_BYTE, this.length); index += offset; data[index] = (byte) value; }
java
public void setByte(int index, int value) { checkPositionIndexes(index, index + SIZE_OF_BYTE, this.length); index += offset; data[index] = (byte) value; }
[ "public", "void", "setByte", "(", "int", "index", ",", "int", "value", ")", "{", "checkPositionIndexes", "(", "index", ",", "index", "+", "SIZE_OF_BYTE", ",", "this", ".", "length", ")", ";", "index", "+=", "offset", ";", "data", "[", "index", "]", "=", "(", "byte", ")", "value", ";", "}" ]
Sets the specified byte at the specified absolute {@code index} in this buffer. The 24 high-order bits of the specified value are ignored. @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or {@code index + 1} is greater than {@code this.capacity}
[ "Sets", "the", "specified", "byte", "at", "the", "specified", "absolute", "{", "@code", "index", "}", "in", "this", "buffer", ".", "The", "24", "high", "-", "order", "bits", "of", "the", "specified", "value", "are", "ignored", "." ]
train
https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L347-L352
nmdp-bioinformatics/ngs
reads/src/main/java/org/nmdp/ngs/reads/paired/PairedEndFastqReader.java
PairedEndFastqReader.readPaired
public static void readPaired(final Readable firstReadable, final Readable secondReadable, final PairedEndListener listener) throws IOException { """ Read the specified paired end reads. The paired end reads are read fully into RAM before processing. @param firstReadable first readable, must not be null @param secondReadable second readable, must not be null @param listener paired end listener, must not be null @throws IOException if an I/O error occurs @deprecated by {@link #streamPaired(Readable,Readable,PairedEndListener)}, will be removed in version 2.0 """ checkNotNull(firstReadable); checkNotNull(secondReadable); checkNotNull(listener); // read both FASTQ files into RAM (ick) final List<Fastq> reads = Lists.newArrayList(); SangerFastqReader fastqReader = new SangerFastqReader(); fastqReader.stream(firstReadable, new StreamListener() { @Override public void fastq(final Fastq fastq) { reads.add(fastq); } }); fastqReader.stream(secondReadable, new StreamListener() { @Override public void fastq(final Fastq fastq) { reads.add(fastq); } }); // .. and sort by description Collections.sort(reads, new Ordering<Fastq>() { @Override public int compare(final Fastq left, final Fastq right) { return left.getDescription().compareTo(right.getDescription()); } }); for (int i = 0, size = reads.size(); i < size; ) { Fastq left = reads.get(i); if ((i + 1) == size) { listener.unpaired(left); break; } Fastq right = reads.get(i + 1); if (isLeft(left)) { if (isRight(right)) { // todo: assert prefixes match listener.paired(left, right); i += 2; } else { listener.unpaired(right); i++; } } else { listener.unpaired(left); i++; } } }
java
public static void readPaired(final Readable firstReadable, final Readable secondReadable, final PairedEndListener listener) throws IOException { checkNotNull(firstReadable); checkNotNull(secondReadable); checkNotNull(listener); // read both FASTQ files into RAM (ick) final List<Fastq> reads = Lists.newArrayList(); SangerFastqReader fastqReader = new SangerFastqReader(); fastqReader.stream(firstReadable, new StreamListener() { @Override public void fastq(final Fastq fastq) { reads.add(fastq); } }); fastqReader.stream(secondReadable, new StreamListener() { @Override public void fastq(final Fastq fastq) { reads.add(fastq); } }); // .. and sort by description Collections.sort(reads, new Ordering<Fastq>() { @Override public int compare(final Fastq left, final Fastq right) { return left.getDescription().compareTo(right.getDescription()); } }); for (int i = 0, size = reads.size(); i < size; ) { Fastq left = reads.get(i); if ((i + 1) == size) { listener.unpaired(left); break; } Fastq right = reads.get(i + 1); if (isLeft(left)) { if (isRight(right)) { // todo: assert prefixes match listener.paired(left, right); i += 2; } else { listener.unpaired(right); i++; } } else { listener.unpaired(left); i++; } } }
[ "public", "static", "void", "readPaired", "(", "final", "Readable", "firstReadable", ",", "final", "Readable", "secondReadable", ",", "final", "PairedEndListener", "listener", ")", "throws", "IOException", "{", "checkNotNull", "(", "firstReadable", ")", ";", "checkNotNull", "(", "secondReadable", ")", ";", "checkNotNull", "(", "listener", ")", ";", "// read both FASTQ files into RAM (ick)", "final", "List", "<", "Fastq", ">", "reads", "=", "Lists", ".", "newArrayList", "(", ")", ";", "SangerFastqReader", "fastqReader", "=", "new", "SangerFastqReader", "(", ")", ";", "fastqReader", ".", "stream", "(", "firstReadable", ",", "new", "StreamListener", "(", ")", "{", "@", "Override", "public", "void", "fastq", "(", "final", "Fastq", "fastq", ")", "{", "reads", ".", "add", "(", "fastq", ")", ";", "}", "}", ")", ";", "fastqReader", ".", "stream", "(", "secondReadable", ",", "new", "StreamListener", "(", ")", "{", "@", "Override", "public", "void", "fastq", "(", "final", "Fastq", "fastq", ")", "{", "reads", ".", "add", "(", "fastq", ")", ";", "}", "}", ")", ";", "// .. and sort by description", "Collections", ".", "sort", "(", "reads", ",", "new", "Ordering", "<", "Fastq", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "final", "Fastq", "left", ",", "final", "Fastq", "right", ")", "{", "return", "left", ".", "getDescription", "(", ")", ".", "compareTo", "(", "right", ".", "getDescription", "(", ")", ")", ";", "}", "}", ")", ";", "for", "(", "int", "i", "=", "0", ",", "size", "=", "reads", ".", "size", "(", ")", ";", "i", "<", "size", ";", ")", "{", "Fastq", "left", "=", "reads", ".", "get", "(", "i", ")", ";", "if", "(", "(", "i", "+", "1", ")", "==", "size", ")", "{", "listener", ".", "unpaired", "(", "left", ")", ";", "break", ";", "}", "Fastq", "right", "=", "reads", ".", "get", "(", "i", "+", "1", ")", ";", "if", "(", "isLeft", "(", "left", ")", ")", "{", "if", "(", "isRight", "(", "right", ")", ")", "{", "// todo: assert prefixes match", "listener", ".", "paired", "(", "left", ",", "right", ")", ";", "i", "+=", "2", ";", "}", "else", "{", "listener", ".", "unpaired", "(", "right", ")", ";", "i", "++", ";", "}", "}", "else", "{", "listener", ".", "unpaired", "(", "left", ")", ";", "i", "++", ";", "}", "}", "}" ]
Read the specified paired end reads. The paired end reads are read fully into RAM before processing. @param firstReadable first readable, must not be null @param secondReadable second readable, must not be null @param listener paired end listener, must not be null @throws IOException if an I/O error occurs @deprecated by {@link #streamPaired(Readable,Readable,PairedEndListener)}, will be removed in version 2.0
[ "Read", "the", "specified", "paired", "end", "reads", ".", "The", "paired", "end", "reads", "are", "read", "fully", "into", "RAM", "before", "processing", "." ]
train
https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/reads/src/main/java/org/nmdp/ngs/reads/paired/PairedEndFastqReader.java#L98-L154
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/PhoneIntents.java
PhoneIntents.newEmptySmsIntent
public static Intent newEmptySmsIntent(Context context, String phoneNumber) { """ Creates an intent that will allow to send an SMS without specifying the phone number @param phoneNumber The phone number to send the SMS to @return the intent """ return newSmsIntent(context, null, new String[]{phoneNumber}); }
java
public static Intent newEmptySmsIntent(Context context, String phoneNumber) { return newSmsIntent(context, null, new String[]{phoneNumber}); }
[ "public", "static", "Intent", "newEmptySmsIntent", "(", "Context", "context", ",", "String", "phoneNumber", ")", "{", "return", "newSmsIntent", "(", "context", ",", "null", ",", "new", "String", "[", "]", "{", "phoneNumber", "}", ")", ";", "}" ]
Creates an intent that will allow to send an SMS without specifying the phone number @param phoneNumber The phone number to send the SMS to @return the intent
[ "Creates", "an", "intent", "that", "will", "allow", "to", "send", "an", "SMS", "without", "specifying", "the", "phone", "number" ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/PhoneIntents.java#L51-L53
codescape/bitvunit
bitvunit-core/src/main/java/de/codescape/bitvunit/report/XmlReportWriter.java
XmlReportWriter.printHeader
private void printHeader(HtmlPage htmlPage, PrintWriter out) { """ Writes the header. @param htmlPage {@link HtmlPage} that was inspected @param out target where the report is written to """ out.println("<?xml version='1.0'?>"); out.println("<BitvUnit version='" + getBitvUnitVersion() + "'>"); out.println("<Report time='" + getFormattedDate() + "' url='" + htmlPage.getUrl().toString() + "'/>"); }
java
private void printHeader(HtmlPage htmlPage, PrintWriter out) { out.println("<?xml version='1.0'?>"); out.println("<BitvUnit version='" + getBitvUnitVersion() + "'>"); out.println("<Report time='" + getFormattedDate() + "' url='" + htmlPage.getUrl().toString() + "'/>"); }
[ "private", "void", "printHeader", "(", "HtmlPage", "htmlPage", ",", "PrintWriter", "out", ")", "{", "out", ".", "println", "(", "\"<?xml version='1.0'?>\"", ")", ";", "out", ".", "println", "(", "\"<BitvUnit version='\"", "+", "getBitvUnitVersion", "(", ")", "+", "\"'>\"", ")", ";", "out", ".", "println", "(", "\"<Report time='\"", "+", "getFormattedDate", "(", ")", "+", "\"' url='\"", "+", "htmlPage", ".", "getUrl", "(", ")", ".", "toString", "(", ")", "+", "\"'/>\"", ")", ";", "}" ]
Writes the header. @param htmlPage {@link HtmlPage} that was inspected @param out target where the report is written to
[ "Writes", "the", "header", "." ]
train
https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/report/XmlReportWriter.java#L50-L54
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/BatchHelper.java
BatchHelper.awaitRequestsCompletion
private void awaitRequestsCompletion() throws IOException { """ Awaits until all sent requests are completed. Should be serialized """ // Don't wait until all requests will be completed if enough requests are pending for full batch while (!responseFutures.isEmpty() && pendingRequests.size() < maxRequestsPerBatch) { try { responseFutures.remove().get(); } catch (InterruptedException | ExecutionException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new RuntimeException("Failed to execute batch", e); } } }
java
private void awaitRequestsCompletion() throws IOException { // Don't wait until all requests will be completed if enough requests are pending for full batch while (!responseFutures.isEmpty() && pendingRequests.size() < maxRequestsPerBatch) { try { responseFutures.remove().get(); } catch (InterruptedException | ExecutionException e) { if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } throw new RuntimeException("Failed to execute batch", e); } } }
[ "private", "void", "awaitRequestsCompletion", "(", ")", "throws", "IOException", "{", "// Don't wait until all requests will be completed if enough requests are pending for full batch", "while", "(", "!", "responseFutures", ".", "isEmpty", "(", ")", "&&", "pendingRequests", ".", "size", "(", ")", "<", "maxRequestsPerBatch", ")", "{", "try", "{", "responseFutures", ".", "remove", "(", ")", ".", "get", "(", ")", ";", "}", "catch", "(", "InterruptedException", "|", "ExecutionException", "e", ")", "{", "if", "(", "e", ".", "getCause", "(", ")", "instanceof", "IOException", ")", "{", "throw", "(", "IOException", ")", "e", ".", "getCause", "(", ")", ";", "}", "throw", "new", "RuntimeException", "(", "\"Failed to execute batch\"", ",", "e", ")", ";", "}", "}", "}" ]
Awaits until all sent requests are completed. Should be serialized
[ "Awaits", "until", "all", "sent", "requests", "are", "completed", ".", "Should", "be", "serialized" ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/BatchHelper.java#L259-L271
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java
MathUtils.ssReg
public static double ssReg(double[] residuals, double[] targetAttribute) { """ How much of the variance is explained by the regression @param residuals error @param targetAttribute data for target attribute @return the sum squares of regression """ double mean = sum(targetAttribute) / targetAttribute.length; double ret = 0; for (int i = 0; i < residuals.length; i++) { ret += Math.pow(residuals[i] - mean, 2); } return ret; }
java
public static double ssReg(double[] residuals, double[] targetAttribute) { double mean = sum(targetAttribute) / targetAttribute.length; double ret = 0; for (int i = 0; i < residuals.length; i++) { ret += Math.pow(residuals[i] - mean, 2); } return ret; }
[ "public", "static", "double", "ssReg", "(", "double", "[", "]", "residuals", ",", "double", "[", "]", "targetAttribute", ")", "{", "double", "mean", "=", "sum", "(", "targetAttribute", ")", "/", "targetAttribute", ".", "length", ";", "double", "ret", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "residuals", ".", "length", ";", "i", "++", ")", "{", "ret", "+=", "Math", ".", "pow", "(", "residuals", "[", "i", "]", "-", "mean", ",", "2", ")", ";", "}", "return", "ret", ";", "}" ]
How much of the variance is explained by the regression @param residuals error @param targetAttribute data for target attribute @return the sum squares of regression
[ "How", "much", "of", "the", "variance", "is", "explained", "by", "the", "regression" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/util/MathUtils.java#L173-L180
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java
TypeQualifierApplications.getApplicableScopedApplications
private static void getApplicableScopedApplications(Set<TypeQualifierAnnotation> result, AnnotatedObject o, ElementType e) { """ Populate Set of TypeQualifierAnnotations for given AnnotatedObject, taking into account annotations applied to outer scopes (e.g., enclosing classes and packages.) @param result Set of TypeQualifierAnnotations @param o an AnnotatedObject @param e ElementType representing kind of AnnotatedObject """ if (!o.isSynthetic()) { AnnotatedObject outer = o.getContainingScope(); if (outer != null) { getApplicableScopedApplications(result, outer, e); } } getDirectApplications(result, o, e); }
java
private static void getApplicableScopedApplications(Set<TypeQualifierAnnotation> result, AnnotatedObject o, ElementType e) { if (!o.isSynthetic()) { AnnotatedObject outer = o.getContainingScope(); if (outer != null) { getApplicableScopedApplications(result, outer, e); } } getDirectApplications(result, o, e); }
[ "private", "static", "void", "getApplicableScopedApplications", "(", "Set", "<", "TypeQualifierAnnotation", ">", "result", ",", "AnnotatedObject", "o", ",", "ElementType", "e", ")", "{", "if", "(", "!", "o", ".", "isSynthetic", "(", ")", ")", "{", "AnnotatedObject", "outer", "=", "o", ".", "getContainingScope", "(", ")", ";", "if", "(", "outer", "!=", "null", ")", "{", "getApplicableScopedApplications", "(", "result", ",", "outer", ",", "e", ")", ";", "}", "}", "getDirectApplications", "(", "result", ",", "o", ",", "e", ")", ";", "}" ]
Populate Set of TypeQualifierAnnotations for given AnnotatedObject, taking into account annotations applied to outer scopes (e.g., enclosing classes and packages.) @param result Set of TypeQualifierAnnotations @param o an AnnotatedObject @param e ElementType representing kind of AnnotatedObject
[ "Populate", "Set", "of", "TypeQualifierAnnotations", "for", "given", "AnnotatedObject", "taking", "into", "account", "annotations", "applied", "to", "outer", "scopes", "(", "e", ".", "g", ".", "enclosing", "classes", "and", "packages", ".", ")" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java#L288-L296
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cloud_project_serviceName_credit_GET
public OvhOrder cloud_project_serviceName_credit_GET(String serviceName, Long amount) throws IOException { """ Get prices and contracts information REST: GET /order/cloud/project/{serviceName}/credit @param amount [required] Amount to add in your cloud credit @param serviceName [required] The project id """ String qPath = "/order/cloud/project/{serviceName}/credit"; StringBuilder sb = path(qPath, serviceName); query(sb, "amount", amount); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder cloud_project_serviceName_credit_GET(String serviceName, Long amount) throws IOException { String qPath = "/order/cloud/project/{serviceName}/credit"; StringBuilder sb = path(qPath, serviceName); query(sb, "amount", amount); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "cloud_project_serviceName_credit_GET", "(", "String", "serviceName", ",", "Long", "amount", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cloud/project/{serviceName}/credit\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"amount\"", ",", "amount", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/cloud/project/{serviceName}/credit @param amount [required] Amount to add in your cloud credit @param serviceName [required] The project id
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2963-L2969
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserAdapter.java
ParserAdapter.checkNotParsing
private void checkNotParsing (String type, String name) throws SAXNotSupportedException { """ Throw an exception if we are parsing. <p>Use this method to detect illegal feature or property changes.</p> @param type The type of thing (feature or property). @param name The feature or property name. @exception SAXNotSupportedException If a document is currently being parsed. """ if (parsing) { throw new SAXNotSupportedException("Cannot change " + type + ' ' + name + " while parsing"); } }
java
private void checkNotParsing (String type, String name) throws SAXNotSupportedException { if (parsing) { throw new SAXNotSupportedException("Cannot change " + type + ' ' + name + " while parsing"); } }
[ "private", "void", "checkNotParsing", "(", "String", "type", ",", "String", "name", ")", "throws", "SAXNotSupportedException", "{", "if", "(", "parsing", ")", "{", "throw", "new", "SAXNotSupportedException", "(", "\"Cannot change \"", "+", "type", "+", "'", "'", "+", "name", "+", "\" while parsing\"", ")", ";", "}", "}" ]
Throw an exception if we are parsing. <p>Use this method to detect illegal feature or property changes.</p> @param type The type of thing (feature or property). @param name The feature or property name. @exception SAXNotSupportedException If a document is currently being parsed.
[ "Throw", "an", "exception", "if", "we", "are", "parsing", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserAdapter.java#L797-L806
pravega/pravega
controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java
StreamMetadataResourceImpl.listScopes
@Override public void listScopes(final SecurityContext securityContext, final AsyncResponse asyncResponse) { """ Implementation of listScopes REST API. @param securityContext The security for API access. @param asyncResponse AsyncResponse provides means for asynchronous server side response processing. """ long traceId = LoggerHelpers.traceEnter(log, "listScopes"); final Principal principal; final List<String> authHeader = getAuthorizationHeader(); try { principal = restAuthHelper.authenticate(authHeader); restAuthHelper.authorize(authHeader, AuthResourceRepresentation.ofScopes(), principal, READ); } catch (AuthException e) { log.warn("Get scopes failed due to authentication failure.", e); asyncResponse.resume(Response.status(Status.fromStatusCode(e.getResponseCode())).build()); LoggerHelpers.traceLeave(log, "listScopes", traceId); return; } controllerService.listScopes() .thenApply(scopesList -> { ScopesList scopes = new ScopesList(); scopesList.forEach(scope -> { try { if (restAuthHelper.isAuthorized(authHeader, AuthResourceRepresentation.ofScope(scope), principal, READ)) { scopes.addScopesItem(new ScopeProperty().scopeName(scope)); } } catch (AuthException e) { log.warn(e.getMessage(), e); // Ignore. This exception occurs under abnormal circumstances and not to determine // whether the user is authorized. In case it does occur, we assume that the user // is unauthorized. } }); return Response.status(Status.OK).entity(scopes).build(); }) .exceptionally(exception -> { log.warn("listScopes failed with exception: ", exception); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); }) .thenApply(response -> { asyncResponse.resume(response); LoggerHelpers.traceLeave(log, "listScopes", traceId); return response; }); }
java
@Override public void listScopes(final SecurityContext securityContext, final AsyncResponse asyncResponse) { long traceId = LoggerHelpers.traceEnter(log, "listScopes"); final Principal principal; final List<String> authHeader = getAuthorizationHeader(); try { principal = restAuthHelper.authenticate(authHeader); restAuthHelper.authorize(authHeader, AuthResourceRepresentation.ofScopes(), principal, READ); } catch (AuthException e) { log.warn("Get scopes failed due to authentication failure.", e); asyncResponse.resume(Response.status(Status.fromStatusCode(e.getResponseCode())).build()); LoggerHelpers.traceLeave(log, "listScopes", traceId); return; } controllerService.listScopes() .thenApply(scopesList -> { ScopesList scopes = new ScopesList(); scopesList.forEach(scope -> { try { if (restAuthHelper.isAuthorized(authHeader, AuthResourceRepresentation.ofScope(scope), principal, READ)) { scopes.addScopesItem(new ScopeProperty().scopeName(scope)); } } catch (AuthException e) { log.warn(e.getMessage(), e); // Ignore. This exception occurs under abnormal circumstances and not to determine // whether the user is authorized. In case it does occur, we assume that the user // is unauthorized. } }); return Response.status(Status.OK).entity(scopes).build(); }) .exceptionally(exception -> { log.warn("listScopes failed with exception: ", exception); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); }) .thenApply(response -> { asyncResponse.resume(response); LoggerHelpers.traceLeave(log, "listScopes", traceId); return response; }); }
[ "@", "Override", "public", "void", "listScopes", "(", "final", "SecurityContext", "securityContext", ",", "final", "AsyncResponse", "asyncResponse", ")", "{", "long", "traceId", "=", "LoggerHelpers", ".", "traceEnter", "(", "log", ",", "\"listScopes\"", ")", ";", "final", "Principal", "principal", ";", "final", "List", "<", "String", ">", "authHeader", "=", "getAuthorizationHeader", "(", ")", ";", "try", "{", "principal", "=", "restAuthHelper", ".", "authenticate", "(", "authHeader", ")", ";", "restAuthHelper", ".", "authorize", "(", "authHeader", ",", "AuthResourceRepresentation", ".", "ofScopes", "(", ")", ",", "principal", ",", "READ", ")", ";", "}", "catch", "(", "AuthException", "e", ")", "{", "log", ".", "warn", "(", "\"Get scopes failed due to authentication failure.\"", ",", "e", ")", ";", "asyncResponse", ".", "resume", "(", "Response", ".", "status", "(", "Status", ".", "fromStatusCode", "(", "e", ".", "getResponseCode", "(", ")", ")", ")", ".", "build", "(", ")", ")", ";", "LoggerHelpers", ".", "traceLeave", "(", "log", ",", "\"listScopes\"", ",", "traceId", ")", ";", "return", ";", "}", "controllerService", ".", "listScopes", "(", ")", ".", "thenApply", "(", "scopesList", "->", "{", "ScopesList", "scopes", "=", "new", "ScopesList", "(", ")", ";", "scopesList", ".", "forEach", "(", "scope", "->", "{", "try", "{", "if", "(", "restAuthHelper", ".", "isAuthorized", "(", "authHeader", ",", "AuthResourceRepresentation", ".", "ofScope", "(", "scope", ")", ",", "principal", ",", "READ", ")", ")", "{", "scopes", ".", "addScopesItem", "(", "new", "ScopeProperty", "(", ")", ".", "scopeName", "(", "scope", ")", ")", ";", "}", "}", "catch", "(", "AuthException", "e", ")", "{", "log", ".", "warn", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "// Ignore. This exception occurs under abnormal circumstances and not to determine", "// whether the user is authorized. In case it does occur, we assume that the user", "// is unauthorized.", "}", "}", ")", ";", "return", "Response", ".", "status", "(", "Status", ".", "OK", ")", ".", "entity", "(", "scopes", ")", ".", "build", "(", ")", ";", "}", ")", ".", "exceptionally", "(", "exception", "->", "{", "log", ".", "warn", "(", "\"listScopes failed with exception: \"", ",", "exception", ")", ";", "return", "Response", ".", "status", "(", "Status", ".", "INTERNAL_SERVER_ERROR", ")", ".", "build", "(", ")", ";", "}", ")", ".", "thenApply", "(", "response", "->", "{", "asyncResponse", ".", "resume", "(", "response", ")", ";", "LoggerHelpers", ".", "traceLeave", "(", "log", ",", "\"listScopes\"", ",", "traceId", ")", ";", "return", "response", ";", "}", ")", ";", "}" ]
Implementation of listScopes REST API. @param securityContext The security for API access. @param asyncResponse AsyncResponse provides means for asynchronous server side response processing.
[ "Implementation", "of", "listScopes", "REST", "API", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rest/resources/StreamMetadataResourceImpl.java#L466-L509
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java
FileOperations.deleteFileFromTask
public void deleteFileFromTask(String jobId, String taskId, String fileName, Boolean recursive, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { """ Deletes the specified file from the specified task's directory on its compute node. @param jobId The ID of the job containing the task. @param taskId The ID of the task. @param fileName The name of the file to delete. @param recursive If the file-path parameter represents a directory instead of a file, you can set the recursive parameter to true to delete the directory and all of the files and subdirectories in it. If recursive is false or null, then the directory must be empty or deletion will fail. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ FileDeleteFromTaskOptions options = new FileDeleteFromTaskOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); this.parentBatchClient.protocolLayer().files().deleteFromTask(jobId, taskId, fileName, recursive, options); }
java
public void deleteFileFromTask(String jobId, String taskId, String fileName, Boolean recursive, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { FileDeleteFromTaskOptions options = new FileDeleteFromTaskOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); this.parentBatchClient.protocolLayer().files().deleteFromTask(jobId, taskId, fileName, recursive, options); }
[ "public", "void", "deleteFileFromTask", "(", "String", "jobId", ",", "String", "taskId", ",", "String", "fileName", ",", "Boolean", "recursive", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", "{", "FileDeleteFromTaskOptions", "options", "=", "new", "FileDeleteFromTaskOptions", "(", ")", ";", "BehaviorManager", "bhMgr", "=", "new", "BehaviorManager", "(", "this", ".", "customBehaviors", "(", ")", ",", "additionalBehaviors", ")", ";", "bhMgr", ".", "applyRequestBehaviors", "(", "options", ")", ";", "this", ".", "parentBatchClient", ".", "protocolLayer", "(", ")", ".", "files", "(", ")", ".", "deleteFromTask", "(", "jobId", ",", "taskId", ",", "fileName", ",", "recursive", ",", "options", ")", ";", "}" ]
Deletes the specified file from the specified task's directory on its compute node. @param jobId The ID of the job containing the task. @param taskId The ID of the task. @param fileName The name of the file to delete. @param recursive If the file-path parameter represents a directory instead of a file, you can set the recursive parameter to true to delete the directory and all of the files and subdirectories in it. If recursive is false or null, then the directory must be empty or deletion will fail. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Deletes", "the", "specified", "file", "from", "the", "specified", "task", "s", "directory", "on", "its", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L200-L206
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java
DatabasesInner.addPrincipals
public DatabasePrincipalListResultInner addPrincipals(String resourceGroupName, String clusterName, String databaseName, List<DatabasePrincipalInner> value) { """ Add Database principals permissions. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param value The list of Kusto database principals. @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 DatabasePrincipalListResultInner object if successful. """ return addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value).toBlocking().single().body(); }
java
public DatabasePrincipalListResultInner addPrincipals(String resourceGroupName, String clusterName, String databaseName, List<DatabasePrincipalInner> value) { return addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value).toBlocking().single().body(); }
[ "public", "DatabasePrincipalListResultInner", "addPrincipals", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ",", "List", "<", "DatabasePrincipalInner", ">", "value", ")", "{", "return", "addPrincipalsWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ",", "databaseName", ",", "value", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Add Database principals permissions. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param value The list of Kusto database principals. @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 DatabasePrincipalListResultInner object if successful.
[ "Add", "Database", "principals", "permissions", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L1135-L1137
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/ColorUtils.java
ColorUtils.RGBtoHSV
public static int[] RGBtoHSV (Color c) { """ Converts {@link Color} to HSV color system @return 3 element int array with hue (0-360), saturation (0-100) and value (0-100) """ return RGBtoHSV(c.r, c.g, c.b); }
java
public static int[] RGBtoHSV (Color c) { return RGBtoHSV(c.r, c.g, c.b); }
[ "public", "static", "int", "[", "]", "RGBtoHSV", "(", "Color", "c", ")", "{", "return", "RGBtoHSV", "(", "c", ".", "r", ",", "c", ".", "g", ",", "c", ".", "b", ")", ";", "}" ]
Converts {@link Color} to HSV color system @return 3 element int array with hue (0-360), saturation (0-100) and value (0-100)
[ "Converts", "{" ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/ColorUtils.java#L119-L121
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/PropertiesField.java
PropertiesField.setProperties
public int setProperties(Map<String,Object> properties, boolean bDisplayOption, int iMoveMode) { """ Set this property in the user's property area. @param strProperty The property key. @param strValue The property value. @param iDisplayOption If true, display the new field. @param iMoveMove The move mode. @return An error code (NORMAL_RETURN for success). """ m_propertiesCache = properties; if ((properties == null) || (properties.size() == 0)) m_propertiesCache = null; String strProperties = null; if (m_propertiesCache != null) strProperties = this.propertiesToInternalString(m_propertiesCache); Map<String,Object> propertiesSave = m_propertiesCache; int iErrorCode = this.setString(strProperties, bDisplayOption, iMoveMode); m_propertiesCache = propertiesSave; // Zeroed out in set String return iErrorCode; }
java
public int setProperties(Map<String,Object> properties, boolean bDisplayOption, int iMoveMode) { m_propertiesCache = properties; if ((properties == null) || (properties.size() == 0)) m_propertiesCache = null; String strProperties = null; if (m_propertiesCache != null) strProperties = this.propertiesToInternalString(m_propertiesCache); Map<String,Object> propertiesSave = m_propertiesCache; int iErrorCode = this.setString(strProperties, bDisplayOption, iMoveMode); m_propertiesCache = propertiesSave; // Zeroed out in set String return iErrorCode; }
[ "public", "int", "setProperties", "(", "Map", "<", "String", ",", "Object", ">", "properties", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "m_propertiesCache", "=", "properties", ";", "if", "(", "(", "properties", "==", "null", ")", "||", "(", "properties", ".", "size", "(", ")", "==", "0", ")", ")", "m_propertiesCache", "=", "null", ";", "String", "strProperties", "=", "null", ";", "if", "(", "m_propertiesCache", "!=", "null", ")", "strProperties", "=", "this", ".", "propertiesToInternalString", "(", "m_propertiesCache", ")", ";", "Map", "<", "String", ",", "Object", ">", "propertiesSave", "=", "m_propertiesCache", ";", "int", "iErrorCode", "=", "this", ".", "setString", "(", "strProperties", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "m_propertiesCache", "=", "propertiesSave", ";", "// Zeroed out in set String", "return", "iErrorCode", ";", "}" ]
Set this property in the user's property area. @param strProperty The property key. @param strValue The property value. @param iDisplayOption If true, display the new field. @param iMoveMove The move mode. @return An error code (NORMAL_RETURN for success).
[ "Set", "this", "property", "in", "the", "user", "s", "property", "area", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L189-L201
lucee/Lucee
core/src/main/java/lucee/intergral/fusiondebug/server/FDStackFrameImpl.java
FDStackFrameImpl.copyValues
private static List copyValues(FDStackFrameImpl frame, List to, Struct from) { """ copy all data from given struct to given list and translate it to a FDValue @param to list to fill with values @param from struct to read values from @return the given list """ Iterator it = from.entrySet().iterator(); Entry entry; while (it.hasNext()) { entry = (Entry) it.next(); to.add(new FDVariable(frame, (String) entry.getKey(), FDCaster.toFDValue(frame, entry.getValue()))); } return to; }
java
private static List copyValues(FDStackFrameImpl frame, List to, Struct from) { Iterator it = from.entrySet().iterator(); Entry entry; while (it.hasNext()) { entry = (Entry) it.next(); to.add(new FDVariable(frame, (String) entry.getKey(), FDCaster.toFDValue(frame, entry.getValue()))); } return to; }
[ "private", "static", "List", "copyValues", "(", "FDStackFrameImpl", "frame", ",", "List", "to", ",", "Struct", "from", ")", "{", "Iterator", "it", "=", "from", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "Entry", "entry", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "entry", "=", "(", "Entry", ")", "it", ".", "next", "(", ")", ";", "to", ".", "add", "(", "new", "FDVariable", "(", "frame", ",", "(", "String", ")", "entry", ".", "getKey", "(", ")", ",", "FDCaster", ".", "toFDValue", "(", "frame", ",", "entry", ".", "getValue", "(", ")", ")", ")", ")", ";", "}", "return", "to", ";", "}" ]
copy all data from given struct to given list and translate it to a FDValue @param to list to fill with values @param from struct to read values from @return the given list
[ "copy", "all", "data", "from", "given", "struct", "to", "given", "list", "and", "translate", "it", "to", "a", "FDValue" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/intergral/fusiondebug/server/FDStackFrameImpl.java#L208-L216
the-fascinator/plugin-subscriber-solrEventLog
src/main/java/com/googlecode/fascinator/subscriber/solrEventLog/SolrEventLogSubscriber.java
SolrEventLogSubscriber.addToIndex
private void addToIndex(Map<String, String> param) throws Exception { """ Add the event to the index @param param : Map of key/value pairs to add to the index @throws Exception if there was an error """ String doc = writeUpdateString(param); addToBuffer(doc); }
java
private void addToIndex(Map<String, String> param) throws Exception { String doc = writeUpdateString(param); addToBuffer(doc); }
[ "private", "void", "addToIndex", "(", "Map", "<", "String", ",", "String", ">", "param", ")", "throws", "Exception", "{", "String", "doc", "=", "writeUpdateString", "(", "param", ")", ";", "addToBuffer", "(", "doc", ")", ";", "}" ]
Add the event to the index @param param : Map of key/value pairs to add to the index @throws Exception if there was an error
[ "Add", "the", "event", "to", "the", "index" ]
train
https://github.com/the-fascinator/plugin-subscriber-solrEventLog/blob/2c9da188887a622a6d43d33ea9099aff53a0516d/src/main/java/com/googlecode/fascinator/subscriber/solrEventLog/SolrEventLogSubscriber.java#L437-L440
kohsuke/args4j
args4j/src/org/kohsuke/args4j/CmdLineParser.java
CmdLineParser.createOptionHandler
protected OptionHandler createOptionHandler(OptionDef o, Setter setter) { """ Creates an {@link OptionHandler} that handles the given {@link Option} annotation and the {@link Setter} instance. """ checkNonNull(o, "OptionDef"); checkNonNull(setter, "Setter"); return OptionHandlerRegistry.getRegistry().createOptionHandler(this, o, setter); }
java
protected OptionHandler createOptionHandler(OptionDef o, Setter setter) { checkNonNull(o, "OptionDef"); checkNonNull(setter, "Setter"); return OptionHandlerRegistry.getRegistry().createOptionHandler(this, o, setter); }
[ "protected", "OptionHandler", "createOptionHandler", "(", "OptionDef", "o", ",", "Setter", "setter", ")", "{", "checkNonNull", "(", "o", ",", "\"OptionDef\"", ")", ";", "checkNonNull", "(", "setter", ",", "\"Setter\"", ")", ";", "return", "OptionHandlerRegistry", ".", "getRegistry", "(", ")", ".", "createOptionHandler", "(", "this", ",", "o", ",", "setter", ")", ";", "}" ]
Creates an {@link OptionHandler} that handles the given {@link Option} annotation and the {@link Setter} instance.
[ "Creates", "an", "{" ]
train
https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L175-L179
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/XSLBasedXMLMagicNumber.java
XSLBasedXMLMagicNumber.isContentType
@Override protected boolean isContentType(String schemaId, String schemaVersion, String systemId, String publicId) { """ Replies if the specified stream contains data that corresponds to this magic number. @param schemaId is the ID of the XSL schema associated to this magic number. @param schemaVersion is the ID of the XSL schema associated to this magic number. @param systemId is the DTD system ID associated to this magic number. @param publicId is the DTD system ID associated to this magic number. @return <code>true</code> if this magic number is corresponding to the given XML document, otherwise <code>false</code> """ if (this.schema == null) { return false; } if (this.regEx != null) { final Matcher matcher = this.regEx.matcher(schemaId); return matcher != null && matcher.find(); } return this.schema.equalsIgnoreCase(schemaId); }
java
@Override protected boolean isContentType(String schemaId, String schemaVersion, String systemId, String publicId) { if (this.schema == null) { return false; } if (this.regEx != null) { final Matcher matcher = this.regEx.matcher(schemaId); return matcher != null && matcher.find(); } return this.schema.equalsIgnoreCase(schemaId); }
[ "@", "Override", "protected", "boolean", "isContentType", "(", "String", "schemaId", ",", "String", "schemaVersion", ",", "String", "systemId", ",", "String", "publicId", ")", "{", "if", "(", "this", ".", "schema", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "this", ".", "regEx", "!=", "null", ")", "{", "final", "Matcher", "matcher", "=", "this", ".", "regEx", ".", "matcher", "(", "schemaId", ")", ";", "return", "matcher", "!=", "null", "&&", "matcher", ".", "find", "(", ")", ";", "}", "return", "this", ".", "schema", ".", "equalsIgnoreCase", "(", "schemaId", ")", ";", "}" ]
Replies if the specified stream contains data that corresponds to this magic number. @param schemaId is the ID of the XSL schema associated to this magic number. @param schemaVersion is the ID of the XSL schema associated to this magic number. @param systemId is the DTD system ID associated to this magic number. @param publicId is the DTD system ID associated to this magic number. @return <code>true</code> if this magic number is corresponding to the given XML document, otherwise <code>false</code>
[ "Replies", "if", "the", "specified", "stream", "contains", "data", "that", "corresponds", "to", "this", "magic", "number", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/XSLBasedXMLMagicNumber.java#L110-L120
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/gpio/BananaProPin.java
BananaProPin.createDigitalPin
protected static Pin createDigitalPin(int address, String name) { """ this pin is permanently pulled up; pin pull settings do not work """ return createDigitalPin(BananaProGpioProvider.NAME, address, name); }
java
protected static Pin createDigitalPin(int address, String name) { return createDigitalPin(BananaProGpioProvider.NAME, address, name); }
[ "protected", "static", "Pin", "createDigitalPin", "(", "int", "address", ",", "String", "name", ")", "{", "return", "createDigitalPin", "(", "BananaProGpioProvider", ".", "NAME", ",", "address", ",", "name", ")", ";", "}" ]
this pin is permanently pulled up; pin pull settings do not work
[ "this", "pin", "is", "permanently", "pulled", "up", ";", "pin", "pull", "settings", "do", "not", "work" ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/gpio/BananaProPin.java#L76-L78
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/VdmBreakpointPropertyPage.java
VdmBreakpointPropertyPage.createCheckButton
protected Button createCheckButton(Composite parent, String text) { """ Creates a fully configured check button with the given text. @param parent the parent composite @param text the label of the returned check button @return a fully configured check button """ return SWTFactory.createCheckButton(parent, text, null, false, 1); }
java
protected Button createCheckButton(Composite parent, String text) { return SWTFactory.createCheckButton(parent, text, null, false, 1); }
[ "protected", "Button", "createCheckButton", "(", "Composite", "parent", ",", "String", "text", ")", "{", "return", "SWTFactory", ".", "createCheckButton", "(", "parent", ",", "text", ",", "null", ",", "false", ",", "1", ")", ";", "}" ]
Creates a fully configured check button with the given text. @param parent the parent composite @param text the label of the returned check button @return a fully configured check button
[ "Creates", "a", "fully", "configured", "check", "button", "with", "the", "given", "text", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/VdmBreakpointPropertyPage.java#L504-L507
groupon/odo
client/src/main/java/com/groupon/odo/client/PathValueClient.java
PathValueClient.removeCustomResponse
public boolean removeCustomResponse(String pathValue, String requestType) { """ Remove any overrides for an endpoint @param pathValue path (endpoint) value @param requestType path request type. "GET", "POST", etc @return true if success, false otherwise """ try { JSONObject path = getPathFromEndpoint(pathValue, requestType); if (path == null) { return false; } String pathId = path.getString("pathId"); return resetResponseOverride(pathId); } catch (Exception e) { e.printStackTrace(); } return false; }
java
public boolean removeCustomResponse(String pathValue, String requestType) { try { JSONObject path = getPathFromEndpoint(pathValue, requestType); if (path == null) { return false; } String pathId = path.getString("pathId"); return resetResponseOverride(pathId); } catch (Exception e) { e.printStackTrace(); } return false; }
[ "public", "boolean", "removeCustomResponse", "(", "String", "pathValue", ",", "String", "requestType", ")", "{", "try", "{", "JSONObject", "path", "=", "getPathFromEndpoint", "(", "pathValue", ",", "requestType", ")", ";", "if", "(", "path", "==", "null", ")", "{", "return", "false", ";", "}", "String", "pathId", "=", "path", ".", "getString", "(", "\"pathId\"", ")", ";", "return", "resetResponseOverride", "(", "pathId", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "false", ";", "}" ]
Remove any overrides for an endpoint @param pathValue path (endpoint) value @param requestType path request type. "GET", "POST", etc @return true if success, false otherwise
[ "Remove", "any", "overrides", "for", "an", "endpoint" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/PathValueClient.java#L103-L115
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.getRounding
public static MonetaryRounding getRounding(String roundingName, String... providers) { """ Access an {@link MonetaryOperator} for custom rounding {@link MonetaryAmount} instances. @param roundingName The rounding identifier. @param providers the providers and ordering to be used. By default providers and ordering as defined in #getDefaultProviders is used. @return the corresponding {@link MonetaryOperator} implementing the rounding, never {@code null}. @throws IllegalArgumentException if no such rounding is registered using a {@link javax.money.spi.RoundingProviderSpi} instance. """ return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow( () -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available.")) .getRounding(roundingName, providers); }
java
public static MonetaryRounding getRounding(String roundingName, String... providers) { return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow( () -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available.")) .getRounding(roundingName, providers); }
[ "public", "static", "MonetaryRounding", "getRounding", "(", "String", "roundingName", ",", "String", "...", "providers", ")", "{", "return", "Optional", ".", "ofNullable", "(", "monetaryRoundingsSingletonSpi", "(", ")", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "MonetaryException", "(", "\"No MonetaryRoundingsSpi loaded, query functionality is not available.\"", ")", ")", ".", "getRounding", "(", "roundingName", ",", "providers", ")", ";", "}" ]
Access an {@link MonetaryOperator} for custom rounding {@link MonetaryAmount} instances. @param roundingName The rounding identifier. @param providers the providers and ordering to be used. By default providers and ordering as defined in #getDefaultProviders is used. @return the corresponding {@link MonetaryOperator} implementing the rounding, never {@code null}. @throws IllegalArgumentException if no such rounding is registered using a {@link javax.money.spi.RoundingProviderSpi} instance.
[ "Access", "an", "{", "@link", "MonetaryOperator", "}", "for", "custom", "rounding", "{", "@link", "MonetaryAmount", "}", "instances", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L171-L175
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/MediaApi.java
MediaApi.addAttachment
public ApiSuccessResponse addAttachment(String mediatype, String id, File attachment, String operationId) throws ApiException { """ Add an attachment to the open-media interaction Add an attachment to the interaction specified in the id path parameter @param mediatype media-type of interaction to add attachment (required) @param id id of interaction (required) @param attachment The file to upload. (optional) @param operationId operationId associated to the request (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<ApiSuccessResponse> resp = addAttachmentWithHttpInfo(mediatype, id, attachment, operationId); return resp.getData(); }
java
public ApiSuccessResponse addAttachment(String mediatype, String id, File attachment, String operationId) throws ApiException { ApiResponse<ApiSuccessResponse> resp = addAttachmentWithHttpInfo(mediatype, id, attachment, operationId); return resp.getData(); }
[ "public", "ApiSuccessResponse", "addAttachment", "(", "String", "mediatype", ",", "String", "id", ",", "File", "attachment", ",", "String", "operationId", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "addAttachmentWithHttpInfo", "(", "mediatype", ",", "id", ",", "attachment", ",", "operationId", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Add an attachment to the open-media interaction Add an attachment to the interaction specified in the id path parameter @param mediatype media-type of interaction to add attachment (required) @param id id of interaction (required) @param attachment The file to upload. (optional) @param operationId operationId associated to the request (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Add", "an", "attachment", "to", "the", "open", "-", "media", "interaction", "Add", "an", "attachment", "to", "the", "interaction", "specified", "in", "the", "id", "path", "parameter" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L313-L316
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Observable.java
Observable.fromFuture
@CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) public static <T> Observable<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit, Scheduler scheduler) { """ Converts a {@link Future} into an ObservableSource, with a timeout on the Future. <p> <img width="640" height="287" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromFuture.timeout.scheduler.png" alt=""> <p> You can convert any object that supports the {@link Future} interface into an ObservableSource that emits the return value of the {@link Future#get} method of that object, by passing the object into the {@code from} method. <p> Unlike 1.x, disposing the Observable won't cancel the future. If necessary, one can use composition to achieve the cancellation effect: {@code futureObservableSource.doOnDispose(() -> future.cancel(true));}. <p> <em>Important note:</em> This ObservableSource is blocking; you cannot dispose it. <dl> <dt><b>Scheduler:</b></dt> <dd>{@code fromFuture} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param future the source {@link Future} @param timeout the maximum time to wait before calling {@code get} @param unit the {@link TimeUnit} of the {@code timeout} argument @param scheduler the {@link Scheduler} to wait for the Future on. Use a Scheduler such as {@link Schedulers#io()} that can block and wait on the Future @param <T> the type of object that the {@link Future} returns, and also the type of item to be emitted by the resulting ObservableSource @return an Observable that emits the item from the source {@link Future} @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a> """ ObjectHelper.requireNonNull(scheduler, "scheduler is null"); Observable<T> o = fromFuture(future, timeout, unit); return o.subscribeOn(scheduler); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) public static <T> Observable<T> fromFuture(Future<? extends T> future, long timeout, TimeUnit unit, Scheduler scheduler) { ObjectHelper.requireNonNull(scheduler, "scheduler is null"); Observable<T> o = fromFuture(future, timeout, unit); return o.subscribeOn(scheduler); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "CUSTOM", ")", "public", "static", "<", "T", ">", "Observable", "<", "T", ">", "fromFuture", "(", "Future", "<", "?", "extends", "T", ">", "future", ",", "long", "timeout", ",", "TimeUnit", "unit", ",", "Scheduler", "scheduler", ")", "{", "ObjectHelper", ".", "requireNonNull", "(", "scheduler", ",", "\"scheduler is null\"", ")", ";", "Observable", "<", "T", ">", "o", "=", "fromFuture", "(", "future", ",", "timeout", ",", "unit", ")", ";", "return", "o", ".", "subscribeOn", "(", "scheduler", ")", ";", "}" ]
Converts a {@link Future} into an ObservableSource, with a timeout on the Future. <p> <img width="640" height="287" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromFuture.timeout.scheduler.png" alt=""> <p> You can convert any object that supports the {@link Future} interface into an ObservableSource that emits the return value of the {@link Future#get} method of that object, by passing the object into the {@code from} method. <p> Unlike 1.x, disposing the Observable won't cancel the future. If necessary, one can use composition to achieve the cancellation effect: {@code futureObservableSource.doOnDispose(() -> future.cancel(true));}. <p> <em>Important note:</em> This ObservableSource is blocking; you cannot dispose it. <dl> <dt><b>Scheduler:</b></dt> <dd>{@code fromFuture} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param future the source {@link Future} @param timeout the maximum time to wait before calling {@code get} @param unit the {@link TimeUnit} of the {@code timeout} argument @param scheduler the {@link Scheduler} to wait for the Future on. Use a Scheduler such as {@link Schedulers#io()} that can block and wait on the Future @param <T> the type of object that the {@link Future} returns, and also the type of item to be emitted by the resulting ObservableSource @return an Observable that emits the item from the source {@link Future} @see <a href="http://reactivex.io/documentation/operators/from.html">ReactiveX operators documentation: From</a>
[ "Converts", "a", "{", "@link", "Future", "}", "into", "an", "ObservableSource", "with", "a", "timeout", "on", "the", "Future", ".", "<p", ">", "<img", "width", "=", "640", "height", "=", "287", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", "/", "ReactiveX", "/", "RxJava", "/", "images", "/", "rx", "-", "operators", "/", "fromFuture", ".", "timeout", ".", "scheduler", ".", "png", "alt", "=", ">", "<p", ">", "You", "can", "convert", "any", "object", "that", "supports", "the", "{", "@link", "Future", "}", "interface", "into", "an", "ObservableSource", "that", "emits", "the", "return", "value", "of", "the", "{", "@link", "Future#get", "}", "method", "of", "that", "object", "by", "passing", "the", "object", "into", "the", "{", "@code", "from", "}", "method", ".", "<p", ">", "Unlike", "1", ".", "x", "disposing", "the", "Observable", "won", "t", "cancel", "the", "future", ".", "If", "necessary", "one", "can", "use", "composition", "to", "achieve", "the", "cancellation", "effect", ":", "{", "@code", "futureObservableSource", ".", "doOnDispose", "((", ")", "-", ">", "future", ".", "cancel", "(", "true", "))", ";", "}", ".", "<p", ">", "<em", ">", "Important", "note", ":", "<", "/", "em", ">", "This", "ObservableSource", "is", "blocking", ";", "you", "cannot", "dispose", "it", ".", "<dl", ">", "<dt", ">", "<b", ">", "Scheduler", ":", "<", "/", "b", ">", "<", "/", "dt", ">", "<dd", ">", "{", "@code", "fromFuture", "}", "does", "not", "operate", "by", "default", "on", "a", "particular", "{", "@link", "Scheduler", "}", ".", "<", "/", "dd", ">", "<", "/", "dl", ">" ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Observable.java#L1888-L1894
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/execution/RuntimeEnvironment.java
RuntimeEnvironment.getExecutingThread
public Thread getExecutingThread() { """ Returns the thread which is assigned to execute the user code. @return the thread which is assigned to execute the user code """ synchronized (this) { if (this.executingThread == null) { if (this.taskName == null) { this.executingThread = new Thread(this); } else { this.executingThread = new Thread(this, getTaskNameWithIndex()); } } return this.executingThread; } }
java
public Thread getExecutingThread() { synchronized (this) { if (this.executingThread == null) { if (this.taskName == null) { this.executingThread = new Thread(this); } else { this.executingThread = new Thread(this, getTaskNameWithIndex()); } } return this.executingThread; } }
[ "public", "Thread", "getExecutingThread", "(", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "this", ".", "executingThread", "==", "null", ")", "{", "if", "(", "this", ".", "taskName", "==", "null", ")", "{", "this", ".", "executingThread", "=", "new", "Thread", "(", "this", ")", ";", "}", "else", "{", "this", ".", "executingThread", "=", "new", "Thread", "(", "this", ",", "getTaskNameWithIndex", "(", ")", ")", ";", "}", "}", "return", "this", ".", "executingThread", ";", "}", "}" ]
Returns the thread which is assigned to execute the user code. @return the thread which is assigned to execute the user code
[ "Returns", "the", "thread", "which", "is", "assigned", "to", "execute", "the", "user", "code", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/execution/RuntimeEnvironment.java#L421-L435
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java
DeleteHandlerV1.deleteEntities
public void deleteEntities(Collection<AtlasVertex> instanceVertices) throws AtlasBaseException { """ Deletes the specified entity vertices. Deletes any traits, composite entities, and structs owned by each entity. Also deletes all the references from/to the entity. @param instanceVertices @throws AtlasException """ RequestContextV1 requestContext = RequestContextV1.get(); Set<AtlasVertex> deletionCandidateVertices = new HashSet<>(); for (AtlasVertex instanceVertex : instanceVertices) { String guid = AtlasGraphUtilsV1.getIdFromVertex(instanceVertex); AtlasEntity.Status state = AtlasGraphUtilsV1.getState(instanceVertex); if (state == AtlasEntity.Status.DELETED) { LOG.debug("Skipping deletion of {} as it is already deleted", guid); continue; } String typeName = AtlasGraphUtilsV1.getTypeName(instanceVertex); AtlasObjectId objId = new AtlasObjectId(guid, typeName); if (requestContext.getDeletedEntityIds().contains(objId)) { LOG.debug("Skipping deletion of {} as it is already deleted", guid); continue; } // Get GUIDs and vertices for all deletion candidates. Set<GraphHelper.VertexInfo> compositeVertices = getOwnedVertices(instanceVertex); // Record all deletion candidate GUIDs in RequestContext // and gather deletion candidate vertices. for (GraphHelper.VertexInfo vertexInfo : compositeVertices) { requestContext.recordEntityDelete(new AtlasObjectId(vertexInfo.getGuid(), vertexInfo.getTypeName())); deletionCandidateVertices.add(vertexInfo.getVertex()); } } // Delete traits and vertices. for (AtlasVertex deletionCandidateVertex : deletionCandidateVertices) { deleteAllTraits(deletionCandidateVertex); deleteTypeVertex(deletionCandidateVertex, false); } }
java
public void deleteEntities(Collection<AtlasVertex> instanceVertices) throws AtlasBaseException { RequestContextV1 requestContext = RequestContextV1.get(); Set<AtlasVertex> deletionCandidateVertices = new HashSet<>(); for (AtlasVertex instanceVertex : instanceVertices) { String guid = AtlasGraphUtilsV1.getIdFromVertex(instanceVertex); AtlasEntity.Status state = AtlasGraphUtilsV1.getState(instanceVertex); if (state == AtlasEntity.Status.DELETED) { LOG.debug("Skipping deletion of {} as it is already deleted", guid); continue; } String typeName = AtlasGraphUtilsV1.getTypeName(instanceVertex); AtlasObjectId objId = new AtlasObjectId(guid, typeName); if (requestContext.getDeletedEntityIds().contains(objId)) { LOG.debug("Skipping deletion of {} as it is already deleted", guid); continue; } // Get GUIDs and vertices for all deletion candidates. Set<GraphHelper.VertexInfo> compositeVertices = getOwnedVertices(instanceVertex); // Record all deletion candidate GUIDs in RequestContext // and gather deletion candidate vertices. for (GraphHelper.VertexInfo vertexInfo : compositeVertices) { requestContext.recordEntityDelete(new AtlasObjectId(vertexInfo.getGuid(), vertexInfo.getTypeName())); deletionCandidateVertices.add(vertexInfo.getVertex()); } } // Delete traits and vertices. for (AtlasVertex deletionCandidateVertex : deletionCandidateVertices) { deleteAllTraits(deletionCandidateVertex); deleteTypeVertex(deletionCandidateVertex, false); } }
[ "public", "void", "deleteEntities", "(", "Collection", "<", "AtlasVertex", ">", "instanceVertices", ")", "throws", "AtlasBaseException", "{", "RequestContextV1", "requestContext", "=", "RequestContextV1", ".", "get", "(", ")", ";", "Set", "<", "AtlasVertex", ">", "deletionCandidateVertices", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "AtlasVertex", "instanceVertex", ":", "instanceVertices", ")", "{", "String", "guid", "=", "AtlasGraphUtilsV1", ".", "getIdFromVertex", "(", "instanceVertex", ")", ";", "AtlasEntity", ".", "Status", "state", "=", "AtlasGraphUtilsV1", ".", "getState", "(", "instanceVertex", ")", ";", "if", "(", "state", "==", "AtlasEntity", ".", "Status", ".", "DELETED", ")", "{", "LOG", ".", "debug", "(", "\"Skipping deletion of {} as it is already deleted\"", ",", "guid", ")", ";", "continue", ";", "}", "String", "typeName", "=", "AtlasGraphUtilsV1", ".", "getTypeName", "(", "instanceVertex", ")", ";", "AtlasObjectId", "objId", "=", "new", "AtlasObjectId", "(", "guid", ",", "typeName", ")", ";", "if", "(", "requestContext", ".", "getDeletedEntityIds", "(", ")", ".", "contains", "(", "objId", ")", ")", "{", "LOG", ".", "debug", "(", "\"Skipping deletion of {} as it is already deleted\"", ",", "guid", ")", ";", "continue", ";", "}", "// Get GUIDs and vertices for all deletion candidates.", "Set", "<", "GraphHelper", ".", "VertexInfo", ">", "compositeVertices", "=", "getOwnedVertices", "(", "instanceVertex", ")", ";", "// Record all deletion candidate GUIDs in RequestContext", "// and gather deletion candidate vertices.", "for", "(", "GraphHelper", ".", "VertexInfo", "vertexInfo", ":", "compositeVertices", ")", "{", "requestContext", ".", "recordEntityDelete", "(", "new", "AtlasObjectId", "(", "vertexInfo", ".", "getGuid", "(", ")", ",", "vertexInfo", ".", "getTypeName", "(", ")", ")", ")", ";", "deletionCandidateVertices", ".", "add", "(", "vertexInfo", ".", "getVertex", "(", ")", ")", ";", "}", "}", "// Delete traits and vertices.", "for", "(", "AtlasVertex", "deletionCandidateVertex", ":", "deletionCandidateVertices", ")", "{", "deleteAllTraits", "(", "deletionCandidateVertex", ")", ";", "deleteTypeVertex", "(", "deletionCandidateVertex", ",", "false", ")", ";", "}", "}" ]
Deletes the specified entity vertices. Deletes any traits, composite entities, and structs owned by each entity. Also deletes all the references from/to the entity. @param instanceVertices @throws AtlasException
[ "Deletes", "the", "specified", "entity", "vertices", ".", "Deletes", "any", "traits", "composite", "entities", "and", "structs", "owned", "by", "each", "entity", ".", "Also", "deletes", "all", "the", "references", "from", "/", "to", "the", "entity", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/DeleteHandlerV1.java#L85-L123
spotbugs/spotbugs
eclipsePlugin/src/edu/umd/cs/findbugs/plugin/eclipse/quickfix/util/ASTUtil.java
ASTUtil.getMethodDeclaration
public static MethodDeclaration getMethodDeclaration(TypeDeclaration type, MethodAnnotation methodAnno) throws MethodDeclarationNotFoundException { """ Returns the <CODE>MethodDeclaration</CODE> for the specified <CODE>MethodAnnotation</CODE>. The method has to be declared in the specified <CODE>TypeDeclaration</CODE>. @param type The <CODE>TypeDeclaration</CODE>, where the <CODE>MethodDeclaration</CODE> is declared in. @param methodAnno The <CODE>MethodAnnotation</CODE>, which contains the method name and signature of the <CODE>MethodDeclaration</CODE> @return the <CODE>MethodDeclaration</CODE> found in the specified <CODE>TypeDeclaration</CODE>. @throws MethodDeclarationNotFoundException if no matching <CODE>MethodDeclaration</CODE> was found. """ Objects.requireNonNull(methodAnno, "method annotation"); return getMethodDeclaration(type, methodAnno.getMethodName(), methodAnno.getMethodSignature()); }
java
public static MethodDeclaration getMethodDeclaration(TypeDeclaration type, MethodAnnotation methodAnno) throws MethodDeclarationNotFoundException { Objects.requireNonNull(methodAnno, "method annotation"); return getMethodDeclaration(type, methodAnno.getMethodName(), methodAnno.getMethodSignature()); }
[ "public", "static", "MethodDeclaration", "getMethodDeclaration", "(", "TypeDeclaration", "type", ",", "MethodAnnotation", "methodAnno", ")", "throws", "MethodDeclarationNotFoundException", "{", "Objects", ".", "requireNonNull", "(", "methodAnno", ",", "\"method annotation\"", ")", ";", "return", "getMethodDeclaration", "(", "type", ",", "methodAnno", ".", "getMethodName", "(", ")", ",", "methodAnno", ".", "getMethodSignature", "(", ")", ")", ";", "}" ]
Returns the <CODE>MethodDeclaration</CODE> for the specified <CODE>MethodAnnotation</CODE>. The method has to be declared in the specified <CODE>TypeDeclaration</CODE>. @param type The <CODE>TypeDeclaration</CODE>, where the <CODE>MethodDeclaration</CODE> is declared in. @param methodAnno The <CODE>MethodAnnotation</CODE>, which contains the method name and signature of the <CODE>MethodDeclaration</CODE> @return the <CODE>MethodDeclaration</CODE> found in the specified <CODE>TypeDeclaration</CODE>. @throws MethodDeclarationNotFoundException if no matching <CODE>MethodDeclaration</CODE> was found.
[ "Returns", "the", "<CODE", ">", "MethodDeclaration<", "/", "CODE", ">", "for", "the", "specified", "<CODE", ">", "MethodAnnotation<", "/", "CODE", ">", ".", "The", "method", "has", "to", "be", "declared", "in", "the", "specified", "<CODE", ">", "TypeDeclaration<", "/", "CODE", ">", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/edu/umd/cs/findbugs/plugin/eclipse/quickfix/util/ASTUtil.java#L338-L343
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.createPartialMock
public static <T> T createPartialMock(Class<T> type, String[] methodNames, Object... constructorArguments) { """ A utility method that may be used to mock several methods in an easy way (by just passing in the method names of the method you wish to mock). The mock object created will support mocking of final and native methods and invokes a specific constructor based on the supplied argument values. @param <T> the type of the mock object @param type the type of the mock object @param methodNames The names of the methods that should be mocked. If {@code null}, then this method will have the same effect as just calling {@link #createMock(Class, Method...)} with the second parameter as {@code new Method[0]} (i.e. all methods in that class will be mocked). @param constructorArguments The constructor arguments that will be used to invoke a certain constructor. (optional) @return the mock object. """ Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments); ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments); return doMock(type, false, new DefaultMockStrategy(), constructorArgs, Whitebox.getMethods(type, methodNames)); }
java
public static <T> T createPartialMock(Class<T> type, String[] methodNames, Object... constructorArguments) { Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments); ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments); return doMock(type, false, new DefaultMockStrategy(), constructorArgs, Whitebox.getMethods(type, methodNames)); }
[ "public", "static", "<", "T", ">", "T", "createPartialMock", "(", "Class", "<", "T", ">", "type", ",", "String", "[", "]", "methodNames", ",", "Object", "...", "constructorArguments", ")", "{", "Constructor", "<", "?", ">", "constructor", "=", "WhiteboxImpl", ".", "findUniqueConstructorOrThrowException", "(", "type", ",", "constructorArguments", ")", ";", "ConstructorArgs", "constructorArgs", "=", "new", "ConstructorArgs", "(", "constructor", ",", "constructorArguments", ")", ";", "return", "doMock", "(", "type", ",", "false", ",", "new", "DefaultMockStrategy", "(", ")", ",", "constructorArgs", ",", "Whitebox", ".", "getMethods", "(", "type", ",", "methodNames", ")", ")", ";", "}" ]
A utility method that may be used to mock several methods in an easy way (by just passing in the method names of the method you wish to mock). The mock object created will support mocking of final and native methods and invokes a specific constructor based on the supplied argument values. @param <T> the type of the mock object @param type the type of the mock object @param methodNames The names of the methods that should be mocked. If {@code null}, then this method will have the same effect as just calling {@link #createMock(Class, Method...)} with the second parameter as {@code new Method[0]} (i.e. all methods in that class will be mocked). @param constructorArguments The constructor arguments that will be used to invoke a certain constructor. (optional) @return the mock object.
[ "A", "utility", "method", "that", "may", "be", "used", "to", "mock", "several", "methods", "in", "an", "easy", "way", "(", "by", "just", "passing", "in", "the", "method", "names", "of", "the", "method", "you", "wish", "to", "mock", ")", ".", "The", "mock", "object", "created", "will", "support", "mocking", "of", "final", "and", "native", "methods", "and", "invokes", "a", "specific", "constructor", "based", "on", "the", "supplied", "argument", "values", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L903-L907
bit3/jsass
src/main/java/io/bit3/jsass/Compiler.java
Compiler.compileFile
public Output compileFile(URI inputPath, URI outputPath, Options options) throws CompilationException { """ Compile file. @param inputPath The input path. @param outputPath The output path. @param options The compile options. @return The compilation output. @throws CompilationException If the compilation failed. """ FileContext context = new FileContext(inputPath, outputPath, options); return compile(context); }
java
public Output compileFile(URI inputPath, URI outputPath, Options options) throws CompilationException { FileContext context = new FileContext(inputPath, outputPath, options); return compile(context); }
[ "public", "Output", "compileFile", "(", "URI", "inputPath", ",", "URI", "outputPath", ",", "Options", "options", ")", "throws", "CompilationException", "{", "FileContext", "context", "=", "new", "FileContext", "(", "inputPath", ",", "outputPath", ",", "options", ")", ";", "return", "compile", "(", "context", ")", ";", "}" ]
Compile file. @param inputPath The input path. @param outputPath The output path. @param options The compile options. @return The compilation output. @throws CompilationException If the compilation failed.
[ "Compile", "file", "." ]
train
https://github.com/bit3/jsass/blob/fba91d5cb1eb507c7cfde5a261e04b1d328cb1ef/src/main/java/io/bit3/jsass/Compiler.java#L76-L80
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.setSubscribedResourceAsDeleted
public void setSubscribedResourceAsDeleted(CmsDbContext dbc, String poolName, CmsResource resource) throws CmsException { """ Marks a subscribed resource as deleted.<p> @param dbc the database context @param poolName the name of the database pool to use @param resource the subscribed resource to mark as deleted @throws CmsException if something goes wrong """ getSubscriptionDriver().setSubscribedResourceAsDeleted(dbc, poolName, resource); }
java
public void setSubscribedResourceAsDeleted(CmsDbContext dbc, String poolName, CmsResource resource) throws CmsException { getSubscriptionDriver().setSubscribedResourceAsDeleted(dbc, poolName, resource); }
[ "public", "void", "setSubscribedResourceAsDeleted", "(", "CmsDbContext", "dbc", ",", "String", "poolName", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "getSubscriptionDriver", "(", ")", ".", "setSubscribedResourceAsDeleted", "(", "dbc", ",", "poolName", ",", "resource", ")", ";", "}" ]
Marks a subscribed resource as deleted.<p> @param dbc the database context @param poolName the name of the database pool to use @param resource the subscribed resource to mark as deleted @throws CmsException if something goes wrong
[ "Marks", "a", "subscribed", "resource", "as", "deleted", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L9021-L9025
grails/grails-core
grails-core/src/main/groovy/org/grails/spring/context/support/PluginAwareResourceBundleMessageSource.java
PluginAwareResourceBundleMessageSource.resolveCodeWithoutArgumentsFromPlugins
protected String resolveCodeWithoutArgumentsFromPlugins(String code, Locale locale) { """ Attempts to resolve a String for the code from the list of plugin base names @param code The code @param locale The locale @return a MessageFormat """ if (pluginCacheMillis < 0) { PropertiesHolder propHolder = getMergedPluginProperties(locale); String result = propHolder.getProperty(code); if (result != null) { return result; } } else { String result = findCodeInBinaryPlugins(code, locale); if (result != null) return result; } return null; }
java
protected String resolveCodeWithoutArgumentsFromPlugins(String code, Locale locale) { if (pluginCacheMillis < 0) { PropertiesHolder propHolder = getMergedPluginProperties(locale); String result = propHolder.getProperty(code); if (result != null) { return result; } } else { String result = findCodeInBinaryPlugins(code, locale); if (result != null) return result; } return null; }
[ "protected", "String", "resolveCodeWithoutArgumentsFromPlugins", "(", "String", "code", ",", "Locale", "locale", ")", "{", "if", "(", "pluginCacheMillis", "<", "0", ")", "{", "PropertiesHolder", "propHolder", "=", "getMergedPluginProperties", "(", "locale", ")", ";", "String", "result", "=", "propHolder", ".", "getProperty", "(", "code", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "}", "else", "{", "String", "result", "=", "findCodeInBinaryPlugins", "(", "code", ",", "locale", ")", ";", "if", "(", "result", "!=", "null", ")", "return", "result", ";", "}", "return", "null", ";", "}" ]
Attempts to resolve a String for the code from the list of plugin base names @param code The code @param locale The locale @return a MessageFormat
[ "Attempts", "to", "resolve", "a", "String", "for", "the", "code", "from", "the", "list", "of", "plugin", "base", "names" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/spring/context/support/PluginAwareResourceBundleMessageSource.java#L195-L209
geomajas/geomajas-project-client-gwt2
plugin/wms/server-extension/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsServerExtension.java
WmsServerExtension.createLayer
public FeatureSearchSupportedWmsServerLayer createLayer(String title, String crs, TileConfiguration tileConfig, WmsLayerConfiguration layerConfig, WmsLayerInfo layerInfo, WfsFeatureTypeDescriptionInfo wfsConfig) { """ Create a new WMS layer. This layer extends the default {@link org.geomajas.gwt2.plugin.wms.client.layer.WmsLayer} by supporting GetFeatureInfo calls. @param title The layer title. @param crs The CRS for this layer. @param tileConfig The tile configuration object. @param layerConfig The layer configuration object. @param layerInfo The layer info object. Acquired from a WMS GetCapabilities. This is optional. @param wfsConfig The WFS configuration. @return A new WMS layer. """ return new FeatureSearchSupportedWmsServerLayer(title, crs, layerConfig, tileConfig, layerInfo, wfsConfig); }
java
public FeatureSearchSupportedWmsServerLayer createLayer(String title, String crs, TileConfiguration tileConfig, WmsLayerConfiguration layerConfig, WmsLayerInfo layerInfo, WfsFeatureTypeDescriptionInfo wfsConfig) { return new FeatureSearchSupportedWmsServerLayer(title, crs, layerConfig, tileConfig, layerInfo, wfsConfig); }
[ "public", "FeatureSearchSupportedWmsServerLayer", "createLayer", "(", "String", "title", ",", "String", "crs", ",", "TileConfiguration", "tileConfig", ",", "WmsLayerConfiguration", "layerConfig", ",", "WmsLayerInfo", "layerInfo", ",", "WfsFeatureTypeDescriptionInfo", "wfsConfig", ")", "{", "return", "new", "FeatureSearchSupportedWmsServerLayer", "(", "title", ",", "crs", ",", "layerConfig", ",", "tileConfig", ",", "layerInfo", ",", "wfsConfig", ")", ";", "}" ]
Create a new WMS layer. This layer extends the default {@link org.geomajas.gwt2.plugin.wms.client.layer.WmsLayer} by supporting GetFeatureInfo calls. @param title The layer title. @param crs The CRS for this layer. @param tileConfig The tile configuration object. @param layerConfig The layer configuration object. @param layerInfo The layer info object. Acquired from a WMS GetCapabilities. This is optional. @param wfsConfig The WFS configuration. @return A new WMS layer.
[ "Create", "a", "new", "WMS", "layer", ".", "This", "layer", "extends", "the", "default", "{", "@link", "org", ".", "geomajas", ".", "gwt2", ".", "plugin", ".", "wms", ".", "client", ".", "layer", ".", "WmsLayer", "}", "by", "supporting", "GetFeatureInfo", "calls", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/wms/server-extension/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsServerExtension.java#L173-L176
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/FeatureUtil.java
FeatureUtil.scaleMinMax
public static void scaleMinMax(double min, double max, INDArray toScale) { """ Scales the ndarray columns to the given min/max values @param min the minimum number @param max the max number """ //X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min INDArray min2 = toScale.min(0); INDArray max2 = toScale.max(0); INDArray std = toScale.subRowVector(min2).diviRowVector(max2.sub(min2)); INDArray scaled = std.mul(max - min).addi(min); toScale.assign(scaled); }
java
public static void scaleMinMax(double min, double max, INDArray toScale) { //X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min INDArray min2 = toScale.min(0); INDArray max2 = toScale.max(0); INDArray std = toScale.subRowVector(min2).diviRowVector(max2.sub(min2)); INDArray scaled = std.mul(max - min).addi(min); toScale.assign(scaled); }
[ "public", "static", "void", "scaleMinMax", "(", "double", "min", ",", "double", "max", ",", "INDArray", "toScale", ")", "{", "//X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min", "INDArray", "min2", "=", "toScale", ".", "min", "(", "0", ")", ";", "INDArray", "max2", "=", "toScale", ".", "max", "(", "0", ")", ";", "INDArray", "std", "=", "toScale", ".", "subRowVector", "(", "min2", ")", ".", "diviRowVector", "(", "max2", ".", "sub", "(", "min2", ")", ")", ";", "INDArray", "scaled", "=", "std", ".", "mul", "(", "max", "-", "min", ")", ".", "addi", "(", "min", ")", ";", "toScale", ".", "assign", "(", "scaled", ")", ";", "}" ]
Scales the ndarray columns to the given min/max values @param min the minimum number @param max the max number
[ "Scales", "the", "ndarray", "columns", "to", "the", "given", "min", "/", "max", "values" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/FeatureUtil.java#L91-L101
gwtbootstrap3/gwtbootstrap3-extras
src/main/java/org/gwtbootstrap3/extras/animate/client/ui/Animate.java
Animate.removeAnimationOnEnd
public static final <T extends UIObject> void removeAnimationOnEnd(final T widget, final String animation) { """ Removes custom animation class on animation end. @param widget Element to remove style from. @param animation Animation CSS class to remove. """ if (widget != null && animation != null) { removeAnimationOnEnd(widget.getElement(), animation); } }
java
public static final <T extends UIObject> void removeAnimationOnEnd(final T widget, final String animation) { if (widget != null && animation != null) { removeAnimationOnEnd(widget.getElement(), animation); } }
[ "public", "static", "final", "<", "T", "extends", "UIObject", ">", "void", "removeAnimationOnEnd", "(", "final", "T", "widget", ",", "final", "String", "animation", ")", "{", "if", "(", "widget", "!=", "null", "&&", "animation", "!=", "null", ")", "{", "removeAnimationOnEnd", "(", "widget", ".", "getElement", "(", ")", ",", "animation", ")", ";", "}", "}" ]
Removes custom animation class on animation end. @param widget Element to remove style from. @param animation Animation CSS class to remove.
[ "Removes", "custom", "animation", "class", "on", "animation", "end", "." ]
train
https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/animate/client/ui/Animate.java#L307-L311
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java
DocBookBuilder.doPopulateDatabasePass
@SuppressWarnings("unchecked") private void doPopulateDatabasePass(final BuildData buildData) throws BuildProcessingException { """ Populates the SpecTopicDatabase with the SpecTopics inside the content specification. It also adds the equivalent real topics to each SpecTopic. @param buildData Information and data structures for the build. @return True if the database was populated successfully otherwise false. @throws BuildProcessingException Thrown if an unexpected error occurs during building. """ log.info("Doing " + buildData.getBuildLocale() + " Populate Database Pass"); final ContentSpec contentSpec = buildData.getContentSpec(); final Map<String, BaseTopicWrapper<?>> topics = new HashMap<String, BaseTopicWrapper<?>>(); if (buildData.isTranslationBuild()) { //Translations should reference an existing historical topic with the fixed urls set, so we assume this to be the case populateTranslatedTopicDatabase(buildData, topics); } else { populateDatabaseTopics(buildData, topics); } // Check if the app should be shutdown if (isShuttingDown.get()) { return; } // Add all the levels to the database DocBookBuildUtilities.addLevelsToDatabase(buildData.getBuildDatabase(), contentSpec.getBaseLevel()); // Check if the app should be shutdown if (isShuttingDown.get()) { return; } // Process the topics to make sure they are valid doTopicPass(buildData, topics); }
java
@SuppressWarnings("unchecked") private void doPopulateDatabasePass(final BuildData buildData) throws BuildProcessingException { log.info("Doing " + buildData.getBuildLocale() + " Populate Database Pass"); final ContentSpec contentSpec = buildData.getContentSpec(); final Map<String, BaseTopicWrapper<?>> topics = new HashMap<String, BaseTopicWrapper<?>>(); if (buildData.isTranslationBuild()) { //Translations should reference an existing historical topic with the fixed urls set, so we assume this to be the case populateTranslatedTopicDatabase(buildData, topics); } else { populateDatabaseTopics(buildData, topics); } // Check if the app should be shutdown if (isShuttingDown.get()) { return; } // Add all the levels to the database DocBookBuildUtilities.addLevelsToDatabase(buildData.getBuildDatabase(), contentSpec.getBaseLevel()); // Check if the app should be shutdown if (isShuttingDown.get()) { return; } // Process the topics to make sure they are valid doTopicPass(buildData, topics); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "doPopulateDatabasePass", "(", "final", "BuildData", "buildData", ")", "throws", "BuildProcessingException", "{", "log", ".", "info", "(", "\"Doing \"", "+", "buildData", ".", "getBuildLocale", "(", ")", "+", "\" Populate Database Pass\"", ")", ";", "final", "ContentSpec", "contentSpec", "=", "buildData", ".", "getContentSpec", "(", ")", ";", "final", "Map", "<", "String", ",", "BaseTopicWrapper", "<", "?", ">", ">", "topics", "=", "new", "HashMap", "<", "String", ",", "BaseTopicWrapper", "<", "?", ">", ">", "(", ")", ";", "if", "(", "buildData", ".", "isTranslationBuild", "(", ")", ")", "{", "//Translations should reference an existing historical topic with the fixed urls set, so we assume this to be the case", "populateTranslatedTopicDatabase", "(", "buildData", ",", "topics", ")", ";", "}", "else", "{", "populateDatabaseTopics", "(", "buildData", ",", "topics", ")", ";", "}", "// Check if the app should be shutdown", "if", "(", "isShuttingDown", ".", "get", "(", ")", ")", "{", "return", ";", "}", "// Add all the levels to the database", "DocBookBuildUtilities", ".", "addLevelsToDatabase", "(", "buildData", ".", "getBuildDatabase", "(", ")", ",", "contentSpec", ".", "getBaseLevel", "(", ")", ")", ";", "// Check if the app should be shutdown", "if", "(", "isShuttingDown", ".", "get", "(", ")", ")", "{", "return", ";", "}", "// Process the topics to make sure they are valid", "doTopicPass", "(", "buildData", ",", "topics", ")", ";", "}" ]
Populates the SpecTopicDatabase with the SpecTopics inside the content specification. It also adds the equivalent real topics to each SpecTopic. @param buildData Information and data structures for the build. @return True if the database was populated successfully otherwise false. @throws BuildProcessingException Thrown if an unexpected error occurs during building.
[ "Populates", "the", "SpecTopicDatabase", "with", "the", "SpecTopics", "inside", "the", "content", "specification", ".", "It", "also", "adds", "the", "equivalent", "real", "topics", "to", "each", "SpecTopic", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L718-L746
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.withRemoteSane
public static SaneSession withRemoteSane( InetAddress saneAddress, long timeout, TimeUnit timeUnit, long soTimeout, TimeUnit soTimeUnit) throws IOException { """ Establishes a connection to the SANE daemon running on the given host on the default SANE port with the given connection timeout. """ return withRemoteSane(saneAddress, DEFAULT_PORT, timeout, timeUnit, soTimeout, soTimeUnit); }
java
public static SaneSession withRemoteSane( InetAddress saneAddress, long timeout, TimeUnit timeUnit, long soTimeout, TimeUnit soTimeUnit) throws IOException { return withRemoteSane(saneAddress, DEFAULT_PORT, timeout, timeUnit, soTimeout, soTimeUnit); }
[ "public", "static", "SaneSession", "withRemoteSane", "(", "InetAddress", "saneAddress", ",", "long", "timeout", ",", "TimeUnit", "timeUnit", ",", "long", "soTimeout", ",", "TimeUnit", "soTimeUnit", ")", "throws", "IOException", "{", "return", "withRemoteSane", "(", "saneAddress", ",", "DEFAULT_PORT", ",", "timeout", ",", "timeUnit", ",", "soTimeout", ",", "soTimeUnit", ")", ";", "}" ]
Establishes a connection to the SANE daemon running on the given host on the default SANE port with the given connection timeout.
[ "Establishes", "a", "connection", "to", "the", "SANE", "daemon", "running", "on", "the", "given", "host", "on", "the", "default", "SANE", "port", "with", "the", "given", "connection", "timeout", "." ]
train
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L67-L71
graknlabs/grakn
server/src/graql/executor/ComputeExecutor.java
ComputeExecutor.scopeContainsInstances
private boolean scopeContainsInstances(GraqlCompute query, ConceptId... ids) { """ Helper method to check if concept instances exist in the query scope @param ids @return true if they exist, false if they don't """ for (ConceptId id : ids) { Thing thing = tx.getConcept(id); if (thing == null || !scopeTypeLabels(query).contains(thing.type().label())) return false; } return true; }
java
private boolean scopeContainsInstances(GraqlCompute query, ConceptId... ids) { for (ConceptId id : ids) { Thing thing = tx.getConcept(id); if (thing == null || !scopeTypeLabels(query).contains(thing.type().label())) return false; } return true; }
[ "private", "boolean", "scopeContainsInstances", "(", "GraqlCompute", "query", ",", "ConceptId", "...", "ids", ")", "{", "for", "(", "ConceptId", "id", ":", "ids", ")", "{", "Thing", "thing", "=", "tx", ".", "getConcept", "(", "id", ")", ";", "if", "(", "thing", "==", "null", "||", "!", "scopeTypeLabels", "(", "query", ")", ".", "contains", "(", "thing", ".", "type", "(", ")", ".", "label", "(", ")", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}" ]
Helper method to check if concept instances exist in the query scope @param ids @return true if they exist, false if they don't
[ "Helper", "method", "to", "check", "if", "concept", "instances", "exist", "in", "the", "query", "scope" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/executor/ComputeExecutor.java#L789-L795
unbescape/unbescape
src/main/java/org/unbescape/properties/PropertiesEscape.java
PropertiesEscape.unescapeProperties
public static void unescapeProperties(final Reader reader, final Writer writer) throws IOException { """ <p> Perform a Java Properties (key or value) <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> Java Properties unescape of SECs and u-based escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2 """ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } PropertiesUnescapeUtil.unescape(reader, writer); }
java
public static void unescapeProperties(final Reader reader, final Writer writer) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } PropertiesUnescapeUtil.unescape(reader, writer); }
[ "public", "static", "void", "unescapeProperties", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument 'writer' cannot be null\"", ")", ";", "}", "PropertiesUnescapeUtil", ".", "unescape", "(", "reader", ",", "writer", ")", ";", "}" ]
<p> Perform a Java Properties (key or value) <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> Java Properties unescape of SECs and u-based escapes. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "Java", "Properties", "(", "key", "or", "value", ")", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "No", "additional", "configuration", "arguments", "are", "required", ".", "Unescape", "operations", "will", "always", "perform", "<em", ">", "complete<", "/", "em", ">", "Java", "Properties", "unescape", "of", "SECs", "and", "u", "-", "based", "escapes", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L1445-L1454
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONCompare.java
JSONCompare.compareJSON
public static JSONCompareResult compareJSON(String expectedStr, String actualStr, JSONCompareMode mode) throws JSONException { """ Compares JSON string provided to the expected JSON string, and returns the results of the comparison. @param expectedStr Expected JSON string @param actualStr JSON string to compare @param mode Defines comparison behavior @return result of the comparison @throws JSONException JSON parsing error """ return compareJSON(expectedStr, actualStr, getComparatorForMode(mode)); }
java
public static JSONCompareResult compareJSON(String expectedStr, String actualStr, JSONCompareMode mode) throws JSONException { return compareJSON(expectedStr, actualStr, getComparatorForMode(mode)); }
[ "public", "static", "JSONCompareResult", "compareJSON", "(", "String", "expectedStr", ",", "String", "actualStr", ",", "JSONCompareMode", "mode", ")", "throws", "JSONException", "{", "return", "compareJSON", "(", "expectedStr", ",", "actualStr", ",", "getComparatorForMode", "(", "mode", ")", ")", ";", "}" ]
Compares JSON string provided to the expected JSON string, and returns the results of the comparison. @param expectedStr Expected JSON string @param actualStr JSON string to compare @param mode Defines comparison behavior @return result of the comparison @throws JSONException JSON parsing error
[ "Compares", "JSON", "string", "provided", "to", "the", "expected", "JSON", "string", "and", "returns", "the", "results", "of", "the", "comparison", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONCompare.java#L123-L126
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java
RecommendedElasticPoolsInner.listMetricsAsync
public Observable<List<RecommendedElasticPoolMetricInner>> listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { """ Returns recommented elastic pool metrics. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;RecommendedElasticPoolMetricInner&gt; object """ return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1<ServiceResponse<List<RecommendedElasticPoolMetricInner>>, List<RecommendedElasticPoolMetricInner>>() { @Override public List<RecommendedElasticPoolMetricInner> call(ServiceResponse<List<RecommendedElasticPoolMetricInner>> response) { return response.body(); } }); }
java
public Observable<List<RecommendedElasticPoolMetricInner>> listMetricsAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) { return listMetricsWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1<ServiceResponse<List<RecommendedElasticPoolMetricInner>>, List<RecommendedElasticPoolMetricInner>>() { @Override public List<RecommendedElasticPoolMetricInner> call(ServiceResponse<List<RecommendedElasticPoolMetricInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "RecommendedElasticPoolMetricInner", ">", ">", "listMetricsAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "recommendedElasticPoolName", ")", "{", "return", "listMetricsWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "recommendedElasticPoolName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "RecommendedElasticPoolMetricInner", ">", ">", ",", "List", "<", "RecommendedElasticPoolMetricInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "RecommendedElasticPoolMetricInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "RecommendedElasticPoolMetricInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Returns recommented elastic pool metrics. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;RecommendedElasticPoolMetricInner&gt; object
[ "Returns", "recommented", "elastic", "pool", "metrics", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java#L291-L298
PuyallupFoursquare/ccb-api-client-java
src/main/java/com/p4square/ccbapi/serializer/FormBuilder.java
FormBuilder.appendField
public void appendField(final String key, final String value) { """ Append a field to the form. @param key The form key, which must be URLEncoded before calling this method. @param value The value associated with the key. The value will be URLEncoded by this method. """ if (builder.length() > 0) { builder.append("&"); } try { builder.append(key).append("=").append(URLEncoder.encode(value, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new AssertionError("UTF-8 encoding should always be available."); } }
java
public void appendField(final String key, final String value) { if (builder.length() > 0) { builder.append("&"); } try { builder.append(key).append("=").append(URLEncoder.encode(value, "UTF-8")); } catch (UnsupportedEncodingException e) { throw new AssertionError("UTF-8 encoding should always be available."); } }
[ "public", "void", "appendField", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "if", "(", "builder", ".", "length", "(", ")", ">", "0", ")", "{", "builder", ".", "append", "(", "\"&\"", ")", ";", "}", "try", "{", "builder", ".", "append", "(", "key", ")", ".", "append", "(", "\"=\"", ")", ".", "append", "(", "URLEncoder", ".", "encode", "(", "value", ",", "\"UTF-8\"", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "AssertionError", "(", "\"UTF-8 encoding should always be available.\"", ")", ";", "}", "}" ]
Append a field to the form. @param key The form key, which must be URLEncoded before calling this method. @param value The value associated with the key. The value will be URLEncoded by this method.
[ "Append", "a", "field", "to", "the", "form", "." ]
train
https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/serializer/FormBuilder.java#L61-L71
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableListProperty.java
AbstractReadableListProperty.doNotifyListenersOfChangedValues
protected void doNotifyListenersOfChangedValues(int startIndex, List<R> oldItems, List<R> newItems) { """ Notifies the change listeners that items have been replaced. <p> Note that the specified lists of items will be wrapped in unmodifiable lists before being passed to the listeners. @param startIndex Index of the first replaced item. @param oldItems Previous items. @param newItems New items. """ List<ListValueChangeListener<R>> listenersCopy = new ArrayList<ListValueChangeListener<R>>(listeners); List<R> oldUnmodifiable = Collections.unmodifiableList(oldItems); List<R> newUnmodifiable = Collections.unmodifiableList(newItems); for (ListValueChangeListener<R> listener : listenersCopy) { listener.valuesChanged(this, startIndex, oldUnmodifiable, newUnmodifiable); } }
java
protected void doNotifyListenersOfChangedValues(int startIndex, List<R> oldItems, List<R> newItems) { List<ListValueChangeListener<R>> listenersCopy = new ArrayList<ListValueChangeListener<R>>(listeners); List<R> oldUnmodifiable = Collections.unmodifiableList(oldItems); List<R> newUnmodifiable = Collections.unmodifiableList(newItems); for (ListValueChangeListener<R> listener : listenersCopy) { listener.valuesChanged(this, startIndex, oldUnmodifiable, newUnmodifiable); } }
[ "protected", "void", "doNotifyListenersOfChangedValues", "(", "int", "startIndex", ",", "List", "<", "R", ">", "oldItems", ",", "List", "<", "R", ">", "newItems", ")", "{", "List", "<", "ListValueChangeListener", "<", "R", ">>", "listenersCopy", "=", "new", "ArrayList", "<", "ListValueChangeListener", "<", "R", ">", ">", "(", "listeners", ")", ";", "List", "<", "R", ">", "oldUnmodifiable", "=", "Collections", ".", "unmodifiableList", "(", "oldItems", ")", ";", "List", "<", "R", ">", "newUnmodifiable", "=", "Collections", ".", "unmodifiableList", "(", "newItems", ")", ";", "for", "(", "ListValueChangeListener", "<", "R", ">", "listener", ":", "listenersCopy", ")", "{", "listener", ".", "valuesChanged", "(", "this", ",", "startIndex", ",", "oldUnmodifiable", ",", "newUnmodifiable", ")", ";", "}", "}" ]
Notifies the change listeners that items have been replaced. <p> Note that the specified lists of items will be wrapped in unmodifiable lists before being passed to the listeners. @param startIndex Index of the first replaced item. @param oldItems Previous items. @param newItems New items.
[ "Notifies", "the", "change", "listeners", "that", "items", "have", "been", "replaced", ".", "<p", ">", "Note", "that", "the", "specified", "lists", "of", "items", "will", "be", "wrapped", "in", "unmodifiable", "lists", "before", "being", "passed", "to", "the", "listeners", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableListProperty.java#L109-L116
OrienteerBAP/wicket-orientdb
wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/converter/AbstractJointConverter.java
AbstractJointConverter.of
public static <F> AbstractJointConverter<F> of(final SerializableFunction<? super F, String> to, final SerializableFunction<String, ? extends F> from) { """ Utility method to construct converter from 2 functions @param <F> type to convert from @param to function to convert to String @param from function to convert from String @return converter """ return new AbstractJointConverter<F>() { @Override public String convertToString(F value, Locale locale) { return to.apply(value); } @Override public F convertToObject(String value, Locale locale) throws ConversionException { return from.apply(value); } }; }
java
public static <F> AbstractJointConverter<F> of(final SerializableFunction<? super F, String> to, final SerializableFunction<String, ? extends F> from) { return new AbstractJointConverter<F>() { @Override public String convertToString(F value, Locale locale) { return to.apply(value); } @Override public F convertToObject(String value, Locale locale) throws ConversionException { return from.apply(value); } }; }
[ "public", "static", "<", "F", ">", "AbstractJointConverter", "<", "F", ">", "of", "(", "final", "SerializableFunction", "<", "?", "super", "F", ",", "String", ">", "to", ",", "final", "SerializableFunction", "<", "String", ",", "?", "extends", "F", ">", "from", ")", "{", "return", "new", "AbstractJointConverter", "<", "F", ">", "(", ")", "{", "@", "Override", "public", "String", "convertToString", "(", "F", "value", ",", "Locale", "locale", ")", "{", "return", "to", ".", "apply", "(", "value", ")", ";", "}", "@", "Override", "public", "F", "convertToObject", "(", "String", "value", ",", "Locale", "locale", ")", "throws", "ConversionException", "{", "return", "from", ".", "apply", "(", "value", ")", ";", "}", "}", ";", "}" ]
Utility method to construct converter from 2 functions @param <F> type to convert from @param to function to convert to String @param from function to convert from String @return converter
[ "Utility", "method", "to", "construct", "converter", "from", "2", "functions" ]
train
https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/converter/AbstractJointConverter.java#L47-L60
jwtk/jjwt
api/src/main/java/io/jsonwebtoken/lang/Collections.java
Collections.findValueOfType
public static Object findValueOfType(Collection<?> collection, Class<?>[] types) { """ Find a single value of one of the given types in the given Collection: searching the Collection for a value of the first type, then searching for a value of the second type, etc. @param collection the collection to search @param types the types to look for, in prioritized order @return a value of one of the given types found if there is a clear match, or <code>null</code> if none or more than one such value found """ if (isEmpty(collection) || Objects.isEmpty(types)) { return null; } for (Class<?> type : types) { Object value = findValueOfType(collection, type); if (value != null) { return value; } } return null; }
java
public static Object findValueOfType(Collection<?> collection, Class<?>[] types) { if (isEmpty(collection) || Objects.isEmpty(types)) { return null; } for (Class<?> type : types) { Object value = findValueOfType(collection, type); if (value != null) { return value; } } return null; }
[ "public", "static", "Object", "findValueOfType", "(", "Collection", "<", "?", ">", "collection", ",", "Class", "<", "?", ">", "[", "]", "types", ")", "{", "if", "(", "isEmpty", "(", "collection", ")", "||", "Objects", ".", "isEmpty", "(", "types", ")", ")", "{", "return", "null", ";", "}", "for", "(", "Class", "<", "?", ">", "type", ":", "types", ")", "{", "Object", "value", "=", "findValueOfType", "(", "collection", ",", "type", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "value", ";", "}", "}", "return", "null", ";", "}" ]
Find a single value of one of the given types in the given Collection: searching the Collection for a value of the first type, then searching for a value of the second type, etc. @param collection the collection to search @param types the types to look for, in prioritized order @return a value of one of the given types found if there is a clear match, or <code>null</code> if none or more than one such value found
[ "Find", "a", "single", "value", "of", "one", "of", "the", "given", "types", "in", "the", "given", "Collection", ":", "searching", "the", "Collection", "for", "a", "value", "of", "the", "first", "type", "then", "searching", "for", "a", "value", "of", "the", "second", "type", "etc", "." ]
train
https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Collections.java#L258-L269
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
JaxbUtils.unmarshal
public static <T> T unmarshal(Class<T> cl, File f) throws JAXBException { """ Convert the contents of a file to an object of a given class. @param cl Type of object @param f File to be read @return Object of the given type """ return unmarshal(cl, new StreamSource(f)); }
java
public static <T> T unmarshal(Class<T> cl, File f) throws JAXBException { return unmarshal(cl, new StreamSource(f)); }
[ "public", "static", "<", "T", ">", "T", "unmarshal", "(", "Class", "<", "T", ">", "cl", ",", "File", "f", ")", "throws", "JAXBException", "{", "return", "unmarshal", "(", "cl", ",", "new", "StreamSource", "(", "f", ")", ")", ";", "}" ]
Convert the contents of a file to an object of a given class. @param cl Type of object @param f File to be read @return Object of the given type
[ "Convert", "the", "contents", "of", "a", "file", "to", "an", "object", "of", "a", "given", "class", "." ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L253-L255
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/LinearEquationSystem.java
LinearEquationSystem.totalPivotSearch
private IntIntPair totalPivotSearch(int k) { """ Method for total pivot search, searches for x,y in {k,...n}, so that {@code |a_xy| > |a_ij|} @param k search starts at entry (k,k) @return the position of the found pivot element """ double max = 0; int i, j, pivotRow = k, pivotCol = k; double absValue; for(i = k; i < coeff.length; i++) { for(j = k; j < coeff[0].length; j++) { // compute absolute value of // current entry in absValue absValue = Math.abs(coeff[row[i]][col[j]]); // compare absValue with value max // found so far if(max < absValue) { // remember new value and position max = absValue; pivotRow = i; pivotCol = j; } // end if } // end for j } // end for k return new IntIntPair(pivotRow, pivotCol); }
java
private IntIntPair totalPivotSearch(int k) { double max = 0; int i, j, pivotRow = k, pivotCol = k; double absValue; for(i = k; i < coeff.length; i++) { for(j = k; j < coeff[0].length; j++) { // compute absolute value of // current entry in absValue absValue = Math.abs(coeff[row[i]][col[j]]); // compare absValue with value max // found so far if(max < absValue) { // remember new value and position max = absValue; pivotRow = i; pivotCol = j; } // end if } // end for j } // end for k return new IntIntPair(pivotRow, pivotCol); }
[ "private", "IntIntPair", "totalPivotSearch", "(", "int", "k", ")", "{", "double", "max", "=", "0", ";", "int", "i", ",", "j", ",", "pivotRow", "=", "k", ",", "pivotCol", "=", "k", ";", "double", "absValue", ";", "for", "(", "i", "=", "k", ";", "i", "<", "coeff", ".", "length", ";", "i", "++", ")", "{", "for", "(", "j", "=", "k", ";", "j", "<", "coeff", "[", "0", "]", ".", "length", ";", "j", "++", ")", "{", "// compute absolute value of", "// current entry in absValue", "absValue", "=", "Math", ".", "abs", "(", "coeff", "[", "row", "[", "i", "]", "]", "[", "col", "[", "j", "]", "]", ")", ";", "// compare absValue with value max", "// found so far", "if", "(", "max", "<", "absValue", ")", "{", "// remember new value and position", "max", "=", "absValue", ";", "pivotRow", "=", "i", ";", "pivotCol", "=", "j", ";", "}", "// end if", "}", "// end for j", "}", "// end for k", "return", "new", "IntIntPair", "(", "pivotRow", ",", "pivotCol", ")", ";", "}" ]
Method for total pivot search, searches for x,y in {k,...n}, so that {@code |a_xy| > |a_ij|} @param k search starts at entry (k,k) @return the position of the found pivot element
[ "Method", "for", "total", "pivot", "search", "searches", "for", "x", "y", "in", "{", "k", "...", "n", "}", "so", "that", "{", "@code", "|a_xy|", ">", "|a_ij|", "}" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/LinearEquationSystem.java#L472-L493
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/utils/ClassFactory.java
ClassFactory.stringToClassInstances
public static List<Object> stringToClassInstances(String str, String separator, Class[] attrTypes, Object[] attrValues) throws DISIException { """ Parses a string of class names separated by separator into a list of objects. @param str names of classes @param separator separator characters @param attrTypes attrTypes @param attrValues attrValues @return ArrayList of class instances @throws DISIException DISIException """ ArrayList<Object> tmp = new ArrayList<Object>(); StringTokenizer stringTokenizer = new StringTokenizer(str, separator); while (stringTokenizer.hasMoreTokens()) { Object obj = getClassInstance(stringTokenizer.nextToken(), attrTypes, attrValues); if (obj != null) { tmp.add(obj); } } return tmp; }
java
public static List<Object> stringToClassInstances(String str, String separator, Class[] attrTypes, Object[] attrValues) throws DISIException { ArrayList<Object> tmp = new ArrayList<Object>(); StringTokenizer stringTokenizer = new StringTokenizer(str, separator); while (stringTokenizer.hasMoreTokens()) { Object obj = getClassInstance(stringTokenizer.nextToken(), attrTypes, attrValues); if (obj != null) { tmp.add(obj); } } return tmp; }
[ "public", "static", "List", "<", "Object", ">", "stringToClassInstances", "(", "String", "str", ",", "String", "separator", ",", "Class", "[", "]", "attrTypes", ",", "Object", "[", "]", "attrValues", ")", "throws", "DISIException", "{", "ArrayList", "<", "Object", ">", "tmp", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "StringTokenizer", "stringTokenizer", "=", "new", "StringTokenizer", "(", "str", ",", "separator", ")", ";", "while", "(", "stringTokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "Object", "obj", "=", "getClassInstance", "(", "stringTokenizer", ".", "nextToken", "(", ")", ",", "attrTypes", ",", "attrValues", ")", ";", "if", "(", "obj", "!=", "null", ")", "{", "tmp", ".", "add", "(", "obj", ")", ";", "}", "}", "return", "tmp", ";", "}" ]
Parses a string of class names separated by separator into a list of objects. @param str names of classes @param separator separator characters @param attrTypes attrTypes @param attrValues attrValues @return ArrayList of class instances @throws DISIException DISIException
[ "Parses", "a", "string", "of", "class", "names", "separated", "by", "separator", "into", "a", "list", "of", "objects", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/utils/ClassFactory.java#L129-L140
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.getRelativePath
public static File getRelativePath(final File basePath, final File refPath) { """ Resolves a path reference against a base path. @param basePath base path @param refPath reference path @return relative path, or refPath if different root means no relative path is possible """ if (!basePath.toPath().getRoot().equals(refPath.toPath().getRoot())) { return refPath; } return basePath.toPath().getParent().relativize(refPath.toPath()).toFile(); }
java
public static File getRelativePath(final File basePath, final File refPath) { if (!basePath.toPath().getRoot().equals(refPath.toPath().getRoot())) { return refPath; } return basePath.toPath().getParent().relativize(refPath.toPath()).toFile(); }
[ "public", "static", "File", "getRelativePath", "(", "final", "File", "basePath", ",", "final", "File", "refPath", ")", "{", "if", "(", "!", "basePath", ".", "toPath", "(", ")", ".", "getRoot", "(", ")", ".", "equals", "(", "refPath", ".", "toPath", "(", ")", ".", "getRoot", "(", ")", ")", ")", "{", "return", "refPath", ";", "}", "return", "basePath", ".", "toPath", "(", ")", ".", "getParent", "(", ")", ".", "relativize", "(", "refPath", ".", "toPath", "(", ")", ")", ".", "toFile", "(", ")", ";", "}" ]
Resolves a path reference against a base path. @param basePath base path @param refPath reference path @return relative path, or refPath if different root means no relative path is possible
[ "Resolves", "a", "path", "reference", "against", "a", "base", "path", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L168-L173
osglworks/java-tool
src/main/java/org/osgl/Lang.java
F1.compose
public <X1, X2, X3, X4> F4<X1, X2, X3, X4, R> compose(final Func4<? super X1, ? super X2, ? super X3, ? super X4, ? extends P1> before) { """ Returns an {@code F3&lt;X1, X2, X3, X4, R&gt;>} function by composing the specified {@code Func3&ltX1, X2, X3, X4, P1&gt;} function with this function applied last @param <X1> the type of first param the new function applied to @param <X2> the type of second param the new function applied to @param <X3> the type of third param the new function applied to @param <X4> the type of fourth param the new function applied to @param before the function to be applied first when applying the return function @return an new function such that f(x1, x2, x3, x4) == apply(f1(x1, x2, x3, x4)) """ final F1<P1, R> me = this; return new F4<X1, X2, X3, X4, R>() { @Override public R apply(X1 x1, X2 x2, X3 x3, X4 x4) { return me.apply(before.apply(x1, x2, x3, x4)); } }; }
java
public <X1, X2, X3, X4> F4<X1, X2, X3, X4, R> compose(final Func4<? super X1, ? super X2, ? super X3, ? super X4, ? extends P1> before) { final F1<P1, R> me = this; return new F4<X1, X2, X3, X4, R>() { @Override public R apply(X1 x1, X2 x2, X3 x3, X4 x4) { return me.apply(before.apply(x1, x2, x3, x4)); } }; }
[ "public", "<", "X1", ",", "X2", ",", "X3", ",", "X4", ">", "F4", "<", "X1", ",", "X2", ",", "X3", ",", "X4", ",", "R", ">", "compose", "(", "final", "Func4", "<", "?", "super", "X1", ",", "?", "super", "X2", ",", "?", "super", "X3", ",", "?", "super", "X4", ",", "?", "extends", "P1", ">", "before", ")", "{", "final", "F1", "<", "P1", ",", "R", ">", "me", "=", "this", ";", "return", "new", "F4", "<", "X1", ",", "X2", ",", "X3", ",", "X4", ",", "R", ">", "(", ")", "{", "@", "Override", "public", "R", "apply", "(", "X1", "x1", ",", "X2", "x2", ",", "X3", "x3", ",", "X4", "x4", ")", "{", "return", "me", ".", "apply", "(", "before", ".", "apply", "(", "x1", ",", "x2", ",", "x3", ",", "x4", ")", ")", ";", "}", "}", ";", "}" ]
Returns an {@code F3&lt;X1, X2, X3, X4, R&gt;>} function by composing the specified {@code Func3&ltX1, X2, X3, X4, P1&gt;} function with this function applied last @param <X1> the type of first param the new function applied to @param <X2> the type of second param the new function applied to @param <X3> the type of third param the new function applied to @param <X4> the type of fourth param the new function applied to @param before the function to be applied first when applying the return function @return an new function such that f(x1, x2, x3, x4) == apply(f1(x1, x2, x3, x4))
[ "Returns", "an", "{", "@code", "F3&lt", ";", "X1", "X2", "X3", "X4", "R&gt", ";", ">", "}", "function", "by", "composing", "the", "specified", "{", "@code", "Func3&ltX1", "X2", "X3", "X4", "P1&gt", ";", "}", "function", "with", "this", "function", "applied", "last" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L728-L737
casbin/jcasbin
src/main/java/org/casbin/jcasbin/util/BuiltInFunctions.java
BuiltInFunctions.ipMatch
public static boolean ipMatch(String ip1, String ip2) { """ ipMatch determines whether IP address ip1 matches the pattern of IP address ip2, ip2 can be an IP address or a CIDR pattern. For example, "192.168.2.123" matches "192.168.2.0/24" @param ip1 the first argument. @param ip2 the second argument. @return whether ip1 matches ip2. """ IPAddressString ipas1 = new IPAddressString(ip1); try { ipas1.validateIPv4(); } catch (AddressStringException e) { e.printStackTrace(); throw new Error("invalid argument: ip1 in IPMatch() function is not an IP address."); } IPAddressString ipas2 = new IPAddressString(ip2); try { ipas2.validate(); } catch (AddressStringException e) { e.printStackTrace(); throw new Error("invalid argument: ip2 in IPMatch() function is neither an IP address nor a CIDR."); } if (ipas1.equals(ipas2)) { return true; } IPAddress ipa1; IPAddress ipa2; try { ipa1 = ipas1.toAddress(); ipa2 = ipas2.toAddress(); } catch (AddressStringException e) { e.printStackTrace(); throw new Error("invalid argument: ip1 or ip2 in IPMatch() function is not an IP address."); } Integer prefix = ipa2.getNetworkPrefixLength(); IPAddress mask = ipa2.getNetwork().getNetworkMask(prefix, false); return ipa1.mask(mask).equals(ipas2.getHostAddress()); }
java
public static boolean ipMatch(String ip1, String ip2) { IPAddressString ipas1 = new IPAddressString(ip1); try { ipas1.validateIPv4(); } catch (AddressStringException e) { e.printStackTrace(); throw new Error("invalid argument: ip1 in IPMatch() function is not an IP address."); } IPAddressString ipas2 = new IPAddressString(ip2); try { ipas2.validate(); } catch (AddressStringException e) { e.printStackTrace(); throw new Error("invalid argument: ip2 in IPMatch() function is neither an IP address nor a CIDR."); } if (ipas1.equals(ipas2)) { return true; } IPAddress ipa1; IPAddress ipa2; try { ipa1 = ipas1.toAddress(); ipa2 = ipas2.toAddress(); } catch (AddressStringException e) { e.printStackTrace(); throw new Error("invalid argument: ip1 or ip2 in IPMatch() function is not an IP address."); } Integer prefix = ipa2.getNetworkPrefixLength(); IPAddress mask = ipa2.getNetwork().getNetworkMask(prefix, false); return ipa1.mask(mask).equals(ipas2.getHostAddress()); }
[ "public", "static", "boolean", "ipMatch", "(", "String", "ip1", ",", "String", "ip2", ")", "{", "IPAddressString", "ipas1", "=", "new", "IPAddressString", "(", "ip1", ")", ";", "try", "{", "ipas1", ".", "validateIPv4", "(", ")", ";", "}", "catch", "(", "AddressStringException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "new", "Error", "(", "\"invalid argument: ip1 in IPMatch() function is not an IP address.\"", ")", ";", "}", "IPAddressString", "ipas2", "=", "new", "IPAddressString", "(", "ip2", ")", ";", "try", "{", "ipas2", ".", "validate", "(", ")", ";", "}", "catch", "(", "AddressStringException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "new", "Error", "(", "\"invalid argument: ip2 in IPMatch() function is neither an IP address nor a CIDR.\"", ")", ";", "}", "if", "(", "ipas1", ".", "equals", "(", "ipas2", ")", ")", "{", "return", "true", ";", "}", "IPAddress", "ipa1", ";", "IPAddress", "ipa2", ";", "try", "{", "ipa1", "=", "ipas1", ".", "toAddress", "(", ")", ";", "ipa2", "=", "ipas2", ".", "toAddress", "(", ")", ";", "}", "catch", "(", "AddressStringException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "new", "Error", "(", "\"invalid argument: ip1 or ip2 in IPMatch() function is not an IP address.\"", ")", ";", "}", "Integer", "prefix", "=", "ipa2", ".", "getNetworkPrefixLength", "(", ")", ";", "IPAddress", "mask", "=", "ipa2", ".", "getNetwork", "(", ")", ".", "getNetworkMask", "(", "prefix", ",", "false", ")", ";", "return", "ipa1", ".", "mask", "(", "mask", ")", ".", "equals", "(", "ipas2", ".", "getHostAddress", "(", ")", ")", ";", "}" ]
ipMatch determines whether IP address ip1 matches the pattern of IP address ip2, ip2 can be an IP address or a CIDR pattern. For example, "192.168.2.123" matches "192.168.2.0/24" @param ip1 the first argument. @param ip2 the second argument. @return whether ip1 matches ip2.
[ "ipMatch", "determines", "whether", "IP", "address", "ip1", "matches", "the", "pattern", "of", "IP", "address", "ip2", "ip2", "can", "be", "an", "IP", "address", "or", "a", "CIDR", "pattern", ".", "For", "example", "192", ".", "168", ".", "2", ".", "123", "matches", "192", ".", "168", ".", "2", ".", "0", "/", "24" ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/util/BuiltInFunctions.java#L116-L150
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Convert.java
Convert.toInteger
public static Integer toInteger(Object value) { """ Converts value to Integer if it can. If value is a Integer, it is returned, if it is a Number, it is promoted to Integer and then returned, in all other cases, it converts the value to String, then tries to parse Integer from it. @param value value to be converted to Integer. @return value converted to Integer. """ if (value == null) { return null; } else if (value instanceof Integer) { return (Integer) value; } else if (value instanceof Number) { return ((Number) value).intValue(); } else { try { return Integer.valueOf(value.toString().trim()); } catch (NumberFormatException e) { throw new ConversionException("failed to convert: '" + value + "' to Integer", e); } } }
java
public static Integer toInteger(Object value) { if (value == null) { return null; } else if (value instanceof Integer) { return (Integer) value; } else if (value instanceof Number) { return ((Number) value).intValue(); } else { try { return Integer.valueOf(value.toString().trim()); } catch (NumberFormatException e) { throw new ConversionException("failed to convert: '" + value + "' to Integer", e); } } }
[ "public", "static", "Integer", "toInteger", "(", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "value", "instanceof", "Integer", ")", "{", "return", "(", "Integer", ")", "value", ";", "}", "else", "if", "(", "value", "instanceof", "Number", ")", "{", "return", "(", "(", "Number", ")", "value", ")", ".", "intValue", "(", ")", ";", "}", "else", "{", "try", "{", "return", "Integer", ".", "valueOf", "(", "value", ".", "toString", "(", ")", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "ConversionException", "(", "\"failed to convert: '\"", "+", "value", "+", "\"' to Integer\"", ",", "e", ")", ";", "}", "}", "}" ]
Converts value to Integer if it can. If value is a Integer, it is returned, if it is a Number, it is promoted to Integer and then returned, in all other cases, it converts the value to String, then tries to parse Integer from it. @param value value to be converted to Integer. @return value converted to Integer.
[ "Converts", "value", "to", "Integer", "if", "it", "can", ".", "If", "value", "is", "a", "Integer", "it", "is", "returned", "if", "it", "is", "a", "Number", "it", "is", "promoted", "to", "Integer", "and", "then", "returned", "in", "all", "other", "cases", "it", "converts", "the", "value", "to", "String", "then", "tries", "to", "parse", "Integer", "from", "it", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Convert.java#L373-L387
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCClobClient.java
JDBCClobClient.setString
public synchronized int setString(long pos, String str) throws SQLException { """ Writes the given Java <code>String</code> to the <code>CLOB</code> value that this <code>Clob</code> object designates at the position <code>pos</code>. @param pos the position at which to start writing to the <code>CLOB</code> value that this <code>Clob</code> object represents @param str the string to be written to the <code>CLOB</code> value that this <code>Clob</code> designates @return the number of characters written @throws SQLException if there is an error accessing the <code>CLOB</code> value """ return setString(pos, str, 0, str.length()); }
java
public synchronized int setString(long pos, String str) throws SQLException { return setString(pos, str, 0, str.length()); }
[ "public", "synchronized", "int", "setString", "(", "long", "pos", ",", "String", "str", ")", "throws", "SQLException", "{", "return", "setString", "(", "pos", ",", "str", ",", "0", ",", "str", ".", "length", "(", ")", ")", ";", "}" ]
Writes the given Java <code>String</code> to the <code>CLOB</code> value that this <code>Clob</code> object designates at the position <code>pos</code>. @param pos the position at which to start writing to the <code>CLOB</code> value that this <code>Clob</code> object represents @param str the string to be written to the <code>CLOB</code> value that this <code>Clob</code> designates @return the number of characters written @throws SQLException if there is an error accessing the <code>CLOB</code> value
[ "Writes", "the", "given", "Java", "<code", ">", "String<", "/", "code", ">", "to", "the", "<code", ">", "CLOB<", "/", "code", ">", "value", "that", "this", "<code", ">", "Clob<", "/", "code", ">", "object", "designates", "at", "the", "position", "<code", ">", "pos<", "/", "code", ">", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCClobClient.java#L210-L213
aoindustries/aocode-public
src/main/java/com/aoindustries/net/UrlUtils.java
UrlUtils.decodeUrlPath
public static String decodeUrlPath(String href, String encoding) throws UnsupportedEncodingException { """ Decodes the URL up to the first ?, if present. Does not decode any characters in the set { '?', ':', '/', ';', '#', '+' }. Does not decode tel: urls (case-sensitive). @see #encodeUrlPath(java.lang.String) """ if(href.startsWith("tel:")) return href; int len = href.length(); int pos = 0; StringBuilder SB = new StringBuilder(href.length()*2); // Leave a little room for encoding while(pos<len) { int nextPos = StringUtility.indexOf(href, noEncodeCharacters, pos); if(nextPos==-1) { SB.append(URLDecoder.decode(href.substring(pos, len), encoding)); pos = len; } else { SB.append(URLDecoder.decode(href.substring(pos, nextPos), encoding)); char nextChar = href.charAt(nextPos); if(nextChar=='?') { // End decoding SB.append(href, nextPos, len); pos = len; } else { SB.append(nextChar); pos = nextPos+1; } } } return SB.toString(); }
java
public static String decodeUrlPath(String href, String encoding) throws UnsupportedEncodingException { if(href.startsWith("tel:")) return href; int len = href.length(); int pos = 0; StringBuilder SB = new StringBuilder(href.length()*2); // Leave a little room for encoding while(pos<len) { int nextPos = StringUtility.indexOf(href, noEncodeCharacters, pos); if(nextPos==-1) { SB.append(URLDecoder.decode(href.substring(pos, len), encoding)); pos = len; } else { SB.append(URLDecoder.decode(href.substring(pos, nextPos), encoding)); char nextChar = href.charAt(nextPos); if(nextChar=='?') { // End decoding SB.append(href, nextPos, len); pos = len; } else { SB.append(nextChar); pos = nextPos+1; } } } return SB.toString(); }
[ "public", "static", "String", "decodeUrlPath", "(", "String", "href", ",", "String", "encoding", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "href", ".", "startsWith", "(", "\"tel:\"", ")", ")", "return", "href", ";", "int", "len", "=", "href", ".", "length", "(", ")", ";", "int", "pos", "=", "0", ";", "StringBuilder", "SB", "=", "new", "StringBuilder", "(", "href", ".", "length", "(", ")", "*", "2", ")", ";", "// Leave a little room for encoding", "while", "(", "pos", "<", "len", ")", "{", "int", "nextPos", "=", "StringUtility", ".", "indexOf", "(", "href", ",", "noEncodeCharacters", ",", "pos", ")", ";", "if", "(", "nextPos", "==", "-", "1", ")", "{", "SB", ".", "append", "(", "URLDecoder", ".", "decode", "(", "href", ".", "substring", "(", "pos", ",", "len", ")", ",", "encoding", ")", ")", ";", "pos", "=", "len", ";", "}", "else", "{", "SB", ".", "append", "(", "URLDecoder", ".", "decode", "(", "href", ".", "substring", "(", "pos", ",", "nextPos", ")", ",", "encoding", ")", ")", ";", "char", "nextChar", "=", "href", ".", "charAt", "(", "nextPos", ")", ";", "if", "(", "nextChar", "==", "'", "'", ")", "{", "// End decoding", "SB", ".", "append", "(", "href", ",", "nextPos", ",", "len", ")", ";", "pos", "=", "len", ";", "}", "else", "{", "SB", ".", "append", "(", "nextChar", ")", ";", "pos", "=", "nextPos", "+", "1", ";", "}", "}", "}", "return", "SB", ".", "toString", "(", ")", ";", "}" ]
Decodes the URL up to the first ?, if present. Does not decode any characters in the set { '?', ':', '/', ';', '#', '+' }. Does not decode tel: urls (case-sensitive). @see #encodeUrlPath(java.lang.String)
[ "Decodes", "the", "URL", "up", "to", "the", "first", "?", "if", "present", ".", "Does", "not", "decode", "any", "characters", "in", "the", "set", "{", "?", ":", "/", ";", "#", "+", "}", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/net/UrlUtils.java#L105-L129
OrienteerBAP/wicket-orientdb
wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryDataProvider.java
OQueryDataProvider.setSort
public void setSort(String property, Boolean order) { """ Set sort @param property property to sort on @param order order to apply: true is for ascending, false is for descending """ SortOrder sortOrder = order==null?SortOrder.ASCENDING:(order?SortOrder.ASCENDING:SortOrder.DESCENDING); if(property==null) { if(order==null) setSort(null); else setSort("@rid", sortOrder); } else { super.setSort(property, sortOrder); } }
java
public void setSort(String property, Boolean order) { SortOrder sortOrder = order==null?SortOrder.ASCENDING:(order?SortOrder.ASCENDING:SortOrder.DESCENDING); if(property==null) { if(order==null) setSort(null); else setSort("@rid", sortOrder); } else { super.setSort(property, sortOrder); } }
[ "public", "void", "setSort", "(", "String", "property", ",", "Boolean", "order", ")", "{", "SortOrder", "sortOrder", "=", "order", "==", "null", "?", "SortOrder", ".", "ASCENDING", ":", "(", "order", "?", "SortOrder", ".", "ASCENDING", ":", "SortOrder", ".", "DESCENDING", ")", ";", "if", "(", "property", "==", "null", ")", "{", "if", "(", "order", "==", "null", ")", "setSort", "(", "null", ")", ";", "else", "setSort", "(", "\"@rid\"", ",", "sortOrder", ")", ";", "}", "else", "{", "super", ".", "setSort", "(", "property", ",", "sortOrder", ")", ";", "}", "}" ]
Set sort @param property property to sort on @param order order to apply: true is for ascending, false is for descending
[ "Set", "sort" ]
train
https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryDataProvider.java#L107-L115
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/RawResolvedFeatures.java
RawResolvedFeatures.getResolvedFeatures
static RawResolvedFeatures getResolvedFeatures(JvmDeclaredType type, CommonTypeComputationServices services) { """ Returns an existing instance of {@link RawResolvedFeatures} or creates a new one that will be cached on the type. It will not add itself as {@link EContentAdapter} but use the {@link JvmTypeChangeDispatcher} instead. """ final List<Adapter> adapterList = type.eAdapters(); RawResolvedFeatures adapter = (RawResolvedFeatures) EcoreUtil.getAdapter(adapterList, RawResolvedFeatures.class); if (adapter != null) { return adapter; } final RawResolvedFeatures newAdapter = new RawResolvedFeatures(type, services); requestNotificationOnChange(type, new Runnable() { @Override public void run() { newAdapter.clear(); adapterList.remove(newAdapter); } }); adapterList.add(newAdapter); return newAdapter; }
java
static RawResolvedFeatures getResolvedFeatures(JvmDeclaredType type, CommonTypeComputationServices services) { final List<Adapter> adapterList = type.eAdapters(); RawResolvedFeatures adapter = (RawResolvedFeatures) EcoreUtil.getAdapter(adapterList, RawResolvedFeatures.class); if (adapter != null) { return adapter; } final RawResolvedFeatures newAdapter = new RawResolvedFeatures(type, services); requestNotificationOnChange(type, new Runnable() { @Override public void run() { newAdapter.clear(); adapterList.remove(newAdapter); } }); adapterList.add(newAdapter); return newAdapter; }
[ "static", "RawResolvedFeatures", "getResolvedFeatures", "(", "JvmDeclaredType", "type", ",", "CommonTypeComputationServices", "services", ")", "{", "final", "List", "<", "Adapter", ">", "adapterList", "=", "type", ".", "eAdapters", "(", ")", ";", "RawResolvedFeatures", "adapter", "=", "(", "RawResolvedFeatures", ")", "EcoreUtil", ".", "getAdapter", "(", "adapterList", ",", "RawResolvedFeatures", ".", "class", ")", ";", "if", "(", "adapter", "!=", "null", ")", "{", "return", "adapter", ";", "}", "final", "RawResolvedFeatures", "newAdapter", "=", "new", "RawResolvedFeatures", "(", "type", ",", "services", ")", ";", "requestNotificationOnChange", "(", "type", ",", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "newAdapter", ".", "clear", "(", ")", ";", "adapterList", ".", "remove", "(", "newAdapter", ")", ";", "}", "}", ")", ";", "adapterList", ".", "add", "(", "newAdapter", ")", ";", "return", "newAdapter", ";", "}" ]
Returns an existing instance of {@link RawResolvedFeatures} or creates a new one that will be cached on the type. It will not add itself as {@link EContentAdapter} but use the {@link JvmTypeChangeDispatcher} instead.
[ "Returns", "an", "existing", "instance", "of", "{" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/RawResolvedFeatures.java#L63-L79
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.task_contactChange_GET
public ArrayList<Long> task_contactChange_GET(String askingAccount, net.minidev.ovh.api.nichandle.changecontact.OvhTaskStateEnum state, String toAccount) throws IOException { """ List of service contact change tasks you are involved in REST: GET /me/task/contactChange @param toAccount [required] Filter the value of toAccount property (like) @param state [required] Filter the value of state property (like) @param askingAccount [required] Filter the value of askingAccount property (like) """ String qPath = "/me/task/contactChange"; StringBuilder sb = path(qPath); query(sb, "askingAccount", askingAccount); query(sb, "state", state); query(sb, "toAccount", toAccount); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> task_contactChange_GET(String askingAccount, net.minidev.ovh.api.nichandle.changecontact.OvhTaskStateEnum state, String toAccount) throws IOException { String qPath = "/me/task/contactChange"; StringBuilder sb = path(qPath); query(sb, "askingAccount", askingAccount); query(sb, "state", state); query(sb, "toAccount", toAccount); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "task_contactChange_GET", "(", "String", "askingAccount", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "nichandle", ".", "changecontact", ".", "OvhTaskStateEnum", "state", ",", "String", "toAccount", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/task/contactChange\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"askingAccount\"", ",", "askingAccount", ")", ";", "query", "(", "sb", ",", "\"state\"", ",", "state", ")", ";", "query", "(", "sb", ",", "\"toAccount\"", ",", "toAccount", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t2", ")", ";", "}" ]
List of service contact change tasks you are involved in REST: GET /me/task/contactChange @param toAccount [required] Filter the value of toAccount property (like) @param state [required] Filter the value of state property (like) @param askingAccount [required] Filter the value of askingAccount property (like)
[ "List", "of", "service", "contact", "change", "tasks", "you", "are", "involved", "in" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2460-L2468
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/role/RoleManager.java
RoleManager.renameRole
@Nonnull public EChange renameRole (@Nullable final String sRoleID, @Nonnull @Nonempty final String sNewName) { """ Rename the role with the passed ID @param sRoleID The ID of the role to be renamed. May be <code>null</code>. @param sNewName The new name of the role. May neither be <code>null</code> nor empty. @return {@link EChange#CHANGED} if the passed role ID was found, and the new name is different from the old name of he role """ // Resolve user group final Role aRole = getOfID (sRoleID); if (aRole == null) { AuditHelper.onAuditModifyFailure (Role.OT, sRoleID, "no-such-id"); return EChange.UNCHANGED; } m_aRWLock.writeLock ().lock (); try { if (aRole.setName (sNewName).isUnchanged ()) return EChange.UNCHANGED; BusinessObjectHelper.setLastModificationNow (aRole); internalUpdateItem (aRole); } finally { m_aRWLock.writeLock ().unlock (); } AuditHelper.onAuditModifySuccess (Role.OT, "name", sRoleID, sNewName); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onRoleRenamed (aRole)); return EChange.CHANGED; }
java
@Nonnull public EChange renameRole (@Nullable final String sRoleID, @Nonnull @Nonempty final String sNewName) { // Resolve user group final Role aRole = getOfID (sRoleID); if (aRole == null) { AuditHelper.onAuditModifyFailure (Role.OT, sRoleID, "no-such-id"); return EChange.UNCHANGED; } m_aRWLock.writeLock ().lock (); try { if (aRole.setName (sNewName).isUnchanged ()) return EChange.UNCHANGED; BusinessObjectHelper.setLastModificationNow (aRole); internalUpdateItem (aRole); } finally { m_aRWLock.writeLock ().unlock (); } AuditHelper.onAuditModifySuccess (Role.OT, "name", sRoleID, sNewName); // Execute callback as the very last action m_aCallbacks.forEach (aCB -> aCB.onRoleRenamed (aRole)); return EChange.CHANGED; }
[ "@", "Nonnull", "public", "EChange", "renameRole", "(", "@", "Nullable", "final", "String", "sRoleID", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sNewName", ")", "{", "// Resolve user group", "final", "Role", "aRole", "=", "getOfID", "(", "sRoleID", ")", ";", "if", "(", "aRole", "==", "null", ")", "{", "AuditHelper", ".", "onAuditModifyFailure", "(", "Role", ".", "OT", ",", "sRoleID", ",", "\"no-such-id\"", ")", ";", "return", "EChange", ".", "UNCHANGED", ";", "}", "m_aRWLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "aRole", ".", "setName", "(", "sNewName", ")", ".", "isUnchanged", "(", ")", ")", "return", "EChange", ".", "UNCHANGED", ";", "BusinessObjectHelper", ".", "setLastModificationNow", "(", "aRole", ")", ";", "internalUpdateItem", "(", "aRole", ")", ";", "}", "finally", "{", "m_aRWLock", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "AuditHelper", ".", "onAuditModifySuccess", "(", "Role", ".", "OT", ",", "\"name\"", ",", "sRoleID", ",", "sNewName", ")", ";", "// Execute callback as the very last action", "m_aCallbacks", ".", "forEach", "(", "aCB", "->", "aCB", ".", "onRoleRenamed", "(", "aRole", ")", ")", ";", "return", "EChange", ".", "CHANGED", ";", "}" ]
Rename the role with the passed ID @param sRoleID The ID of the role to be renamed. May be <code>null</code>. @param sNewName The new name of the role. May neither be <code>null</code> nor empty. @return {@link EChange#CHANGED} if the passed role ID was found, and the new name is different from the old name of he role
[ "Rename", "the", "role", "with", "the", "passed", "ID" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/role/RoleManager.java#L197-L227
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.addFieldAliases
private void addFieldAliases(Decl.Variable p, EnclosingScope scope) { """ In the special case of a record type declaration, those fields contained in the record are registered as "field aliases". This means they can be referred to directly from the type invariant, rather than requiring an additional variable be declared. For example, the following is permitted: <pre> type Point is {int x, int y} where x >= 0 && y >= 0 </pre> Here, <code>x</code> and <code>y</code> are "field aliases" within the scope of the type invariant. In essence, what happens is that the above is silently transformed into the following: <pre> type Point is ({int x, int y} $) where $.x >= 0 && $.y >= 0 </pre> The anonymous variable name <code>$</code> is chosen because it cannot conflict with a declared variable in the program source (i.e. it is not a valid variable identifier). @param p @param scope """ Type t = p.getType(); if (t instanceof Type.Record) { // This is currently the only situation in which field aliases can // arise. Type.Record r = (Type.Record) t; for (Type.Field fd : r.getFields()) { scope.declareFieldAlias(fd.getName()); } } }
java
private void addFieldAliases(Decl.Variable p, EnclosingScope scope) { Type t = p.getType(); if (t instanceof Type.Record) { // This is currently the only situation in which field aliases can // arise. Type.Record r = (Type.Record) t; for (Type.Field fd : r.getFields()) { scope.declareFieldAlias(fd.getName()); } } }
[ "private", "void", "addFieldAliases", "(", "Decl", ".", "Variable", "p", ",", "EnclosingScope", "scope", ")", "{", "Type", "t", "=", "p", ".", "getType", "(", ")", ";", "if", "(", "t", "instanceof", "Type", ".", "Record", ")", "{", "// This is currently the only situation in which field aliases can", "// arise.", "Type", ".", "Record", "r", "=", "(", "Type", ".", "Record", ")", "t", ";", "for", "(", "Type", ".", "Field", "fd", ":", "r", ".", "getFields", "(", ")", ")", "{", "scope", ".", "declareFieldAlias", "(", "fd", ".", "getName", "(", ")", ")", ";", "}", "}", "}" ]
In the special case of a record type declaration, those fields contained in the record are registered as "field aliases". This means they can be referred to directly from the type invariant, rather than requiring an additional variable be declared. For example, the following is permitted: <pre> type Point is {int x, int y} where x >= 0 && y >= 0 </pre> Here, <code>x</code> and <code>y</code> are "field aliases" within the scope of the type invariant. In essence, what happens is that the above is silently transformed into the following: <pre> type Point is ({int x, int y} $) where $.x >= 0 && $.y >= 0 </pre> The anonymous variable name <code>$</code> is chosen because it cannot conflict with a declared variable in the program source (i.e. it is not a valid variable identifier). @param p @param scope
[ "In", "the", "special", "case", "of", "a", "record", "type", "declaration", "those", "fields", "contained", "in", "the", "record", "are", "registered", "as", "field", "aliases", ".", "This", "means", "they", "can", "be", "referred", "to", "directly", "from", "the", "type", "invariant", "rather", "than", "requiring", "an", "additional", "variable", "be", "declared", ".", "For", "example", "the", "following", "is", "permitted", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L510-L520
cycorp/api-suite
core-api/src/main/java/com/cyc/kb/exception/KbTypeException.java
KbTypeException.fromThrowable
public static KbTypeException fromThrowable(String message, Throwable cause) { """ Converts a Throwable to a KbTypeException with the specified detail message. If the Throwable is a KbTypeException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new KbTypeException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a KbTypeException """ return (cause instanceof KbTypeException && Objects.equals(message, cause.getMessage())) ? (KbTypeException) cause : new KbTypeException(message, cause); }
java
public static KbTypeException fromThrowable(String message, Throwable cause) { return (cause instanceof KbTypeException && Objects.equals(message, cause.getMessage())) ? (KbTypeException) cause : new KbTypeException(message, cause); }
[ "public", "static", "KbTypeException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "KbTypeException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getMessage", "(", ")", ")", ")", "?", "(", "KbTypeException", ")", "cause", ":", "new", "KbTypeException", "(", "message", ",", "cause", ")", ";", "}" ]
Converts a Throwable to a KbTypeException with the specified detail message. If the Throwable is a KbTypeException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new KbTypeException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a KbTypeException
[ "Converts", "a", "Throwable", "to", "a", "KbTypeException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "KbTypeException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "the", "one", "supplied", "the", "Throwable", "will", "be", "passed", "through", "unmodified", ";", "otherwise", "it", "will", "be", "wrapped", "in", "a", "new", "KbTypeException", "with", "the", "detail", "message", "." ]
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbTypeException.java#L63-L67