repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
jenkinsci/jenkins
core/src/main/java/jenkins/util/AntClassLoader.java
AntClassLoader.defineClassFromData
protected Class defineClassFromData(File container, byte[] classData, String classname) throws IOException { """ Define a class given its bytes @param container the container from which the class data has been read may be a directory or a jar/zip file. @param classData the bytecode data for the class @param classname the name of the class @return the Class instance created from the given data @throws IOException if the class data cannot be read. """ definePackage(container, classname); ProtectionDomain currentPd = Project.class.getProtectionDomain(); String classResource = getClassFilename(classname); CodeSource src = new CodeSource(FILE_UTILS.getFileURL(container), getCertificates(container, classResource)); ProtectionDomain classesPd = new ProtectionDomain(src, currentPd.getPermissions(), this, currentPd.getPrincipals()); return defineClass(classname, classData, 0, classData.length, classesPd); }
java
protected Class defineClassFromData(File container, byte[] classData, String classname) throws IOException { definePackage(container, classname); ProtectionDomain currentPd = Project.class.getProtectionDomain(); String classResource = getClassFilename(classname); CodeSource src = new CodeSource(FILE_UTILS.getFileURL(container), getCertificates(container, classResource)); ProtectionDomain classesPd = new ProtectionDomain(src, currentPd.getPermissions(), this, currentPd.getPrincipals()); return defineClass(classname, classData, 0, classData.length, classesPd); }
[ "protected", "Class", "defineClassFromData", "(", "File", "container", ",", "byte", "[", "]", "classData", ",", "String", "classname", ")", "throws", "IOException", "{", "definePackage", "(", "container", ",", "classname", ")", ";", "ProtectionDomain", "currentPd"...
Define a class given its bytes @param container the container from which the class data has been read may be a directory or a jar/zip file. @param classData the bytecode data for the class @param classname the name of the class @return the Class instance created from the given data @throws IOException if the class data cannot be read.
[ "Define", "a", "class", "given", "its", "bytes" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/AntClassLoader.java#L1127-L1141
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/InputUtils.java
InputUtils.getClassName
public static String getClassName(Map<String, Object> map) { """ InputHandler converts every object into Map. This function returns Class name of object from which this Map was created. @param map Map from which Class name would be returned @return Class name from which Map was built """ String className = null; if (map.containsKey(MAP_CLASS_NAME) == true) { className = (String) map.get(MAP_CLASS_NAME); } return className; }
java
public static String getClassName(Map<String, Object> map) { String className = null; if (map.containsKey(MAP_CLASS_NAME) == true) { className = (String) map.get(MAP_CLASS_NAME); } return className; }
[ "public", "static", "String", "getClassName", "(", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "String", "className", "=", "null", ";", "if", "(", "map", ".", "containsKey", "(", "MAP_CLASS_NAME", ")", "==", "true", ")", "{", "className", ...
InputHandler converts every object into Map. This function returns Class name of object from which this Map was created. @param map Map from which Class name would be returned @return Class name from which Map was built
[ "InputHandler", "converts", "every", "object", "into", "Map", ".", "This", "function", "returns", "Class", "name", "of", "object", "from", "which", "this", "Map", "was", "created", "." ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/InputUtils.java#L58-L66
geomajas/geomajas-project-client-gwt
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java
SearchCommService.buildGeometryCriterion
public static GeometryCriterion buildGeometryCriterion(final Geometry geometry, final MapWidget mapWidget, VectorLayer layer) { """ Build {@link GeometryCriterion} for the map widget, geometry and optional layer. @param geometry geometry @param mapWidget map widget @param layer layer @return geometry criterion """ List<String> layers; if (null == layer) { layers = getVisibleServerLayerIds(mapWidget.getMapModel()); } else { layers = new ArrayList<String>(); layers.add(layer.getServerLayerId()); } return new GeometryCriterion(layers, GeometryConverter.toDto(geometry)); }
java
public static GeometryCriterion buildGeometryCriterion(final Geometry geometry, final MapWidget mapWidget, VectorLayer layer) { List<String> layers; if (null == layer) { layers = getVisibleServerLayerIds(mapWidget.getMapModel()); } else { layers = new ArrayList<String>(); layers.add(layer.getServerLayerId()); } return new GeometryCriterion(layers, GeometryConverter.toDto(geometry)); }
[ "public", "static", "GeometryCriterion", "buildGeometryCriterion", "(", "final", "Geometry", "geometry", ",", "final", "MapWidget", "mapWidget", ",", "VectorLayer", "layer", ")", "{", "List", "<", "String", ">", "layers", ";", "if", "(", "null", "==", "layer", ...
Build {@link GeometryCriterion} for the map widget, geometry and optional layer. @param geometry geometry @param mapWidget map widget @param layer layer @return geometry criterion
[ "Build", "{", "@link", "GeometryCriterion", "}", "for", "the", "map", "widget", "geometry", "and", "optional", "layer", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/util/SearchCommService.java#L175-L185
Azure/azure-sdk-for-java
signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java
SignalRsInner.beginUpdateAsync
public Observable<SignalRResourceInner> beginUpdateAsync(String resourceGroupName, String resourceName) { """ Operation to update an exiting SignalR service. @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 resourceName The name of the SignalR resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SignalRResourceInner object """ return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() { @Override public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) { return response.body(); } }); }
java
public Observable<SignalRResourceInner> beginUpdateAsync(String resourceGroupName, String resourceName) { return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() { @Override public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SignalRResourceInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "map", "(...
Operation to update an exiting SignalR service. @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 resourceName The name of the SignalR resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SignalRResourceInner object
[ "Operation", "to", "update", "an", "exiting", "SignalR", "service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java#L1606-L1613
ical4j/ical4j
src/main/java/net/fortuna/ical4j/model/Recur.java
Recur.getDates
public final DateList getDates(final Date seed, final Period period, final Value value) { """ Convenience method for retrieving recurrences in a specified period. @param seed a seed date for generating recurrence instances @param period the period of returned recurrence dates @param value type of dates to generate @return a list of dates """ return getDates(seed, period.getStart(), period.getEnd(), value, -1); }
java
public final DateList getDates(final Date seed, final Period period, final Value value) { return getDates(seed, period.getStart(), period.getEnd(), value, -1); }
[ "public", "final", "DateList", "getDates", "(", "final", "Date", "seed", ",", "final", "Period", "period", ",", "final", "Value", "value", ")", "{", "return", "getDates", "(", "seed", ",", "period", ".", "getStart", "(", ")", ",", "period", ".", "getEnd"...
Convenience method for retrieving recurrences in a specified period. @param seed a seed date for generating recurrence instances @param period the period of returned recurrence dates @param value type of dates to generate @return a list of dates
[ "Convenience", "method", "for", "retrieving", "recurrences", "in", "a", "specified", "period", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/model/Recur.java#L640-L643
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/UtilColor.java
UtilColor.multiplyRgb
public static int multiplyRgb(int rgb, double fr, double fg, double fb) { """ Apply an rgb factor. @param rgb The original rgb. @param fr The red factor. @param fg The green factor. @param fb The blue factor. @return The multiplied rgb. """ if (rgb == 0) { return rgb; } final int a = rgb >> Constant.BYTE_4 & 0xFF; final int r = (int) UtilMath.clamp((rgb >> Constant.BYTE_3 & 0xFF) * fr, 0, 255); final int g = (int) UtilMath.clamp((rgb >> Constant.BYTE_2 & 0xFF) * fg, 0, 255); final int b = (int) UtilMath.clamp((rgb >> Constant.BYTE_1 & 0xFF) * fb, 0, 255); // CHECKSTYLE IGNORE LINE: BooleanExpressionComplexity|TrailingComment return (a & 0xFF) << Constant.BYTE_4 | (r & 0xFF) << Constant.BYTE_3 | (g & 0xFF) << Constant.BYTE_2 | (b & 0xFF) << Constant.BYTE_1; }
java
public static int multiplyRgb(int rgb, double fr, double fg, double fb) { if (rgb == 0) { return rgb; } final int a = rgb >> Constant.BYTE_4 & 0xFF; final int r = (int) UtilMath.clamp((rgb >> Constant.BYTE_3 & 0xFF) * fr, 0, 255); final int g = (int) UtilMath.clamp((rgb >> Constant.BYTE_2 & 0xFF) * fg, 0, 255); final int b = (int) UtilMath.clamp((rgb >> Constant.BYTE_1 & 0xFF) * fb, 0, 255); // CHECKSTYLE IGNORE LINE: BooleanExpressionComplexity|TrailingComment return (a & 0xFF) << Constant.BYTE_4 | (r & 0xFF) << Constant.BYTE_3 | (g & 0xFF) << Constant.BYTE_2 | (b & 0xFF) << Constant.BYTE_1; }
[ "public", "static", "int", "multiplyRgb", "(", "int", "rgb", ",", "double", "fr", ",", "double", "fg", ",", "double", "fb", ")", "{", "if", "(", "rgb", "==", "0", ")", "{", "return", "rgb", ";", "}", "final", "int", "a", "=", "rgb", ">>", "Consta...
Apply an rgb factor. @param rgb The original rgb. @param fr The red factor. @param fg The green factor. @param fb The blue factor. @return The multiplied rgb.
[ "Apply", "an", "rgb", "factor", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/UtilColor.java#L42-L59
plaid/plaid-java
src/main/java/com/plaid/client/internal/Util.java
Util.arrayToMap
public static Map<String, String> arrayToMap(String[] args) { """ Helper to convert an alternating key1,value1,key2,value2,... array into a map. @param args Alternating arguments. @return Resulting map. """ if (args.length % 2 != 0) { throw new IllegalArgumentException("Must pass in an even number of args, one key per value."); } Map<String, String> ret = new HashMap<>(); for (int i = 0; i < args.length; i += 2) { ret.put(args[i], args[i + 1]); } return ret; }
java
public static Map<String, String> arrayToMap(String[] args) { if (args.length % 2 != 0) { throw new IllegalArgumentException("Must pass in an even number of args, one key per value."); } Map<String, String> ret = new HashMap<>(); for (int i = 0; i < args.length; i += 2) { ret.put(args[i], args[i + 1]); } return ret; }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "arrayToMap", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", "%", "2", "!=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Must pass in an ev...
Helper to convert an alternating key1,value1,key2,value2,... array into a map. @param args Alternating arguments. @return Resulting map.
[ "Helper", "to", "convert", "an", "alternating", "key1", "value1", "key2", "value2", "...", "array", "into", "a", "map", "." ]
train
https://github.com/plaid/plaid-java/blob/360f1f8a5178fa0c3c2c2e07a58f8ccec5f33117/src/main/java/com/plaid/client/internal/Util.java#L107-L119
hawkular/hawkular-apm
api/src/main/java/org/hawkular/apm/api/utils/PropertyUtil.java
PropertyUtil.getProperty
public static String getProperty(String name, String def) { """ This method returns the named property, first checking the system properties and if not found, checking the environment. @param name The name @param def The default if not found @return The property, or the default value if not found """ String ret = System.getProperty(name, System.getenv(name)); if (ret != null) { return ret; } return def; }
java
public static String getProperty(String name, String def) { String ret = System.getProperty(name, System.getenv(name)); if (ret != null) { return ret; } return def; }
[ "public", "static", "String", "getProperty", "(", "String", "name", ",", "String", "def", ")", "{", "String", "ret", "=", "System", ".", "getProperty", "(", "name", ",", "System", ".", "getenv", "(", "name", ")", ")", ";", "if", "(", "ret", "!=", "nu...
This method returns the named property, first checking the system properties and if not found, checking the environment. @param name The name @param def The default if not found @return The property, or the default value if not found
[ "This", "method", "returns", "the", "named", "property", "first", "checking", "the", "system", "properties", "and", "if", "not", "found", "checking", "the", "environment", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/utils/PropertyUtil.java#L261-L267
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java
ProxyUtils.createInstance
public static <T> T createInstance(T impl, String name, String category, String subsystem, IOnDemandCallHandler handler, IOnDemandStatsFactory<? extends IStats> statsFactory, boolean attachLoggers, Class<T> interf, Class<?>... additionalInterfaces) { """ Creates a new proxied instance for an existing implementation. @param <T> interface type. @param impl the implementation of the interface. @param name name of the producer. @param category category of the producer, i.e. service, dao, api, controller. @param subsystem subsystem of the producer, i.e. messaging, payment, registration, shop. @param handler handler for the calls. @param statsFactory the factory for the stats. @param attachLoggers if true loggers are attached. @param interf interfaces. @return a newly created proxy of type T. """ if (name==null) name = extractName(interf); Class<?>[] interfacesParameter = mergeInterfaces(interf, additionalInterfaces); @SuppressWarnings ("unchecked") final MoskitoInvokationProxy proxy = new MoskitoInvokationProxy( impl, handler, statsFactory, name+ '-' +getInstanceCounter(name), category, subsystem, interfacesParameter ); @SuppressWarnings("unchecked") T ret = (T) proxy.createProxy(); if (attachLoggers){ LoggerUtil.createSLF4JDefaultAndIntervalStatsLogger(proxy.getProducer()); } return ret; }
java
public static <T> T createInstance(T impl, String name, String category, String subsystem, IOnDemandCallHandler handler, IOnDemandStatsFactory<? extends IStats> statsFactory, boolean attachLoggers, Class<T> interf, Class<?>... additionalInterfaces){ if (name==null) name = extractName(interf); Class<?>[] interfacesParameter = mergeInterfaces(interf, additionalInterfaces); @SuppressWarnings ("unchecked") final MoskitoInvokationProxy proxy = new MoskitoInvokationProxy( impl, handler, statsFactory, name+ '-' +getInstanceCounter(name), category, subsystem, interfacesParameter ); @SuppressWarnings("unchecked") T ret = (T) proxy.createProxy(); if (attachLoggers){ LoggerUtil.createSLF4JDefaultAndIntervalStatsLogger(proxy.getProducer()); } return ret; }
[ "public", "static", "<", "T", ">", "T", "createInstance", "(", "T", "impl", ",", "String", "name", ",", "String", "category", ",", "String", "subsystem", ",", "IOnDemandCallHandler", "handler", ",", "IOnDemandStatsFactory", "<", "?", "extends", "IStats", ">", ...
Creates a new proxied instance for an existing implementation. @param <T> interface type. @param impl the implementation of the interface. @param name name of the producer. @param category category of the producer, i.e. service, dao, api, controller. @param subsystem subsystem of the producer, i.e. messaging, payment, registration, shop. @param handler handler for the calls. @param statsFactory the factory for the stats. @param attachLoggers if true loggers are attached. @param interf interfaces. @return a newly created proxy of type T.
[ "Creates", "a", "new", "proxied", "instance", "for", "an", "existing", "implementation", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java#L44-L68
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.iPv4Address
public static Validator<CharSequence> iPv4Address(@NonNull final Context context, @StringRes final int resourceId) { """ Creates and returns a validator, which allows to validate texts to ensure, that they represent valid IPv4 addresses. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource ID of the string resource, which contains the error message, which should be set, as an {@link Integer} value. The resource ID must correspond to a valid string resource @return The validator, which has been created, as an instance of the type {@link Validator} """ return new IPv4AddressValidator(context, resourceId); }
java
public static Validator<CharSequence> iPv4Address(@NonNull final Context context, @StringRes final int resourceId) { return new IPv4AddressValidator(context, resourceId); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "iPv4Address", "(", "@", "NonNull", "final", "Context", "context", ",", "@", "StringRes", "final", "int", "resourceId", ")", "{", "return", "new", "IPv4AddressValidator", "(", "context", ",", "resourceId...
Creates and returns a validator, which allows to validate texts to ensure, that they represent valid IPv4 addresses. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @param resourceId The resource ID of the string resource, which contains the error message, which should be set, as an {@link Integer} value. The resource ID must correspond to a valid string resource @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "represent", "valid", "IPv4", "addresses", ".", "Empty", "texts", "are", "also", "accepted", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L910-L913
aspectran/aspectran
shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java
DefaultOptionParser.handleLongOptionWithoutEqual
private void handleLongOptionWithoutEqual(String token) throws OptionParserException { """ Handles the following tokens: <pre> --L -L --l -l </pre> @param token the command line token to handle @throws OptionParserException if option parsing fails """ List<String> matchingOpts = getMatchingLongOptions(token); if (matchingOpts.isEmpty()) { handleUnknownToken(currentToken); } else if (matchingOpts.size() > 1 && !options.hasLongOption(token)) { throw new AmbiguousOptionException(token, matchingOpts); } else { String key = (options.hasLongOption(token) ? token : matchingOpts.get(0)); handleOption(options.getOption(key)); } }
java
private void handleLongOptionWithoutEqual(String token) throws OptionParserException { List<String> matchingOpts = getMatchingLongOptions(token); if (matchingOpts.isEmpty()) { handleUnknownToken(currentToken); } else if (matchingOpts.size() > 1 && !options.hasLongOption(token)) { throw new AmbiguousOptionException(token, matchingOpts); } else { String key = (options.hasLongOption(token) ? token : matchingOpts.get(0)); handleOption(options.getOption(key)); } }
[ "private", "void", "handleLongOptionWithoutEqual", "(", "String", "token", ")", "throws", "OptionParserException", "{", "List", "<", "String", ">", "matchingOpts", "=", "getMatchingLongOptions", "(", "token", ")", ";", "if", "(", "matchingOpts", ".", "isEmpty", "(...
Handles the following tokens: <pre> --L -L --l -l </pre> @param token the command line token to handle @throws OptionParserException if option parsing fails
[ "Handles", "the", "following", "tokens", ":", "<pre", ">", "--", "L", "-", "L", "--", "l", "-", "l", "<", "/", "pre", ">" ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java#L266-L276
tvesalainen/util
util/src/main/java/d3/env/TSAGeoMag.java
TSAGeoMag.getIntensity
public double getIntensity( double dlat, double dlong, double year, double altitude ) { """ Returns the magnetic field intensity from the Department of Defense geomagnetic model and data in nano Tesla. @param dlat Latitude in decimal degrees. @param dlong Longitude in decimal degrees. @param year Date of the calculation in decimal years. @param altitude Altitude of the calculation in kilometers. @return Magnetic field strength in nano Tesla. """ calcGeoMag( dlat, dlong, year, altitude ); return ti; }
java
public double getIntensity( double dlat, double dlong, double year, double altitude ) { calcGeoMag( dlat, dlong, year, altitude ); return ti; }
[ "public", "double", "getIntensity", "(", "double", "dlat", ",", "double", "dlong", ",", "double", "year", ",", "double", "altitude", ")", "{", "calcGeoMag", "(", "dlat", ",", "dlong", ",", "year", ",", "altitude", ")", ";", "return", "ti", ";", "}" ]
Returns the magnetic field intensity from the Department of Defense geomagnetic model and data in nano Tesla. @param dlat Latitude in decimal degrees. @param dlong Longitude in decimal degrees. @param year Date of the calculation in decimal years. @param altitude Altitude of the calculation in kilometers. @return Magnetic field strength in nano Tesla.
[ "Returns", "the", "magnetic", "field", "intensity", "from", "the", "Department", "of", "Defense", "geomagnetic", "model", "and", "data", "in", "nano", "Tesla", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L968-L972
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsInner.java
WorkItemConfigurationsInner.createAsync
public Observable<WorkItemConfigurationInner> createAsync(String resourceGroupName, String resourceName, WorkItemCreateConfiguration workItemConfigurationProperties) { """ Create a work item configuration for an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param workItemConfigurationProperties Properties that need to be specified to create a work item configuration of a Application Insights component. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkItemConfigurationInner object """ return createWithServiceResponseAsync(resourceGroupName, resourceName, workItemConfigurationProperties).map(new Func1<ServiceResponse<WorkItemConfigurationInner>, WorkItemConfigurationInner>() { @Override public WorkItemConfigurationInner call(ServiceResponse<WorkItemConfigurationInner> response) { return response.body(); } }); }
java
public Observable<WorkItemConfigurationInner> createAsync(String resourceGroupName, String resourceName, WorkItemCreateConfiguration workItemConfigurationProperties) { return createWithServiceResponseAsync(resourceGroupName, resourceName, workItemConfigurationProperties).map(new Func1<ServiceResponse<WorkItemConfigurationInner>, WorkItemConfigurationInner>() { @Override public WorkItemConfigurationInner call(ServiceResponse<WorkItemConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WorkItemConfigurationInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "WorkItemCreateConfiguration", "workItemConfigurationProperties", ")", "{", "return", "createWithServiceResponseAsync", "(", ...
Create a work item configuration for an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param workItemConfigurationProperties Properties that need to be specified to create a work item configuration of a Application Insights component. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the WorkItemConfigurationInner object
[ "Create", "a", "work", "item", "configuration", "for", "an", "Application", "Insights", "component", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsInner.java#L208-L215
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java
JdbcControlImpl.onAquire
@EventHandler(field = "_resourceContext", eventSet = ResourceEvents.class, eventName = "onAcquire") public void onAquire() { """ Invoked by the controls runtime when a new instance of this class is aquired by the runtime """ if (LOGGER.isDebugEnabled()) { LOGGER.debug("Enter: onAquire()"); } try { getConnection(); } catch (SQLException se) { throw new ControlException("SQL Exception while attempting to connect to database.", se); } }
java
@EventHandler(field = "_resourceContext", eventSet = ResourceEvents.class, eventName = "onAcquire") public void onAquire() { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Enter: onAquire()"); } try { getConnection(); } catch (SQLException se) { throw new ControlException("SQL Exception while attempting to connect to database.", se); } }
[ "@", "EventHandler", "(", "field", "=", "\"_resourceContext\"", ",", "eventSet", "=", "ResourceEvents", ".", "class", ",", "eventName", "=", "\"onAcquire\"", ")", "public", "void", "onAquire", "(", ")", "{", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", "...
Invoked by the controls runtime when a new instance of this class is aquired by the runtime
[ "Invoked", "by", "the", "controls", "runtime", "when", "a", "new", "instance", "of", "this", "class", "is", "aquired", "by", "the", "runtime" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java#L103-L115
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java
JDBC4PreparedStatement.setObject
@Override public void setObject(int parameterIndex, Object x) throws SQLException { """ Sets the value of the designated parameter using the given object. """ checkParameterBounds(parameterIndex); this.parameters[parameterIndex-1] = x; }
java
@Override public void setObject(int parameterIndex, Object x) throws SQLException { checkParameterBounds(parameterIndex); this.parameters[parameterIndex-1] = x; }
[ "@", "Override", "public", "void", "setObject", "(", "int", "parameterIndex", ",", "Object", "x", ")", "throws", "SQLException", "{", "checkParameterBounds", "(", "parameterIndex", ")", ";", "this", ".", "parameters", "[", "parameterIndex", "-", "1", "]", "=",...
Sets the value of the designated parameter using the given object.
[ "Sets", "the", "value", "of", "the", "designated", "parameter", "using", "the", "given", "object", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L461-L466
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java
Context2.declarePrefix
void declarePrefix (String prefix, String uri) { """ Declare a Namespace prefix for this context. @param prefix The prefix to declare. @param uri The associated Namespace URI. @see org.xml.sax.helpers.NamespaceSupport2#declarePrefix """ // Lazy processing... if (!tablesDirty) { copyTables(); } if (declarations == null) { declarations = new Vector(); } prefix = prefix.intern(); uri = uri.intern(); if ("".equals(prefix)) { if ("".equals(uri)) { defaultNS = null; } else { defaultNS = uri; } } else { prefixTable.put(prefix, uri); uriTable.put(uri, prefix); // may wipe out another prefix } declarations.addElement(prefix); }
java
void declarePrefix (String prefix, String uri) { // Lazy processing... if (!tablesDirty) { copyTables(); } if (declarations == null) { declarations = new Vector(); } prefix = prefix.intern(); uri = uri.intern(); if ("".equals(prefix)) { if ("".equals(uri)) { defaultNS = null; } else { defaultNS = uri; } } else { prefixTable.put(prefix, uri); uriTable.put(uri, prefix); // may wipe out another prefix } declarations.addElement(prefix); }
[ "void", "declarePrefix", "(", "String", "prefix", ",", "String", "uri", ")", "{", "// Lazy processing...", "if", "(", "!", "tablesDirty", ")", "{", "copyTables", "(", ")", ";", "}", "if", "(", "declarations", "==", "null", ")", "{", "declarations", "=", ...
Declare a Namespace prefix for this context. @param prefix The prefix to declare. @param uri The associated Namespace URI. @see org.xml.sax.helpers.NamespaceSupport2#declarePrefix
[ "Declare", "a", "Namespace", "prefix", "for", "this", "context", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java#L535-L558
jbossws/jbossws-cxf
modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPBuilder.java
CXFMAPBuilder.inboundMap
public MAP inboundMap(Map<String, Object> ctx) { """ retrieve the inbound server message address properties attached to a message context @param ctx the server message context @return """ AddressingProperties implementation = (AddressingProperties)ctx.get(CXFMAPConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND); return newMap(implementation); }
java
public MAP inboundMap(Map<String, Object> ctx) { AddressingProperties implementation = (AddressingProperties)ctx.get(CXFMAPConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND); return newMap(implementation); }
[ "public", "MAP", "inboundMap", "(", "Map", "<", "String", ",", "Object", ">", "ctx", ")", "{", "AddressingProperties", "implementation", "=", "(", "AddressingProperties", ")", "ctx", ".", "get", "(", "CXFMAPConstants", ".", "SERVER_ADDRESSING_PROPERTIES_INBOUND", ...
retrieve the inbound server message address properties attached to a message context @param ctx the server message context @return
[ "retrieve", "the", "inbound", "server", "message", "address", "properties", "attached", "to", "a", "message", "context" ]
train
https://github.com/jbossws/jbossws-cxf/blob/e1d5df3664cbc2482ebc83cafd355a4d60d12150/modules/client/src/main/java/org/jboss/wsf/stack/cxf/extensions/addressing/map/CXFMAPBuilder.java#L71-L75
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java
CertificatesInner.listByIntegrationAccountsWithServiceResponseAsync
public Observable<ServiceResponse<Page<IntegrationAccountCertificateInner>>> listByIntegrationAccountsWithServiceResponseAsync(final String resourceGroupName, final String integrationAccountName, final Integer top) { """ Gets a list of integration account certificates. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param top The number of items to be included in the result. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;IntegrationAccountCertificateInner&gt; object """ return listByIntegrationAccountsSinglePageAsync(resourceGroupName, integrationAccountName, top) .concatMap(new Func1<ServiceResponse<Page<IntegrationAccountCertificateInner>>, Observable<ServiceResponse<Page<IntegrationAccountCertificateInner>>>>() { @Override public Observable<ServiceResponse<Page<IntegrationAccountCertificateInner>>> call(ServiceResponse<Page<IntegrationAccountCertificateInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByIntegrationAccountsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<IntegrationAccountCertificateInner>>> listByIntegrationAccountsWithServiceResponseAsync(final String resourceGroupName, final String integrationAccountName, final Integer top) { return listByIntegrationAccountsSinglePageAsync(resourceGroupName, integrationAccountName, top) .concatMap(new Func1<ServiceResponse<Page<IntegrationAccountCertificateInner>>, Observable<ServiceResponse<Page<IntegrationAccountCertificateInner>>>>() { @Override public Observable<ServiceResponse<Page<IntegrationAccountCertificateInner>>> call(ServiceResponse<Page<IntegrationAccountCertificateInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByIntegrationAccountsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "IntegrationAccountCertificateInner", ">", ">", ">", "listByIntegrationAccountsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "integrationAccountName", ",", "f...
Gets a list of integration account certificates. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param top The number of items to be included in the result. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;IntegrationAccountCertificateInner&gt; object
[ "Gets", "a", "list", "of", "integration", "account", "certificates", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java#L274-L286
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.sendSubscriptionEvent
void sendSubscriptionEvent(String topic, int nb) { """ Send subscription event to all client @param topic @param session """ Collection<Session> sessions = getSessionsForTopic(topic); if (!sessions.isEmpty()) { MessageToClient messageToClient = new MessageToClient(); messageToClient.setId(topic); messageToClient.setType(MessageType.MESSAGE); messageToClient.setResponse(nb); // Collection<Session> sessionsClosed = new ArrayList<>(); // throws java.lang.StackOverflowError for (Session session : sessions) { if (session.isOpen()) { session.getAsyncRemote().sendObject(messageToClient); // } else { // sessionsClosed.add(session); } } // removeSessionsToTopic(sessionsClosed); } }
java
void sendSubscriptionEvent(String topic, int nb) { Collection<Session> sessions = getSessionsForTopic(topic); if (!sessions.isEmpty()) { MessageToClient messageToClient = new MessageToClient(); messageToClient.setId(topic); messageToClient.setType(MessageType.MESSAGE); messageToClient.setResponse(nb); // Collection<Session> sessionsClosed = new ArrayList<>(); // throws java.lang.StackOverflowError for (Session session : sessions) { if (session.isOpen()) { session.getAsyncRemote().sendObject(messageToClient); // } else { // sessionsClosed.add(session); } } // removeSessionsToTopic(sessionsClosed); } }
[ "void", "sendSubscriptionEvent", "(", "String", "topic", ",", "int", "nb", ")", "{", "Collection", "<", "Session", ">", "sessions", "=", "getSessionsForTopic", "(", "topic", ")", ";", "if", "(", "!", "sessions", ".", "isEmpty", "(", ")", ")", "{", "Messa...
Send subscription event to all client @param topic @param session
[ "Send", "subscription", "event", "to", "all", "client" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L202-L219
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/AbstractBundleLinkRenderer.java
AbstractBundleLinkRenderer.addComment
protected void addComment(String commentText, Writer out) throws IOException { """ Adds an HTML comment to the output stream. @param commentText the comment @param out Writer @throws IOException if an IO exception occurs """ StringBuilder sb = new StringBuilder("<script type=\"text/javascript\">/* "); sb.append(commentText).append(" */</script>").append("\n"); out.write(sb.toString()); }
java
protected void addComment(String commentText, Writer out) throws IOException { StringBuilder sb = new StringBuilder("<script type=\"text/javascript\">/* "); sb.append(commentText).append(" */</script>").append("\n"); out.write(sb.toString()); }
[ "protected", "void", "addComment", "(", "String", "commentText", ",", "Writer", "out", ")", "throws", "IOException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"<script type=\\\"text/javascript\\\">/* \"", ")", ";", "sb", ".", "append", "(", "...
Adds an HTML comment to the output stream. @param commentText the comment @param out Writer @throws IOException if an IO exception occurs
[ "Adds", "an", "HTML", "comment", "to", "the", "output", "stream", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/AbstractBundleLinkRenderer.java#L351-L355
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java
GeometryExtrude.getClockWise
private static LineString getClockWise(final LineString lineString) { """ Reverse the LineString to be oriented clockwise. All NaN z values are replaced by a zero value. @param lineString @return """ final Coordinate c0 = lineString.getCoordinateN(0); final Coordinate c1 = lineString.getCoordinateN(1); final Coordinate c2 = lineString.getCoordinateN(2); lineString.apply(new UpdateZCoordinateSequenceFilter(0, 3)); if (CGAlgorithms.computeOrientation(c0, c1, c2) == CGAlgorithms.CLOCKWISE) { return lineString; } else { return (LineString) lineString.reverse(); } }
java
private static LineString getClockWise(final LineString lineString) { final Coordinate c0 = lineString.getCoordinateN(0); final Coordinate c1 = lineString.getCoordinateN(1); final Coordinate c2 = lineString.getCoordinateN(2); lineString.apply(new UpdateZCoordinateSequenceFilter(0, 3)); if (CGAlgorithms.computeOrientation(c0, c1, c2) == CGAlgorithms.CLOCKWISE) { return lineString; } else { return (LineString) lineString.reverse(); } }
[ "private", "static", "LineString", "getClockWise", "(", "final", "LineString", "lineString", ")", "{", "final", "Coordinate", "c0", "=", "lineString", ".", "getCoordinateN", "(", "0", ")", ";", "final", "Coordinate", "c1", "=", "lineString", ".", "getCoordinateN...
Reverse the LineString to be oriented clockwise. All NaN z values are replaced by a zero value. @param lineString @return
[ "Reverse", "the", "LineString", "to", "be", "oriented", "clockwise", ".", "All", "NaN", "z", "values", "are", "replaced", "by", "a", "zero", "value", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java#L187-L197
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SchemasInner.java
SchemasInner.getAsync
public Observable<IntegrationAccountSchemaInner> getAsync(String resourceGroupName, String integrationAccountName, String schemaName) { """ Gets an integration account schema. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param schemaName The integration account schema name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountSchemaInner object """ return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, schemaName).map(new Func1<ServiceResponse<IntegrationAccountSchemaInner>, IntegrationAccountSchemaInner>() { @Override public IntegrationAccountSchemaInner call(ServiceResponse<IntegrationAccountSchemaInner> response) { return response.body(); } }); }
java
public Observable<IntegrationAccountSchemaInner> getAsync(String resourceGroupName, String integrationAccountName, String schemaName) { return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, schemaName).map(new Func1<ServiceResponse<IntegrationAccountSchemaInner>, IntegrationAccountSchemaInner>() { @Override public IntegrationAccountSchemaInner call(ServiceResponse<IntegrationAccountSchemaInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IntegrationAccountSchemaInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "schemaName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "inte...
Gets an integration account schema. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param schemaName The integration account schema name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountSchemaInner object
[ "Gets", "an", "integration", "account", "schema", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SchemasInner.java#L381-L388
pac4j/pac4j
pac4j-core/src/main/java/org/pac4j/core/exception/http/RedirectionActionHelper.java
RedirectionActionHelper.buildFormPostContentAction
public static RedirectionAction buildFormPostContentAction(final WebContext context, final String content) { """ Build the appropriate redirection action for a content which is a form post. @param context the web context @param content the content @return the appropriate redirection action """ if (ContextHelper.isPost(context) && useModernHttpCodes) { return new TemporaryRedirectAction(content); } else { return new OkAction(content); } }
java
public static RedirectionAction buildFormPostContentAction(final WebContext context, final String content) { if (ContextHelper.isPost(context) && useModernHttpCodes) { return new TemporaryRedirectAction(content); } else { return new OkAction(content); } }
[ "public", "static", "RedirectionAction", "buildFormPostContentAction", "(", "final", "WebContext", "context", ",", "final", "String", "content", ")", "{", "if", "(", "ContextHelper", ".", "isPost", "(", "context", ")", "&&", "useModernHttpCodes", ")", "{", "return...
Build the appropriate redirection action for a content which is a form post. @param context the web context @param content the content @return the appropriate redirection action
[ "Build", "the", "appropriate", "redirection", "action", "for", "a", "content", "which", "is", "a", "form", "post", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/exception/http/RedirectionActionHelper.java#L40-L46
Netflix/frigga
src/main/java/com/netflix/frigga/cluster/ClusterGrouper.java
ClusterGrouper.groupAsgNamesByClusterName
public static Map<String, List<String>> groupAsgNamesByClusterName(List<String> asgNames) { """ Groups a list of ASG names by cluster name. @param asgNames list of asg names @return map of cluster name to list of ASG names in that cluster """ return groupByClusterName(asgNames, new AsgNameProvider<String>() { public String extractAsgName(String asgName) { return asgName; } }); }
java
public static Map<String, List<String>> groupAsgNamesByClusterName(List<String> asgNames) { return groupByClusterName(asgNames, new AsgNameProvider<String>() { public String extractAsgName(String asgName) { return asgName; } }); }
[ "public", "static", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "groupAsgNamesByClusterName", "(", "List", "<", "String", ">", "asgNames", ")", "{", "return", "groupByClusterName", "(", "asgNames", ",", "new", "AsgNameProvider", "<", "String", ...
Groups a list of ASG names by cluster name. @param asgNames list of asg names @return map of cluster name to list of ASG names in that cluster
[ "Groups", "a", "list", "of", "ASG", "names", "by", "cluster", "name", "." ]
train
https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/cluster/ClusterGrouper.java#L57-L63
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.existsResource
public boolean existsResource(CmsUUID structureId, CmsResourceFilter filter) { """ Checks the availability of a resource in the VFS, using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p> A resource may be of type <code>{@link CmsFile}</code> or <code>{@link CmsFolder}</code>.<p> The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code> will ignore the date release / date expired information of the resource.<p> This method also takes into account the user permissions, so if the given resource exists, but the current user has not the required permissions, then this method will return <code>false</code>.<p> @param structureId the structure id of the resource to check @param filter the resource filter to use while checking @return <code>true</code> if the resource is available @see #readResource(CmsUUID) @see #readResource(CmsUUID, CmsResourceFilter) """ return m_securityManager.existsResource(m_context, structureId, filter); }
java
public boolean existsResource(CmsUUID structureId, CmsResourceFilter filter) { return m_securityManager.existsResource(m_context, structureId, filter); }
[ "public", "boolean", "existsResource", "(", "CmsUUID", "structureId", ",", "CmsResourceFilter", "filter", ")", "{", "return", "m_securityManager", ".", "existsResource", "(", "m_context", ",", "structureId", ",", "filter", ")", ";", "}" ]
Checks the availability of a resource in the VFS, using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p> A resource may be of type <code>{@link CmsFile}</code> or <code>{@link CmsFolder}</code>.<p> The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code> will ignore the date release / date expired information of the resource.<p> This method also takes into account the user permissions, so if the given resource exists, but the current user has not the required permissions, then this method will return <code>false</code>.<p> @param structureId the structure id of the resource to check @param filter the resource filter to use while checking @return <code>true</code> if the resource is available @see #readResource(CmsUUID) @see #readResource(CmsUUID, CmsResourceFilter)
[ "Checks", "the", "availability", "of", "a", "resource", "in", "the", "VFS", "using", "the", "<code", ">", "{", "@link", "CmsResourceFilter#DEFAULT", "}", "<", "/", "code", ">", "filter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1176-L1179
Ecwid/ecwid-mailchimp
src/main/java/com/ecwid/mailchimp/MailChimpObject.java
MailChimpObject.fromJson
public static <T extends MailChimpObject> T fromJson(String json, Class<T> clazz) { """ Deserializes an object from JSON. @throws IllegalArgumentException if <code>json</code> cannot be deserialized to an object of class <code>clazz</code>. """ try { return MailChimpGsonFactory.createGson().fromJson(json, clazz); } catch(JsonParseException e) { throw new IllegalArgumentException(e); } }
java
public static <T extends MailChimpObject> T fromJson(String json, Class<T> clazz) { try { return MailChimpGsonFactory.createGson().fromJson(json, clazz); } catch(JsonParseException e) { throw new IllegalArgumentException(e); } }
[ "public", "static", "<", "T", "extends", "MailChimpObject", ">", "T", "fromJson", "(", "String", "json", ",", "Class", "<", "T", ">", "clazz", ")", "{", "try", "{", "return", "MailChimpGsonFactory", ".", "createGson", "(", ")", ".", "fromJson", "(", "jso...
Deserializes an object from JSON. @throws IllegalArgumentException if <code>json</code> cannot be deserialized to an object of class <code>clazz</code>.
[ "Deserializes", "an", "object", "from", "JSON", "." ]
train
https://github.com/Ecwid/ecwid-mailchimp/blob/8acb37d7677bd494879d4db11f3c42ba4c85eb36/src/main/java/com/ecwid/mailchimp/MailChimpObject.java#L383-L389
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/IssuesTrackerHelper.java
IssuesTrackerHelper.setIssueTrackerInfo
public void setIssueTrackerInfo(BuildInfoBuilder builder) { """ Apply issues tracker info to a build info builder (used by generic tasks and maven2 which doesn't use the extractor """ Issues issues = new Issues(); issues.setAggregateBuildIssues(aggregateBuildIssues); issues.setAggregationBuildStatus(aggregationBuildStatus); issues.setTracker(new IssueTracker("JIRA", issueTrackerVersion)); Set<Issue> affectedIssuesSet = IssuesTrackerUtils.getAffectedIssuesSet(affectedIssues); if (!affectedIssuesSet.isEmpty()) { issues.setAffectedIssues(affectedIssuesSet); } builder.issues(issues); }
java
public void setIssueTrackerInfo(BuildInfoBuilder builder) { Issues issues = new Issues(); issues.setAggregateBuildIssues(aggregateBuildIssues); issues.setAggregationBuildStatus(aggregationBuildStatus); issues.setTracker(new IssueTracker("JIRA", issueTrackerVersion)); Set<Issue> affectedIssuesSet = IssuesTrackerUtils.getAffectedIssuesSet(affectedIssues); if (!affectedIssuesSet.isEmpty()) { issues.setAffectedIssues(affectedIssuesSet); } builder.issues(issues); }
[ "public", "void", "setIssueTrackerInfo", "(", "BuildInfoBuilder", "builder", ")", "{", "Issues", "issues", "=", "new", "Issues", "(", ")", ";", "issues", ".", "setAggregateBuildIssues", "(", "aggregateBuildIssues", ")", ";", "issues", ".", "setAggregationBuildStatus...
Apply issues tracker info to a build info builder (used by generic tasks and maven2 which doesn't use the extractor
[ "Apply", "issues", "tracker", "info", "to", "a", "build", "info", "builder", "(", "used", "by", "generic", "tasks", "and", "maven2", "which", "doesn", "t", "use", "the", "extractor" ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/IssuesTrackerHelper.java#L103-L113
grpc/grpc-java
alts/src/main/java/io/grpc/alts/ComputeEngineChannelBuilder.java
ComputeEngineChannelBuilder.forAddress
public static ComputeEngineChannelBuilder forAddress(String name, int port) { """ "Overrides" the static method in {@link ManagedChannelBuilder}. """ return forTarget(GrpcUtil.authorityFromHostAndPort(name, port)); }
java
public static ComputeEngineChannelBuilder forAddress(String name, int port) { return forTarget(GrpcUtil.authorityFromHostAndPort(name, port)); }
[ "public", "static", "ComputeEngineChannelBuilder", "forAddress", "(", "String", "name", ",", "int", "port", ")", "{", "return", "forTarget", "(", "GrpcUtil", ".", "authorityFromHostAndPort", "(", "name", ",", "port", ")", ")", ";", "}" ]
"Overrides" the static method in {@link ManagedChannelBuilder}.
[ "Overrides", "the", "static", "method", "in", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/ComputeEngineChannelBuilder.java#L72-L74
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java
RouteTablesInner.beginUpdateTagsAsync
public Observable<RouteTableInner> beginUpdateTagsAsync(String resourceGroupName, String routeTableName) { """ Updates a route table tags. @param resourceGroupName The name of the resource group. @param routeTableName The name of the route table. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RouteTableInner object """ return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, routeTableName).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() { @Override public RouteTableInner call(ServiceResponse<RouteTableInner> response) { return response.body(); } }); }
java
public Observable<RouteTableInner> beginUpdateTagsAsync(String resourceGroupName, String routeTableName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, routeTableName).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() { @Override public RouteTableInner call(ServiceResponse<RouteTableInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RouteTableInner", ">", "beginUpdateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "routeTableName", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "routeTableName", ")", ".", "map...
Updates a route table tags. @param resourceGroupName The name of the resource group. @param routeTableName The name of the route table. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RouteTableInner object
[ "Updates", "a", "route", "table", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java#L779-L786
apiman/apiman
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java
AuditUtils.contractCreatedToApi
public static AuditEntryBean contractCreatedToApi(ContractBean bean, ISecurityContext securityContext) { """ Creates an audit entry for the 'contract created' event. @param bean the bean @param securityContext the security context @return the audit entry """ AuditEntryBean entry = newEntry(bean.getApi().getApi().getOrganization().getId(), AuditEntityType.Api, securityContext); // Ensure the order of contract-created events are deterministic by adding 1 ms to this one entry.setCreatedOn(new Date(entry.getCreatedOn().getTime() + 1)); entry.setWhat(AuditEntryType.CreateContract); entry.setEntityId(bean.getApi().getApi().getId()); entry.setEntityVersion(bean.getApi().getVersion()); ContractData data = new ContractData(bean); entry.setData(toJSON(data)); return entry; }
java
public static AuditEntryBean contractCreatedToApi(ContractBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getApi().getApi().getOrganization().getId(), AuditEntityType.Api, securityContext); // Ensure the order of contract-created events are deterministic by adding 1 ms to this one entry.setCreatedOn(new Date(entry.getCreatedOn().getTime() + 1)); entry.setWhat(AuditEntryType.CreateContract); entry.setEntityId(bean.getApi().getApi().getId()); entry.setEntityVersion(bean.getApi().getVersion()); ContractData data = new ContractData(bean); entry.setData(toJSON(data)); return entry; }
[ "public", "static", "AuditEntryBean", "contractCreatedToApi", "(", "ContractBean", "bean", ",", "ISecurityContext", "securityContext", ")", "{", "AuditEntryBean", "entry", "=", "newEntry", "(", "bean", ".", "getApi", "(", ")", ".", "getApi", "(", ")", ".", "getO...
Creates an audit entry for the 'contract created' event. @param bean the bean @param securityContext the security context @return the audit entry
[ "Creates", "an", "audit", "entry", "for", "the", "contract", "created", "event", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java#L440-L450
palaima/DebugDrawer
debugdrawer-timber/src/main/java/io/palaima/debugdrawer/timber/util/Intents.java
Intents.hasHandler
public static boolean hasHandler(Context context, Intent intent) { """ Queries on-device packages for a handler for the supplied {@link Intent}. """ List<ResolveInfo> handlers = context.getPackageManager().queryIntentActivities(intent, 0); return !handlers.isEmpty(); }
java
public static boolean hasHandler(Context context, Intent intent) { List<ResolveInfo> handlers = context.getPackageManager().queryIntentActivities(intent, 0); return !handlers.isEmpty(); }
[ "public", "static", "boolean", "hasHandler", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "List", "<", "ResolveInfo", ">", "handlers", "=", "context", ".", "getPackageManager", "(", ")", ".", "queryIntentActivities", "(", "intent", ",", "0", ...
Queries on-device packages for a handler for the supplied {@link Intent}.
[ "Queries", "on", "-", "device", "packages", "for", "a", "handler", "for", "the", "supplied", "{" ]
train
https://github.com/palaima/DebugDrawer/blob/49b5992a1148757bd740c4a0b7df10ef70ade6d8/debugdrawer-timber/src/main/java/io/palaima/debugdrawer/timber/util/Intents.java#L29-L32
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/util/I18nUtil.java
I18nUtil.getText
public static String getText(String key, ResourceBundle bundle, Object... arguments) { """ <p>getText.</p> @param key a {@link java.lang.String} object. @param bundle a {@link java.util.ResourceBundle} object. @param arguments a {@link java.lang.Object} object. @return a {@link java.lang.String} object. """ try { String value = bundle.getString(key); return MessageFormat.format(value, arguments); } catch (MissingResourceException ex) { return key; } }
java
public static String getText(String key, ResourceBundle bundle, Object... arguments) { try { String value = bundle.getString(key); return MessageFormat.format(value, arguments); } catch (MissingResourceException ex) { return key; } }
[ "public", "static", "String", "getText", "(", "String", "key", ",", "ResourceBundle", "bundle", ",", "Object", "...", "arguments", ")", "{", "try", "{", "String", "value", "=", "bundle", ".", "getString", "(", "key", ")", ";", "return", "MessageFormat", "....
<p>getText.</p> @param key a {@link java.lang.String} object. @param bundle a {@link java.util.ResourceBundle} object. @param arguments a {@link java.lang.Object} object. @return a {@link java.lang.String} object.
[ "<p", ">", "getText", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/util/I18nUtil.java#L48-L60
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
ExecutionEnvironment.createRemoteEnvironment
public static ExecutionEnvironment createRemoteEnvironment(String host, int port, String... jarFiles) { """ Creates a {@link RemoteEnvironment}. The remote environment sends (parts of) the program to a cluster for execution. Note that all file paths used in the program must be accessible from the cluster. The execution will use the cluster's default parallelism, unless the parallelism is set explicitly via {@link ExecutionEnvironment#setParallelism(int)}. @param host The host name or address of the master (JobManager), where the program should be executed. @param port The port of the master (JobManager), where the program should be executed. @param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses user-defined functions, user-defined input formats, or any libraries, those must be provided in the JAR files. @return A remote environment that executes the program on a cluster. """ return new RemoteEnvironment(host, port, jarFiles); }
java
public static ExecutionEnvironment createRemoteEnvironment(String host, int port, String... jarFiles) { return new RemoteEnvironment(host, port, jarFiles); }
[ "public", "static", "ExecutionEnvironment", "createRemoteEnvironment", "(", "String", "host", ",", "int", "port", ",", "String", "...", "jarFiles", ")", "{", "return", "new", "RemoteEnvironment", "(", "host", ",", "port", ",", "jarFiles", ")", ";", "}" ]
Creates a {@link RemoteEnvironment}. The remote environment sends (parts of) the program to a cluster for execution. Note that all file paths used in the program must be accessible from the cluster. The execution will use the cluster's default parallelism, unless the parallelism is set explicitly via {@link ExecutionEnvironment#setParallelism(int)}. @param host The host name or address of the master (JobManager), where the program should be executed. @param port The port of the master (JobManager), where the program should be executed. @param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses user-defined functions, user-defined input formats, or any libraries, those must be provided in the JAR files. @return A remote environment that executes the program on a cluster.
[ "Creates", "a", "{", "@link", "RemoteEnvironment", "}", ".", "The", "remote", "environment", "sends", "(", "parts", "of", ")", "the", "program", "to", "a", "cluster", "for", "execution", ".", "Note", "that", "all", "file", "paths", "used", "in", "the", "...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L1172-L1174
google/truth
core/src/main/java/com/google/common/truth/Correspondence.java
Correspondence.formatDiff
@NullableDecl public String formatDiff(@NullableDecl A actual, @NullableDecl E expected) { """ Returns a {@link String} describing the difference between the {@code actual} and {@code expected} values, if possible, or {@code null} if not. <p>The implementation on the {@link Correspondence} base class always returns {@code null}. To enable diffing, use {@link #formattingDiffsUsing} (or override this method in a subclass, but factory methods are recommended over subclassing). <p>Assertions should only invoke this with parameters for which {@link #compare} returns {@code false}. <p>If this throws an exception, that implies that it is not possible to describe the diffs. An assertion will normally only call this method if it has established that its condition does not hold: good practice dictates that, if this method throws, the assertion should catch the exception and continue to describe the original failure as if this method had returned null, mentioning the failure from this method as additional information. """ return null; }
java
@NullableDecl public String formatDiff(@NullableDecl A actual, @NullableDecl E expected) { return null; }
[ "@", "NullableDecl", "public", "String", "formatDiff", "(", "@", "NullableDecl", "A", "actual", ",", "@", "NullableDecl", "E", "expected", ")", "{", "return", "null", ";", "}" ]
Returns a {@link String} describing the difference between the {@code actual} and {@code expected} values, if possible, or {@code null} if not. <p>The implementation on the {@link Correspondence} base class always returns {@code null}. To enable diffing, use {@link #formattingDiffsUsing} (or override this method in a subclass, but factory methods are recommended over subclassing). <p>Assertions should only invoke this with parameters for which {@link #compare} returns {@code false}. <p>If this throws an exception, that implies that it is not possible to describe the diffs. An assertion will normally only call this method if it has established that its condition does not hold: good practice dictates that, if this method throws, the assertion should catch the exception and continue to describe the original failure as if this method had returned null, mentioning the failure from this method as additional information.
[ "Returns", "a", "{", "@link", "String", "}", "describing", "the", "difference", "between", "the", "{", "@code", "actual", "}", "and", "{", "@code", "expected", "}", "values", "if", "possible", "or", "{", "@code", "null", "}", "if", "not", "." ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Correspondence.java#L709-L712
avarabyeu/restendpoint
src/main/java/com/github/avarabyeu/restendpoint/http/DefaultErrorHandler.java
DefaultErrorHandler.handleError
protected void handleError(URI requestUri, HttpMethod requestMethod, int statusCode, String statusMessage, ByteSource errorBody) throws RestEndpointIOException { """ Handler methods for HTTP client errors @param requestUri - Request URI @param requestMethod - Request HTTP Method @param statusCode - HTTP status code @param statusMessage - HTTP status message @param errorBody - HTTP response body """ throw new RestEndpointException(requestUri, requestMethod, statusCode, statusMessage, errorBody); }
java
protected void handleError(URI requestUri, HttpMethod requestMethod, int statusCode, String statusMessage, ByteSource errorBody) throws RestEndpointIOException { throw new RestEndpointException(requestUri, requestMethod, statusCode, statusMessage, errorBody); }
[ "protected", "void", "handleError", "(", "URI", "requestUri", ",", "HttpMethod", "requestMethod", ",", "int", "statusCode", ",", "String", "statusMessage", ",", "ByteSource", "errorBody", ")", "throws", "RestEndpointIOException", "{", "throw", "new", "RestEndpointExce...
Handler methods for HTTP client errors @param requestUri - Request URI @param requestMethod - Request HTTP Method @param statusCode - HTTP status code @param statusMessage - HTTP status message @param errorBody - HTTP response body
[ "Handler", "methods", "for", "HTTP", "client", "errors" ]
train
https://github.com/avarabyeu/restendpoint/blob/e11fc0813ea4cefbe4d8bca292cd48b40abf185d/src/main/java/com/github/avarabyeu/restendpoint/http/DefaultErrorHandler.java#L69-L72
jfinal/jfinal
src/main/java/com/jfinal/plugin/activerecord/DbPro.java
DbPro.deleteById
public boolean deleteById(String tableName, Object idValue) { """ Delete record by id with default primary key. <pre> Example: Db.use().deleteById("user", 15); </pre> @param tableName the table name of the table @param idValue the id value of the record @return true if delete succeed otherwise false """ return deleteByIds(tableName, config.dialect.getDefaultPrimaryKey(), idValue); }
java
public boolean deleteById(String tableName, Object idValue) { return deleteByIds(tableName, config.dialect.getDefaultPrimaryKey(), idValue); }
[ "public", "boolean", "deleteById", "(", "String", "tableName", ",", "Object", "idValue", ")", "{", "return", "deleteByIds", "(", "tableName", ",", "config", ".", "dialect", ".", "getDefaultPrimaryKey", "(", ")", ",", "idValue", ")", ";", "}" ]
Delete record by id with default primary key. <pre> Example: Db.use().deleteById("user", 15); </pre> @param tableName the table name of the table @param idValue the id value of the record @return true if delete succeed otherwise false
[ "Delete", "record", "by", "id", "with", "default", "primary", "key", ".", "<pre", ">", "Example", ":", "Db", ".", "use", "()", ".", "deleteById", "(", "user", "15", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/DbPro.java#L415-L417
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java
Hierarchy.isSubtype
public static boolean isSubtype(@DottedClassName String clsName, @DottedClassName String possibleSupertypeClassName) throws ClassNotFoundException { """ Determine whether one class (or reference type) is a subtype of another. @param clsName the name of the class or reference type @param possibleSupertypeClassName the name of the possible superclass @return true if clsName is a subtype of possibleSupertypeClassName, false if not """ Subtypes2 subtypes2 = Global.getAnalysisCache().getDatabase(Subtypes2.class); return subtypes2.isSubtype(DescriptorFactory.createClassDescriptorFromDottedClassName(clsName), DescriptorFactory.createClassDescriptorFromDottedClassName(possibleSupertypeClassName)); }
java
public static boolean isSubtype(@DottedClassName String clsName, @DottedClassName String possibleSupertypeClassName) throws ClassNotFoundException { Subtypes2 subtypes2 = Global.getAnalysisCache().getDatabase(Subtypes2.class); return subtypes2.isSubtype(DescriptorFactory.createClassDescriptorFromDottedClassName(clsName), DescriptorFactory.createClassDescriptorFromDottedClassName(possibleSupertypeClassName)); }
[ "public", "static", "boolean", "isSubtype", "(", "@", "DottedClassName", "String", "clsName", ",", "@", "DottedClassName", "String", "possibleSupertypeClassName", ")", "throws", "ClassNotFoundException", "{", "Subtypes2", "subtypes2", "=", "Global", ".", "getAnalysisCac...
Determine whether one class (or reference type) is a subtype of another. @param clsName the name of the class or reference type @param possibleSupertypeClassName the name of the possible superclass @return true if clsName is a subtype of possibleSupertypeClassName, false if not
[ "Determine", "whether", "one", "class", "(", "or", "reference", "type", ")", "is", "a", "subtype", "of", "another", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L95-L98
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderNotePersistenceImpl.java
CommerceOrderNotePersistenceImpl.findByC_R
@Override public List<CommerceOrderNote> findByC_R(long commerceOrderId, boolean restricted, int start, int end) { """ Returns a range of all the commerce order notes where commerceOrderId = &#63; and restricted = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderNoteModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param commerceOrderId the commerce order ID @param restricted the restricted @param start the lower bound of the range of commerce order notes @param end the upper bound of the range of commerce order notes (not inclusive) @return the range of matching commerce order notes """ return findByC_R(commerceOrderId, restricted, start, end, null); }
java
@Override public List<CommerceOrderNote> findByC_R(long commerceOrderId, boolean restricted, int start, int end) { return findByC_R(commerceOrderId, restricted, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceOrderNote", ">", "findByC_R", "(", "long", "commerceOrderId", ",", "boolean", "restricted", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByC_R", "(", "commerceOrderId", ",", "restricted", ","...
Returns a range of all the commerce order notes where commerceOrderId = &#63; and restricted = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderNoteModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param commerceOrderId the commerce order ID @param restricted the restricted @param start the lower bound of the range of commerce order notes @param end the upper bound of the range of commerce order notes (not inclusive) @return the range of matching commerce order notes
[ "Returns", "a", "range", "of", "all", "the", "commerce", "order", "notes", "where", "commerceOrderId", "=", "&#63", ";", "and", "restricted", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderNotePersistenceImpl.java#L665-L669
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapCircle.java
MapCircle.calcBounds
@Override @Pure protected Rectangle2d calcBounds() { """ Compute the bounds of this element. This function does not update the internal attribute replied by {@link #getBoundingBox()} """ double x = this.getX(); double y = this.getY(); final double w = this.radius * 2; final double h = w; x -= w / 2.; y -= h / 2.; return new Rectangle2d(x, y, w, h); }
java
@Override @Pure protected Rectangle2d calcBounds() { double x = this.getX(); double y = this.getY(); final double w = this.radius * 2; final double h = w; x -= w / 2.; y -= h / 2.; return new Rectangle2d(x, y, w, h); }
[ "@", "Override", "@", "Pure", "protected", "Rectangle2d", "calcBounds", "(", ")", "{", "double", "x", "=", "this", ".", "getX", "(", ")", ";", "double", "y", "=", "this", ".", "getY", "(", ")", ";", "final", "double", "w", "=", "this", ".", "radius...
Compute the bounds of this element. This function does not update the internal attribute replied by {@link #getBoundingBox()}
[ "Compute", "the", "bounds", "of", "this", "element", ".", "This", "function", "does", "not", "update", "the", "internal", "attribute", "replied", "by", "{" ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapCircle.java#L349-L362
Nexmo/nexmo-java
src/main/java/com/nexmo/client/insight/InsightClient.java
InsightClient.getBasicNumberInsight
public BasicInsightResponse getBasicNumberInsight(String number, String country) throws IOException, NexmoClientException { """ Perform a Basic Insight Request with a number and country. @param number A single phone number that you need insight about in national or international format @param country If a number does not have a country code or it is uncertain, set the two-character country code. @return A {@link BasicInsightResponse} representing the response from the Nexmo Number Insight API. @throws IOException if a network error occurred contacting the Nexmo Nexmo Number Insight API. @throws NexmoClientException if there was a problem with the Nexmo request or response objects. """ return getBasicNumberInsight(BasicInsightRequest.withNumberAndCountry(number, country)); }
java
public BasicInsightResponse getBasicNumberInsight(String number, String country) throws IOException, NexmoClientException { return getBasicNumberInsight(BasicInsightRequest.withNumberAndCountry(number, country)); }
[ "public", "BasicInsightResponse", "getBasicNumberInsight", "(", "String", "number", ",", "String", "country", ")", "throws", "IOException", ",", "NexmoClientException", "{", "return", "getBasicNumberInsight", "(", "BasicInsightRequest", ".", "withNumberAndCountry", "(", "...
Perform a Basic Insight Request with a number and country. @param number A single phone number that you need insight about in national or international format @param country If a number does not have a country code or it is uncertain, set the two-character country code. @return A {@link BasicInsightResponse} representing the response from the Nexmo Number Insight API. @throws IOException if a network error occurred contacting the Nexmo Nexmo Number Insight API. @throws NexmoClientException if there was a problem with the Nexmo request or response objects.
[ "Perform", "a", "Basic", "Insight", "Request", "with", "a", "number", "and", "country", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/insight/InsightClient.java#L78-L80
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebUtil.java
CareWebUtil.showMessage
public static void showMessage(String message, String caption) { """ Sends an informational message for display by desktop. @param message Text of the message. @param caption Optional caption text. """ getShell().getMessageWindow().showMessage(message, caption); }
java
public static void showMessage(String message, String caption) { getShell().getMessageWindow().showMessage(message, caption); }
[ "public", "static", "void", "showMessage", "(", "String", "message", ",", "String", "caption", ")", "{", "getShell", "(", ")", ".", "getMessageWindow", "(", ")", ".", "showMessage", "(", "message", ",", "caption", ")", ";", "}" ]
Sends an informational message for display by desktop. @param message Text of the message. @param caption Optional caption text.
[ "Sends", "an", "informational", "message", "for", "display", "by", "desktop", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebUtil.java#L83-L85
Azure/azure-sdk-for-java
authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ProviderOperationsMetadatasInner.java
ProviderOperationsMetadatasInner.getAsync
public Observable<ProviderOperationsMetadataInner> getAsync(String resourceProviderNamespace, String apiVersion) { """ Gets provider operations metadata for the specified resource provider. @param resourceProviderNamespace The namespace of the resource provider. @param apiVersion The API version to use for the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProviderOperationsMetadataInner object """ return getWithServiceResponseAsync(resourceProviderNamespace, apiVersion).map(new Func1<ServiceResponse<ProviderOperationsMetadataInner>, ProviderOperationsMetadataInner>() { @Override public ProviderOperationsMetadataInner call(ServiceResponse<ProviderOperationsMetadataInner> response) { return response.body(); } }); }
java
public Observable<ProviderOperationsMetadataInner> getAsync(String resourceProviderNamespace, String apiVersion) { return getWithServiceResponseAsync(resourceProviderNamespace, apiVersion).map(new Func1<ServiceResponse<ProviderOperationsMetadataInner>, ProviderOperationsMetadataInner>() { @Override public ProviderOperationsMetadataInner call(ServiceResponse<ProviderOperationsMetadataInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ProviderOperationsMetadataInner", ">", "getAsync", "(", "String", "resourceProviderNamespace", ",", "String", "apiVersion", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceProviderNamespace", ",", "apiVersion", ")", ".", "map...
Gets provider operations metadata for the specified resource provider. @param resourceProviderNamespace The namespace of the resource provider. @param apiVersion The API version to use for the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProviderOperationsMetadataInner object
[ "Gets", "provider", "operations", "metadata", "for", "the", "specified", "resource", "provider", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/ProviderOperationsMetadatasInner.java#L109-L116
amsa-code/risky
behaviour-detector/src/main/java/au/gov/amsa/navigation/VesselPosition.java
VesselPosition.intersectionTimes
public Optional<Times> intersectionTimes(VesselPosition vp) { """ Returns absent if no intersection occurs else return the one or two times of intersection of circles around the vessel relative to this.time(). @param vp @return """ // TODO handle vp doesn't have speed or cog but is within collision // distance given any cog and max speed Optional<VesselPosition> p = vp.predict(time); if (!p.isPresent()) { return Optional.absent(); } Vector deltaV = velocity().get().minus(p.get().velocity().get()); Vector deltaP = position(this).minus(p.get().position(this)); // imagine a ring around the vessel centroid with maxDimensionMetres/2 // radius. This is the ring we are going to test for collision. double r = p.get().maxDimensionMetres().or(maxDimensionMetresWhenUnknown) / 2 + maxDimensionMetres().or(maxDimensionMetresWhenUnknown) / 2; if (deltaP.dot(deltaP) <= r) return of(new Times(p.get().time())); double a = deltaV.dot(deltaV); double b = 2 * deltaV.dot(deltaP); double c = deltaP.dot(deltaP) - r * r; // Now solve the quadratic equation with coefficients a,b,c double discriminant = b * b - 4 * a * c; if (a == 0) return Optional.absent(); else if (discriminant < 0) return Optional.absent(); else { if (discriminant == 0) { return of(new Times(Math.round(-b / 2 / a))); } else { long alpha1 = Math.round((-b + Math.sqrt(discriminant)) / 2 / a); long alpha2 = Math.round((-b - Math.sqrt(discriminant)) / 2 / a); return of(new Times(alpha1, alpha2)); } } }
java
public Optional<Times> intersectionTimes(VesselPosition vp) { // TODO handle vp doesn't have speed or cog but is within collision // distance given any cog and max speed Optional<VesselPosition> p = vp.predict(time); if (!p.isPresent()) { return Optional.absent(); } Vector deltaV = velocity().get().minus(p.get().velocity().get()); Vector deltaP = position(this).minus(p.get().position(this)); // imagine a ring around the vessel centroid with maxDimensionMetres/2 // radius. This is the ring we are going to test for collision. double r = p.get().maxDimensionMetres().or(maxDimensionMetresWhenUnknown) / 2 + maxDimensionMetres().or(maxDimensionMetresWhenUnknown) / 2; if (deltaP.dot(deltaP) <= r) return of(new Times(p.get().time())); double a = deltaV.dot(deltaV); double b = 2 * deltaV.dot(deltaP); double c = deltaP.dot(deltaP) - r * r; // Now solve the quadratic equation with coefficients a,b,c double discriminant = b * b - 4 * a * c; if (a == 0) return Optional.absent(); else if (discriminant < 0) return Optional.absent(); else { if (discriminant == 0) { return of(new Times(Math.round(-b / 2 / a))); } else { long alpha1 = Math.round((-b + Math.sqrt(discriminant)) / 2 / a); long alpha2 = Math.round((-b - Math.sqrt(discriminant)) / 2 / a); return of(new Times(alpha1, alpha2)); } } }
[ "public", "Optional", "<", "Times", ">", "intersectionTimes", "(", "VesselPosition", "vp", ")", "{", "// TODO handle vp doesn't have speed or cog but is within collision", "// distance given any cog and max speed", "Optional", "<", "VesselPosition", ">", "p", "=", "vp", ".", ...
Returns absent if no intersection occurs else return the one or two times of intersection of circles around the vessel relative to this.time(). @param vp @return
[ "Returns", "absent", "if", "no", "intersection", "occurs", "else", "return", "the", "one", "or", "two", "times", "of", "intersection", "of", "circles", "around", "the", "vessel", "relative", "to", "this", ".", "time", "()", "." ]
train
https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/behaviour-detector/src/main/java/au/gov/amsa/navigation/VesselPosition.java#L337-L377
magro/memcached-session-manager
core/src/main/java/de/javakaffee/web/msm/StorageKeyFormat.java
StorageKeyFormat.of
public static StorageKeyFormat of(final String config, final String host, final String context, final String webappVersion) { """ Creates a new {@link StorageKeyFormat} for the given configuration. The configuration has the form <code>$token,$token</code> Some examples which config would create which output for the key / session id "foo" with context path "ctxt" and host "hst": <dl> <dt>static:x</dt><dd>x_foo</dd> <dt>host</dt><dd>hst_foo</dd> <dt>host.hash</dt><dd>e93c085e_foo</dd> <dt>context</dt><dd>ctxt_foo</dd> <dt>context.hash</dt><dd>45e6345f_foo</dd> <dt>host,context</dt><dd>hst:ctxt_foo</dd> <dt>webappVersion</dt><dd>001_foo</dd> <dt>host.hash,context.hash,webappVersion</dt><dd>e93c085e:45e6345f:001_foo</dd> </dl> """ if(config == null || config.trim().isEmpty()) return EMPTY; final String[] tokens = config.split(","); final StringBuilder sb = new StringBuilder(); for (int i = 0; i < tokens.length; i++) { final String value = PrefixTokenFactory.parse(tokens[i], host, context, webappVersion); if(value != null && !value.trim().isEmpty()) { if(sb.length() > 0) sb.append(STORAGE_TOKEN_SEP); sb.append(value); } } final String prefix = sb.length() == 0 ? null : sb.append(STORAGE_KEY_SEP).toString(); return new StorageKeyFormat(prefix, config); }
java
public static StorageKeyFormat of(final String config, final String host, final String context, final String webappVersion) { if(config == null || config.trim().isEmpty()) return EMPTY; final String[] tokens = config.split(","); final StringBuilder sb = new StringBuilder(); for (int i = 0; i < tokens.length; i++) { final String value = PrefixTokenFactory.parse(tokens[i], host, context, webappVersion); if(value != null && !value.trim().isEmpty()) { if(sb.length() > 0) sb.append(STORAGE_TOKEN_SEP); sb.append(value); } } final String prefix = sb.length() == 0 ? null : sb.append(STORAGE_KEY_SEP).toString(); return new StorageKeyFormat(prefix, config); }
[ "public", "static", "StorageKeyFormat", "of", "(", "final", "String", "config", ",", "final", "String", "host", ",", "final", "String", "context", ",", "final", "String", "webappVersion", ")", "{", "if", "(", "config", "==", "null", "||", "config", ".", "t...
Creates a new {@link StorageKeyFormat} for the given configuration. The configuration has the form <code>$token,$token</code> Some examples which config would create which output for the key / session id "foo" with context path "ctxt" and host "hst": <dl> <dt>static:x</dt><dd>x_foo</dd> <dt>host</dt><dd>hst_foo</dd> <dt>host.hash</dt><dd>e93c085e_foo</dd> <dt>context</dt><dd>ctxt_foo</dd> <dt>context.hash</dt><dd>45e6345f_foo</dd> <dt>host,context</dt><dd>hst:ctxt_foo</dd> <dt>webappVersion</dt><dd>001_foo</dd> <dt>host.hash,context.hash,webappVersion</dt><dd>e93c085e:45e6345f:001_foo</dd> </dl>
[ "Creates", "a", "new", "{", "@link", "StorageKeyFormat", "}", "for", "the", "given", "configuration", ".", "The", "configuration", "has", "the", "form", "<code", ">", "$token", "$token<", "/", "code", ">" ]
train
https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/StorageKeyFormat.java#L71-L88
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java
NonplanarBonds.findBond
private IBond findBond(IAtom beg1, IAtom beg2, IAtom end) { """ Find a bond between two possible atoms. For example beg1 - end or beg2 - end. @param beg1 begin 1 @param beg2 begin 2 @param end end @return the bond (or null if none) """ IBond bond = container.getBond(beg1, end); if (bond != null) return bond; return container.getBond(beg2, end); }
java
private IBond findBond(IAtom beg1, IAtom beg2, IAtom end) { IBond bond = container.getBond(beg1, end); if (bond != null) return bond; return container.getBond(beg2, end); }
[ "private", "IBond", "findBond", "(", "IAtom", "beg1", ",", "IAtom", "beg2", ",", "IAtom", "end", ")", "{", "IBond", "bond", "=", "container", ".", "getBond", "(", "beg1", ",", "end", ")", ";", "if", "(", "bond", "!=", "null", ")", "return", "bond", ...
Find a bond between two possible atoms. For example beg1 - end or beg2 - end. @param beg1 begin 1 @param beg2 begin 2 @param end end @return the bond (or null if none)
[ "Find", "a", "bond", "between", "two", "possible", "atoms", ".", "For", "example", "beg1", "-", "end", "or", "beg2", "-", "end", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java#L401-L406
citrusframework/citrus
modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsSyncProducer.java
JmsSyncProducer.createMessageConsumer
private MessageConsumer createMessageConsumer(Destination replyToDestination, String messageId) throws JMSException { """ Creates a message consumer on temporary/durable queue or topic. Durable queue/topic destinations require a message selector to be set. @param replyToDestination the reply destination. @param messageId the messageId used for optional message selector. @return @throws JMSException """ MessageConsumer messageConsumer; if (replyToDestination instanceof Queue) { messageConsumer = session.createConsumer(replyToDestination, "JMSCorrelationID = '" + messageId.replaceAll("'", "''") + "'"); } else { messageConsumer = session.createDurableSubscriber((Topic)replyToDestination, getName(), "JMSCorrelationID = '" + messageId.replaceAll("'", "''") + "'", false); } return messageConsumer; }
java
private MessageConsumer createMessageConsumer(Destination replyToDestination, String messageId) throws JMSException { MessageConsumer messageConsumer; if (replyToDestination instanceof Queue) { messageConsumer = session.createConsumer(replyToDestination, "JMSCorrelationID = '" + messageId.replaceAll("'", "''") + "'"); } else { messageConsumer = session.createDurableSubscriber((Topic)replyToDestination, getName(), "JMSCorrelationID = '" + messageId.replaceAll("'", "''") + "'", false); } return messageConsumer; }
[ "private", "MessageConsumer", "createMessageConsumer", "(", "Destination", "replyToDestination", ",", "String", "messageId", ")", "throws", "JMSException", "{", "MessageConsumer", "messageConsumer", ";", "if", "(", "replyToDestination", "instanceof", "Queue", ")", "{", ...
Creates a message consumer on temporary/durable queue or topic. Durable queue/topic destinations require a message selector to be set. @param replyToDestination the reply destination. @param messageId the messageId used for optional message selector. @return @throws JMSException
[ "Creates", "a", "message", "consumer", "on", "temporary", "/", "durable", "queue", "or", "topic", ".", "Durable", "queue", "/", "topic", "destinations", "require", "a", "message", "selector", "to", "be", "set", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsSyncProducer.java#L236-L248
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Snappy.java
Snappy.encodeLiteral
static void encodeLiteral(ByteBuf in, ByteBuf out, int length) { """ Writes a literal to the supplied output buffer by directly copying from the input buffer. The literal is taken from the current readerIndex up to the supplied length. @param in The input buffer to copy from @param out The output buffer to copy to @param length The length of the literal to copy """ if (length < 61) { out.writeByte(length - 1 << 2); } else { int bitLength = bitsToEncode(length - 1); int bytesToEncode = 1 + bitLength / 8; out.writeByte(59 + bytesToEncode << 2); for (int i = 0; i < bytesToEncode; i++) { out.writeByte(length - 1 >> i * 8 & 0x0ff); } } out.writeBytes(in, length); }
java
static void encodeLiteral(ByteBuf in, ByteBuf out, int length) { if (length < 61) { out.writeByte(length - 1 << 2); } else { int bitLength = bitsToEncode(length - 1); int bytesToEncode = 1 + bitLength / 8; out.writeByte(59 + bytesToEncode << 2); for (int i = 0; i < bytesToEncode; i++) { out.writeByte(length - 1 >> i * 8 & 0x0ff); } } out.writeBytes(in, length); }
[ "static", "void", "encodeLiteral", "(", "ByteBuf", "in", ",", "ByteBuf", "out", ",", "int", "length", ")", "{", "if", "(", "length", "<", "61", ")", "{", "out", ".", "writeByte", "(", "length", "-", "1", "<<", "2", ")", ";", "}", "else", "{", "in...
Writes a literal to the supplied output buffer by directly copying from the input buffer. The literal is taken from the current readerIndex up to the supplied length. @param in The input buffer to copy from @param out The output buffer to copy to @param length The length of the literal to copy
[ "Writes", "a", "literal", "to", "the", "supplied", "output", "buffer", "by", "directly", "copying", "from", "the", "input", "buffer", ".", "The", "literal", "is", "taken", "from", "the", "current", "readerIndex", "up", "to", "the", "supplied", "length", "." ...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L223-L236
knightliao/disconf
disconf-client/src/main/java/com/baidu/disconf/client/addons/properties/ReloadingPropertyPlaceholderConfigurer.java
ReloadingPropertyPlaceholderConfigurer.getDynamic
private DynamicProperty getDynamic(String currentBeanName, String currentPropertyName, String orgStrVal) { """ @param currentBeanName 当前的bean name @param currentPropertyName 当前它的属性 @param orgStrVal 原来的值 @return """ DynamicProperty dynamic = new DynamicProperty(currentBeanName, currentPropertyName, orgStrVal); DynamicProperty found = dynamicProperties.get(dynamic); if (found != null) { return found; } dynamicProperties.put(dynamic, dynamic); return dynamic; }
java
private DynamicProperty getDynamic(String currentBeanName, String currentPropertyName, String orgStrVal) { DynamicProperty dynamic = new DynamicProperty(currentBeanName, currentPropertyName, orgStrVal); DynamicProperty found = dynamicProperties.get(dynamic); if (found != null) { return found; } dynamicProperties.put(dynamic, dynamic); return dynamic; }
[ "private", "DynamicProperty", "getDynamic", "(", "String", "currentBeanName", ",", "String", "currentPropertyName", ",", "String", "orgStrVal", ")", "{", "DynamicProperty", "dynamic", "=", "new", "DynamicProperty", "(", "currentBeanName", ",", "currentPropertyName", ","...
@param currentBeanName 当前的bean name @param currentPropertyName 当前它的属性 @param orgStrVal 原来的值 @return
[ "@param", "currentBeanName", "当前的bean", "name", "@param", "currentPropertyName", "当前它的属性", "@param", "orgStrVal", "原来的值" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-client/src/main/java/com/baidu/disconf/client/addons/properties/ReloadingPropertyPlaceholderConfigurer.java#L107-L115
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/action/menu/UndoOperationAction.java
UndoOperationAction.execute
public boolean execute(Canvas target, Menu menu, MenuItem item) { """ This function tries to find out whether or not this menu item should be enabled. Only if there are more then 1 operations in the feature transaction operation queue, will this menu item be enabled. """ FeatureTransaction featureTransaction = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction(); if (featureTransaction != null) { boolean operationCount = featureTransaction.getOperationQueue().size() > 0; if (operationCount) { // The first addCoordinateOp may not be undone! FeatureOperation firstOperation = featureTransaction.getOperationQueue().get(0); if (firstOperation instanceof AddCoordinateOp) { if (featureTransaction.getNewFeatures()[0].getGeometry().getNumPoints() == 1) { return false; } } return true; } } return false; }
java
public boolean execute(Canvas target, Menu menu, MenuItem item) { FeatureTransaction featureTransaction = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction(); if (featureTransaction != null) { boolean operationCount = featureTransaction.getOperationQueue().size() > 0; if (operationCount) { // The first addCoordinateOp may not be undone! FeatureOperation firstOperation = featureTransaction.getOperationQueue().get(0); if (firstOperation instanceof AddCoordinateOp) { if (featureTransaction.getNewFeatures()[0].getGeometry().getNumPoints() == 1) { return false; } } return true; } } return false; }
[ "public", "boolean", "execute", "(", "Canvas", "target", ",", "Menu", "menu", ",", "MenuItem", "item", ")", "{", "FeatureTransaction", "featureTransaction", "=", "mapWidget", ".", "getMapModel", "(", ")", ".", "getFeatureEditor", "(", ")", ".", "getFeatureTransa...
This function tries to find out whether or not this menu item should be enabled. Only if there are more then 1 operations in the feature transaction operation queue, will this menu item be enabled.
[ "This", "function", "tries", "to", "find", "out", "whether", "or", "not", "this", "menu", "item", "should", "be", "enabled", ".", "Only", "if", "there", "are", "more", "then", "1", "operations", "in", "the", "feature", "transaction", "operation", "queue", ...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/menu/UndoOperationAction.java#L75-L92
google/flogger
api/src/main/java/com/google/common/flogger/backend/FormatOptions.java
FormatOptions.filter
public FormatOptions filter(int allowedFlags, boolean allowWidth, boolean allowPrecision) { """ Returns a possibly new FormatOptions instance possibly containing a subset of the formatting information. This is useful if a backend implementation wishes to create formatting options that ignore some of the specified formatting information. @param allowedFlags A mask of flag values to be retained in the returned instance. Use {@link #ALL_FLAGS} to retain all flag values, or {@code 0} to suppress all flags. @param allowWidth specifies whether to include width in the returned instance. @param allowPrecision specifies whether to include precision in the returned instance. """ if (isDefault()) { return this; } int newFlags = allowedFlags & flags; int newWidth = allowWidth ? width : UNSET; int newPrecision = allowPrecision ? precision : UNSET; // Remember that we must never create a non-canonical default instance. if (newFlags == 0 && newWidth == UNSET && newPrecision == UNSET) { return DEFAULT; } // This check would be faster if we encoded the entire state into a long value. It's also // entirely possible we should just allocate a new instance and be damned (especially as // having anything other than the default instance is rare). // TODO(dbeaumont): Measure performance and see about removing this code, almost certainly fine. if (newFlags == flags && newWidth == width && newPrecision == precision) { return this; } return new FormatOptions(newFlags, newWidth, newPrecision); }
java
public FormatOptions filter(int allowedFlags, boolean allowWidth, boolean allowPrecision) { if (isDefault()) { return this; } int newFlags = allowedFlags & flags; int newWidth = allowWidth ? width : UNSET; int newPrecision = allowPrecision ? precision : UNSET; // Remember that we must never create a non-canonical default instance. if (newFlags == 0 && newWidth == UNSET && newPrecision == UNSET) { return DEFAULT; } // This check would be faster if we encoded the entire state into a long value. It's also // entirely possible we should just allocate a new instance and be damned (especially as // having anything other than the default instance is rare). // TODO(dbeaumont): Measure performance and see about removing this code, almost certainly fine. if (newFlags == flags && newWidth == width && newPrecision == precision) { return this; } return new FormatOptions(newFlags, newWidth, newPrecision); }
[ "public", "FormatOptions", "filter", "(", "int", "allowedFlags", ",", "boolean", "allowWidth", ",", "boolean", "allowPrecision", ")", "{", "if", "(", "isDefault", "(", ")", ")", "{", "return", "this", ";", "}", "int", "newFlags", "=", "allowedFlags", "&", ...
Returns a possibly new FormatOptions instance possibly containing a subset of the formatting information. This is useful if a backend implementation wishes to create formatting options that ignore some of the specified formatting information. @param allowedFlags A mask of flag values to be retained in the returned instance. Use {@link #ALL_FLAGS} to retain all flag values, or {@code 0} to suppress all flags. @param allowWidth specifies whether to include width in the returned instance. @param allowPrecision specifies whether to include precision in the returned instance.
[ "Returns", "a", "possibly", "new", "FormatOptions", "instance", "possibly", "containing", "a", "subset", "of", "the", "formatting", "information", ".", "This", "is", "useful", "if", "a", "backend", "implementation", "wishes", "to", "create", "formatting", "options...
train
https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/backend/FormatOptions.java#L278-L297
google/closure-compiler
src/com/google/javascript/jscomp/TypeValidator.java
TypeValidator.expectStringOrNumberOrSymbol
void expectStringOrNumberOrSymbol(Node n, JSType type, String msg) { """ Expect the type to be a number or string or symbol, or a type convertible to a number or string. If the expectation is not met, issue a warning at the provided node's source code position. """ if (!type.matchesNumberContext() && !type.matchesStringContext() && !type.matchesSymbolContext()) { mismatch(n, msg, type, NUMBER_STRING_SYMBOL); } else { expectStringOrNumberOrSymbolStrict(n, type, msg); } }
java
void expectStringOrNumberOrSymbol(Node n, JSType type, String msg) { if (!type.matchesNumberContext() && !type.matchesStringContext() && !type.matchesSymbolContext()) { mismatch(n, msg, type, NUMBER_STRING_SYMBOL); } else { expectStringOrNumberOrSymbolStrict(n, type, msg); } }
[ "void", "expectStringOrNumberOrSymbol", "(", "Node", "n", ",", "JSType", "type", ",", "String", "msg", ")", "{", "if", "(", "!", "type", ".", "matchesNumberContext", "(", ")", "&&", "!", "type", ".", "matchesStringContext", "(", ")", "&&", "!", "type", "...
Expect the type to be a number or string or symbol, or a type convertible to a number or string. If the expectation is not met, issue a warning at the provided node's source code position.
[ "Expect", "the", "type", "to", "be", "a", "number", "or", "string", "or", "symbol", "or", "a", "type", "convertible", "to", "a", "number", "or", "string", ".", "If", "the", "expectation", "is", "not", "met", "issue", "a", "warning", "at", "the", "provi...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L456-L464
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java
TernaryPatcher.post
public static void post(OpcodeStack stack, int opcode) { """ called after the execution of the parent OpcodeStack.sawOpcode, to restore the user values after the GOTO or GOTO_W's mergeJumps were processed @param stack the OpcodeStack with the items containing user values @param opcode the opcode currently seen """ if (!sawGOTO || (opcode == Const.GOTO) || (opcode == Const.GOTO_W)) { return; } int depth = stack.getStackDepth(); for (int i = 0; i < depth && i < userValues.size(); i++) { OpcodeStack.Item item = stack.getStackItem(i); if (item.getUserValue() == null) { item.setUserValue(userValues.get(i)); } } userValues.clear(); sawGOTO = false; }
java
public static void post(OpcodeStack stack, int opcode) { if (!sawGOTO || (opcode == Const.GOTO) || (opcode == Const.GOTO_W)) { return; } int depth = stack.getStackDepth(); for (int i = 0; i < depth && i < userValues.size(); i++) { OpcodeStack.Item item = stack.getStackItem(i); if (item.getUserValue() == null) { item.setUserValue(userValues.get(i)); } } userValues.clear(); sawGOTO = false; }
[ "public", "static", "void", "post", "(", "OpcodeStack", "stack", ",", "int", "opcode", ")", "{", "if", "(", "!", "sawGOTO", "||", "(", "opcode", "==", "Const", ".", "GOTO", ")", "||", "(", "opcode", "==", "Const", ".", "GOTO_W", ")", ")", "{", "ret...
called after the execution of the parent OpcodeStack.sawOpcode, to restore the user values after the GOTO or GOTO_W's mergeJumps were processed @param stack the OpcodeStack with the items containing user values @param opcode the opcode currently seen
[ "called", "after", "the", "execution", "of", "the", "parent", "OpcodeStack", ".", "sawOpcode", "to", "restore", "the", "user", "values", "after", "the", "GOTO", "or", "GOTO_W", "s", "mergeJumps", "were", "processed" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java#L76-L90
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java
AbstractNotification.appendText
private void appendText(StringBuilder sb, String text, String format) { """ Appends a text element if it is not null or empty. @param sb String builder. @param text Text value to append. @param format Format specifier. """ if (text != null && !text.isEmpty()) { format = "@vistanotification.detail." + format + ".label"; sb.append(StrUtil.formatMessage(format, text)).append("\n"); } }
java
private void appendText(StringBuilder sb, String text, String format) { if (text != null && !text.isEmpty()) { format = "@vistanotification.detail." + format + ".label"; sb.append(StrUtil.formatMessage(format, text)).append("\n"); } }
[ "private", "void", "appendText", "(", "StringBuilder", "sb", ",", "String", "text", ",", "String", "format", ")", "{", "if", "(", "text", "!=", "null", "&&", "!", "text", ".", "isEmpty", "(", ")", ")", "{", "format", "=", "\"@vistanotification.detail.\"", ...
Appends a text element if it is not null or empty. @param sb String builder. @param text Text value to append. @param format Format specifier.
[ "Appends", "a", "text", "element", "if", "it", "is", "not", "null", "or", "empty", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java#L327-L332
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_network_public_GET
public ArrayList<OvhNetwork> project_serviceName_network_public_GET(String serviceName) throws IOException { """ Get public networks REST: GET /cloud/project/{serviceName}/network/public @param serviceName [required] Service name """ String qPath = "/cloud/project/{serviceName}/network/public"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
java
public ArrayList<OvhNetwork> project_serviceName_network_public_GET(String serviceName) throws IOException { String qPath = "/cloud/project/{serviceName}/network/public"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
[ "public", "ArrayList", "<", "OvhNetwork", ">", "project_serviceName_network_public_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/network/public\"", ";", "StringBuilder", "sb", "=", "path", "(...
Get public networks REST: GET /cloud/project/{serviceName}/network/public @param serviceName [required] Service name
[ "Get", "public", "networks" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L861-L866
epam/parso
src/main/java/com/epam/parso/impl/SasFileParser.java
SasFileParser.processPageMetadata
private void processPageMetadata(int bitOffset, List<SubheaderPointer> subheaderPointers) throws IOException { """ The method to parse and read metadata of a page, used for pages of the {@link SasFileConstants#PAGE_META_TYPE_1} {@link SasFileConstants#PAGE_META_TYPE_1}, and {@link SasFileConstants#PAGE_MIX_TYPE} types. The method goes through subheaders, one by one, and calls the processing functions depending on their signatures. @param bitOffset the offset from the beginning of the page at which the page stores its metadata. @param subheaderPointers the number of subheaders on the page. @throws IOException if reading from the {@link SasFileParser#sasFileStream} string is impossible. """ subheaderPointers.clear(); for (int subheaderPointerIndex = 0; subheaderPointerIndex < currentPageSubheadersCount; subheaderPointerIndex++) { SubheaderPointer currentSubheaderPointer = processSubheaderPointers((long) bitOffset + SUBHEADER_POINTERS_OFFSET, subheaderPointerIndex); subheaderPointers.add(currentSubheaderPointer); if (currentSubheaderPointer.compression != TRUNCATED_SUBHEADER_ID) { long subheaderSignature = readSubheaderSignature(currentSubheaderPointer.offset); SubheaderIndexes subheaderIndex = chooseSubheaderClass(subheaderSignature, currentSubheaderPointer.compression, currentSubheaderPointer.type); if (subheaderIndex != null) { if (subheaderIndex != SubheaderIndexes.DATA_SUBHEADER_INDEX) { LOGGER.debug(SUBHEADER_PROCESS_FUNCTION_NAME, subheaderIndex); subheaderIndexToClass.get(subheaderIndex).processSubheader( subheaderPointers.get(subheaderPointerIndex).offset, subheaderPointers.get(subheaderPointerIndex).length); } else { currentPageDataSubheaderPointers.add(subheaderPointers.get(subheaderPointerIndex)); } } else { LOGGER.debug(UNKNOWN_SUBHEADER_SIGNATURE); } } } }
java
private void processPageMetadata(int bitOffset, List<SubheaderPointer> subheaderPointers) throws IOException { subheaderPointers.clear(); for (int subheaderPointerIndex = 0; subheaderPointerIndex < currentPageSubheadersCount; subheaderPointerIndex++) { SubheaderPointer currentSubheaderPointer = processSubheaderPointers((long) bitOffset + SUBHEADER_POINTERS_OFFSET, subheaderPointerIndex); subheaderPointers.add(currentSubheaderPointer); if (currentSubheaderPointer.compression != TRUNCATED_SUBHEADER_ID) { long subheaderSignature = readSubheaderSignature(currentSubheaderPointer.offset); SubheaderIndexes subheaderIndex = chooseSubheaderClass(subheaderSignature, currentSubheaderPointer.compression, currentSubheaderPointer.type); if (subheaderIndex != null) { if (subheaderIndex != SubheaderIndexes.DATA_SUBHEADER_INDEX) { LOGGER.debug(SUBHEADER_PROCESS_FUNCTION_NAME, subheaderIndex); subheaderIndexToClass.get(subheaderIndex).processSubheader( subheaderPointers.get(subheaderPointerIndex).offset, subheaderPointers.get(subheaderPointerIndex).length); } else { currentPageDataSubheaderPointers.add(subheaderPointers.get(subheaderPointerIndex)); } } else { LOGGER.debug(UNKNOWN_SUBHEADER_SIGNATURE); } } } }
[ "private", "void", "processPageMetadata", "(", "int", "bitOffset", ",", "List", "<", "SubheaderPointer", ">", "subheaderPointers", ")", "throws", "IOException", "{", "subheaderPointers", ".", "clear", "(", ")", ";", "for", "(", "int", "subheaderPointerIndex", "=",...
The method to parse and read metadata of a page, used for pages of the {@link SasFileConstants#PAGE_META_TYPE_1} {@link SasFileConstants#PAGE_META_TYPE_1}, and {@link SasFileConstants#PAGE_MIX_TYPE} types. The method goes through subheaders, one by one, and calls the processing functions depending on their signatures. @param bitOffset the offset from the beginning of the page at which the page stores its metadata. @param subheaderPointers the number of subheaders on the page. @throws IOException if reading from the {@link SasFileParser#sasFileStream} string is impossible.
[ "The", "method", "to", "parse", "and", "read", "metadata", "of", "a", "page", "used", "for", "pages", "of", "the", "{", "@link", "SasFileConstants#PAGE_META_TYPE_1", "}", "{", "@link", "SasFileConstants#PAGE_META_TYPE_1", "}", "and", "{", "@link", "SasFileConstant...
train
https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L383-L409
icode/ameba-utils
src/main/java/ameba/util/Assert.java
Assert.notEmpty
public static void notEmpty(Map map, String message) { """ Assert that a Map has entries; that is, it must not be {@code null} and must have at least one entry. <pre class="code">Assert.notEmpty(map, "Map must have entries");</pre> @param map the map to check @param message the exception message to use if the assertion fails @throws java.lang.IllegalArgumentException if the map is {@code null} or has no entries """ if (MapUtils.isEmpty(map)) { throw new IllegalArgumentException(message); } }
java
public static void notEmpty(Map map, String message) { if (MapUtils.isEmpty(map)) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "notEmpty", "(", "Map", "map", ",", "String", "message", ")", "{", "if", "(", "MapUtils", ".", "isEmpty", "(", "map", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Assert that a Map has entries; that is, it must not be {@code null} and must have at least one entry. <pre class="code">Assert.notEmpty(map, "Map must have entries");</pre> @param map the map to check @param message the exception message to use if the assertion fails @throws java.lang.IllegalArgumentException if the map is {@code null} or has no entries
[ "Assert", "that", "a", "Map", "has", "entries", ";", "that", "is", "it", "must", "not", "be", "{", "@code", "null", "}", "and", "must", "have", "at", "least", "one", "entry", ".", "<pre", "class", "=", "code", ">", "Assert", ".", "notEmpty", "(", "...
train
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/Assert.java#L298-L302
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java
StaxUtils.readQName
public static QName readQName(XMLStreamReader reader) throws XMLStreamException { """ Reads a QName from the element text. Reader must be positioned at the start tag. """ String value = reader.getElementText(); if (value == null) { return null; } value = value.trim(); int index = value.indexOf(":"); if (index == -1) { return new QName(value); } String prefix = value.substring(0, index); String localName = value.substring(index + 1); String ns = reader.getNamespaceURI(prefix); if ((!StringUtils.isEmpty(prefix) && ns == null) || localName == null) { throw new RuntimeException("Invalid QName in mapping: " + value); } if (ns == null) { return new QName(localName); } return new QName(ns, localName, prefix); }
java
public static QName readQName(XMLStreamReader reader) throws XMLStreamException { String value = reader.getElementText(); if (value == null) { return null; } value = value.trim(); int index = value.indexOf(":"); if (index == -1) { return new QName(value); } String prefix = value.substring(0, index); String localName = value.substring(index + 1); String ns = reader.getNamespaceURI(prefix); if ((!StringUtils.isEmpty(prefix) && ns == null) || localName == null) { throw new RuntimeException("Invalid QName in mapping: " + value); } if (ns == null) { return new QName(localName); } return new QName(ns, localName, prefix); }
[ "public", "static", "QName", "readQName", "(", "XMLStreamReader", "reader", ")", "throws", "XMLStreamException", "{", "String", "value", "=", "reader", ".", "getElementText", "(", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", ...
Reads a QName from the element text. Reader must be positioned at the start tag.
[ "Reads", "a", "QName", "from", "the", "element", "text", ".", "Reader", "must", "be", "positioned", "at", "the", "start", "tag", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java#L1851-L1877
coursera/courier
generator-api/src/main/java/org/coursera/courier/api/CourierTemplateSpecGenerator.java
CourierTemplateSpecGenerator.enclosingClassAndMemberNameToString
private static String enclosingClassAndMemberNameToString(ClassTemplateSpec enclosingClass, String memberName) { """ /* Generate human consumable representation of enclosing class and field name. """ final StringBuilder sb = new StringBuilder(); if (memberName != null) { sb.append(" in "); sb.append(memberName); } if (enclosingClass != null) { sb.append(" in "); sb.append(enclosingClass.getFullName()); } return sb.toString(); }
java
private static String enclosingClassAndMemberNameToString(ClassTemplateSpec enclosingClass, String memberName) { final StringBuilder sb = new StringBuilder(); if (memberName != null) { sb.append(" in "); sb.append(memberName); } if (enclosingClass != null) { sb.append(" in "); sb.append(enclosingClass.getFullName()); } return sb.toString(); }
[ "private", "static", "String", "enclosingClassAndMemberNameToString", "(", "ClassTemplateSpec", "enclosingClass", ",", "String", "memberName", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "memberName", "!=", "null"...
/* Generate human consumable representation of enclosing class and field name.
[ "/", "*", "Generate", "human", "consumable", "representation", "of", "enclosing", "class", "and", "field", "name", "." ]
train
https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/CourierTemplateSpecGenerator.java#L268-L282
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java
AbstractClassFileWriter.generateServiceDescriptor
protected void generateServiceDescriptor(String className, GeneratedFile generatedFile) throws IOException { """ Generates a service discovery for the given class name and file. @param className The class name @param generatedFile The generated file @throws IOException An exception if an error occurs """ CharSequence contents = generatedFile.getTextContent(); if (contents != null) { String[] entries = contents.toString().split("\\n"); if (!Arrays.asList(entries).contains(className)) { try (BufferedWriter w = new BufferedWriter(generatedFile.openWriter())) { w.newLine(); w.write(className); } } } else { try (BufferedWriter w = new BufferedWriter(generatedFile.openWriter())) { w.write(className); } } }
java
protected void generateServiceDescriptor(String className, GeneratedFile generatedFile) throws IOException { CharSequence contents = generatedFile.getTextContent(); if (contents != null) { String[] entries = contents.toString().split("\\n"); if (!Arrays.asList(entries).contains(className)) { try (BufferedWriter w = new BufferedWriter(generatedFile.openWriter())) { w.newLine(); w.write(className); } } } else { try (BufferedWriter w = new BufferedWriter(generatedFile.openWriter())) { w.write(className); } } }
[ "protected", "void", "generateServiceDescriptor", "(", "String", "className", ",", "GeneratedFile", "generatedFile", ")", "throws", "IOException", "{", "CharSequence", "contents", "=", "generatedFile", ".", "getTextContent", "(", ")", ";", "if", "(", "contents", "!=...
Generates a service discovery for the given class name and file. @param className The class name @param generatedFile The generated file @throws IOException An exception if an error occurs
[ "Generates", "a", "service", "discovery", "for", "the", "given", "class", "name", "and", "file", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java#L1086-L1101
fuinorg/utils4j
src/main/java/org/fuin/utils4j/Utils4J.java
Utils4J.jreFile
public static boolean jreFile(final File file) { """ Determines if the file is a file from the Java runtime and exists. @param file File to test. @return TRUE if the file is in the 'java.home' directory. """ final String javaHome = System.getProperty("java.home"); try { return file.getCanonicalPath().startsWith(javaHome) && file.isFile(); } catch (final IOException ex) { throw new RuntimeException("Error reading canonical path for: " + file, ex); } }
java
public static boolean jreFile(final File file) { final String javaHome = System.getProperty("java.home"); try { return file.getCanonicalPath().startsWith(javaHome) && file.isFile(); } catch (final IOException ex) { throw new RuntimeException("Error reading canonical path for: " + file, ex); } }
[ "public", "static", "boolean", "jreFile", "(", "final", "File", "file", ")", "{", "final", "String", "javaHome", "=", "System", ".", "getProperty", "(", "\"java.home\"", ")", ";", "try", "{", "return", "file", ".", "getCanonicalPath", "(", ")", ".", "start...
Determines if the file is a file from the Java runtime and exists. @param file File to test. @return TRUE if the file is in the 'java.home' directory.
[ "Determines", "if", "the", "file", "is", "a", "file", "from", "the", "Java", "runtime", "and", "exists", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L1625-L1632
NoraUi/NoraUi
src/main/java/com/github/noraui/utils/Utilities.java
Utilities.findElement
public static WebElement findElement(PageElement element, Object... args) { """ Find the first {@link WebElement} using the given method. This method is affected by the 'implicit wait' times in force at the time of execution. The findElement(..) invocation will return a matching row, or try again repeatedly until the configured timeout is reached. @param element is PageElement find in page. @param args can be a index i @return the first {@link WebElement} using the given method """ return Context.getDriver().findElement(getLocator(element.getPage().getApplication(), element.getPage().getPageKey() + element.getKey(), args)); }
java
public static WebElement findElement(PageElement element, Object... args) { return Context.getDriver().findElement(getLocator(element.getPage().getApplication(), element.getPage().getPageKey() + element.getKey(), args)); }
[ "public", "static", "WebElement", "findElement", "(", "PageElement", "element", ",", "Object", "...", "args", ")", "{", "return", "Context", ".", "getDriver", "(", ")", ".", "findElement", "(", "getLocator", "(", "element", ".", "getPage", "(", ")", ".", "...
Find the first {@link WebElement} using the given method. This method is affected by the 'implicit wait' times in force at the time of execution. The findElement(..) invocation will return a matching row, or try again repeatedly until the configured timeout is reached. @param element is PageElement find in page. @param args can be a index i @return the first {@link WebElement} using the given method
[ "Find", "the", "first", "{", "@link", "WebElement", "}", "using", "the", "given", "method", ".", "This", "method", "is", "affected", "by", "the", "implicit", "wait", "times", "in", "force", "at", "the", "time", "of", "execution", ".", "The", "findElement",...
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/utils/Utilities.java#L193-L195
kkopacz/agiso-tempel
bundles/tempel-core/src/main/java/org/agiso/tempel/core/DefaultTemplateExecutor.java
DefaultTemplateExecutor.executeTemplate
@Override public void executeTemplate(String templateName, Map<String, Object> properties, String workDir) { """ Uruchamia proces generacji treści w oparciu o szablon. @param templateName Szablon do uruchomienia. @param properties Mapa parametrów uruchomienia szablonu. @param workDir Ścieżka do katalogu roboczego. """ // Pobieranie definicji szablonu do użycia: Template<?> template = templateProvider.get(templateName, null, null, null); if(template == null) { throw new RuntimeException("Nie znaleziono szablonu " + templateName); } if(template.isAbstract()) { throw new AbstractTemplateException(templateName); } // Weryfikowanie definicji szablonu, szablonu nadrzędnego i wszystkich // szablonów używanych. Sprawdzanie dostępność klas silników generatorów. templateVerifier.verifyTemplate(template, templateProvider); MapStack<String, Object> propertiesStack = new SimpleMapStack<String,Object>(); propertiesStack.push(new HashMap<String, Object>(properties)); doExecuteTemplate(template, propertiesStack, workDir); propertiesStack.pop(); }
java
@Override public void executeTemplate(String templateName, Map<String, Object> properties, String workDir) { // Pobieranie definicji szablonu do użycia: Template<?> template = templateProvider.get(templateName, null, null, null); if(template == null) { throw new RuntimeException("Nie znaleziono szablonu " + templateName); } if(template.isAbstract()) { throw new AbstractTemplateException(templateName); } // Weryfikowanie definicji szablonu, szablonu nadrzędnego i wszystkich // szablonów używanych. Sprawdzanie dostępność klas silników generatorów. templateVerifier.verifyTemplate(template, templateProvider); MapStack<String, Object> propertiesStack = new SimpleMapStack<String,Object>(); propertiesStack.push(new HashMap<String, Object>(properties)); doExecuteTemplate(template, propertiesStack, workDir); propertiesStack.pop(); }
[ "@", "Override", "public", "void", "executeTemplate", "(", "String", "templateName", ",", "Map", "<", "String", ",", "Object", ">", "properties", ",", "String", "workDir", ")", "{", "// Pobieranie definicji szablonu do użycia:", "Template", "<", "?", ">", "templat...
Uruchamia proces generacji treści w oparciu o szablon. @param templateName Szablon do uruchomienia. @param properties Mapa parametrów uruchomienia szablonu. @param workDir Ścieżka do katalogu roboczego.
[ "Uruchamia", "proces", "generacji", "treści", "w", "oparciu", "o", "szablon", "." ]
train
https://github.com/kkopacz/agiso-tempel/blob/ff7a96153153b6bc07212d776816b87d9538f6fa/bundles/tempel-core/src/main/java/org/agiso/tempel/core/DefaultTemplateExecutor.java#L125-L144
kiegroup/drools
drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java
DefaultBeanClassBuilder.buildDynamicPropertyMap
protected void buildDynamicPropertyMap( ClassWriter cw, ClassDefinition def ) { """ A traitable class is a special class with support for dynamic properties and types. This method builds the property map, containing the key/values pairs to implement any property defined in a trait interface but not supported by the traited class fields. @param cw @param def """ FieldVisitor fv = cw.visitField( Opcodes.ACC_PRIVATE, TraitableBean.MAP_FIELD_NAME, Type.getDescriptor( Map.class ) , "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;", null); fv.visitEnd(); MethodVisitor mv = cw.visitMethod( Opcodes.ACC_PUBLIC, "_getDynamicProperties", Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ), "()Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;", null); mv.visitCode(); mv.visitVarInsn( ALOAD, 0 ); mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType(def.getName()), TraitableBean.MAP_FIELD_NAME, Type.getDescriptor( Map.class ) ); mv.visitInsn( ARETURN ); mv.visitMaxs( 0, 0 ); mv.visitEnd(); mv = cw.visitMethod( ACC_PUBLIC, "_setDynamicProperties", Type.getMethodDescriptor( Type.getType( void.class ), new Type[] { Type.getType( Map.class ) } ), "(Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;)V", null); mv.visitCode(); mv.visitVarInsn( ALOAD, 0 ); mv.visitVarInsn( ALOAD, 1 ); mv.visitFieldInsn ( PUTFIELD, BuildUtils.getInternalType( def.getName() ), TraitableBean.MAP_FIELD_NAME, Type.getDescriptor( Map.class ) ); mv.visitInsn( RETURN) ; mv.visitMaxs( 0, 0 ); mv.visitEnd(); }
java
protected void buildDynamicPropertyMap( ClassWriter cw, ClassDefinition def ) { FieldVisitor fv = cw.visitField( Opcodes.ACC_PRIVATE, TraitableBean.MAP_FIELD_NAME, Type.getDescriptor( Map.class ) , "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;", null); fv.visitEnd(); MethodVisitor mv = cw.visitMethod( Opcodes.ACC_PUBLIC, "_getDynamicProperties", Type.getMethodDescriptor( Type.getType( Map.class ), new Type[] {} ), "()Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;", null); mv.visitCode(); mv.visitVarInsn( ALOAD, 0 ); mv.visitFieldInsn( GETFIELD, BuildUtils.getInternalType(def.getName()), TraitableBean.MAP_FIELD_NAME, Type.getDescriptor( Map.class ) ); mv.visitInsn( ARETURN ); mv.visitMaxs( 0, 0 ); mv.visitEnd(); mv = cw.visitMethod( ACC_PUBLIC, "_setDynamicProperties", Type.getMethodDescriptor( Type.getType( void.class ), new Type[] { Type.getType( Map.class ) } ), "(Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;)V", null); mv.visitCode(); mv.visitVarInsn( ALOAD, 0 ); mv.visitVarInsn( ALOAD, 1 ); mv.visitFieldInsn ( PUTFIELD, BuildUtils.getInternalType( def.getName() ), TraitableBean.MAP_FIELD_NAME, Type.getDescriptor( Map.class ) ); mv.visitInsn( RETURN) ; mv.visitMaxs( 0, 0 ); mv.visitEnd(); }
[ "protected", "void", "buildDynamicPropertyMap", "(", "ClassWriter", "cw", ",", "ClassDefinition", "def", ")", "{", "FieldVisitor", "fv", "=", "cw", ".", "visitField", "(", "Opcodes", ".", "ACC_PRIVATE", ",", "TraitableBean", ".", "MAP_FIELD_NAME", ",", "Type", "...
A traitable class is a special class with support for dynamic properties and types. This method builds the property map, containing the key/values pairs to implement any property defined in a trait interface but not supported by the traited class fields. @param cw @param def
[ "A", "traitable", "class", "is", "a", "special", "class", "with", "support", "for", "dynamic", "properties", "and", "types", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/factmodel/DefaultBeanClassBuilder.java#L765-L801
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.loadClass
Symbol loadClass(Env<AttrContext> env, Name name) { """ Load toplevel or member class with given fully qualified name and verify that it is accessible. @param env The current environment. @param name The fully qualified name of the class to be loaded. """ try { ClassSymbol c = reader.loadClass(name); return isAccessible(env, c) ? c : new AccessError(c); } catch (ClassReader.BadClassFile err) { throw err; } catch (CompletionFailure ex) { return typeNotFound; } }
java
Symbol loadClass(Env<AttrContext> env, Name name) { try { ClassSymbol c = reader.loadClass(name); return isAccessible(env, c) ? c : new AccessError(c); } catch (ClassReader.BadClassFile err) { throw err; } catch (CompletionFailure ex) { return typeNotFound; } }
[ "Symbol", "loadClass", "(", "Env", "<", "AttrContext", ">", "env", ",", "Name", "name", ")", "{", "try", "{", "ClassSymbol", "c", "=", "reader", ".", "loadClass", "(", "name", ")", ";", "return", "isAccessible", "(", "env", ",", "c", ")", "?", "c", ...
Load toplevel or member class with given fully qualified name and verify that it is accessible. @param env The current environment. @param name The fully qualified name of the class to be loaded.
[ "Load", "toplevel", "or", "member", "class", "with", "given", "fully", "qualified", "name", "and", "verify", "that", "it", "is", "accessible", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L1905-L1914
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java
TransformerIdentityImpl.elementDecl
public void elementDecl (String name, String model) throws SAXException { """ Report an element type declaration. <p>The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all whitespace is removed,and will include the enclosing parentheses.</p> @param name The element type name. @param model The content model as a normalized string. @exception SAXException The application may raise an exception. """ if (null != m_resultDeclHandler) m_resultDeclHandler.elementDecl(name, model); }
java
public void elementDecl (String name, String model) throws SAXException { if (null != m_resultDeclHandler) m_resultDeclHandler.elementDecl(name, model); }
[ "public", "void", "elementDecl", "(", "String", "name", ",", "String", "model", ")", "throws", "SAXException", "{", "if", "(", "null", "!=", "m_resultDeclHandler", ")", "m_resultDeclHandler", ".", "elementDecl", "(", "name", ",", "model", ")", ";", "}" ]
Report an element type declaration. <p>The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all whitespace is removed,and will include the enclosing parentheses.</p> @param name The element type name. @param model The content model as a normalized string. @exception SAXException The application may raise an exception.
[ "Report", "an", "element", "type", "declaration", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L1342-L1347
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java
FieldInfo.setValue
public void setValue(Object obj, Object value) { """ Sets this field in the given object to the given value using reflection. <p>If the field is final, it checks that the value being set is identical to the existing value. """ if (setters.length > 0) { for (Method method : setters) { if (value == null || method.getParameterTypes()[0].isAssignableFrom(value.getClass())) { try { method.invoke(obj, value); return; } catch (IllegalAccessException | InvocationTargetException e) { // try to set field directly } } } } setFieldValue(field, obj, value); }
java
public void setValue(Object obj, Object value) { if (setters.length > 0) { for (Method method : setters) { if (value == null || method.getParameterTypes()[0].isAssignableFrom(value.getClass())) { try { method.invoke(obj, value); return; } catch (IllegalAccessException | InvocationTargetException e) { // try to set field directly } } } } setFieldValue(field, obj, value); }
[ "public", "void", "setValue", "(", "Object", "obj", ",", "Object", "value", ")", "{", "if", "(", "setters", ".", "length", ">", "0", ")", "{", "for", "(", "Method", "method", ":", "setters", ")", "{", "if", "(", "value", "==", "null", "||", "method...
Sets this field in the given object to the given value using reflection. <p>If the field is final, it checks that the value being set is identical to the existing value.
[ "Sets", "this", "field", "in", "the", "given", "object", "to", "the", "given", "value", "using", "reflection", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/util/FieldInfo.java#L219-L233
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractRepositoryClient.java
AbstractRepositoryClient.getAssetsWithUnboundedMaxVersion
@Override public Collection<Asset> getAssetsWithUnboundedMaxVersion(final Collection<ResourceType> types, final Collection<String> rightProductIds, final Visibility visibility) throws IOException, RequestFailureException { """ This method will return all of the assets matching specific filters in Massive that do not have a maximum version in their applies to filter info. It will just return a summary of each asset and not include any {@link Attachment}s. @param types The types to look for or <code>null</code> will return all types @param productIds The product IDs to look for. Should not be <code>null</code> although supplying this will return assets for any product ID @param visibility The visibility to look for or <code>null</code> will return all visibility values (or none) @return A collection of the assets of that type @throws IOException @throws RequestFailureException """ return getFilteredAssets(types, rightProductIds, visibility, null, true); }
java
@Override public Collection<Asset> getAssetsWithUnboundedMaxVersion(final Collection<ResourceType> types, final Collection<String> rightProductIds, final Visibility visibility) throws IOException, RequestFailureException { return getFilteredAssets(types, rightProductIds, visibility, null, true); }
[ "@", "Override", "public", "Collection", "<", "Asset", ">", "getAssetsWithUnboundedMaxVersion", "(", "final", "Collection", "<", "ResourceType", ">", "types", ",", "final", "Collection", "<", "String", ">", "rightProductIds", ",", "final", "Visibility", "visibility"...
This method will return all of the assets matching specific filters in Massive that do not have a maximum version in their applies to filter info. It will just return a summary of each asset and not include any {@link Attachment}s. @param types The types to look for or <code>null</code> will return all types @param productIds The product IDs to look for. Should not be <code>null</code> although supplying this will return assets for any product ID @param visibility The visibility to look for or <code>null</code> will return all visibility values (or none) @return A collection of the assets of that type @throws IOException @throws RequestFailureException
[ "This", "method", "will", "return", "all", "of", "the", "assets", "matching", "specific", "filters", "in", "Massive", "that", "do", "not", "have", "a", "maximum", "version", "in", "their", "applies", "to", "filter", "info", ".", "It", "will", "just", "retu...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/AbstractRepositoryClient.java#L67-L71
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/RefinePolygonToGrayLine.java
RefinePolygonToGrayLine.optimize
protected boolean optimize( Point2D_F64 a , Point2D_F64 b , LineGeneral2D_F64 found ) { """ Fits a line defined by the two points. When fitting the line the weight of the edge is used to determine how influential the point is @param a Corner point in image coordinates. @param b Corner point in image coordinates. @param found (output) Line in image coordinates @return true if successful or false if it failed """ computeAdjustedEndPoints(a, b); return snapToEdge.refine(adjA, adjB, found); }
java
protected boolean optimize( Point2D_F64 a , Point2D_F64 b , LineGeneral2D_F64 found ) { computeAdjustedEndPoints(a, b); return snapToEdge.refine(adjA, adjB, found); }
[ "protected", "boolean", "optimize", "(", "Point2D_F64", "a", ",", "Point2D_F64", "b", ",", "LineGeneral2D_F64", "found", ")", "{", "computeAdjustedEndPoints", "(", "a", ",", "b", ")", ";", "return", "snapToEdge", ".", "refine", "(", "adjA", ",", "adjB", ",",...
Fits a line defined by the two points. When fitting the line the weight of the edge is used to determine how influential the point is @param a Corner point in image coordinates. @param b Corner point in image coordinates. @param found (output) Line in image coordinates @return true if successful or false if it failed
[ "Fits", "a", "line", "defined", "by", "the", "two", "points", ".", "When", "fitting", "the", "line", "the", "weight", "of", "the", "edge", "is", "used", "to", "determine", "how", "influential", "the", "point", "is" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/RefinePolygonToGrayLine.java#L271-L276
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/Timecode.java
Timecode.getSmpteTimecode
@Deprecated public static final Timecode getSmpteTimecode(final String smpte, final Timebase timebase) { """ Part an SMPTE formatted timecode (<code>[-][dd:]hh:mm:ss:ff</code> -or <code>[-][dd:]hh:mm:ss;ff</code> for drop-frame timecode alongside a timebase @param smpte @param timebase @return """ return getInstance(smpte, timebase); }
java
@Deprecated public static final Timecode getSmpteTimecode(final String smpte, final Timebase timebase) { return getInstance(smpte, timebase); }
[ "@", "Deprecated", "public", "static", "final", "Timecode", "getSmpteTimecode", "(", "final", "String", "smpte", ",", "final", "Timebase", "timebase", ")", "{", "return", "getInstance", "(", "smpte", ",", "timebase", ")", ";", "}" ]
Part an SMPTE formatted timecode (<code>[-][dd:]hh:mm:ss:ff</code> -or <code>[-][dd:]hh:mm:ss;ff</code> for drop-frame timecode alongside a timebase @param smpte @param timebase @return
[ "Part", "an", "SMPTE", "formatted", "timecode", "(", "<code", ">", "[", "-", "]", "[", "dd", ":", "]", "hh", ":", "mm", ":", "ss", ":", "ff<", "/", "code", ">", "-", "or", "<code", ">", "[", "-", "]", "[", "dd", ":", "]", "hh", ":", "mm", ...
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/Timecode.java#L837-L841
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSSourceAuditor.java
XDSSourceAuditor.auditProvideAndRegisterEvent
protected void auditProvideAndRegisterEvent( IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String submissionSetUniqueId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { """ Generically sends audit messages for XDS Document Source Provide And Register Document Set events @param transaction The specific IHE Transaction (ITI-15 or ITI-41) @param eventOutcome The event outcome indicator @param repositoryEndpointUri The endpoint of the repository in this transaction @param submissionSetUniqueId The UniqueID of the Submission Set provided @param patientId The Patient Id that this submission pertains to @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token) """ ExportEvent exportEvent = new ExportEvent(true, eventOutcome, transaction, purposesOfUse); exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); /* * FIXME: Overriding endpoint URI with "anonymous", for now */ String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous"; //String replyToUri = getSystemUserId(); exportEvent.addSourceActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(userName)) { exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } exportEvent.addDestinationActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { exportEvent.addPatientParticipantObject(patientId); } exportEvent.addSubmissionSetParticipantObject(submissionSetUniqueId); audit(exportEvent); }
java
protected void auditProvideAndRegisterEvent( IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, String repositoryEndpointUri, String userName, String submissionSetUniqueId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { ExportEvent exportEvent = new ExportEvent(true, eventOutcome, transaction, purposesOfUse); exportEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); /* * FIXME: Overriding endpoint URI with "anonymous", for now */ String replyToUri = "http://www.w3.org/2005/08/addressing/anonymous"; //String replyToUri = getSystemUserId(); exportEvent.addSourceActiveParticipant(replyToUri, getSystemAltUserId(), getSystemUserName(), getSystemNetworkId(), true); if (!EventUtils.isEmptyOrNull(userName)) { exportEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } exportEvent.addDestinationActiveParticipant(repositoryEndpointUri, null, null, EventUtils.getAddressForUrl(repositoryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { exportEvent.addPatientParticipantObject(patientId); } exportEvent.addSubmissionSetParticipantObject(submissionSetUniqueId); audit(exportEvent); }
[ "protected", "void", "auditProvideAndRegisterEvent", "(", "IHETransactionEventTypeCodes", "transaction", ",", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "repositoryEndpointUri", ",", "String", "userName", ",", "String", "submissionSetUniqueId", ",", "String", ...
Generically sends audit messages for XDS Document Source Provide And Register Document Set events @param transaction The specific IHE Transaction (ITI-15 or ITI-41) @param eventOutcome The event outcome indicator @param repositoryEndpointUri The endpoint of the repository in this transaction @param submissionSetUniqueId The UniqueID of the Submission Set provided @param patientId The Patient Id that this submission pertains to @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Generically", "sends", "audit", "messages", "for", "XDS", "Document", "Source", "Provide", "And", "Register", "Document", "Set", "events" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSSourceAuditor.java#L110-L138
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java
TaskForm.startProcessInstanceByIdForm
@Deprecated public void startProcessInstanceByIdForm(String processDefinitionId, String callbackUrl) { """ @deprecated use {@link startProcessInstanceByIdForm()} instead @param processDefinitionId @param callbackUrl """ this.url = callbackUrl; this.processDefinitionId = processDefinitionId; beginConversation(); }
java
@Deprecated public void startProcessInstanceByIdForm(String processDefinitionId, String callbackUrl) { this.url = callbackUrl; this.processDefinitionId = processDefinitionId; beginConversation(); }
[ "@", "Deprecated", "public", "void", "startProcessInstanceByIdForm", "(", "String", "processDefinitionId", ",", "String", "callbackUrl", ")", "{", "this", ".", "url", "=", "callbackUrl", ";", "this", ".", "processDefinitionId", "=", "processDefinitionId", ";", "begi...
@deprecated use {@link startProcessInstanceByIdForm()} instead @param processDefinitionId @param callbackUrl
[ "@deprecated", "use", "{", "@link", "startProcessInstanceByIdForm", "()", "}", "instead" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java#L127-L132
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/util/PropertyUtils.java
PropertyUtils.getPropertyDescriptor
private static PropertyDescriptor getPropertyDescriptor(Object bean, String name) { """ <p> Retrieve the property descriptor for the specified property of the specified bean, or return <code>null</code> if there is no such descriptor. This method resolves indexed and nested property references in the same manner as other methods in this class, except that if the last (or only) name element is indexed, the descriptor for the last resolved property itself is returned. </p> @param bean Bean for which a property descriptor is requested @param name Possibly indexed and/or nested name of the property for which a property descriptor is requested @exception IllegalAccessException if the caller does not have access to the property accessor method @exception IllegalArgumentException if <code>bean</code> or <code>name</code> is null @exception IllegalArgumentException if a nested reference to a property returns null @exception InvocationTargetException if the property accessor method throws an exception @exception NoSuchMethodException if an accessor method for this propety cannot be found """ PropertyDescriptor descriptor = null; PropertyDescriptor descriptors[] = getPropertyDescriptors(bean.getClass()); if (descriptors != null) { for (PropertyDescriptor descriptor1 : descriptors) { if (name.equals(descriptor1.getName())) { descriptor = descriptor1; } } } return descriptor; }
java
private static PropertyDescriptor getPropertyDescriptor(Object bean, String name) { PropertyDescriptor descriptor = null; PropertyDescriptor descriptors[] = getPropertyDescriptors(bean.getClass()); if (descriptors != null) { for (PropertyDescriptor descriptor1 : descriptors) { if (name.equals(descriptor1.getName())) { descriptor = descriptor1; } } } return descriptor; }
[ "private", "static", "PropertyDescriptor", "getPropertyDescriptor", "(", "Object", "bean", ",", "String", "name", ")", "{", "PropertyDescriptor", "descriptor", "=", "null", ";", "PropertyDescriptor", "descriptors", "[", "]", "=", "getPropertyDescriptors", "(", "bean",...
<p> Retrieve the property descriptor for the specified property of the specified bean, or return <code>null</code> if there is no such descriptor. This method resolves indexed and nested property references in the same manner as other methods in this class, except that if the last (or only) name element is indexed, the descriptor for the last resolved property itself is returned. </p> @param bean Bean for which a property descriptor is requested @param name Possibly indexed and/or nested name of the property for which a property descriptor is requested @exception IllegalAccessException if the caller does not have access to the property accessor method @exception IllegalArgumentException if <code>bean</code> or <code>name</code> is null @exception IllegalArgumentException if a nested reference to a property returns null @exception InvocationTargetException if the property accessor method throws an exception @exception NoSuchMethodException if an accessor method for this propety cannot be found
[ "<p", ">", "Retrieve", "the", "property", "descriptor", "for", "the", "specified", "property", "of", "the", "specified", "bean", "or", "return", "<code", ">", "null<", "/", "code", ">", "if", "there", "is", "no", "such", "descriptor", ".", "This", "method"...
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/util/PropertyUtils.java#L116-L128
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
StrBuilder.lastIndexOf
public int lastIndexOf(final char ch, int startIndex) { """ Searches the string builder to find the last reference to the specified char. @param ch the character to find @param startIndex the index to start at, invalid index rounded to edge @return the last index of the character, or -1 if not found """ startIndex = (startIndex >= size ? size - 1 : startIndex); if (startIndex < 0) { return -1; } for (int i = startIndex; i >= 0; i--) { if (buffer[i] == ch) { return i; } } return -1; }
java
public int lastIndexOf(final char ch, int startIndex) { startIndex = (startIndex >= size ? size - 1 : startIndex); if (startIndex < 0) { return -1; } for (int i = startIndex; i >= 0; i--) { if (buffer[i] == ch) { return i; } } return -1; }
[ "public", "int", "lastIndexOf", "(", "final", "char", "ch", ",", "int", "startIndex", ")", "{", "startIndex", "=", "(", "startIndex", ">=", "size", "?", "size", "-", "1", ":", "startIndex", ")", ";", "if", "(", "startIndex", "<", "0", ")", "{", "retu...
Searches the string builder to find the last reference to the specified char. @param ch the character to find @param startIndex the index to start at, invalid index rounded to edge @return the last index of the character, or -1 if not found
[ "Searches", "the", "string", "builder", "to", "find", "the", "last", "reference", "to", "the", "specified", "char", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2541-L2552
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitConfigMonitor.java
GitConfigMonitor.addChange
@Override public void addChange(DiffEntry change) { """ Add a {@link FlowSpec} for an added, updated, or modified flow config @param change """ if (checkConfigFilePath(change.getNewPath())) { Path configFilePath = new Path(this.repositoryDir, change.getNewPath()); try { Config flowConfig = loadConfigFileWithFlowNameOverrides(configFilePath); this.flowCatalog.put(FlowSpec.builder() .withConfig(flowConfig) .withVersion(SPEC_VERSION) .withDescription(SPEC_DESCRIPTION) .build()); } catch (IOException e) { log.warn("Could not load config file: " + configFilePath); } } }
java
@Override public void addChange(DiffEntry change) { if (checkConfigFilePath(change.getNewPath())) { Path configFilePath = new Path(this.repositoryDir, change.getNewPath()); try { Config flowConfig = loadConfigFileWithFlowNameOverrides(configFilePath); this.flowCatalog.put(FlowSpec.builder() .withConfig(flowConfig) .withVersion(SPEC_VERSION) .withDescription(SPEC_DESCRIPTION) .build()); } catch (IOException e) { log.warn("Could not load config file: " + configFilePath); } } }
[ "@", "Override", "public", "void", "addChange", "(", "DiffEntry", "change", ")", "{", "if", "(", "checkConfigFilePath", "(", "change", ".", "getNewPath", "(", ")", ")", ")", "{", "Path", "configFilePath", "=", "new", "Path", "(", "this", ".", "repositoryDi...
Add a {@link FlowSpec} for an added, updated, or modified flow config @param change
[ "Add", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitConfigMonitor.java#L94-L111
youngmonkeys/ezyfox-sfs2x
src/main/java/com/tvd12/ezyfox/sfs2x/clienthandler/ClientEventHandler.java
ClientEventHandler.checkUserAgent
private Object checkUserAgent(RequestResponseClass clazz, ApiUser userAgent) { """ For each listener, we may use a class of user agent, so we need check it @param clazz structure of listener class @param userAgent user agent object @return instance of user agent """ if(clazz.getUserClass().isAssignableFrom(userAgent.getClass())) return userAgent; return UserAgentUtil.getGameUser(userAgent, clazz.getUserClass()); }
java
private Object checkUserAgent(RequestResponseClass clazz, ApiUser userAgent) { if(clazz.getUserClass().isAssignableFrom(userAgent.getClass())) return userAgent; return UserAgentUtil.getGameUser(userAgent, clazz.getUserClass()); }
[ "private", "Object", "checkUserAgent", "(", "RequestResponseClass", "clazz", ",", "ApiUser", "userAgent", ")", "{", "if", "(", "clazz", ".", "getUserClass", "(", ")", ".", "isAssignableFrom", "(", "userAgent", ".", "getClass", "(", ")", ")", ")", "return", "...
For each listener, we may use a class of user agent, so we need check it @param clazz structure of listener class @param userAgent user agent object @return instance of user agent
[ "For", "each", "listener", "we", "may", "use", "a", "class", "of", "user", "agent", "so", "we", "need", "check", "it" ]
train
https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/clienthandler/ClientEventHandler.java#L133-L137
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/producible/ProducibleConfig.java
ProducibleConfig.imports
public static ProducibleConfig imports(Xml root) { """ Create the producible data from node. @param root The root reference (must not be <code>null</code>). @return The producible data. @throws LionEngineException If unable to read node. """ Check.notNull(root); final Xml node = root.getChild(NODE_PRODUCIBLE); final SizeConfig size = SizeConfig.imports(root); final int time = node.readInteger(ATT_STEPS); return new ProducibleConfig(time, size.getWidth(), size.getHeight()); }
java
public static ProducibleConfig imports(Xml root) { Check.notNull(root); final Xml node = root.getChild(NODE_PRODUCIBLE); final SizeConfig size = SizeConfig.imports(root); final int time = node.readInteger(ATT_STEPS); return new ProducibleConfig(time, size.getWidth(), size.getHeight()); }
[ "public", "static", "ProducibleConfig", "imports", "(", "Xml", "root", ")", "{", "Check", ".", "notNull", "(", "root", ")", ";", "final", "Xml", "node", "=", "root", ".", "getChild", "(", "NODE_PRODUCIBLE", ")", ";", "final", "SizeConfig", "size", "=", "...
Create the producible data from node. @param root The root reference (must not be <code>null</code>). @return The producible data. @throws LionEngineException If unable to read node.
[ "Create", "the", "producible", "data", "from", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/producible/ProducibleConfig.java#L63-L72
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/ping.java
ping.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ ping_responses result = (ping_responses) service.get_payload_formatter().string_to_resource(ping_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ping_response_array); } ping[] result_ping = new ping[result.ping_response_array.length]; for(int i = 0; i < result.ping_response_array.length; i++) { result_ping[i] = result.ping_response_array[i].ping[0]; } return result_ping; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ping_responses result = (ping_responses) service.get_payload_formatter().string_to_resource(ping_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ping_response_array); } ping[] result_ping = new ping[result.ping_response_array.length]; for(int i = 0; i < result.ping_response_array.length; i++) { result_ping[i] = result.ping_response_array[i].ping[0]; } return result_ping; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ping_responses", "result", "=", "(", "ping_responses", ")", "service", ".", "get_payload_formatter", "(", ...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/ping.java#L203-L220
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/cos/COSUtils.java
COSUtils.translateException
public static IOException translateException(String operation, Path path, AmazonClientException exception) { """ Translate an exception raised in an operation into an IOException. The specific type of IOException depends on the class of {@link AmazonClientException} passed in, and any status codes included in the operation. That is: HTTP error codes are examined and can be used to build a more specific response. @param operation operation @param path path operated on (must not be null) @param exception amazon exception raised @return an IOE which wraps the caught exception """ return translateException(operation, path.toString(), exception); }
java
public static IOException translateException(String operation, Path path, AmazonClientException exception) { return translateException(operation, path.toString(), exception); }
[ "public", "static", "IOException", "translateException", "(", "String", "operation", ",", "Path", "path", ",", "AmazonClientException", "exception", ")", "{", "return", "translateException", "(", "operation", ",", "path", ".", "toString", "(", ")", ",", "exception...
Translate an exception raised in an operation into an IOException. The specific type of IOException depends on the class of {@link AmazonClientException} passed in, and any status codes included in the operation. That is: HTTP error codes are examined and can be used to build a more specific response. @param operation operation @param path path operated on (must not be null) @param exception amazon exception raised @return an IOE which wraps the caught exception
[ "Translate", "an", "exception", "raised", "in", "an", "operation", "into", "an", "IOException", ".", "The", "specific", "type", "of", "IOException", "depends", "on", "the", "class", "of", "{", "@link", "AmazonClientException", "}", "passed", "in", "and", "any"...
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSUtils.java#L72-L75
szpak/mockito-java8
src/main/java/info/solidsoft/mockito/java8/LambdaMatcher.java
LambdaMatcher.argLambdaThrowing
@Incubating public static <T> T argLambdaThrowing(ThrowingPredicate<T> throwingLambda, String description) { """ A variant of argLambda(Predicate) for lambdas declaring checked exceptions. """ return argThat(new LambdaMatcher<>(throwingLambda.uncheck(), description)); }
java
@Incubating public static <T> T argLambdaThrowing(ThrowingPredicate<T> throwingLambda, String description) { return argThat(new LambdaMatcher<>(throwingLambda.uncheck(), description)); }
[ "@", "Incubating", "public", "static", "<", "T", ">", "T", "argLambdaThrowing", "(", "ThrowingPredicate", "<", "T", ">", "throwingLambda", ",", "String", "description", ")", "{", "return", "argThat", "(", "new", "LambdaMatcher", "<>", "(", "throwingLambda", "....
A variant of argLambda(Predicate) for lambdas declaring checked exceptions.
[ "A", "variant", "of", "argLambda", "(", "Predicate", ")", "for", "lambdas", "declaring", "checked", "exceptions", "." ]
train
https://github.com/szpak/mockito-java8/blob/0aa342d5887515c185f0affaa83d4a456b0e9dab/src/main/java/info/solidsoft/mockito/java8/LambdaMatcher.java#L130-L133
diffplug/JMatIO
src/main/java/ca/mjdsystems/jmatio/io/OSArrayTag.java
OSArrayTag.writeTo
public void writeTo(DataOutputStream os) throws IOException { """ Writes tag and data to <code>DataOutputStream</code>. Wites padding if neccesary. @param os @throws IOException """ int padding; if (size<=4 && size>0) { // Use small data element format (Page 1-10 in "MATLAB 7 MAT-File Format", September 2010 revision) os.writeShort(size); os.writeShort(type); padding = getPadding(data.limit(), true); } else { os.writeInt(type); os.writeInt(size); padding = getPadding(data.limit(), false); } int maxBuffSize = 1024; int writeBuffSize = data.remaining() < maxBuffSize ? data.remaining() : maxBuffSize; byte[] tmp = new byte[writeBuffSize]; while ( data.remaining() > 0 ) { int length = data.remaining() > tmp.length ? tmp.length : data.remaining(); data.get( tmp, 0, length); os.write(tmp, 0, length); } if ( padding > 0 ) { os.write( new byte[padding] ); } }
java
public void writeTo(DataOutputStream os) throws IOException { int padding; if (size<=4 && size>0) { // Use small data element format (Page 1-10 in "MATLAB 7 MAT-File Format", September 2010 revision) os.writeShort(size); os.writeShort(type); padding = getPadding(data.limit(), true); } else { os.writeInt(type); os.writeInt(size); padding = getPadding(data.limit(), false); } int maxBuffSize = 1024; int writeBuffSize = data.remaining() < maxBuffSize ? data.remaining() : maxBuffSize; byte[] tmp = new byte[writeBuffSize]; while ( data.remaining() > 0 ) { int length = data.remaining() > tmp.length ? tmp.length : data.remaining(); data.get( tmp, 0, length); os.write(tmp, 0, length); } if ( padding > 0 ) { os.write( new byte[padding] ); } }
[ "public", "void", "writeTo", "(", "DataOutputStream", "os", ")", "throws", "IOException", "{", "int", "padding", ";", "if", "(", "size", "<=", "4", "&&", "size", ">", "0", ")", "{", "// Use small data element format (Page 1-10 in \"MATLAB 7 MAT-File Format\", Septembe...
Writes tag and data to <code>DataOutputStream</code>. Wites padding if neccesary. @param os @throws IOException
[ "Writes", "tag", "and", "data", "to", "<code", ">", "DataOutputStream<", "/", "code", ">", ".", "Wites", "padding", "if", "neccesary", "." ]
train
https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/io/OSArrayTag.java#L45-L74
beders/Resty
src/main/java/us/monoid/web/Resty.java
Resty.authenticate
public void authenticate(URI aSite, String aLogin, char[] aPwd) { """ Register this root URI for authentication. Whenever a URL is requested that starts with this root, the credentials given are used for HTTP AUTH. Note that currently authentication information is shared across all Resty instances. This is due to the shortcomings of the java.net authentication mechanism. This might change should Resty adopt HttpClient and is the reason why this method is not a static one. @param aSite the root URI of the site @param aLogin the login name @param aPwd the password. The array will not be internally copied. Whenever you null it, the password is gone within Resty """ rath.addSite(aSite, aLogin, aPwd); }
java
public void authenticate(URI aSite, String aLogin, char[] aPwd) { rath.addSite(aSite, aLogin, aPwd); }
[ "public", "void", "authenticate", "(", "URI", "aSite", ",", "String", "aLogin", ",", "char", "[", "]", "aPwd", ")", "{", "rath", ".", "addSite", "(", "aSite", ",", "aLogin", ",", "aPwd", ")", ";", "}" ]
Register this root URI for authentication. Whenever a URL is requested that starts with this root, the credentials given are used for HTTP AUTH. Note that currently authentication information is shared across all Resty instances. This is due to the shortcomings of the java.net authentication mechanism. This might change should Resty adopt HttpClient and is the reason why this method is not a static one. @param aSite the root URI of the site @param aLogin the login name @param aPwd the password. The array will not be internally copied. Whenever you null it, the password is gone within Resty
[ "Register", "this", "root", "URI", "for", "authentication", ".", "Whenever", "a", "URL", "is", "requested", "that", "starts", "with", "this", "root", "the", "credentials", "given", "are", "used", "for", "HTTP", "AUTH", ".", "Note", "that", "currently", "auth...
train
https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L136-L138
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemDatasetRepository.java
FileSystemDatasetRepository.partitionKeyForPath
@SuppressWarnings( { """ Get a {@link org.kitesdk.data.spi.PartitionKey} corresponding to a partition's filesystem path represented as a {@link URI}. If the path is not a valid partition, then {@link IllegalArgumentException} is thrown. Note that the partition does not have to exist. @param dataset the filesystem dataset @param partitionPath a directory path where the partition data is stored @return a partition key representing the partition at the given path @since 0.4.0 """"unchecked", "deprecation"}) public static PartitionKey partitionKeyForPath(Dataset dataset, URI partitionPath) { Preconditions.checkState(dataset.getDescriptor().isPartitioned(), "Attempt to get a partition on a non-partitioned dataset (name:%s)", dataset.getName()); Preconditions.checkArgument(dataset instanceof FileSystemDataset, "Dataset is not a FileSystemDataset"); FileSystemDataset fsDataset = (FileSystemDataset) dataset; FileSystem fs = fsDataset.getFileSystem(); URI partitionUri = fs.makeQualified(new Path(partitionPath)).toUri(); URI directoryUri = fsDataset.getDirectory().toUri(); URI relativizedUri = directoryUri.relativize(partitionUri); if (relativizedUri.equals(partitionUri)) { throw new IllegalArgumentException(String.format("Partition URI %s has different " + "root directory to dataset (directory: %s).", partitionUri, directoryUri)); } Iterable<String> parts = Splitter.on('/').split(relativizedUri.getPath()); PartitionStrategy partitionStrategy = dataset.getDescriptor().getPartitionStrategy(); List<FieldPartitioner> fieldPartitioners = Accessor.getDefault().getFieldPartitioners(partitionStrategy); if (Iterables.size(parts) > fieldPartitioners.size()) { throw new IllegalArgumentException(String.format("Too many partition directories " + "for %s (%s), expecting %s.", partitionUri, Iterables.size(parts), fieldPartitioners.size())); } Schema schema = dataset.getDescriptor().getSchema(); List<Object> values = Lists.newArrayList(); int i = 0; for (String part : parts) { Iterator<String> split = Splitter.on('=').split(part).iterator(); String fieldName = split.next(); FieldPartitioner fp = fieldPartitioners.get(i++); if (!fieldName.equals(fp.getName())) { throw new IllegalArgumentException(String.format("Unrecognized partition name " + "'%s' in partition %s, expecting '%s'.", fieldName, partitionUri, fp.getName())); } if (!split.hasNext()) { throw new IllegalArgumentException(String.format("Missing partition value for " + "'%s' in partition %s.", fieldName, partitionUri)); } String stringValue = split.next(); values.add(PathConversion.valueForDirname(fp, schema, stringValue)); } return new PartitionKey(values.toArray(new Object[values.size()])); }
java
@SuppressWarnings({"unchecked", "deprecation"}) public static PartitionKey partitionKeyForPath(Dataset dataset, URI partitionPath) { Preconditions.checkState(dataset.getDescriptor().isPartitioned(), "Attempt to get a partition on a non-partitioned dataset (name:%s)", dataset.getName()); Preconditions.checkArgument(dataset instanceof FileSystemDataset, "Dataset is not a FileSystemDataset"); FileSystemDataset fsDataset = (FileSystemDataset) dataset; FileSystem fs = fsDataset.getFileSystem(); URI partitionUri = fs.makeQualified(new Path(partitionPath)).toUri(); URI directoryUri = fsDataset.getDirectory().toUri(); URI relativizedUri = directoryUri.relativize(partitionUri); if (relativizedUri.equals(partitionUri)) { throw new IllegalArgumentException(String.format("Partition URI %s has different " + "root directory to dataset (directory: %s).", partitionUri, directoryUri)); } Iterable<String> parts = Splitter.on('/').split(relativizedUri.getPath()); PartitionStrategy partitionStrategy = dataset.getDescriptor().getPartitionStrategy(); List<FieldPartitioner> fieldPartitioners = Accessor.getDefault().getFieldPartitioners(partitionStrategy); if (Iterables.size(parts) > fieldPartitioners.size()) { throw new IllegalArgumentException(String.format("Too many partition directories " + "for %s (%s), expecting %s.", partitionUri, Iterables.size(parts), fieldPartitioners.size())); } Schema schema = dataset.getDescriptor().getSchema(); List<Object> values = Lists.newArrayList(); int i = 0; for (String part : parts) { Iterator<String> split = Splitter.on('=').split(part).iterator(); String fieldName = split.next(); FieldPartitioner fp = fieldPartitioners.get(i++); if (!fieldName.equals(fp.getName())) { throw new IllegalArgumentException(String.format("Unrecognized partition name " + "'%s' in partition %s, expecting '%s'.", fieldName, partitionUri, fp.getName())); } if (!split.hasNext()) { throw new IllegalArgumentException(String.format("Missing partition value for " + "'%s' in partition %s.", fieldName, partitionUri)); } String stringValue = split.next(); values.add(PathConversion.valueForDirname(fp, schema, stringValue)); } return new PartitionKey(values.toArray(new Object[values.size()])); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"deprecation\"", "}", ")", "public", "static", "PartitionKey", "partitionKeyForPath", "(", "Dataset", "dataset", ",", "URI", "partitionPath", ")", "{", "Preconditions", ".", "checkState", "(", "dataset", "...
Get a {@link org.kitesdk.data.spi.PartitionKey} corresponding to a partition's filesystem path represented as a {@link URI}. If the path is not a valid partition, then {@link IllegalArgumentException} is thrown. Note that the partition does not have to exist. @param dataset the filesystem dataset @param partitionPath a directory path where the partition data is stored @return a partition key representing the partition at the given path @since 0.4.0
[ "Get", "a", "{" ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemDatasetRepository.java#L332-L384
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/struct/image/InterleavedU8.java
InterleavedU8.get32
public int get32( int x , int y ) { """ Returns an integer formed from 4 bands. a[i]<<24 | a[i+1] << 16 | a[i+2]<<8 | a[3] @param x column @param y row @return 32 bit integer """ int i = startIndex + y*stride+x*4; return ((data[i]&0xFF) << 24) | ((data[i+1]&0xFF) << 16) | ((data[i+2]&0xFF) << 8) | (data[i+3]&0xFF); }
java
public int get32( int x , int y ) { int i = startIndex + y*stride+x*4; return ((data[i]&0xFF) << 24) | ((data[i+1]&0xFF) << 16) | ((data[i+2]&0xFF) << 8) | (data[i+3]&0xFF); }
[ "public", "int", "get32", "(", "int", "x", ",", "int", "y", ")", "{", "int", "i", "=", "startIndex", "+", "y", "*", "stride", "+", "x", "*", "4", ";", "return", "(", "(", "data", "[", "i", "]", "&", "0xFF", ")", "<<", "24", ")", "|", "(", ...
Returns an integer formed from 4 bands. a[i]<<24 | a[i+1] << 16 | a[i+2]<<8 | a[3] @param x column @param y row @return 32 bit integer
[ "Returns", "an", "integer", "formed", "from", "4", "bands", ".", "a", "[", "i", "]", "<<24", "|", "a", "[", "i", "+", "1", "]", "<<", "16", "|", "a", "[", "i", "+", "2", "]", "<<8", "|", "a", "[", "3", "]" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/image/InterleavedU8.java#L56-L59
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/util/InjectionUtil.java
InjectionUtil.callMethod
public static <T> T callMethod(Class<T> retClass, Class<?> targetClass, Object target, String method, Class[] argClasses, Object[] args) { """ Calls a method with the provided arguments as parameters. @param retClass the method return value @param targetClass the instance class @param target the instance containing the method @param method the method name @param argClasses types of the method arguments @param args method arguments used during invocation @param <T> relating type parameter @return method return value """ try { Method classMethod = targetClass.getDeclaredMethod(method, argClasses); return AccessController.doPrivileged( new SetMethodPrivilegedAction<T>(classMethod, target, args)); } catch (NoSuchMethodException e) { throw new TransfuseInjectionException("Exception during method injection: NoSuchFieldException", e); } catch (PrivilegedActionException e) { throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e); } catch (Exception e) { throw new TransfuseInjectionException("Exception during field injection", e); } }
java
public static <T> T callMethod(Class<T> retClass, Class<?> targetClass, Object target, String method, Class[] argClasses, Object[] args) { try { Method classMethod = targetClass.getDeclaredMethod(method, argClasses); return AccessController.doPrivileged( new SetMethodPrivilegedAction<T>(classMethod, target, args)); } catch (NoSuchMethodException e) { throw new TransfuseInjectionException("Exception during method injection: NoSuchFieldException", e); } catch (PrivilegedActionException e) { throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e); } catch (Exception e) { throw new TransfuseInjectionException("Exception during field injection", e); } }
[ "public", "static", "<", "T", ">", "T", "callMethod", "(", "Class", "<", "T", ">", "retClass", ",", "Class", "<", "?", ">", "targetClass", ",", "Object", "target", ",", "String", "method", ",", "Class", "[", "]", "argClasses", ",", "Object", "[", "]"...
Calls a method with the provided arguments as parameters. @param retClass the method return value @param targetClass the instance class @param target the instance containing the method @param method the method name @param argClasses types of the method arguments @param args method arguments used during invocation @param <T> relating type parameter @return method return value
[ "Calls", "a", "method", "with", "the", "provided", "arguments", "as", "parameters", "." ]
train
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/util/InjectionUtil.java#L144-L158
webjars/webjars-locator
src/main/java/org/webjars/RequireJS.java
RequireJS.requireJsConfigErrorMessage
private static String requireJsConfigErrorMessage(Map.Entry<String, String> webJar) { """ A generic error message for when the RequireJS config could not be parsed out of the WebJar's pom.xml meta-data. @param webJar A tuple (artifactId -> version) representing the WebJar. @return The error message. """ return "Could not read WebJar RequireJS config for: " + webJar.getKey() + " " + webJar.getValue() + "\n" + "Please file a bug at: http://github.com/webjars/" + webJar.getKey() + "/issues/new"; }
java
private static String requireJsConfigErrorMessage(Map.Entry<String, String> webJar) { return "Could not read WebJar RequireJS config for: " + webJar.getKey() + " " + webJar.getValue() + "\n" + "Please file a bug at: http://github.com/webjars/" + webJar.getKey() + "/issues/new"; }
[ "private", "static", "String", "requireJsConfigErrorMessage", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "webJar", ")", "{", "return", "\"Could not read WebJar RequireJS config for: \"", "+", "webJar", ".", "getKey", "(", ")", "+", "\" \"", "+", ...
A generic error message for when the RequireJS config could not be parsed out of the WebJar's pom.xml meta-data. @param webJar A tuple (artifactId -> version) representing the WebJar. @return The error message.
[ "A", "generic", "error", "message", "for", "when", "the", "RequireJS", "config", "could", "not", "be", "parsed", "out", "of", "the", "WebJar", "s", "pom", ".", "xml", "meta", "-", "data", "." ]
train
https://github.com/webjars/webjars-locator/blob/8796fb3ff1b9ad5c0d433ecf63a60520c715e3a0/src/main/java/org/webjars/RequireJS.java#L551-L554
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.setColor
public void setColor(int n, int color) { """ Set a knot color. @param n the knot index @param color the color """ int firstColor = map[0]; int lastColor = map[256-1]; if (n > 0) for (int i = 0; i < n; i++) map[i] = ImageMath.mixColors((float)i/n, firstColor, color); if (n < 256-1) for (int i = n; i < 256; i++) map[i] = ImageMath.mixColors((float)(i-n)/(256-n), color, lastColor); }
java
public void setColor(int n, int color) { int firstColor = map[0]; int lastColor = map[256-1]; if (n > 0) for (int i = 0; i < n; i++) map[i] = ImageMath.mixColors((float)i/n, firstColor, color); if (n < 256-1) for (int i = n; i < 256; i++) map[i] = ImageMath.mixColors((float)(i-n)/(256-n), color, lastColor); }
[ "public", "void", "setColor", "(", "int", "n", ",", "int", "color", ")", "{", "int", "firstColor", "=", "map", "[", "0", "]", ";", "int", "lastColor", "=", "map", "[", "256", "-", "1", "]", ";", "if", "(", "n", ">", "0", ")", "for", "(", "int...
Set a knot color. @param n the knot index @param color the color
[ "Set", "a", "knot", "color", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L151-L160
threerings/nenya
core/src/main/java/com/threerings/media/util/AStarPathUtil.java
AStarPathUtil.considerStep
protected static void considerStep (Info info, Node n, int x, int y, int cost) { """ Consider the step <code>(n.x, n.y)</code> to <code>(x, y)</code> for possible inclusion in the path. @param info the info object. @param n the originating node for the step. @param x the x-coordinate for the destination step. @param y the y-coordinate for the destination step. """ // skip node if it's outside the map bounds or otherwise impassable if (!info.isStepValid(n.x, n.y, x, y)) { return; } // calculate the new cost for this node int newg = n.g + cost; // make sure the cost is reasonable if (newg > info.maxcost) { // Log.info("Rejected costly step."); return; } // retrieve the node corresponding to this location Node np = info.getNode(x, y); // skip if it's already in the open or closed list or if its // actual cost is less than the just-calculated cost if ((np.closed || info.open.contains(np)) && np.g <= newg) { return; } // remove the node from the open list since we're about to // modify its score which determines its placement in the list info.open.remove(np); // update the node's information np.parent = n; np.g = newg; np.h = getDistanceEstimate(np.x, np.y, info.destx, info.desty); np.f = np.g + np.h; // remove it from the closed list if it's present np.closed = false; // add it to the open list for further consideration info.open.add(np); _considered++; }
java
protected static void considerStep (Info info, Node n, int x, int y, int cost) { // skip node if it's outside the map bounds or otherwise impassable if (!info.isStepValid(n.x, n.y, x, y)) { return; } // calculate the new cost for this node int newg = n.g + cost; // make sure the cost is reasonable if (newg > info.maxcost) { // Log.info("Rejected costly step."); return; } // retrieve the node corresponding to this location Node np = info.getNode(x, y); // skip if it's already in the open or closed list or if its // actual cost is less than the just-calculated cost if ((np.closed || info.open.contains(np)) && np.g <= newg) { return; } // remove the node from the open list since we're about to // modify its score which determines its placement in the list info.open.remove(np); // update the node's information np.parent = n; np.g = newg; np.h = getDistanceEstimate(np.x, np.y, info.destx, info.desty); np.f = np.g + np.h; // remove it from the closed list if it's present np.closed = false; // add it to the open list for further consideration info.open.add(np); _considered++; }
[ "protected", "static", "void", "considerStep", "(", "Info", "info", ",", "Node", "n", ",", "int", "x", ",", "int", "y", ",", "int", "cost", ")", "{", "// skip node if it's outside the map bounds or otherwise impassable", "if", "(", "!", "info", ".", "isStepValid...
Consider the step <code>(n.x, n.y)</code> to <code>(x, y)</code> for possible inclusion in the path. @param info the info object. @param n the originating node for the step. @param x the x-coordinate for the destination step. @param y the y-coordinate for the destination step.
[ "Consider", "the", "step", "<code", ">", "(", "n", ".", "x", "n", ".", "y", ")", "<", "/", "code", ">", "to", "<code", ">", "(", "x", "y", ")", "<", "/", "code", ">", "for", "possible", "inclusion", "in", "the", "path", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/AStarPathUtil.java#L226-L267
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java
DerInputStream.readString
private String readString(byte stringTag, String stringName, String enc) throws IOException { """ Private helper routine to read an encoded string from the input stream. @param stringTag the tag for the type of string to read @param stringName a name to display in error messages @param enc the encoder to use to interpret the data. Should correspond to the stringTag above. """ if (buffer.read() != stringTag) throw new IOException("DER input not a " + stringName + " string"); int length = getLength(buffer); byte[] retval = new byte[length]; if ((length != 0) && (buffer.read(retval) != length)) throw new IOException("short read of DER " + stringName + " string"); return new String(retval, enc); }
java
private String readString(byte stringTag, String stringName, String enc) throws IOException { if (buffer.read() != stringTag) throw new IOException("DER input not a " + stringName + " string"); int length = getLength(buffer); byte[] retval = new byte[length]; if ((length != 0) && (buffer.read(retval) != length)) throw new IOException("short read of DER " + stringName + " string"); return new String(retval, enc); }
[ "private", "String", "readString", "(", "byte", "stringTag", ",", "String", "stringName", ",", "String", "enc", ")", "throws", "IOException", "{", "if", "(", "buffer", ".", "read", "(", ")", "!=", "stringTag", ")", "throw", "new", "IOException", "(", "\"DE...
Private helper routine to read an encoded string from the input stream. @param stringTag the tag for the type of string to read @param stringName a name to display in error messages @param enc the encoder to use to interpret the data. Should correspond to the stringTag above.
[ "Private", "helper", "routine", "to", "read", "an", "encoded", "string", "from", "the", "input", "stream", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L514-L528
appium/java-client
src/main/java/io/appium/java_client/MobileCommand.java
MobileCommand.pushFileCommand
public static Map.Entry<String, Map<String, ?>> pushFileCommand(String remotePath, byte[] base64Data) { """ This method forms a {@link java.util.Map} of parameters for the file pushing. @param remotePath Path to file to write data to on remote device @param base64Data Base64 encoded byte array of data to write to remote device @return a key-value pair. The key is the command name. The value is a {@link java.util.Map} command arguments. """ String[] parameters = new String[]{"path", "data"}; Object[] values = new Object[]{remotePath, new String(base64Data, StandardCharsets.UTF_8)}; return new AbstractMap.SimpleEntry<>(PUSH_FILE, prepareArguments(parameters, values)); }
java
public static Map.Entry<String, Map<String, ?>> pushFileCommand(String remotePath, byte[] base64Data) { String[] parameters = new String[]{"path", "data"}; Object[] values = new Object[]{remotePath, new String(base64Data, StandardCharsets.UTF_8)}; return new AbstractMap.SimpleEntry<>(PUSH_FILE, prepareArguments(parameters, values)); }
[ "public", "static", "Map", ".", "Entry", "<", "String", ",", "Map", "<", "String", ",", "?", ">", ">", "pushFileCommand", "(", "String", "remotePath", ",", "byte", "[", "]", "base64Data", ")", "{", "String", "[", "]", "parameters", "=", "new", "String"...
This method forms a {@link java.util.Map} of parameters for the file pushing. @param remotePath Path to file to write data to on remote device @param base64Data Base64 encoded byte array of data to write to remote device @return a key-value pair. The key is the command name. The value is a {@link java.util.Map} command arguments.
[ "This", "method", "forms", "a", "{", "@link", "java", ".", "util", ".", "Map", "}", "of", "parameters", "for", "the", "file", "pushing", "." ]
train
https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/MobileCommand.java#L480-L484
codegist/crest
core/src/main/java/org/codegist/crest/CRest.java
CRest.basicAuth
public static CRestBuilder basicAuth(String username, String password) { """ <p>Configures the resulting <b>CRest</b> instance to authenticate all requests using Basic Auth</p> @param username user name to authenticate the requests with @param password password to authenticate the requests with @return a CRestBuilder instance @see org.codegist.crest.CRestBuilder#basicAuth(String, String) """ return new CRestBuilder().basicAuth(username, password); }
java
public static CRestBuilder basicAuth(String username, String password){ return new CRestBuilder().basicAuth(username, password); }
[ "public", "static", "CRestBuilder", "basicAuth", "(", "String", "username", ",", "String", "password", ")", "{", "return", "new", "CRestBuilder", "(", ")", ".", "basicAuth", "(", "username", ",", "password", ")", ";", "}" ]
<p>Configures the resulting <b>CRest</b> instance to authenticate all requests using Basic Auth</p> @param username user name to authenticate the requests with @param password password to authenticate the requests with @return a CRestBuilder instance @see org.codegist.crest.CRestBuilder#basicAuth(String, String)
[ "<p", ">", "Configures", "the", "resulting", "<b", ">", "CRest<", "/", "b", ">", "instance", "to", "authenticate", "all", "requests", "using", "Basic", "Auth<", "/", "p", ">" ]
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRest.java#L207-L209
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/xml/ObjectTreeParser.java
ObjectTreeParser.invoke
private void invoke(Method method, Object instance, Object[] params) throws SlickXMLException { """ Call a method on a object @param method The method to call @param instance The objet to call the method on @param params The parameters to pass @throws SlickXMLException Indicates a failure to call or access the method """ try { method.setAccessible(true); method.invoke(instance, params); } catch (IllegalArgumentException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } catch (IllegalAccessException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } catch (InvocationTargetException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } finally { method.setAccessible(false); } }
java
private void invoke(Method method, Object instance, Object[] params) throws SlickXMLException { try { method.setAccessible(true); method.invoke(instance, params); } catch (IllegalArgumentException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } catch (IllegalAccessException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } catch (InvocationTargetException e) { throw new SlickXMLException("Failed to invoke: "+method+" for an XML attribute, is it valid?", e); } finally { method.setAccessible(false); } }
[ "private", "void", "invoke", "(", "Method", "method", ",", "Object", "instance", ",", "Object", "[", "]", "params", ")", "throws", "SlickXMLException", "{", "try", "{", "method", ".", "setAccessible", "(", "true", ")", ";", "method", ".", "invoke", "(", ...
Call a method on a object @param method The method to call @param instance The objet to call the method on @param params The parameters to pass @throws SlickXMLException Indicates a failure to call or access the method
[ "Call", "a", "method", "on", "a", "object" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/xml/ObjectTreeParser.java#L450-L463
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/kernelized/OSKL.java
OSKL.scoreSaveEval
private double scoreSaveEval(Vec x, List<Double> qi) { """ Computes the score and saves the results of the kernel computations in {@link #inputKEvals}. The first value in the list will be the self kernel product @param x the input vector @param qi the query information for the vector @return the dot product in the kernel space """ inputKEvals.clear(); inputKEvals.add(k.eval(0, 0, Arrays.asList(x), qi)); double sum = 0; for(int i = 0; i < alphas.size(); i++) { double k_ix = k.eval(i, x, qi, vecs, accelCache); inputKEvals.add(k_ix); sum += alphas.getD(i)*k_ix; } return sum; }
java
private double scoreSaveEval(Vec x, List<Double> qi) { inputKEvals.clear(); inputKEvals.add(k.eval(0, 0, Arrays.asList(x), qi)); double sum = 0; for(int i = 0; i < alphas.size(); i++) { double k_ix = k.eval(i, x, qi, vecs, accelCache); inputKEvals.add(k_ix); sum += alphas.getD(i)*k_ix; } return sum; }
[ "private", "double", "scoreSaveEval", "(", "Vec", "x", ",", "List", "<", "Double", ">", "qi", ")", "{", "inputKEvals", ".", "clear", "(", ")", ";", "inputKEvals", ".", "add", "(", "k", ".", "eval", "(", "0", ",", "0", ",", "Arrays", ".", "asList", ...
Computes the score and saves the results of the kernel computations in {@link #inputKEvals}. The first value in the list will be the self kernel product @param x the input vector @param qi the query information for the vector @return the dot product in the kernel space
[ "Computes", "the", "score", "and", "saves", "the", "results", "of", "the", "kernel", "computations", "in", "{" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/kernelized/OSKL.java#L376-L388
mgm-tp/jfunk
jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java
WebDriverTool.findAll
@Deprecated public List<WebElement> findAll(final By by, final Predicate<WebElement> condition) { """ Finds all elements. Uses the internal {@link WebElementFinder}, which tries to apply the specified {@code condition} until it times out. @param by the {@link By} used to locate the element @param condition a condition the found elements must meet @return the list of elements @deprecated Use {@link #findElements(By, Predicate)} instead """ return findElements(by, condition); }
java
@Deprecated public List<WebElement> findAll(final By by, final Predicate<WebElement> condition) { return findElements(by, condition); }
[ "@", "Deprecated", "public", "List", "<", "WebElement", ">", "findAll", "(", "final", "By", "by", ",", "final", "Predicate", "<", "WebElement", ">", "condition", ")", "{", "return", "findElements", "(", "by", ",", "condition", ")", ";", "}" ]
Finds all elements. Uses the internal {@link WebElementFinder}, which tries to apply the specified {@code condition} until it times out. @param by the {@link By} used to locate the element @param condition a condition the found elements must meet @return the list of elements @deprecated Use {@link #findElements(By, Predicate)} instead
[ "Finds", "all", "elements", ".", "Uses", "the", "internal", "{", "@link", "WebElementFinder", "}", "which", "tries", "to", "apply", "the", "specified", "{", "@code", "condition", "}", "until", "it", "times", "out", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/WebDriverTool.java#L226-L229
alkacon/opencms-core
src/org/opencms/xml/types/CmsXmlVfsImageValue.java
CmsXmlVfsImageValue.setParameterValue
private void setParameterValue(CmsObject cms, String key, String value) { """ Sets a parameter for the image with the provided key as name and the value.<p> @param cms the current users context @param key the parameter name to set @param value the value of the parameter """ if (m_parameters == null) { m_parameters = getParameterMap(getStringValue(cms)); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(value) && m_parameters.containsKey(key)) { m_parameters.remove(key); } else if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) { m_parameters.put(key, new String[] {value}); } String result = CmsRequestUtil.getRequestLink(getStringValue(cms)); result = CmsRequestUtil.appendParameters(result, m_parameters, false); setStringValue(cms, result); }
java
private void setParameterValue(CmsObject cms, String key, String value) { if (m_parameters == null) { m_parameters = getParameterMap(getStringValue(cms)); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(value) && m_parameters.containsKey(key)) { m_parameters.remove(key); } else if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) { m_parameters.put(key, new String[] {value}); } String result = CmsRequestUtil.getRequestLink(getStringValue(cms)); result = CmsRequestUtil.appendParameters(result, m_parameters, false); setStringValue(cms, result); }
[ "private", "void", "setParameterValue", "(", "CmsObject", "cms", ",", "String", "key", ",", "String", "value", ")", "{", "if", "(", "m_parameters", "==", "null", ")", "{", "m_parameters", "=", "getParameterMap", "(", "getStringValue", "(", "cms", ")", ")", ...
Sets a parameter for the image with the provided key as name and the value.<p> @param cms the current users context @param key the parameter name to set @param value the value of the parameter
[ "Sets", "a", "parameter", "for", "the", "image", "with", "the", "provided", "key", "as", "name", "and", "the", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/types/CmsXmlVfsImageValue.java#L381-L394
craftercms/core
src/main/java/org/craftercms/core/xml/mergers/impl/resolvers/MetaDataMergeStrategyResolver.java
MetaDataMergeStrategyResolver.getStrategy
public DescriptorMergeStrategy getStrategy(String descriptorUrl, Document descriptorDom) throws XmlException { """ Returns a {@link DescriptorMergeStrategy} for a given descriptor. The strategy chosen is the one defined in the descriptor document. @param descriptorUrl the URL that identifies the descriptor @param descriptorDom the XML DOM of the descriptor @return the {@link DescriptorMergeStrategy} for the descriptor, or null if the DOM is null or if there's no element in the DOM that defines the merge strategy to use. @throws XmlException if the element value doesn't refer to an existing strategy """ if (descriptorDom != null) { Node element = descriptorDom.selectSingleNode(mergeStrategyElementXPathQuery); if (element != null) { DescriptorMergeStrategy strategy = elementValueToStrategyMappings.get(element.getText()); if (strategy != null) { return strategy; } else { throw new XmlException("Element value \"" + element.getText() + "\" doesn't refer to an " + "registered strategy"); } } else { return null; } } else { return null; } }
java
public DescriptorMergeStrategy getStrategy(String descriptorUrl, Document descriptorDom) throws XmlException { if (descriptorDom != null) { Node element = descriptorDom.selectSingleNode(mergeStrategyElementXPathQuery); if (element != null) { DescriptorMergeStrategy strategy = elementValueToStrategyMappings.get(element.getText()); if (strategy != null) { return strategy; } else { throw new XmlException("Element value \"" + element.getText() + "\" doesn't refer to an " + "registered strategy"); } } else { return null; } } else { return null; } }
[ "public", "DescriptorMergeStrategy", "getStrategy", "(", "String", "descriptorUrl", ",", "Document", "descriptorDom", ")", "throws", "XmlException", "{", "if", "(", "descriptorDom", "!=", "null", ")", "{", "Node", "element", "=", "descriptorDom", ".", "selectSingleN...
Returns a {@link DescriptorMergeStrategy} for a given descriptor. The strategy chosen is the one defined in the descriptor document. @param descriptorUrl the URL that identifies the descriptor @param descriptorDom the XML DOM of the descriptor @return the {@link DescriptorMergeStrategy} for the descriptor, or null if the DOM is null or if there's no element in the DOM that defines the merge strategy to use. @throws XmlException if the element value doesn't refer to an existing strategy
[ "Returns", "a", "{", "@link", "DescriptorMergeStrategy", "}", "for", "a", "given", "descriptor", ".", "The", "strategy", "chosen", "is", "the", "one", "defined", "in", "the", "descriptor", "document", "." ]
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/xml/mergers/impl/resolvers/MetaDataMergeStrategyResolver.java#L60-L77
aehrc/snorocket
snorocket-core/src/main/java/au/csiro/snorocket/core/R.java
R1.getB
protected IConceptSet getB(int A, int r) { """ Returns {B | A [ r.B} or {B | (A,B) in R(r)} @param A @param r @return """ if (A >= CONCEPTS) { resizeConcepts(A); } if (r >= ROLES) { resizeRoles(r); } final int index = indexOf(A, r); if (null == data[index]) { data[index] = new SparseConceptSet(); addRole(r); if (null != base && index < base.length && null != base[index]) { data[index].addAll(base[index]); } } return data[index]; }
java
protected IConceptSet getB(int A, int r) { if (A >= CONCEPTS) { resizeConcepts(A); } if (r >= ROLES) { resizeRoles(r); } final int index = indexOf(A, r); if (null == data[index]) { data[index] = new SparseConceptSet(); addRole(r); if (null != base && index < base.length && null != base[index]) { data[index].addAll(base[index]); } } return data[index]; }
[ "protected", "IConceptSet", "getB", "(", "int", "A", ",", "int", "r", ")", "{", "if", "(", "A", ">=", "CONCEPTS", ")", "{", "resizeConcepts", "(", "A", ")", ";", "}", "if", "(", "r", ">=", "ROLES", ")", "{", "resizeRoles", "(", "r", ")", ";", "...
Returns {B | A [ r.B} or {B | (A,B) in R(r)} @param A @param r @return
[ "Returns", "{", "B", "|", "A", "[", "r", ".", "B", "}", "or", "{", "B", "|", "(", "A", "B", ")", "in", "R", "(", "r", ")", "}" ]
train
https://github.com/aehrc/snorocket/blob/e33c1e216f8a66d6502e3a14e80876811feedd8b/snorocket-core/src/main/java/au/csiro/snorocket/core/R.java#L143-L160
alkacon/opencms-core
src/org/opencms/flex/CmsFlexCache.java
CmsFlexCache.getCachedKey
public CmsFlexCacheKey getCachedKey(String key, CmsObject cms) { """ Returns the CmsFlexCacheKey data structure for a given key (i.e. resource name).<p> Useful if you want to show the cache key for a resources, like on the FlexCache administration page.<p> Only users with administrator permissions are allowed to perform this operation.<p> @param key the resource name for which to look up the variation for @param cms the CmsObject used for user authorization @return the CmsFlexCacheKey data structure found for the resource """ if (!isEnabled() || !OpenCms.getRoleManager().hasRole(cms, CmsRole.WORKPLACE_MANAGER)) { return null; } Object o = m_keyCache.get(key); if (o != null) { return ((CmsFlexCacheVariation)o).m_key; } return null; }
java
public CmsFlexCacheKey getCachedKey(String key, CmsObject cms) { if (!isEnabled() || !OpenCms.getRoleManager().hasRole(cms, CmsRole.WORKPLACE_MANAGER)) { return null; } Object o = m_keyCache.get(key); if (o != null) { return ((CmsFlexCacheVariation)o).m_key; } return null; }
[ "public", "CmsFlexCacheKey", "getCachedKey", "(", "String", "key", ",", "CmsObject", "cms", ")", "{", "if", "(", "!", "isEnabled", "(", ")", "||", "!", "OpenCms", ".", "getRoleManager", "(", ")", ".", "hasRole", "(", "cms", ",", "CmsRole", ".", "WORKPLAC...
Returns the CmsFlexCacheKey data structure for a given key (i.e. resource name).<p> Useful if you want to show the cache key for a resources, like on the FlexCache administration page.<p> Only users with administrator permissions are allowed to perform this operation.<p> @param key the resource name for which to look up the variation for @param cms the CmsObject used for user authorization @return the CmsFlexCacheKey data structure found for the resource
[ "Returns", "the", "CmsFlexCacheKey", "data", "structure", "for", "a", "given", "key", "(", "i", ".", "e", ".", "resource", "name", ")", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexCache.java#L504-L514
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.availabilities_GET
public ArrayList<OvhAvailabilities> availabilities_GET(OvhOvhSubsidiaryEnum country, String hardware) throws IOException { """ List the availability of dedicated server REST: GET /dedicated/server/availabilities @param country [required] The subsidiary company where the availability is requested @param hardware [required] The kind of hardware which is requested API beta """ String qPath = "/dedicated/server/availabilities"; StringBuilder sb = path(qPath); query(sb, "country", country); query(sb, "hardware", hardware); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t17); }
java
public ArrayList<OvhAvailabilities> availabilities_GET(OvhOvhSubsidiaryEnum country, String hardware) throws IOException { String qPath = "/dedicated/server/availabilities"; StringBuilder sb = path(qPath); query(sb, "country", country); query(sb, "hardware", hardware); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t17); }
[ "public", "ArrayList", "<", "OvhAvailabilities", ">", "availabilities_GET", "(", "OvhOvhSubsidiaryEnum", "country", ",", "String", "hardware", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/availabilities\"", ";", "StringBuilder", "sb", ...
List the availability of dedicated server REST: GET /dedicated/server/availabilities @param country [required] The subsidiary company where the availability is requested @param hardware [required] The kind of hardware which is requested API beta
[ "List", "the", "availability", "of", "dedicated", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2377-L2384
basho/riak-java-client
src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java
AnnotationUtil.getUsermetaData
public static <T> RiakUserMetadata getUsermetaData(RiakUserMetadata metaContainer, T domainObject) { """ Attempts to get the riak user metadata from a domain object by looking for a {@literal @RiakUsermeta} annotated field or getter method. @param <T> the type of the domain object @param metaContainer the RiakUserMetadata container @param domainObject the domain object @return a Map containing the user metadata. """ return AnnotationHelper.getInstance().getUsermetaData(metaContainer, domainObject); }
java
public static <T> RiakUserMetadata getUsermetaData(RiakUserMetadata metaContainer, T domainObject) { return AnnotationHelper.getInstance().getUsermetaData(metaContainer, domainObject); }
[ "public", "static", "<", "T", ">", "RiakUserMetadata", "getUsermetaData", "(", "RiakUserMetadata", "metaContainer", ",", "T", "domainObject", ")", "{", "return", "AnnotationHelper", ".", "getInstance", "(", ")", ".", "getUsermetaData", "(", "metaContainer", ",", "...
Attempts to get the riak user metadata from a domain object by looking for a {@literal @RiakUsermeta} annotated field or getter method. @param <T> the type of the domain object @param metaContainer the RiakUserMetadata container @param domainObject the domain object @return a Map containing the user metadata.
[ "Attempts", "to", "get", "the", "riak", "user", "metadata", "from", "a", "domain", "object", "by", "looking", "for", "a", "{", "@literal", "@RiakUsermeta", "}", "annotated", "field", "or", "getter", "method", "." ]
train
https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java#L265-L268
caspervg/SC4D-LEX4J
lex4j/src/main/java/net/caspervg/lex4j/route/SearchRoute.java
SearchRoute.addFilter
public void addFilter(Filter filter, Object value) { """ Adds a parameter to the search operation @param filter the filter to be added @param value value of the filter to be added. String.valueOf() of this Object is used for the search. """ if (filter.getParameterClass().isInstance(value)) { parameters.put(filter.repr(), value); } else { String msg = "You need to supply the correct parameter for the " + filter + " filter. Expecting a(n) " + filter.getParameterClass().getSimpleName(); throw new FilterParameterException(msg); } }
java
public void addFilter(Filter filter, Object value) { if (filter.getParameterClass().isInstance(value)) { parameters.put(filter.repr(), value); } else { String msg = "You need to supply the correct parameter for the " + filter + " filter. Expecting a(n) " + filter.getParameterClass().getSimpleName(); throw new FilterParameterException(msg); } }
[ "public", "void", "addFilter", "(", "Filter", "filter", ",", "Object", "value", ")", "{", "if", "(", "filter", ".", "getParameterClass", "(", ")", ".", "isInstance", "(", "value", ")", ")", "{", "parameters", ".", "put", "(", "filter", ".", "repr", "("...
Adds a parameter to the search operation @param filter the filter to be added @param value value of the filter to be added. String.valueOf() of this Object is used for the search.
[ "Adds", "a", "parameter", "to", "the", "search", "operation" ]
train
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/SearchRoute.java#L45-L53