repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
netty/netty
codec-dns/src/main/java/io/netty/handler/codec/dns/DatagramDnsResponseEncoder.java
DatagramDnsResponseEncoder.encodeHeader
private static void encodeHeader(DnsResponse response, ByteBuf buf) { buf.writeShort(response.id()); int flags = 32768; flags |= (response.opCode().byteValue() & 0xFF) << 11; if (response.isAuthoritativeAnswer()) { flags |= 1 << 10; } if (response.isTruncated()) { flags |= 1 << 9; } if (response.isRecursionDesired()) { flags |= 1 << 8; } if (response.isRecursionAvailable()) { flags |= 1 << 7; } flags |= response.z() << 4; flags |= response.code().intValue(); buf.writeShort(flags); buf.writeShort(response.count(DnsSection.QUESTION)); buf.writeShort(response.count(DnsSection.ANSWER)); buf.writeShort(response.count(DnsSection.AUTHORITY)); buf.writeShort(response.count(DnsSection.ADDITIONAL)); }
java
private static void encodeHeader(DnsResponse response, ByteBuf buf) { buf.writeShort(response.id()); int flags = 32768; flags |= (response.opCode().byteValue() & 0xFF) << 11; if (response.isAuthoritativeAnswer()) { flags |= 1 << 10; } if (response.isTruncated()) { flags |= 1 << 9; } if (response.isRecursionDesired()) { flags |= 1 << 8; } if (response.isRecursionAvailable()) { flags |= 1 << 7; } flags |= response.z() << 4; flags |= response.code().intValue(); buf.writeShort(flags); buf.writeShort(response.count(DnsSection.QUESTION)); buf.writeShort(response.count(DnsSection.ANSWER)); buf.writeShort(response.count(DnsSection.AUTHORITY)); buf.writeShort(response.count(DnsSection.ADDITIONAL)); }
[ "private", "static", "void", "encodeHeader", "(", "DnsResponse", "response", ",", "ByteBuf", "buf", ")", "{", "buf", ".", "writeShort", "(", "response", ".", "id", "(", ")", ")", ";", "int", "flags", "=", "32768", ";", "flags", "|=", "(", "response", "...
Encodes the header that is always 12 bytes long. @param response the response header being encoded @param buf the buffer the encoded data should be written to
[ "Encodes", "the", "header", "that", "is", "always", "12", "bytes", "long", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-dns/src/main/java/io/netty/handler/codec/dns/DatagramDnsResponseEncoder.java#L97-L120
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java
ApiOvhDedicatednas.serviceName_partition_partitionName_quota_uid_GET
public OvhQuota serviceName_partition_partitionName_quota_uid_GET(String serviceName, String partitionName, Long uid) throws IOException { String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}/quota/{uid}"; StringBuilder sb = path(qPath, serviceName, partitionName, uid); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhQuota.class); }
java
public OvhQuota serviceName_partition_partitionName_quota_uid_GET(String serviceName, String partitionName, Long uid) throws IOException { String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}/quota/{uid}"; StringBuilder sb = path(qPath, serviceName, partitionName, uid); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhQuota.class); }
[ "public", "OvhQuota", "serviceName_partition_partitionName_quota_uid_GET", "(", "String", "serviceName", ",", "String", "partitionName", ",", "Long", "uid", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/nas/{serviceName}/partition/{partitionName}/quot...
Get this object properties REST: GET /dedicated/nas/{serviceName}/partition/{partitionName}/quota/{uid} @param serviceName [required] The internal name of your storage @param partitionName [required] the given name of partition @param uid [required] the uid to set quota on
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java#L237-L242
openengsb/openengsb
ports/jms/src/main/java/org/openengsb/ports/jms/DestinationUrl.java
DestinationUrl.createDestinationUrl
public static DestinationUrl createDestinationUrl(String destination) { String[] split = splitDestination(destination); String host = split[0].trim(); String jmsDestination = split[1].trim(); return new DestinationUrl(host, jmsDestination); }
java
public static DestinationUrl createDestinationUrl(String destination) { String[] split = splitDestination(destination); String host = split[0].trim(); String jmsDestination = split[1].trim(); return new DestinationUrl(host, jmsDestination); }
[ "public", "static", "DestinationUrl", "createDestinationUrl", "(", "String", "destination", ")", "{", "String", "[", "]", "split", "=", "splitDestination", "(", "destination", ")", ";", "String", "host", "=", "split", "[", "0", "]", ".", "trim", "(", ")", ...
Creates an instance of an connection URL based on an destination string. In case that the destination string does not match the form HOST?QUEUE||TOPIC an IllegalArgumentException is thrown.
[ "Creates", "an", "instance", "of", "an", "connection", "URL", "based", "on", "an", "destination", "string", ".", "In", "case", "that", "the", "destination", "string", "does", "not", "match", "the", "form", "HOST?QUEUE||TOPIC", "an", "IllegalArgumentException", "...
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/ports/jms/src/main/java/org/openengsb/ports/jms/DestinationUrl.java#L34-L39
bcecchinato/spring-postinitialize
src/main/java/fr/zebasto/spring/post/initialize/PostInitializeProcessor.java
PostInitializeProcessor.initializeAnnotations
private void initializeAnnotations() { this.applicationContext.getBeansOfType(null, false, false).values() .stream() .filter(Objects::nonNull) .forEach(bean -> ReflectionUtils.doWithMethods(bean.getClass(), method -> { int order = AnnotationUtils.findAnnotation(method, PostInitialize.class).order(); postInitializingMethods.add(order, new PostInitializingMethod(method, bean)); }, this.methodFilter)); }
java
private void initializeAnnotations() { this.applicationContext.getBeansOfType(null, false, false).values() .stream() .filter(Objects::nonNull) .forEach(bean -> ReflectionUtils.doWithMethods(bean.getClass(), method -> { int order = AnnotationUtils.findAnnotation(method, PostInitialize.class).order(); postInitializingMethods.add(order, new PostInitializingMethod(method, bean)); }, this.methodFilter)); }
[ "private", "void", "initializeAnnotations", "(", ")", "{", "this", ".", "applicationContext", ".", "getBeansOfType", "(", "null", ",", "false", ",", "false", ")", ".", "values", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "Objects", "::", "non...
Bean processor for methods annotated with {@link PostInitialize} @since 1.0.0
[ "Bean", "processor", "for", "methods", "annotated", "with", "{", "@link", "PostInitialize", "}" ]
train
https://github.com/bcecchinato/spring-postinitialize/blob/5acd221a6aac8f03cbad63205e3157b0aeaf4bba/src/main/java/fr/zebasto/spring/post/initialize/PostInitializeProcessor.java#L71-L79
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java
TypeQualifierApplications.getInheritedTypeQualifierAnnotation
public static @CheckForNull TypeQualifierAnnotation getInheritedTypeQualifierAnnotation(XMethod xmethod, int parameter, TypeQualifierValue<?> typeQualifierValue) { assert !xmethod.isStatic(); ParameterAnnotationAccumulator accumulator = new ParameterAnnotationAccumulator(typeQualifierValue, xmethod, parameter); try { AnalysisContext.currentAnalysisContext().getSubtypes2().traverseSupertypesDepthFirst(xmethod.getClassDescriptor(), accumulator); TypeQualifierAnnotation result = accumulator.getResult().getEffectiveTypeQualifierAnnotation(); if (result == null && accumulator.overrides()) { return TypeQualifierAnnotation.OVERRIDES_BUT_NO_ANNOTATION; } return result; } catch (ClassNotFoundException e) { AnalysisContext.currentAnalysisContext().getLookupFailureCallback().reportMissingClass(e); return null; } }
java
public static @CheckForNull TypeQualifierAnnotation getInheritedTypeQualifierAnnotation(XMethod xmethod, int parameter, TypeQualifierValue<?> typeQualifierValue) { assert !xmethod.isStatic(); ParameterAnnotationAccumulator accumulator = new ParameterAnnotationAccumulator(typeQualifierValue, xmethod, parameter); try { AnalysisContext.currentAnalysisContext().getSubtypes2().traverseSupertypesDepthFirst(xmethod.getClassDescriptor(), accumulator); TypeQualifierAnnotation result = accumulator.getResult().getEffectiveTypeQualifierAnnotation(); if (result == null && accumulator.overrides()) { return TypeQualifierAnnotation.OVERRIDES_BUT_NO_ANNOTATION; } return result; } catch (ClassNotFoundException e) { AnalysisContext.currentAnalysisContext().getLookupFailureCallback().reportMissingClass(e); return null; } }
[ "public", "static", "@", "CheckForNull", "TypeQualifierAnnotation", "getInheritedTypeQualifierAnnotation", "(", "XMethod", "xmethod", ",", "int", "parameter", ",", "TypeQualifierValue", "<", "?", ">", "typeQualifierValue", ")", "{", "assert", "!", "xmethod", ".", "isS...
Get the effective inherited TypeQualifierAnnotation on the given instance method parameter. @param xmethod an instance method @param parameter a parameter (0 == first parameter) @param typeQualifierValue the kind of TypeQualifierValue we are looking for @return effective inherited TypeQualifierAnnotation on the parameter, or null if there is not effective TypeQualifierAnnotation
[ "Get", "the", "effective", "inherited", "TypeQualifierAnnotation", "on", "the", "given", "instance", "method", "parameter", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java#L952-L969
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageUtils.java
HttpMessageUtils.copy
public static void copy(Message from, HttpMessage to) { HttpMessage source; if (from instanceof HttpMessage) { source = (HttpMessage) from; } else { source = new HttpMessage(from); } copy(source, to); }
java
public static void copy(Message from, HttpMessage to) { HttpMessage source; if (from instanceof HttpMessage) { source = (HttpMessage) from; } else { source = new HttpMessage(from); } copy(source, to); }
[ "public", "static", "void", "copy", "(", "Message", "from", ",", "HttpMessage", "to", ")", "{", "HttpMessage", "source", ";", "if", "(", "from", "instanceof", "HttpMessage", ")", "{", "source", "=", "(", "HttpMessage", ")", "from", ";", "}", "else", "{",...
Apply message settings to target http message. @param from @param to
[ "Apply", "message", "settings", "to", "target", "http", "message", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageUtils.java#L40-L49
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java
LogManager.addLogger
public boolean addLogger(Logger logger) { final String name = logger.getName(); if (name == null) { throw new NullPointerException(); } drainLoggerRefQueueBounded(); LoggerContext cx = getUserContext(); if (cx.addLocalLogger(logger, this)) { // Do we have a per logger handler too? // Note: this will add a 200ms penalty loadLoggerHandlers(logger, name, name + ".handlers"); return true; } else { return false; } }
java
public boolean addLogger(Logger logger) { final String name = logger.getName(); if (name == null) { throw new NullPointerException(); } drainLoggerRefQueueBounded(); LoggerContext cx = getUserContext(); if (cx.addLocalLogger(logger, this)) { // Do we have a per logger handler too? // Note: this will add a 200ms penalty loadLoggerHandlers(logger, name, name + ".handlers"); return true; } else { return false; } }
[ "public", "boolean", "addLogger", "(", "Logger", "logger", ")", "{", "final", "String", "name", "=", "logger", ".", "getName", "(", ")", ";", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "drainL...
Add a named logger. This does nothing and returns false if a logger with the same name is already registered. <p> The Logger factory methods call this method to register each newly created Logger. <p> The application should retain its own reference to the Logger object to avoid it being garbage collected. The LogManager may only retain a weak reference. @param logger the new logger. @return true if the argument logger was registered successfully, false if a logger of that name already exists. @exception NullPointerException if the logger name is null.
[ "Add", "a", "named", "logger", ".", "This", "does", "nothing", "and", "returns", "false", "if", "a", "logger", "with", "the", "same", "name", "is", "already", "registered", ".", "<p", ">", "The", "Logger", "factory", "methods", "call", "this", "method", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/LogManager.java#L983-L998
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/resources/InstanceResource.java
InstanceResource.updateMetadata
@PUT @Path("metadata") public Response updateMetadata(@Context UriInfo uriInfo) { try { InstanceInfo instanceInfo = registry.getInstanceByAppAndId(app.getName(), id); // ReplicationInstance information is not found, generate an error if (instanceInfo == null) { logger.warn("Cannot find instance while updating metadata for instance {}/{}", app.getName(), id); return Response.status(Status.NOT_FOUND).build(); } MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters(); Set<Entry<String, List<String>>> entrySet = queryParams.entrySet(); Map<String, String> metadataMap = instanceInfo.getMetadata(); // Metadata map is empty - create a new map if (Collections.emptyMap().getClass().equals(metadataMap.getClass())) { metadataMap = new ConcurrentHashMap<>(); InstanceInfo.Builder builder = new InstanceInfo.Builder(instanceInfo); builder.setMetadata(metadataMap); instanceInfo = builder.build(); } // Add all the user supplied entries to the map for (Entry<String, List<String>> entry : entrySet) { metadataMap.put(entry.getKey(), entry.getValue().get(0)); } registry.register(instanceInfo, false); return Response.ok().build(); } catch (Throwable e) { logger.error("Error updating metadata for instance {}", id, e); return Response.serverError().build(); } }
java
@PUT @Path("metadata") public Response updateMetadata(@Context UriInfo uriInfo) { try { InstanceInfo instanceInfo = registry.getInstanceByAppAndId(app.getName(), id); // ReplicationInstance information is not found, generate an error if (instanceInfo == null) { logger.warn("Cannot find instance while updating metadata for instance {}/{}", app.getName(), id); return Response.status(Status.NOT_FOUND).build(); } MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters(); Set<Entry<String, List<String>>> entrySet = queryParams.entrySet(); Map<String, String> metadataMap = instanceInfo.getMetadata(); // Metadata map is empty - create a new map if (Collections.emptyMap().getClass().equals(metadataMap.getClass())) { metadataMap = new ConcurrentHashMap<>(); InstanceInfo.Builder builder = new InstanceInfo.Builder(instanceInfo); builder.setMetadata(metadataMap); instanceInfo = builder.build(); } // Add all the user supplied entries to the map for (Entry<String, List<String>> entry : entrySet) { metadataMap.put(entry.getKey(), entry.getValue().get(0)); } registry.register(instanceInfo, false); return Response.ok().build(); } catch (Throwable e) { logger.error("Error updating metadata for instance {}", id, e); return Response.serverError().build(); } }
[ "@", "PUT", "@", "Path", "(", "\"metadata\"", ")", "public", "Response", "updateMetadata", "(", "@", "Context", "UriInfo", "uriInfo", ")", "{", "try", "{", "InstanceInfo", "instanceInfo", "=", "registry", ".", "getInstanceByAppAndId", "(", "app", ".", "getName...
Updates user-specific metadata information. If the key is already available, its value will be overwritten. If not, it will be added. @param uriInfo - URI information generated by jersey. @return response indicating whether the operation was a success or failure.
[ "Updates", "user", "-", "specific", "metadata", "information", ".", "If", "the", "key", "is", "already", "available", "its", "value", "will", "be", "overwritten", ".", "If", "not", "it", "will", "be", "added", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/resources/InstanceResource.java#L235-L266
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgArc.java
DwgArc.readDwgArcV15
public void readDwgArcV15(int[] data, int offset) throws Exception { //System.out.println("readDwgArc() executed ..."); int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); Vector v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double x = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double y = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double z = ((Double)v.get(1)).doubleValue(); double[] coord = new double[]{x, y, z}; center = coord; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double val = ((Double)v.get(1)).doubleValue(); radius = val; v = DwgUtil.testBit(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); boolean flag = ((Boolean)v.get(1)).booleanValue(); if (flag) { val=0.0; } else { v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); val = ((Double)v.get(1)).doubleValue(); } thickness = val; v = DwgUtil.testBit(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); flag = ((Boolean)v.get(1)).booleanValue(); if (flag) { x = y = 0.0; z = 1.0; } else { v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); x = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); y = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); z = ((Double)v.get(1)).doubleValue(); } coord = new double[]{x, y, z}; extrusion = coord; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); val = ((Double)v.get(1)).doubleValue(); initAngle = val; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); val = ((Double)v.get(1)).doubleValue(); endAngle = val; bitPos = readObjectTailV15(data, bitPos); }
java
public void readDwgArcV15(int[] data, int offset) throws Exception { //System.out.println("readDwgArc() executed ..."); int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); Vector v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double x = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double y = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double z = ((Double)v.get(1)).doubleValue(); double[] coord = new double[]{x, y, z}; center = coord; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); double val = ((Double)v.get(1)).doubleValue(); radius = val; v = DwgUtil.testBit(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); boolean flag = ((Boolean)v.get(1)).booleanValue(); if (flag) { val=0.0; } else { v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); val = ((Double)v.get(1)).doubleValue(); } thickness = val; v = DwgUtil.testBit(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); flag = ((Boolean)v.get(1)).booleanValue(); if (flag) { x = y = 0.0; z = 1.0; } else { v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); x = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); y = ((Double)v.get(1)).doubleValue(); v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); z = ((Double)v.get(1)).doubleValue(); } coord = new double[]{x, y, z}; extrusion = coord; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); val = ((Double)v.get(1)).doubleValue(); initAngle = val; v = DwgUtil.getBitDouble(data, bitPos); bitPos = ((Integer)v.get(0)).intValue(); val = ((Double)v.get(1)).doubleValue(); endAngle = val; bitPos = readObjectTailV15(data, bitPos); }
[ "public", "void", "readDwgArcV15", "(", "int", "[", "]", "data", ",", "int", "offset", ")", "throws", "Exception", "{", "//System.out.println(\"readDwgArc() executed ...\");", "int", "bitPos", "=", "offset", ";", "bitPos", "=", "readObjectHeaderV15", "(", "data", ...
Read an Arc in the DWG format Version 15 @param data Array of unsigned bytes obtained from the DWG binary file @param offset The current bit offset where the value begins @throws Exception If an unexpected bit value is found in the DWG file. Occurs when we are looking for LwPolylines.
[ "Read", "an", "Arc", "in", "the", "DWG", "format", "Version", "15" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgArc.java#L47-L105
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteResponseResult.java
CreateRouteResponseResult.withResponseModels
public CreateRouteResponseResult withResponseModels(java.util.Map<String, String> responseModels) { setResponseModels(responseModels); return this; }
java
public CreateRouteResponseResult withResponseModels(java.util.Map<String, String> responseModels) { setResponseModels(responseModels); return this; }
[ "public", "CreateRouteResponseResult", "withResponseModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "responseModels", ")", "{", "setResponseModels", "(", "responseModels", ")", ";", "return", "this", ";", "}" ]
<p> Represents the response models of a route response. </p> @param responseModels Represents the response models of a route response. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Represents", "the", "response", "models", "of", "a", "route", "response", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteResponseResult.java#L127-L130
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java
SeaGlassTabbedPaneUI.getContext
public SeaGlassContext getContext(JComponent c, Region subregion) { return getContext(c, subregion, getComponentState(c)); }
java
public SeaGlassContext getContext(JComponent c, Region subregion) { return getContext(c, subregion, getComponentState(c)); }
[ "public", "SeaGlassContext", "getContext", "(", "JComponent", "c", ",", "Region", "subregion", ")", "{", "return", "getContext", "(", "c", ",", "subregion", ",", "getComponentState", "(", "c", ")", ")", ";", "}" ]
Create a SynthContext for the component and subregion. Use the current state. @param c the component. @param subregion the subregion. @return the newly created SynthContext.
[ "Create", "a", "SynthContext", "for", "the", "component", "and", "subregion", ".", "Use", "the", "current", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTabbedPaneUI.java#L428-L430
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByPhoneNumber2
public Iterable<DUser> queryByPhoneNumber2(java.lang.String phoneNumber2) { return queryByField(null, DUserMapper.Field.PHONENUMBER2.getFieldName(), phoneNumber2); }
java
public Iterable<DUser> queryByPhoneNumber2(java.lang.String phoneNumber2) { return queryByField(null, DUserMapper.Field.PHONENUMBER2.getFieldName(), phoneNumber2); }
[ "public", "Iterable", "<", "DUser", ">", "queryByPhoneNumber2", "(", "java", ".", "lang", ".", "String", "phoneNumber2", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "PHONENUMBER2", ".", "getFieldName", "(", ")", ",...
query-by method for field phoneNumber2 @param phoneNumber2 the specified attribute @return an Iterable of DUsers for the specified phoneNumber2
[ "query", "-", "by", "method", "for", "field", "phoneNumber2" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L196-L198
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java
ClassesManager.functionsAreAllowed
private static boolean functionsAreAllowed(boolean isAddAllFunction, boolean isPutAllFunction,Class<?> classD,Class<?> classS) { if(isAddAllFunction) return collectionIsAssignableFrom(classD) && collectionIsAssignableFrom(classS); if(isPutAllFunction) return mapIsAssignableFrom(classD) && mapIsAssignableFrom(classS); return isAssignableFrom(classD,classS); }
java
private static boolean functionsAreAllowed(boolean isAddAllFunction, boolean isPutAllFunction,Class<?> classD,Class<?> classS) { if(isAddAllFunction) return collectionIsAssignableFrom(classD) && collectionIsAssignableFrom(classS); if(isPutAllFunction) return mapIsAssignableFrom(classD) && mapIsAssignableFrom(classS); return isAssignableFrom(classD,classS); }
[ "private", "static", "boolean", "functionsAreAllowed", "(", "boolean", "isAddAllFunction", ",", "boolean", "isPutAllFunction", ",", "Class", "<", "?", ">", "classD", ",", "Class", "<", "?", ">", "classS", ")", "{", "if", "(", "isAddAllFunction", ")", "return",...
Returns true if the function to check is allowed. @param isAddAllFunction true if addAll method is to check @param isPutAllFunction true if putAll method is to check @param classD destination class @param classS source class @return true if the function to check is allowed
[ "Returns", "true", "if", "the", "function", "to", "check", "is", "allowed", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java#L232-L242
atomix/atomix
protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/RaftSessionConnection.java
RaftSessionConnection.retryRequest
@SuppressWarnings("unchecked") protected <T extends RaftRequest> void retryRequest(Throwable cause, T request, BiFunction sender, int count, int selectionId, CompletableFuture future) { // If the connection has not changed, reset it and connect to the next server. if (this.selectionId == selectionId) { log.trace("Resetting connection. Reason: {}", cause.getMessage()); this.currentNode = null; } // Attempt to send the request again. sendRequest(request, sender, count, future); }
java
@SuppressWarnings("unchecked") protected <T extends RaftRequest> void retryRequest(Throwable cause, T request, BiFunction sender, int count, int selectionId, CompletableFuture future) { // If the connection has not changed, reset it and connect to the next server. if (this.selectionId == selectionId) { log.trace("Resetting connection. Reason: {}", cause.getMessage()); this.currentNode = null; } // Attempt to send the request again. sendRequest(request, sender, count, future); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "<", "T", "extends", "RaftRequest", ">", "void", "retryRequest", "(", "Throwable", "cause", ",", "T", "request", ",", "BiFunction", "sender", ",", "int", "count", ",", "int", "selectionId", ",", ...
Resends a request due to a request failure, resetting the connection if necessary.
[ "Resends", "a", "request", "due", "to", "a", "request", "failure", "resetting", "the", "connection", "if", "necessary", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/session/impl/RaftSessionConnection.java#L241-L251
CloudSlang/cs-actions
cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java
WSManRemoteShellService.createShell
private String createShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, XPathExpressionException, SAXException, ParserConfigurationException { String document = ResourceLoader.loadAsString(CREATE_SHELL_REQUEST_XML); document = createCreateShellRequestBody(document, httpClientInputs.getUrl(), String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> createShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, document); return getResourceId(createShellResult.get(RETURN_RESULT), CREATE_RESPONSE_ACTION, CREATE_RESPONSE_SHELL_ID_XPATH, SHELL_ID_NOT_RETRIEVED); }
java
private String createShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, XPathExpressionException, SAXException, ParserConfigurationException { String document = ResourceLoader.loadAsString(CREATE_SHELL_REQUEST_XML); document = createCreateShellRequestBody(document, httpClientInputs.getUrl(), String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> createShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, document); return getResourceId(createShellResult.get(RETURN_RESULT), CREATE_RESPONSE_ACTION, CREATE_RESPONSE_SHELL_ID_XPATH, SHELL_ID_NOT_RETRIEVED); }
[ "private", "String", "createShell", "(", "HttpClientService", "csHttpClient", ",", "HttpClientInputs", "httpClientInputs", ",", "WSManRequestInputs", "wsManRequestInputs", ")", "throws", "RuntimeException", ",", "IOException", ",", "URISyntaxException", ",", "XPathExpressionE...
Creates a shell on the remote server and returns the shell id. @param csHttpClient @param httpClientInputs @param wsManRequestInputs @return the id of the created shell. @throws RuntimeException @throws IOException @throws URISyntaxException @throws TransformerException @throws XPathExpressionException @throws SAXException @throws ParserConfigurationException
[ "Creates", "a", "shell", "on", "the", "remote", "server", "and", "returns", "the", "shell", "id", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java#L191-L200
strator-dev/greenpepper
greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java
ConfluenceGreenPepper.verifyCredentials
public void verifyCredentials(String username, String password) throws GreenPepperServerException { if (username != null && !isCredentialsValid(username, password)) { throw new GreenPepperServerException("greenpepper.confluence.badcredentials", "The username and password are incorrect."); } }
java
public void verifyCredentials(String username, String password) throws GreenPepperServerException { if (username != null && !isCredentialsValid(username, password)) { throw new GreenPepperServerException("greenpepper.confluence.badcredentials", "The username and password are incorrect."); } }
[ "public", "void", "verifyCredentials", "(", "String", "username", ",", "String", "password", ")", "throws", "GreenPepperServerException", "{", "if", "(", "username", "!=", "null", "&&", "!", "isCredentialsValid", "(", "username", ",", "password", ")", ")", "{", ...
<p>verifyCredentials.</p> @param username a {@link java.lang.String} object. @param password a {@link java.lang.String} object. @throws com.greenpepper.server.GreenPepperServerException if any.
[ "<p", ">", "verifyCredentials", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L902-L906
notnoop/java-apns
src/main/java/com/notnoop/apns/ApnsServiceBuilder.java
ApnsServiceBuilder.asBatched
public ApnsServiceBuilder asBatched(int waitTimeInSec, int maxWaitTimeInSec, ScheduledExecutorService batchThreadPoolExecutor) { this.isBatched = true; this.batchWaitTimeInSec = waitTimeInSec; this.batchMaxWaitTimeInSec = maxWaitTimeInSec; this.batchThreadPoolExecutor = batchThreadPoolExecutor; return this; }
java
public ApnsServiceBuilder asBatched(int waitTimeInSec, int maxWaitTimeInSec, ScheduledExecutorService batchThreadPoolExecutor) { this.isBatched = true; this.batchWaitTimeInSec = waitTimeInSec; this.batchMaxWaitTimeInSec = maxWaitTimeInSec; this.batchThreadPoolExecutor = batchThreadPoolExecutor; return this; }
[ "public", "ApnsServiceBuilder", "asBatched", "(", "int", "waitTimeInSec", ",", "int", "maxWaitTimeInSec", ",", "ScheduledExecutorService", "batchThreadPoolExecutor", ")", "{", "this", ".", "isBatched", "=", "true", ";", "this", ".", "batchWaitTimeInSec", "=", "waitTim...
Construct service which will process notification requests in batch. After each request batch will wait <code>waitTimeInSec</code> for more request to come before executing but not more than <code>maxWaitTimeInSec</code> Each batch creates new connection and close it after finished. In case reconnect policy is specified it will be applied by batch processing. E.g.: {@link ReconnectPolicy.Provided#EVERY_HALF_HOUR} will reconnect the connection in case batch is running for more than half an hour Note: It is not recommended to use pooled connection @param waitTimeInSec time to wait for more notification request before executing batch @param maxWaitTimeInSec maximum wait time for batch before executing @param batchThreadPoolExecutor executor for batched processing (may be null)
[ "Construct", "service", "which", "will", "process", "notification", "requests", "in", "batch", ".", "After", "each", "request", "batch", "will", "wait", "<code", ">", "waitTimeInSec<", "/", "code", ">", "for", "more", "request", "to", "come", "before", "execut...
train
https://github.com/notnoop/java-apns/blob/180a190d4cb49458441596ca7c69d50ec7f1dba5/src/main/java/com/notnoop/apns/ApnsServiceBuilder.java#L664-L670
janus-project/guava.janusproject.io
guava/src/com/google/common/eventbus/EventSubscriber.java
EventSubscriber.handleEvent
public void handleEvent(Object event) throws InvocationTargetException { checkNotNull(event); try { method.invoke(target, new Object[] { event }); } catch (IllegalArgumentException e) { throw new Error("Method rejected target/argument: " + event, e); } catch (IllegalAccessException e) { throw new Error("Method became inaccessible: " + event, e); } catch (InvocationTargetException e) { if (e.getCause() instanceof Error) { throw (Error) e.getCause(); } throw e; } }
java
public void handleEvent(Object event) throws InvocationTargetException { checkNotNull(event); try { method.invoke(target, new Object[] { event }); } catch (IllegalArgumentException e) { throw new Error("Method rejected target/argument: " + event, e); } catch (IllegalAccessException e) { throw new Error("Method became inaccessible: " + event, e); } catch (InvocationTargetException e) { if (e.getCause() instanceof Error) { throw (Error) e.getCause(); } throw e; } }
[ "public", "void", "handleEvent", "(", "Object", "event", ")", "throws", "InvocationTargetException", "{", "checkNotNull", "(", "event", ")", ";", "try", "{", "method", ".", "invoke", "(", "target", ",", "new", "Object", "[", "]", "{", "event", "}", ")", ...
Invokes the wrapped subscriber method to handle {@code event}. @param event event to handle @throws InvocationTargetException if the wrapped method throws any {@link Throwable} that is not an {@link Error} ({@code Error} instances are propagated as-is).
[ "Invokes", "the", "wrapped", "subscriber", "method", "to", "handle", "{", "@code", "event", "}", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/eventbus/EventSubscriber.java#L71-L85
cloudfoundry/uaa
server/src/main/java/org/cloudfoundry/identity/uaa/scim/bootstrap/ScimUserBootstrap.java
ScimUserBootstrap.addUser
protected void addUser(UaaUser user) { ScimUser scimUser = getScimUser(user); if (scimUser==null) { if (isEmpty(user.getPassword()) && user.getOrigin().equals(OriginKeys.UAA)) { logger.debug("User's password cannot be empty"); throw new InvalidPasswordException("Password cannot be empty", BAD_REQUEST); } createNewUser(user); } else { if (override) { updateUser(scimUser, user); } else { logger.debug("Override flag not set. Not registering existing user: " + user); } } }
java
protected void addUser(UaaUser user) { ScimUser scimUser = getScimUser(user); if (scimUser==null) { if (isEmpty(user.getPassword()) && user.getOrigin().equals(OriginKeys.UAA)) { logger.debug("User's password cannot be empty"); throw new InvalidPasswordException("Password cannot be empty", BAD_REQUEST); } createNewUser(user); } else { if (override) { updateUser(scimUser, user); } else { logger.debug("Override flag not set. Not registering existing user: " + user); } } }
[ "protected", "void", "addUser", "(", "UaaUser", "user", ")", "{", "ScimUser", "scimUser", "=", "getScimUser", "(", "user", ")", ";", "if", "(", "scimUser", "==", "null", ")", "{", "if", "(", "isEmpty", "(", "user", ".", "getPassword", "(", ")", ")", ...
Add a user account from the properties provided. @param user a UaaUser
[ "Add", "a", "user", "account", "from", "the", "properties", "provided", "." ]
train
https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/scim/bootstrap/ScimUserBootstrap.java#L172-L188
zaproxy/zaproxy
src/org/zaproxy/zap/view/StandardFieldsDialog.java
StandardFieldsDialog.addPasswordField
public void addPasswordField(int tabIndex, String fieldLabel, String value) { addTextComponent(tabIndex, new JPasswordField(), fieldLabel, value); }
java
public void addPasswordField(int tabIndex, String fieldLabel, String value) { addTextComponent(tabIndex, new JPasswordField(), fieldLabel, value); }
[ "public", "void", "addPasswordField", "(", "int", "tabIndex", ",", "String", "fieldLabel", ",", "String", "value", ")", "{", "addTextComponent", "(", "tabIndex", ",", "new", "JPasswordField", "(", ")", ",", "fieldLabel", ",", "value", ")", ";", "}" ]
Adds a {@link JPasswordField} field to the tab with the given index, with the given label and, optionally, the given value. @param tabIndex the index of the tab @param fieldLabel the label of the field @param value the value of the field, might be {@code null} @throws IllegalArgumentException if the dialogue is not a tabbed dialogue or if the index does not correspond to an existing tab @since 2.6.0 @see #addPasswordField(String, String) @see #getPasswordValue(String)
[ "Adds", "a", "{", "@link", "JPasswordField", "}", "field", "to", "the", "tab", "with", "the", "given", "index", "with", "the", "given", "label", "and", "optionally", "the", "given", "value", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/StandardFieldsDialog.java#L676-L678
meertensinstituut/mtas
src/main/java/mtas/analysis/token/MtasToken.java
MtasToken.setRealOffset
final public void setRealOffset(Integer start, Integer end) { if ((start == null) || (end == null)) { // do nothing } else if (start > end) { throw new IllegalArgumentException( "Start real offset after end real offset"); } else { tokenRealOffset = new MtasOffset(start, end); } }
java
final public void setRealOffset(Integer start, Integer end) { if ((start == null) || (end == null)) { // do nothing } else if (start > end) { throw new IllegalArgumentException( "Start real offset after end real offset"); } else { tokenRealOffset = new MtasOffset(start, end); } }
[ "final", "public", "void", "setRealOffset", "(", "Integer", "start", ",", "Integer", "end", ")", "{", "if", "(", "(", "start", "==", "null", ")", "||", "(", "end", "==", "null", ")", ")", "{", "// do nothing", "}", "else", "if", "(", "start", ">", ...
Sets the real offset. @param start the start @param end the end
[ "Sets", "the", "real", "offset", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/analysis/token/MtasToken.java#L461-L470
bluelinelabs/Conductor
conductor/src/main/java/com/bluelinelabs/conductor/Router.java
Router.onRequestPermissionsResult
public void onRequestPermissionsResult(@NonNull String instanceId, int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { Controller controller = getControllerWithInstanceId(instanceId); if (controller != null) { controller.requestPermissionsResult(requestCode, permissions, grantResults); } }
java
public void onRequestPermissionsResult(@NonNull String instanceId, int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { Controller controller = getControllerWithInstanceId(instanceId); if (controller != null) { controller.requestPermissionsResult(requestCode, permissions, grantResults); } }
[ "public", "void", "onRequestPermissionsResult", "(", "@", "NonNull", "String", "instanceId", ",", "int", "requestCode", ",", "@", "NonNull", "String", "[", "]", "permissions", ",", "@", "NonNull", "int", "[", "]", "grantResults", ")", "{", "Controller", "contr...
This should be called by the host Activity when its onRequestPermissionsResult method is called. The call will be forwarded to the {@link Controller} with the instanceId passed in. @param instanceId The instanceId of the Controller to which this result should be forwarded @param requestCode The Activity's onRequestPermissionsResult requestCode @param permissions The Activity's onRequestPermissionsResult permissions @param grantResults The Activity's onRequestPermissionsResult grantResults
[ "This", "should", "be", "called", "by", "the", "host", "Activity", "when", "its", "onRequestPermissionsResult", "method", "is", "called", ".", "The", "call", "will", "be", "forwarded", "to", "the", "{", "@link", "Controller", "}", "with", "the", "instanceId", ...
train
https://github.com/bluelinelabs/Conductor/blob/94c9121bb16f93b481954513a8e3905846829fb2/conductor/src/main/java/com/bluelinelabs/conductor/Router.java#L77-L82
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/TrueTypeFont.java
TrueTypeFont.getFontDescriptor
public float getFontDescriptor(int key, float fontSize) { switch (key) { case ASCENT: return os_2.sTypoAscender * fontSize / head.unitsPerEm; case CAPHEIGHT: return os_2.sCapHeight * fontSize / head.unitsPerEm; case DESCENT: return os_2.sTypoDescender * fontSize / head.unitsPerEm; case ITALICANGLE: return (float)italicAngle; case BBOXLLX: return fontSize * head.xMin / head.unitsPerEm; case BBOXLLY: return fontSize * head.yMin / head.unitsPerEm; case BBOXURX: return fontSize * head.xMax / head.unitsPerEm; case BBOXURY: return fontSize * head.yMax / head.unitsPerEm; case AWT_ASCENT: return fontSize * hhea.Ascender / head.unitsPerEm; case AWT_DESCENT: return fontSize * hhea.Descender / head.unitsPerEm; case AWT_LEADING: return fontSize * hhea.LineGap / head.unitsPerEm; case AWT_MAXADVANCE: return fontSize * hhea.advanceWidthMax / head.unitsPerEm; case UNDERLINE_POSITION: return (underlinePosition - underlineThickness / 2) * fontSize / head.unitsPerEm; case UNDERLINE_THICKNESS: return underlineThickness * fontSize / head.unitsPerEm; case STRIKETHROUGH_POSITION: return os_2.yStrikeoutPosition * fontSize / head.unitsPerEm; case STRIKETHROUGH_THICKNESS: return os_2.yStrikeoutSize * fontSize / head.unitsPerEm; case SUBSCRIPT_SIZE: return os_2.ySubscriptYSize * fontSize / head.unitsPerEm; case SUBSCRIPT_OFFSET: return -os_2.ySubscriptYOffset * fontSize / head.unitsPerEm; case SUPERSCRIPT_SIZE: return os_2.ySuperscriptYSize * fontSize / head.unitsPerEm; case SUPERSCRIPT_OFFSET: return os_2.ySuperscriptYOffset * fontSize / head.unitsPerEm; } return 0; }
java
public float getFontDescriptor(int key, float fontSize) { switch (key) { case ASCENT: return os_2.sTypoAscender * fontSize / head.unitsPerEm; case CAPHEIGHT: return os_2.sCapHeight * fontSize / head.unitsPerEm; case DESCENT: return os_2.sTypoDescender * fontSize / head.unitsPerEm; case ITALICANGLE: return (float)italicAngle; case BBOXLLX: return fontSize * head.xMin / head.unitsPerEm; case BBOXLLY: return fontSize * head.yMin / head.unitsPerEm; case BBOXURX: return fontSize * head.xMax / head.unitsPerEm; case BBOXURY: return fontSize * head.yMax / head.unitsPerEm; case AWT_ASCENT: return fontSize * hhea.Ascender / head.unitsPerEm; case AWT_DESCENT: return fontSize * hhea.Descender / head.unitsPerEm; case AWT_LEADING: return fontSize * hhea.LineGap / head.unitsPerEm; case AWT_MAXADVANCE: return fontSize * hhea.advanceWidthMax / head.unitsPerEm; case UNDERLINE_POSITION: return (underlinePosition - underlineThickness / 2) * fontSize / head.unitsPerEm; case UNDERLINE_THICKNESS: return underlineThickness * fontSize / head.unitsPerEm; case STRIKETHROUGH_POSITION: return os_2.yStrikeoutPosition * fontSize / head.unitsPerEm; case STRIKETHROUGH_THICKNESS: return os_2.yStrikeoutSize * fontSize / head.unitsPerEm; case SUBSCRIPT_SIZE: return os_2.ySubscriptYSize * fontSize / head.unitsPerEm; case SUBSCRIPT_OFFSET: return -os_2.ySubscriptYOffset * fontSize / head.unitsPerEm; case SUPERSCRIPT_SIZE: return os_2.ySuperscriptYSize * fontSize / head.unitsPerEm; case SUPERSCRIPT_OFFSET: return os_2.ySuperscriptYOffset * fontSize / head.unitsPerEm; } return 0; }
[ "public", "float", "getFontDescriptor", "(", "int", "key", ",", "float", "fontSize", ")", "{", "switch", "(", "key", ")", "{", "case", "ASCENT", ":", "return", "os_2", ".", "sTypoAscender", "*", "fontSize", "/", "head", ".", "unitsPerEm", ";", "case", "C...
Gets the font parameter identified by <CODE>key</CODE>. Valid values for <CODE>key</CODE> are <CODE>ASCENT</CODE>, <CODE>CAPHEIGHT</CODE>, <CODE>DESCENT</CODE> and <CODE>ITALICANGLE</CODE>. @param key the parameter to be extracted @param fontSize the font size in points @return the parameter in points
[ "Gets", "the", "font", "parameter", "identified", "by", "<CODE", ">", "key<", "/", "CODE", ">", ".", "Valid", "values", "for", "<CODE", ">", "key<", "/", "CODE", ">", "are", "<CODE", ">", "ASCENT<", "/", "CODE", ">", "<CODE", ">", "CAPHEIGHT<", "/", ...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/TrueTypeFont.java#L1357-L1401
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/input/named/AbstractNamedInputHandler.java
AbstractNamedInputHandler.updateBean
protected T updateBean(T object, Map<String, Object> source) { T clone = copyProperties(object); updateProperties(clone, source); return clone; }
java
protected T updateBean(T object, Map<String, Object> source) { T clone = copyProperties(object); updateProperties(clone, source); return clone; }
[ "protected", "T", "updateBean", "(", "T", "object", ",", "Map", "<", "String", ",", "Object", ">", "source", ")", "{", "T", "clone", "=", "copyProperties", "(", "object", ")", ";", "updateProperties", "(", "clone", ",", "source", ")", ";", "return", "c...
Updates bean with values from source. @param object Bean object to update @param source Map which would be read @return cloned bean with updated values
[ "Updates", "bean", "with", "values", "from", "source", "." ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/input/named/AbstractNamedInputHandler.java#L88-L94
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/LocaleDisplayNames.java
LocaleDisplayNames.getInstance
public static LocaleDisplayNames getInstance(ULocale locale, DisplayContext... contexts) { LocaleDisplayNames result = null; if (FACTORY_DISPLAYCONTEXT != null) { try { result = (LocaleDisplayNames) FACTORY_DISPLAYCONTEXT.invoke(null, locale, contexts); } catch (InvocationTargetException e) { // fall through } catch (IllegalAccessException e) { // fall through } } if (result == null) { result = new LastResortLocaleDisplayNames(locale, contexts); } return result; }
java
public static LocaleDisplayNames getInstance(ULocale locale, DisplayContext... contexts) { LocaleDisplayNames result = null; if (FACTORY_DISPLAYCONTEXT != null) { try { result = (LocaleDisplayNames) FACTORY_DISPLAYCONTEXT.invoke(null, locale, contexts); } catch (InvocationTargetException e) { // fall through } catch (IllegalAccessException e) { // fall through } } if (result == null) { result = new LastResortLocaleDisplayNames(locale, contexts); } return result; }
[ "public", "static", "LocaleDisplayNames", "getInstance", "(", "ULocale", "locale", ",", "DisplayContext", "...", "contexts", ")", "{", "LocaleDisplayNames", "result", "=", "null", ";", "if", "(", "FACTORY_DISPLAYCONTEXT", "!=", "null", ")", "{", "try", "{", "res...
Returns an instance of LocaleDisplayNames that returns names formatted for the provided locale, using the provided DisplayContext settings @param locale the display locale @param contexts one or more context settings (e.g. for dialect handling, capitalization, etc. @return a LocaleDisplayNames instance
[ "Returns", "an", "instance", "of", "LocaleDisplayNames", "that", "returns", "names", "formatted", "for", "the", "provided", "locale", "using", "the", "provided", "DisplayContext", "settings" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/LocaleDisplayNames.java#L102-L118
apache/flink
flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/HadoopRecoverableFsDataOutputStream.java
HadoopRecoverableFsDataOutputStream.waitUntilLeaseIsRevoked
private static boolean waitUntilLeaseIsRevoked(final FileSystem fs, final Path path) throws IOException { Preconditions.checkState(fs instanceof DistributedFileSystem); final DistributedFileSystem dfs = (DistributedFileSystem) fs; dfs.recoverLease(path); final Deadline deadline = Deadline.now().plus(Duration.ofMillis(LEASE_TIMEOUT)); final StopWatch sw = new StopWatch(); sw.start(); boolean isClosed = dfs.isFileClosed(path); while (!isClosed && deadline.hasTimeLeft()) { try { Thread.sleep(500L); } catch (InterruptedException e1) { throw new IOException("Recovering the lease failed: ", e1); } isClosed = dfs.isFileClosed(path); } return isClosed; }
java
private static boolean waitUntilLeaseIsRevoked(final FileSystem fs, final Path path) throws IOException { Preconditions.checkState(fs instanceof DistributedFileSystem); final DistributedFileSystem dfs = (DistributedFileSystem) fs; dfs.recoverLease(path); final Deadline deadline = Deadline.now().plus(Duration.ofMillis(LEASE_TIMEOUT)); final StopWatch sw = new StopWatch(); sw.start(); boolean isClosed = dfs.isFileClosed(path); while (!isClosed && deadline.hasTimeLeft()) { try { Thread.sleep(500L); } catch (InterruptedException e1) { throw new IOException("Recovering the lease failed: ", e1); } isClosed = dfs.isFileClosed(path); } return isClosed; }
[ "private", "static", "boolean", "waitUntilLeaseIsRevoked", "(", "final", "FileSystem", "fs", ",", "final", "Path", "path", ")", "throws", "IOException", "{", "Preconditions", ".", "checkState", "(", "fs", "instanceof", "DistributedFileSystem", ")", ";", "final", "...
Called when resuming execution after a failure and waits until the lease of the file we are resuming is free. <p>The lease of the file we are resuming writing/committing to may still belong to the process that failed previously and whose state we are recovering. @param path The path to the file we want to resume writing to.
[ "Called", "when", "resuming", "execution", "after", "a", "failure", "and", "waits", "until", "the", "lease", "of", "the", "file", "we", "are", "resuming", "is", "free", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-hadoop-fs/src/main/java/org/apache/flink/runtime/fs/hdfs/HadoopRecoverableFsDataOutputStream.java#L321-L342
BlueBrain/bluima
modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/tools/util/CountedNumberedSet.java
CountedNumberedSet.setCount
public void setCount(Object o,int c) { int[] nums = (int[]) cset.get(o); if (nums != null) { nums[0] = c; } else { cset.put(o,new int[]{c,1}); } }
java
public void setCount(Object o,int c) { int[] nums = (int[]) cset.get(o); if (nums != null) { nums[0] = c; } else { cset.put(o,new int[]{c,1}); } }
[ "public", "void", "setCount", "(", "Object", "o", ",", "int", "c", ")", "{", "int", "[", "]", "nums", "=", "(", "int", "[", "]", ")", "cset", ".", "get", "(", "o", ")", ";", "if", "(", "nums", "!=", "null", ")", "{", "nums", "[", "0", "]", ...
Assigns the specified object the specified count in the set. @param o The object to be added or updated in the set. @param c The count of the specified object.
[ "Assigns", "the", "specified", "object", "the", "specified", "count", "in", "the", "set", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/tools/util/CountedNumberedSet.java#L70-L78
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java
LoadBalancersInner.updateTags
public LoadBalancerInner updateTags(String resourceGroupName, String loadBalancerName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, loadBalancerName, tags).toBlocking().last().body(); }
java
public LoadBalancerInner updateTags(String resourceGroupName, String loadBalancerName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, loadBalancerName, tags).toBlocking().last().body(); }
[ "public", "LoadBalancerInner", "updateTags", "(", "String", "resourceGroupName", ",", "String", "loadBalancerName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "loadBal...
Updates a load balancer tags. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LoadBalancerInner object if successful.
[ "Updates", "a", "load", "balancer", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java#L681-L683
lucee/Lucee
core/src/main/java/lucee/transformer/library/function/FunctionLibFactory.java
FunctionLibFactory.setAttributes
private static void setAttributes(FunctionLib extFL, FunctionLib newFL) { newFL.setDescription(extFL.getDescription()); newFL.setDisplayName(extFL.getDisplayName()); newFL.setShortName(extFL.getShortName()); newFL.setUri(extFL.getUri()); newFL.setVersion(extFL.getVersion()); }
java
private static void setAttributes(FunctionLib extFL, FunctionLib newFL) { newFL.setDescription(extFL.getDescription()); newFL.setDisplayName(extFL.getDisplayName()); newFL.setShortName(extFL.getShortName()); newFL.setUri(extFL.getUri()); newFL.setVersion(extFL.getVersion()); }
[ "private", "static", "void", "setAttributes", "(", "FunctionLib", "extFL", ",", "FunctionLib", "newFL", ")", "{", "newFL", ".", "setDescription", "(", "extFL", ".", "getDescription", "(", ")", ")", ";", "newFL", ".", "setDisplayName", "(", "extFL", ".", "get...
copy attributes from old fld to the new @param extFL @param newFL
[ "copy", "attributes", "from", "old", "fld", "to", "the", "new" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibFactory.java#L478-L484
fozziethebeat/S-Space
opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java
LatentRelationalAnalysis.getIndexOfPair
private static int getIndexOfPair(String value, Map<Integer, String> row_data) { for(Integer i : row_data.keySet()) { if(row_data.get(i).equals(value)) { return i.intValue(); } } return -1; }
java
private static int getIndexOfPair(String value, Map<Integer, String> row_data) { for(Integer i : row_data.keySet()) { if(row_data.get(i).equals(value)) { return i.intValue(); } } return -1; }
[ "private", "static", "int", "getIndexOfPair", "(", "String", "value", ",", "Map", "<", "Integer", ",", "String", ">", "row_data", ")", "{", "for", "(", "Integer", "i", ":", "row_data", ".", "keySet", "(", ")", ")", "{", "if", "(", "row_data", ".", "g...
returns the index of the String in the HashMap, or -1 if value was not found.
[ "returns", "the", "index", "of", "the", "String", "in", "the", "HashMap", "or", "-", "1", "if", "value", "was", "not", "found", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/opt/src/main/java/edu/ucla/sspace/lra/LatentRelationalAnalysis.java#L826-L833
groupon/monsoon
intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java
NamedResolverMap.getBooleanOrDefault
public boolean getBooleanOrDefault(int key, boolean dfl) { Any3<Boolean, Integer, String> value = data.getOrDefault(Any2.<Integer, String>left(key), Any3.<Boolean, Integer, String>create1(dfl)); return value.get1().orElseThrow(() -> new IllegalArgumentException("expected boolean argument for param " + key)); }
java
public boolean getBooleanOrDefault(int key, boolean dfl) { Any3<Boolean, Integer, String> value = data.getOrDefault(Any2.<Integer, String>left(key), Any3.<Boolean, Integer, String>create1(dfl)); return value.get1().orElseThrow(() -> new IllegalArgumentException("expected boolean argument for param " + key)); }
[ "public", "boolean", "getBooleanOrDefault", "(", "int", "key", ",", "boolean", "dfl", ")", "{", "Any3", "<", "Boolean", ",", "Integer", ",", "String", ">", "value", "=", "data", ".", "getOrDefault", "(", "Any2", ".", "<", "Integer", ",", "String", ">", ...
Return the boolean value indicated by the given numeric key. @param key The key of the value to return. @param dfl The default value to return, if the key is absent. @return The boolean value stored under the given key, or dfl. @throws IllegalArgumentException if the value is present, but not a boolean.
[ "Return", "the", "boolean", "value", "indicated", "by", "the", "given", "numeric", "key", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/resolver/NamedResolverMap.java#L45-L48
pierre/serialization
hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/SmileStorage.java
SmileStorage.prepareToRead
@Override public void prepareToRead(final RecordReader reader, final PigSplit split) throws IOException { this.reader = reader; this.split = split; }
java
@Override public void prepareToRead(final RecordReader reader, final PigSplit split) throws IOException { this.reader = reader; this.split = split; }
[ "@", "Override", "public", "void", "prepareToRead", "(", "final", "RecordReader", "reader", ",", "final", "PigSplit", "split", ")", "throws", "IOException", "{", "this", ".", "reader", "=", "reader", ";", "this", ".", "split", "=", "split", ";", "}" ]
Initializes LoadFunc for reading data. This will be called during execution before any calls to getNext. The RecordReader needs to be passed here because it has been instantiated for a particular InputSplit. @param reader {@link org.apache.hadoop.mapreduce.RecordReader} to be used by this instance of the LoadFunc @param split The input {@link org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigSplit} to process @throws java.io.IOException if there is an exception during initialization
[ "Initializes", "LoadFunc", "for", "reading", "data", ".", "This", "will", "be", "called", "during", "execution", "before", "any", "calls", "to", "getNext", ".", "The", "RecordReader", "needs", "to", "be", "passed", "here", "because", "it", "has", "been", "in...
train
https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/SmileStorage.java#L138-L143
mnlipp/jgrapes
org.jgrapes.http/src/org/jgrapes/http/ResponseCreationSupport.java
ResponseCreationSupport.resourceInfo
@SuppressWarnings("PMD.EmptyCatchBlock") public static ResourceInfo resourceInfo(URL resource) { try { Path path = Paths.get(resource.toURI()); return new ResourceInfo(Files.isDirectory(path), Files.getLastModifiedTime(path).toInstant() .with(ChronoField.NANO_OF_SECOND, 0)); } catch (FileSystemNotFoundException | IOException | URISyntaxException e) { // Fall through } if ("jar".equals(resource.getProtocol())) { try { JarURLConnection conn = (JarURLConnection) resource.openConnection(); JarEntry entry = conn.getJarEntry(); return new ResourceInfo(entry.isDirectory(), entry.getLastModifiedTime().toInstant() .with(ChronoField.NANO_OF_SECOND, 0)); } catch (IOException e) { // Fall through } } try { URLConnection conn = resource.openConnection(); long lastModified = conn.getLastModified(); if (lastModified != 0) { return new ResourceInfo(null, Instant.ofEpochMilli( lastModified).with(ChronoField.NANO_OF_SECOND, 0)); } } catch (IOException e) { // Fall through } return new ResourceInfo(null, null); }
java
@SuppressWarnings("PMD.EmptyCatchBlock") public static ResourceInfo resourceInfo(URL resource) { try { Path path = Paths.get(resource.toURI()); return new ResourceInfo(Files.isDirectory(path), Files.getLastModifiedTime(path).toInstant() .with(ChronoField.NANO_OF_SECOND, 0)); } catch (FileSystemNotFoundException | IOException | URISyntaxException e) { // Fall through } if ("jar".equals(resource.getProtocol())) { try { JarURLConnection conn = (JarURLConnection) resource.openConnection(); JarEntry entry = conn.getJarEntry(); return new ResourceInfo(entry.isDirectory(), entry.getLastModifiedTime().toInstant() .with(ChronoField.NANO_OF_SECOND, 0)); } catch (IOException e) { // Fall through } } try { URLConnection conn = resource.openConnection(); long lastModified = conn.getLastModified(); if (lastModified != 0) { return new ResourceInfo(null, Instant.ofEpochMilli( lastModified).with(ChronoField.NANO_OF_SECOND, 0)); } } catch (IOException e) { // Fall through } return new ResourceInfo(null, null); }
[ "@", "SuppressWarnings", "(", "\"PMD.EmptyCatchBlock\"", ")", "public", "static", "ResourceInfo", "resourceInfo", "(", "URL", "resource", ")", "{", "try", "{", "Path", "path", "=", "Paths", ".", "get", "(", "resource", ".", "toURI", "(", ")", ")", ";", "re...
Attempts to lookup the additional resource information for the given URL. If a {@link URL} references a file, it is easy to find out if the resource referenced is a directory and to get its last modification time. Getting the same information for a {@link URL} that references resources in a jar is a bit more difficult. This method handles both cases. @param resource the resource URL @return the resource info
[ "Attempts", "to", "lookup", "the", "additional", "resource", "information", "for", "the", "given", "URL", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/ResponseCreationSupport.java#L265-L299
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getSecret
public SecretBundle getSecret(String vaultBaseUrl, String secretName, String secretVersion) { return getSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion).toBlocking().single().body(); }
java
public SecretBundle getSecret(String vaultBaseUrl, String secretName, String secretVersion) { return getSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion).toBlocking().single().body(); }
[ "public", "SecretBundle", "getSecret", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ",", "String", "secretVersion", ")", "{", "return", "getSecretWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "secretName", ",", "secretVersion", ")", ".", "toBlock...
Get a specified secret from a given key vault. The GET operation is applicable to any secret stored in Azure Key Vault. This operation requires the secrets/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param secretVersion The version of the secret. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SecretBundle object if successful.
[ "Get", "a", "specified", "secret", "from", "a", "given", "key", "vault", ".", "The", "GET", "operation", "is", "applicable", "to", "any", "secret", "stored", "in", "Azure", "Key", "Vault", ".", "This", "operation", "requires", "the", "secrets", "/", "get",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3828-L3830
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/BrokerHelper.java
BrokerHelper.assertValidPkForDelete
public boolean assertValidPkForDelete(ClassDescriptor cld, Object obj) { if(!ProxyHelper.isProxy(obj)) { FieldDescriptor fieldDescriptors[] = cld.getPkFields(); int fieldDescriptorSize = fieldDescriptors.length; for(int i = 0; i < fieldDescriptorSize; i++) { FieldDescriptor fd = fieldDescriptors[i]; Object pkValue = fd.getPersistentField().get(obj); if (representsNull(fd, pkValue)) { return false; } } } return true; }
java
public boolean assertValidPkForDelete(ClassDescriptor cld, Object obj) { if(!ProxyHelper.isProxy(obj)) { FieldDescriptor fieldDescriptors[] = cld.getPkFields(); int fieldDescriptorSize = fieldDescriptors.length; for(int i = 0; i < fieldDescriptorSize; i++) { FieldDescriptor fd = fieldDescriptors[i]; Object pkValue = fd.getPersistentField().get(obj); if (representsNull(fd, pkValue)) { return false; } } } return true; }
[ "public", "boolean", "assertValidPkForDelete", "(", "ClassDescriptor", "cld", ",", "Object", "obj", ")", "{", "if", "(", "!", "ProxyHelper", ".", "isProxy", "(", "obj", ")", ")", "{", "FieldDescriptor", "fieldDescriptors", "[", "]", "=", "cld", ".", "getPkFi...
returns true if the primary key fields are valid for delete, else false. PK fields are valid if each of them contains a valid non-null value @param cld the ClassDescriptor @param obj the object @return boolean
[ "returns", "true", "if", "the", "primary", "key", "fields", "are", "valid", "for", "delete", "else", "false", ".", "PK", "fields", "are", "valid", "if", "each", "of", "them", "contains", "a", "valid", "non", "-", "null", "value" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L475-L492
tbrooks8/Precipice
precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java
GuardRail.releasePermits
public void releasePermits(long number, Result result, long startNanos, long nanoTime) { resultCounts.write(result, number, nanoTime); resultLatency.write(result, number, nanoTime - startNanos, nanoTime); for (BackPressure<Rejected> backPressure : backPressureList) { backPressure.releasePermit(number, result, nanoTime); } }
java
public void releasePermits(long number, Result result, long startNanos, long nanoTime) { resultCounts.write(result, number, nanoTime); resultLatency.write(result, number, nanoTime - startNanos, nanoTime); for (BackPressure<Rejected> backPressure : backPressureList) { backPressure.releasePermit(number, result, nanoTime); } }
[ "public", "void", "releasePermits", "(", "long", "number", ",", "Result", "result", ",", "long", "startNanos", ",", "long", "nanoTime", ")", "{", "resultCounts", ".", "write", "(", "result", ",", "number", ",", "nanoTime", ")", ";", "resultLatency", ".", "...
Release acquired permits with known result. Since there is a known result the result count object and latency will be updated. @param number of permits to release @param result of the execution @param startNanos of the execution @param nanoTime currentInterval nano time
[ "Release", "acquired", "permits", "with", "known", "result", ".", "Since", "there", "is", "a", "known", "result", "the", "result", "count", "object", "and", "latency", "will", "be", "updated", "." ]
train
https://github.com/tbrooks8/Precipice/blob/97fae467fd676b16a96b8d88b02569d8fc1f2681/precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java#L152-L159
inmite/android-validation-komensky
library/src/main/java/eu/inmite/android/lib/validations/form/FormValidator.java
FormValidator.registerViewAdapter
@SuppressWarnings("TryWithIdenticalCatches") public static void registerViewAdapter(Class<? extends View> viewType, Class<? extends IFieldAdapter<? extends View,?>> adapterClass) { if (viewType == null || adapterClass == null) { throw new IllegalArgumentException("arguments must not be null"); } try { FieldAdapterFactory.registerAdapter(viewType, adapterClass); } catch (IllegalAccessException e) { throw new FormsValidationException(e); } catch (InstantiationException e) { throw new FormsValidationException(e); } }
java
@SuppressWarnings("TryWithIdenticalCatches") public static void registerViewAdapter(Class<? extends View> viewType, Class<? extends IFieldAdapter<? extends View,?>> adapterClass) { if (viewType == null || adapterClass == null) { throw new IllegalArgumentException("arguments must not be null"); } try { FieldAdapterFactory.registerAdapter(viewType, adapterClass); } catch (IllegalAccessException e) { throw new FormsValidationException(e); } catch (InstantiationException e) { throw new FormsValidationException(e); } }
[ "@", "SuppressWarnings", "(", "\"TryWithIdenticalCatches\"", ")", "public", "static", "void", "registerViewAdapter", "(", "Class", "<", "?", "extends", "View", ">", "viewType", ",", "Class", "<", "?", "extends", "IFieldAdapter", "<", "?", "extends", "View", ",",...
Register adapter that can be used to get value from view. @param viewType type of view adapter is determined to get values from @param adapterClass class of adapter to register @throws IllegalArgumentException if adapterClass is null or viewType is null @throws FormsValidationException when there is a problem when accessing adapter class
[ "Register", "adapter", "that", "can", "be", "used", "to", "get", "value", "from", "view", ".", "@param", "viewType", "type", "of", "view", "adapter", "is", "determined", "to", "get", "values", "from", "@param", "adapterClass", "class", "of", "adapter", "to",...
train
https://github.com/inmite/android-validation-komensky/blob/7c544f2d9f104a9800fcf4757eecb3caa8e76451/library/src/main/java/eu/inmite/android/lib/validations/form/FormValidator.java#L85-L98
ivanceras/orm
src/main/java/com/ivanceras/db/server/util/ModelCurator.java
ModelCurator.crossOutLinkerTables
private void crossOutLinkerTables(){ String[] primaryKeys = model.getPrimaryAttributes(); if(primaryKeys != null && primaryKeys.length == 2){//there are only 2 primary keys //if both primary keys look up to different table which is also a primary key String[] hasOne = model.getHasOne(); String[] hasOneLocalColum = model.getHasOneLocalColumn(); String[] hasOneReferencedColumn = model.getHasOneReferencedColumn(); int indexP1 = CStringUtils.indexOf(hasOneLocalColum, primaryKeys[0]); int indexP2 = CStringUtils.indexOf(hasOneLocalColum, primaryKeys[1]); if(indexP1 >= 0 && indexP2 >= 0){ String t1 = hasOne[indexP1]; String t2 = hasOne[indexP2]; String ref1 = hasOneReferencedColumn[indexP1]; String ref2 = hasOneReferencedColumn[indexP2]; ModelDef m1 = getModel(t1); boolean isRef1Primary = CStringUtils.inArray(m1.getPrimaryAttributes(), ref1); ModelDef m2 = getModel(t2); boolean isRef2Primary = CStringUtils.inArray(m2.getPrimaryAttributes(), ref2); if(model != m1 && model != m2 && isRef1Primary && isRef2Primary ){ removeFromHasMany(m1, model.getTableName());//remove the hasMany of this table removeFromHasMany(m2, model.getTableName());//remove the hasMany of this table addToHasMany(m1, m2.getTableName(), ref2, null); addToHasMany(m2, m1.getTableName(), ref1, null); } } } }
java
private void crossOutLinkerTables(){ String[] primaryKeys = model.getPrimaryAttributes(); if(primaryKeys != null && primaryKeys.length == 2){//there are only 2 primary keys //if both primary keys look up to different table which is also a primary key String[] hasOne = model.getHasOne(); String[] hasOneLocalColum = model.getHasOneLocalColumn(); String[] hasOneReferencedColumn = model.getHasOneReferencedColumn(); int indexP1 = CStringUtils.indexOf(hasOneLocalColum, primaryKeys[0]); int indexP2 = CStringUtils.indexOf(hasOneLocalColum, primaryKeys[1]); if(indexP1 >= 0 && indexP2 >= 0){ String t1 = hasOne[indexP1]; String t2 = hasOne[indexP2]; String ref1 = hasOneReferencedColumn[indexP1]; String ref2 = hasOneReferencedColumn[indexP2]; ModelDef m1 = getModel(t1); boolean isRef1Primary = CStringUtils.inArray(m1.getPrimaryAttributes(), ref1); ModelDef m2 = getModel(t2); boolean isRef2Primary = CStringUtils.inArray(m2.getPrimaryAttributes(), ref2); if(model != m1 && model != m2 && isRef1Primary && isRef2Primary ){ removeFromHasMany(m1, model.getTableName());//remove the hasMany of this table removeFromHasMany(m2, model.getTableName());//remove the hasMany of this table addToHasMany(m1, m2.getTableName(), ref2, null); addToHasMany(m2, m1.getTableName(), ref1, null); } } } }
[ "private", "void", "crossOutLinkerTables", "(", ")", "{", "String", "[", "]", "primaryKeys", "=", "model", ".", "getPrimaryAttributes", "(", ")", ";", "if", "(", "primaryKeys", "!=", "null", "&&", "primaryKeys", ".", "length", "==", "2", ")", "{", "//there...
Remove a linker table present in the hasMany, then short circuit right away to the linked table Linker tables contains composite primary keys of two tables If each local column of the primary key is the primary of the table it is referring to the this is a lookup table ie. product, product_category, category Product will have many category Category at the same time is used by many product Changes should be apply on both tables right away
[ "Remove", "a", "linker", "table", "present", "in", "the", "hasMany", "then", "short", "circuit", "right", "away", "to", "the", "linked", "table" ]
train
https://github.com/ivanceras/orm/blob/e63213cb8abefd11df0e2d34b1c95477788e600e/src/main/java/com/ivanceras/db/server/util/ModelCurator.java#L282-L321
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Configuration.java
Configuration.overrideFromEnvironmentVariables
private void overrideFromEnvironmentVariables() { String url = System.getenv("ACTIVEJDBC.URL"); String user = System.getenv("ACTIVEJDBC.USER"); String password = System.getenv("ACTIVEJDBC.PASSWORD"); String driver = System.getenv("ACTIVEJDBC.DRIVER"); if(!blank(url) && !blank(user) && !blank(password) && !blank(driver)){ connectionSpecMap.put(getEnvironment(), new ConnectionJdbcSpec(driver, url, user, password)); } String jndi = System.getenv("ACTIVEJDBC.JNDI"); if(!blank(jndi)){ connectionSpecMap.put(getEnvironment(), new ConnectionJndiSpec(jndi)); } }
java
private void overrideFromEnvironmentVariables() { String url = System.getenv("ACTIVEJDBC.URL"); String user = System.getenv("ACTIVEJDBC.USER"); String password = System.getenv("ACTIVEJDBC.PASSWORD"); String driver = System.getenv("ACTIVEJDBC.DRIVER"); if(!blank(url) && !blank(user) && !blank(password) && !blank(driver)){ connectionSpecMap.put(getEnvironment(), new ConnectionJdbcSpec(driver, url, user, password)); } String jndi = System.getenv("ACTIVEJDBC.JNDI"); if(!blank(jndi)){ connectionSpecMap.put(getEnvironment(), new ConnectionJndiSpec(jndi)); } }
[ "private", "void", "overrideFromEnvironmentVariables", "(", ")", "{", "String", "url", "=", "System", ".", "getenv", "(", "\"ACTIVEJDBC.URL\"", ")", ";", "String", "user", "=", "System", ".", "getenv", "(", "\"ACTIVEJDBC.USER\"", ")", ";", "String", "password", ...
Overrides current environment's connection spec from system properties.
[ "Overrides", "current", "environment", "s", "connection", "spec", "from", "system", "properties", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Configuration.java#L137-L150
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/AppFramework.java
AppFramework.postProcessAfterInitialization
@Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { registerObject(bean); return bean; }
java
@Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { registerObject(bean); return bean; }
[ "@", "Override", "public", "Object", "postProcessAfterInitialization", "(", "Object", "bean", ",", "String", "beanName", ")", "throws", "BeansException", "{", "registerObject", "(", "bean", ")", ";", "return", "bean", ";", "}" ]
Automatically registers any container-managed bean with the framework. @param bean Object to register. @param beanName Name of the managed bean.
[ "Automatically", "registers", "any", "container", "-", "managed", "bean", "with", "the", "framework", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/AppFramework.java#L197-L201
zxing/zxing
core/src/main/java/com/google/zxing/datamatrix/DataMatrixWriter.java
DataMatrixWriter.convertByteMatrixToBitMatrix
private static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix matrix, int reqWidth, int reqHeight) { int matrixWidth = matrix.getWidth(); int matrixHeight = matrix.getHeight(); int outputWidth = Math.max(reqWidth, matrixWidth); int outputHeight = Math.max(reqHeight, matrixHeight); int multiple = Math.min(outputWidth / matrixWidth, outputHeight / matrixHeight); int leftPadding = (outputWidth - (matrixWidth * multiple)) / 2 ; int topPadding = (outputHeight - (matrixHeight * multiple)) / 2 ; BitMatrix output; // remove padding if requested width and height are too small if (reqHeight < matrixHeight || reqWidth < matrixWidth) { leftPadding = 0; topPadding = 0; output = new BitMatrix(matrixWidth, matrixHeight); } else { output = new BitMatrix(reqWidth, reqHeight); } output.clear(); for (int inputY = 0, outputY = topPadding; inputY < matrixHeight; inputY++, outputY += multiple) { // Write the contents of this row of the bytematrix for (int inputX = 0, outputX = leftPadding; inputX < matrixWidth; inputX++, outputX += multiple) { if (matrix.get(inputX, inputY) == 1) { output.setRegion(outputX, outputY, multiple, multiple); } } } return output; }
java
private static BitMatrix convertByteMatrixToBitMatrix(ByteMatrix matrix, int reqWidth, int reqHeight) { int matrixWidth = matrix.getWidth(); int matrixHeight = matrix.getHeight(); int outputWidth = Math.max(reqWidth, matrixWidth); int outputHeight = Math.max(reqHeight, matrixHeight); int multiple = Math.min(outputWidth / matrixWidth, outputHeight / matrixHeight); int leftPadding = (outputWidth - (matrixWidth * multiple)) / 2 ; int topPadding = (outputHeight - (matrixHeight * multiple)) / 2 ; BitMatrix output; // remove padding if requested width and height are too small if (reqHeight < matrixHeight || reqWidth < matrixWidth) { leftPadding = 0; topPadding = 0; output = new BitMatrix(matrixWidth, matrixHeight); } else { output = new BitMatrix(reqWidth, reqHeight); } output.clear(); for (int inputY = 0, outputY = topPadding; inputY < matrixHeight; inputY++, outputY += multiple) { // Write the contents of this row of the bytematrix for (int inputX = 0, outputX = leftPadding; inputX < matrixWidth; inputX++, outputX += multiple) { if (matrix.get(inputX, inputY) == 1) { output.setRegion(outputX, outputY, multiple, multiple); } } } return output; }
[ "private", "static", "BitMatrix", "convertByteMatrixToBitMatrix", "(", "ByteMatrix", "matrix", ",", "int", "reqWidth", ",", "int", "reqHeight", ")", "{", "int", "matrixWidth", "=", "matrix", ".", "getWidth", "(", ")", ";", "int", "matrixHeight", "=", "matrix", ...
Convert the ByteMatrix to BitMatrix. @param reqHeight The requested height of the image (in pixels) with the Datamatrix code @param reqWidth The requested width of the image (in pixels) with the Datamatrix code @param matrix The input matrix. @return The output matrix.
[ "Convert", "the", "ByteMatrix", "to", "BitMatrix", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/datamatrix/DataMatrixWriter.java#L163-L196
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/BritishCutoverChronology.java
BritishCutoverChronology.dateYearDay
@Override public BritishCutoverDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
java
@Override public BritishCutoverDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
[ "@", "Override", "public", "BritishCutoverDate", "dateYearDay", "(", "Era", "era", ",", "int", "yearOfEra", ",", "int", "dayOfYear", ")", "{", "return", "dateYearDay", "(", "prolepticYear", "(", "era", ",", "yearOfEra", ")", ",", "dayOfYear", ")", ";", "}" ]
Obtains a local date in British Cutover calendar system from the era, year-of-era and day-of-year fields. <p> The day-of-year takes into account the cutover, thus there are only 355 days in 1752. @param era the British Cutover era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the British Cutover local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code JulianEra}
[ "Obtains", "a", "local", "date", "in", "British", "Cutover", "calendar", "system", "from", "the", "era", "year", "-", "of", "-", "era", "and", "day", "-", "of", "-", "year", "fields", ".", "<p", ">", "The", "day", "-", "of", "-", "year", "takes", "...
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/BritishCutoverChronology.java#L265-L268
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java
UserResources.updateUserPrivilege
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Path("/{userId}/privileged") @Description("Grants or revokes privileged permissions") public PrincipalUserDto updateUserPrivilege(@Context HttpServletRequest req, @PathParam("userId") final BigInteger userId, @FormParam("privileged") final boolean privileged) { validatePrivilegedUser(req); if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } PrincipalUser user = _uService.findUserByPrimaryKey(userId); if (user == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } try { Method method = PrincipalUser.class.getDeclaredMethod("setPrivileged", boolean.class); method.setAccessible(true); method.invoke(user, privileged); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new SystemException("Failed to change privileged status.", e); } user = _uService.updateUser(user); return PrincipalUserDto.transformToDto(user); }
java
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Path("/{userId}/privileged") @Description("Grants or revokes privileged permissions") public PrincipalUserDto updateUserPrivilege(@Context HttpServletRequest req, @PathParam("userId") final BigInteger userId, @FormParam("privileged") final boolean privileged) { validatePrivilegedUser(req); if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } PrincipalUser user = _uService.findUserByPrimaryKey(userId); if (user == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } try { Method method = PrincipalUser.class.getDeclaredMethod("setPrivileged", boolean.class); method.setAccessible(true); method.invoke(user, privileged); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new SystemException("Failed to change privileged status.", e); } user = _uService.updateUser(user); return PrincipalUserDto.transformToDto(user); }
[ "@", "PUT", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_FORM_URLENCODED", ")", "@", "Path", "(", "\"/{userId}/privileged\"", ")", "@", "Description", "(", "\"Grants or revokes privileged permiss...
Grants or revokes privileged permissions. @param req The HTTP request. @param userId The ID of the user to update. @param privileged True if the user has privileged access. @return The updated user DTO. @throws WebApplicationException If an error occurs. @throws SystemException If the privileged status is unable to be changed.
[ "Grants", "or", "revokes", "privileged", "permissions", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java#L247-L275
js-lib-com/template.xhtml
src/main/java/js/template/xhtml/AttrOperator.java
AttrOperator.doExec
@Override protected Object doExec(Element element, Object scope, String expression, Object... arguments) throws TemplateException { if(expression.isEmpty()) { throw new TemplateException("Invalid ATTR operand. Attribute property path expression is empty."); } Set<Attr> syntheticAttributes = new HashSet<Attr>(); PairsList pairs = new PairsList(expression); for(Pair pair : pairs) { // accordingly this operator expression syntax first value is attribute name and second is property path String value = content.getString(scope, pair.second()); if(value != null) { syntheticAttributes.add(new AttrImpl(pair.first(), value)); } } return syntheticAttributes; }
java
@Override protected Object doExec(Element element, Object scope, String expression, Object... arguments) throws TemplateException { if(expression.isEmpty()) { throw new TemplateException("Invalid ATTR operand. Attribute property path expression is empty."); } Set<Attr> syntheticAttributes = new HashSet<Attr>(); PairsList pairs = new PairsList(expression); for(Pair pair : pairs) { // accordingly this operator expression syntax first value is attribute name and second is property path String value = content.getString(scope, pair.second()); if(value != null) { syntheticAttributes.add(new AttrImpl(pair.first(), value)); } } return syntheticAttributes; }
[ "@", "Override", "protected", "Object", "doExec", "(", "Element", "element", ",", "Object", "scope", ",", "String", "expression", ",", "Object", "...", "arguments", ")", "throws", "TemplateException", "{", "if", "(", "expression", ".", "isEmpty", "(", ")", "...
Execute ATTR operator. Expression argument is set of attribute name / property path pairs. Property path is used to retrieve content value that is converted to string and used as attribute value. @param element context element, unused, @param scope scope object, @param expression set of attribute name / property path pairs, @param arguments optional arguments, unused. @return always returns null for void. @throws TemplateException if expression is empty or not well formatted or if requested content value is undefined.
[ "Execute", "ATTR", "operator", ".", "Expression", "argument", "is", "set", "of", "attribute", "name", "/", "property", "path", "pairs", ".", "Property", "path", "is", "used", "to", "retrieve", "content", "value", "that", "is", "converted", "to", "string", "a...
train
https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/AttrOperator.java#L58-L76
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/SystemUtil.java
SystemUtil.isDebuggingEnabled
public static boolean isDebuggingEnabled() { boolean debuggingEnabled = false; if (ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("-agentlib:jdwp") > 0) { debuggingEnabled = true; } else if (ManagementFactory.getRuntimeMXBean().getInputArguments().contains("-Xdebug")) { debuggingEnabled = true; } else if (System.getProperty("debug", "").equals("true")) { debuggingEnabled = true; } return debuggingEnabled; }
java
public static boolean isDebuggingEnabled() { boolean debuggingEnabled = false; if (ManagementFactory.getRuntimeMXBean().getInputArguments().toString().indexOf("-agentlib:jdwp") > 0) { debuggingEnabled = true; } else if (ManagementFactory.getRuntimeMXBean().getInputArguments().contains("-Xdebug")) { debuggingEnabled = true; } else if (System.getProperty("debug", "").equals("true")) { debuggingEnabled = true; } return debuggingEnabled; }
[ "public", "static", "boolean", "isDebuggingEnabled", "(", ")", "{", "boolean", "debuggingEnabled", "=", "false", ";", "if", "(", "ManagementFactory", ".", "getRuntimeMXBean", "(", ")", ".", "getInputArguments", "(", ")", ".", "toString", "(", ")", ".", "indexO...
Examines some system properties to determine whether the process is likely being debugged in an IDE or remotely. @return true if being debugged, false otherwise
[ "Examines", "some", "system", "properties", "to", "determine", "whether", "the", "process", "is", "likely", "being", "debugged", "in", "an", "IDE", "or", "remotely", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/SystemUtil.java#L254-L264
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java
DTMDocumentImpl.appendNode
private final int appendNode(int w0, int w1, int w2, int w3) { // A decent compiler may inline this. int slotnumber = nodes.appendSlot(w0, w1, w2, w3); if (DEBUG) System.out.println(slotnumber+": "+w0+" "+w1+" "+w2+" "+w3); if (previousSiblingWasParent) nodes.writeEntry(previousSibling,2,slotnumber); previousSiblingWasParent = false; // Set the default; endElement overrides return slotnumber; }
java
private final int appendNode(int w0, int w1, int w2, int w3) { // A decent compiler may inline this. int slotnumber = nodes.appendSlot(w0, w1, w2, w3); if (DEBUG) System.out.println(slotnumber+": "+w0+" "+w1+" "+w2+" "+w3); if (previousSiblingWasParent) nodes.writeEntry(previousSibling,2,slotnumber); previousSiblingWasParent = false; // Set the default; endElement overrides return slotnumber; }
[ "private", "final", "int", "appendNode", "(", "int", "w0", ",", "int", "w1", ",", "int", "w2", ",", "int", "w3", ")", "{", "// A decent compiler may inline this.", "int", "slotnumber", "=", "nodes", ".", "appendSlot", "(", "w0", ",", "w1", ",", "w2", ","...
Wrapper for ChunkedIntArray.append, to automatically update the previous sibling's "next" reference (if necessary) and periodically wake a reader who may have encountered incomplete data and entered a wait state. @param w0 int As in ChunkedIntArray.append @param w1 int As in ChunkedIntArray.append @param w2 int As in ChunkedIntArray.append @param w3 int As in ChunkedIntArray.append @return int As in ChunkedIntArray.append @see ChunkedIntArray.append
[ "Wrapper", "for", "ChunkedIntArray", ".", "append", "to", "automatically", "update", "the", "previous", "sibling", "s", "next", "reference", "(", "if", "necessary", ")", "and", "periodically", "wake", "a", "reader", "who", "may", "have", "encountered", "incomple...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L206-L219
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetUpdateRequestResourcesImpl.java
SheetUpdateRequestResourcesImpl.updateUpdateRequest
public UpdateRequest updateUpdateRequest(long sheetId, UpdateRequest updateRequest) throws SmartsheetException { return this.updateResource("sheets/" + sheetId + "/updaterequests/" + updateRequest.getId(), UpdateRequest.class, updateRequest); }
java
public UpdateRequest updateUpdateRequest(long sheetId, UpdateRequest updateRequest) throws SmartsheetException { return this.updateResource("sheets/" + sheetId + "/updaterequests/" + updateRequest.getId(), UpdateRequest.class, updateRequest); }
[ "public", "UpdateRequest", "updateUpdateRequest", "(", "long", "sheetId", ",", "UpdateRequest", "updateRequest", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "updateResource", "(", "\"sheets/\"", "+", "sheetId", "+", "\"/updaterequests/\"", "+", "...
Changes the specified Update Request for the Sheet. It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/updaterequests/{updateRequestId} @param sheetId the Id of the sheet @param updateRequest the update request object @return the update request resource. @throws IllegalArgumentException if any argument is null or empty string @throws InvalidRequestException if there is any problem with the REST API request @throws AuthorizationException if there is any problem with the REST API authorization (access token) @throws ResourceNotFoundException if the resource cannot be found @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting) @throws SmartsheetException if there is any other error during the operation
[ "Changes", "the", "specified", "Update", "Request", "for", "the", "Sheet", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetUpdateRequestResourcesImpl.java#L149-L152
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getResource
private static URL getResource(String name, ClassLoader[] classLoaders) { // Java standard class loader require resource name to be an absolute path without leading path separator // at this point <name> argument is guaranteed to not start with leading path separator for(ClassLoader classLoader : classLoaders) { URL url = classLoader.getResource(name); if(url == null) { // it seems there are class loaders that require leading path separator // not confirmed rumor but found in similar libraries url = classLoader.getResource('/' + name); } if(url != null) { return url; } } return null; }
java
private static URL getResource(String name, ClassLoader[] classLoaders) { // Java standard class loader require resource name to be an absolute path without leading path separator // at this point <name> argument is guaranteed to not start with leading path separator for(ClassLoader classLoader : classLoaders) { URL url = classLoader.getResource(name); if(url == null) { // it seems there are class loaders that require leading path separator // not confirmed rumor but found in similar libraries url = classLoader.getResource('/' + name); } if(url != null) { return url; } } return null; }
[ "private", "static", "URL", "getResource", "(", "String", "name", ",", "ClassLoader", "[", "]", "classLoaders", ")", "{", "// Java standard class loader require resource name to be an absolute path without leading path separator\r", "// at this point <name> argument is guaranteed to no...
Get named resource URL from a list of class loaders. Traverses class loaders in given order searching for requested resource. Return first resource found or null if none found. @param name resource name with syntax as requested by Java ClassLoader, @param classLoaders target class loaders. @return found resource URL or null.
[ "Get", "named", "resource", "URL", "from", "a", "list", "of", "class", "loaders", ".", "Traverses", "class", "loaders", "in", "given", "order", "searching", "for", "requested", "resource", ".", "Return", "first", "resource", "found", "or", "null", "if", "non...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L997-L1014
togglz/togglz
core/src/main/java/org/togglz/core/util/MoreObjects.java
MoreObjects.firstNonNull
public static <T> T firstNonNull(T first, T second) { return first != null ? first : checkNotNull(second); }
java
public static <T> T firstNonNull(T first, T second) { return first != null ? first : checkNotNull(second); }
[ "public", "static", "<", "T", ">", "T", "firstNonNull", "(", "T", "first", ",", "T", "second", ")", "{", "return", "first", "!=", "null", "?", "first", ":", "checkNotNull", "(", "second", ")", ";", "}" ]
Returns the first of two given parameters that is not {@code null}, if either is, or otherwise throws a {@link NullPointerException}. @return {@code first} if {@code first} is not {@code null}, or {@code second} if {@code first} is {@code null} and {@code second} is not {@code null} @throws NullPointerException if both {@code first} and {@code second} were {@code null} @since 3.0
[ "Returns", "the", "first", "of", "two", "given", "parameters", "that", "is", "not", "{", "@code", "null", "}", "if", "either", "is", "or", "otherwise", "throws", "a", "{", "@link", "NullPointerException", "}", "." ]
train
https://github.com/togglz/togglz/blob/76d3ffbc8e3fac5a6cb566cc4afbd8dd5f06c4e5/core/src/main/java/org/togglz/core/util/MoreObjects.java#L114-L116
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java
TypeUtils.typeImplements
public static TypeDef typeImplements(TypeDef base, ClassRef... superClass) { return new TypeDefBuilder(base) .withImplementsList(superClass) .build(); }
java
public static TypeDef typeImplements(TypeDef base, ClassRef... superClass) { return new TypeDefBuilder(base) .withImplementsList(superClass) .build(); }
[ "public", "static", "TypeDef", "typeImplements", "(", "TypeDef", "base", ",", "ClassRef", "...", "superClass", ")", "{", "return", "new", "TypeDefBuilder", "(", "base", ")", ".", "withImplementsList", "(", "superClass", ")", ".", "build", "(", ")", ";", "}" ...
Sets one {@link io.sundr.codegen.model.TypeDef} as an interface of an other. @param base The base type. @param superClass The super type. @return The updated type definition.
[ "Sets", "one", "{", "@link", "io", ".", "sundr", ".", "codegen", ".", "model", ".", "TypeDef", "}", "as", "an", "interface", "of", "an", "other", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java#L173-L177
alkacon/opencms-core
src/org/opencms/jsp/search/controller/CmsSearchControllerFacetRange.java
CmsSearchControllerFacetRange.addFacetOptions
protected void addFacetOptions(StringBuffer query) { // start appendFacetOption(query, "range.start", m_config.getStart()); // end appendFacetOption(query, "range.end", m_config.getEnd()); // gap appendFacetOption(query, "range.gap", m_config.getGap()); // other for (I_CmsSearchConfigurationFacetRange.Other o : m_config.getOther()) { appendFacetOption(query, "range.other", o.toString()); } // hardend appendFacetOption(query, "range.hardend", Boolean.toString(m_config.getHardEnd())); // mincount if (m_config.getMinCount() != null) { appendFacetOption(query, "mincount", m_config.getMinCount().toString()); } }
java
protected void addFacetOptions(StringBuffer query) { // start appendFacetOption(query, "range.start", m_config.getStart()); // end appendFacetOption(query, "range.end", m_config.getEnd()); // gap appendFacetOption(query, "range.gap", m_config.getGap()); // other for (I_CmsSearchConfigurationFacetRange.Other o : m_config.getOther()) { appendFacetOption(query, "range.other", o.toString()); } // hardend appendFacetOption(query, "range.hardend", Boolean.toString(m_config.getHardEnd())); // mincount if (m_config.getMinCount() != null) { appendFacetOption(query, "mincount", m_config.getMinCount().toString()); } }
[ "protected", "void", "addFacetOptions", "(", "StringBuffer", "query", ")", "{", "// start", "appendFacetOption", "(", "query", ",", "\"range.start\"", ",", "m_config", ".", "getStart", "(", ")", ")", ";", "// end", "appendFacetOption", "(", "query", ",", "\"rang...
Adds the query parts for the facet options, except the filter parts. @param query The query part that is extended with the facet options.
[ "Adds", "the", "query", "parts", "for", "the", "facet", "options", "except", "the", "filter", "parts", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/controller/CmsSearchControllerFacetRange.java#L139-L157
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/Languages.java
Languages.getLanguageForLocale
public static Language getLanguageForLocale(Locale locale) { Language language = getLanguageForLanguageNameAndCountry(locale); if (language != null) { return language; } else { Language firstFallbackLanguage = getLanguageForLanguageNameOnly(locale); if (firstFallbackLanguage != null) { return firstFallbackLanguage; } } for (Language aLanguage : languages) { if (aLanguage.getShortCodeWithCountryAndVariant().equals("en-US")) { return aLanguage; } } throw new RuntimeException("No appropriate language found, not even en-US. Supported languages: " + get()); }
java
public static Language getLanguageForLocale(Locale locale) { Language language = getLanguageForLanguageNameAndCountry(locale); if (language != null) { return language; } else { Language firstFallbackLanguage = getLanguageForLanguageNameOnly(locale); if (firstFallbackLanguage != null) { return firstFallbackLanguage; } } for (Language aLanguage : languages) { if (aLanguage.getShortCodeWithCountryAndVariant().equals("en-US")) { return aLanguage; } } throw new RuntimeException("No appropriate language found, not even en-US. Supported languages: " + get()); }
[ "public", "static", "Language", "getLanguageForLocale", "(", "Locale", "locale", ")", "{", "Language", "language", "=", "getLanguageForLanguageNameAndCountry", "(", "locale", ")", ";", "if", "(", "language", "!=", "null", ")", "{", "return", "language", ";", "}"...
Get the best match for a locale, using American English as the final fallback if nothing else fits. The returned language will be a country variant language (e.g. British English, not just English) if available. Note: this does not consider languages added dynamically @throws RuntimeException if no language was found and American English as a fallback is not available
[ "Get", "the", "best", "match", "for", "a", "locale", "using", "American", "English", "as", "the", "final", "fallback", "if", "nothing", "else", "fits", ".", "The", "returned", "language", "will", "be", "a", "country", "variant", "language", "(", "e", ".", ...
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/Languages.java#L262-L278
looly/hutool
hutool-core/src/main/java/cn/hutool/core/math/Combination.java
Combination.count
public static long count(int n, int m) { if(0 == m) { return 1; } if(n == m) { return NumberUtil.factorial(n) / NumberUtil.factorial(m); } return (n > m) ? NumberUtil.factorial(n, n - m) / NumberUtil.factorial(m) : 0; }
java
public static long count(int n, int m) { if(0 == m) { return 1; } if(n == m) { return NumberUtil.factorial(n) / NumberUtil.factorial(m); } return (n > m) ? NumberUtil.factorial(n, n - m) / NumberUtil.factorial(m) : 0; }
[ "public", "static", "long", "count", "(", "int", "n", ",", "int", "m", ")", "{", "if", "(", "0", "==", "m", ")", "{", "return", "1", ";", "}", "if", "(", "n", "==", "m", ")", "{", "return", "NumberUtil", ".", "factorial", "(", "n", ")", "/", ...
计算组合数,即C(n, m) = n!/((n-m)! * m!) @param n 总数 @param m 选择的个数 @return 组合数
[ "计算组合数,即C", "(", "n", "m", ")", "=", "n!", "/", "((", "n", "-", "m", ")", "!", "*", "m!", ")" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/math/Combination.java#L37-L45
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.vpnDeviceConfigurationScript
public String vpnDeviceConfigurationScript(String resourceGroupName, String virtualNetworkGatewayConnectionName, VpnDeviceScriptParameters parameters) { return vpnDeviceConfigurationScriptWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).toBlocking().single().body(); }
java
public String vpnDeviceConfigurationScript(String resourceGroupName, String virtualNetworkGatewayConnectionName, VpnDeviceScriptParameters parameters) { return vpnDeviceConfigurationScriptWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).toBlocking().single().body(); }
[ "public", "String", "vpnDeviceConfigurationScript", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "VpnDeviceScriptParameters", "parameters", ")", "{", "return", "vpnDeviceConfigurationScriptWithServiceResponseAsync", "(", "resourceGr...
Gets a xml format representation for vpn device configuration script. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection for which the configuration script is generated. @param parameters Parameters supplied to the generate vpn device script operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the String object if successful.
[ "Gets", "a", "xml", "format", "representation", "for", "vpn", "device", "configuration", "script", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2978-L2980
neoremind/fluent-validator
fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/QuickValidator.java
QuickValidator.doAndGetComplexResult2
public static ComplexResult2 doAndGetComplexResult2(Decorator decorator) { return validate(decorator, FluentValidator.checkAll(), null, ResultCollectors.toComplex2()); }
java
public static ComplexResult2 doAndGetComplexResult2(Decorator decorator) { return validate(decorator, FluentValidator.checkAll(), null, ResultCollectors.toComplex2()); }
[ "public", "static", "ComplexResult2", "doAndGetComplexResult2", "(", "Decorator", "decorator", ")", "{", "return", "validate", "(", "decorator", ",", "FluentValidator", ".", "checkAll", "(", ")", ",", "null", ",", "ResultCollectors", ".", "toComplex2", "(", ")", ...
Execute validation by using a new FluentValidator instance and without a shared context. The result type is {@link ComplexResult2} @param decorator Same as decorator design pattern, provided to add more functions to the fluentValidator @return ComplexResult2
[ "Execute", "validation", "by", "using", "a", "new", "FluentValidator", "instance", "and", "without", "a", "shared", "context", ".", "The", "result", "type", "is", "{", "@link", "ComplexResult2", "}" ]
train
https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/QuickValidator.java#L62-L64
infinispan/infinispan
hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/access/InvalidationCacheAccessDelegate.java
InvalidationCacheAccessDelegate.putFromLoad
@Override @SuppressWarnings("UnusedParameters") public boolean putFromLoad(Object session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException { if ( !region.checkValid() ) { if (trace) { log.tracef( "Region %s not valid", region.getName() ); } return false; } // In theory, since putForExternalRead is already as minimal as it can // get, we shouldn't be need this check. However, without the check and // without https://issues.jboss.org/browse/ISPN-1986, it's impossible to // know whether the put actually occurred. Knowing this is crucial so // that Hibernate can expose accurate statistics. if ( minimalPutOverride && cache.containsKey( key ) ) { return false; } PutFromLoadValidator.Lock lock = putValidator.acquirePutFromLoadLock(session, key, txTimestamp); if ( lock == null) { if (trace) { log.tracef( "Put from load lock not acquired for key %s", key ); } return false; } try { writeCache.putForExternalRead( key, value ); } finally { putValidator.releasePutFromLoadLock( key, lock); } return true; }
java
@Override @SuppressWarnings("UnusedParameters") public boolean putFromLoad(Object session, Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) throws CacheException { if ( !region.checkValid() ) { if (trace) { log.tracef( "Region %s not valid", region.getName() ); } return false; } // In theory, since putForExternalRead is already as minimal as it can // get, we shouldn't be need this check. However, without the check and // without https://issues.jboss.org/browse/ISPN-1986, it's impossible to // know whether the put actually occurred. Knowing this is crucial so // that Hibernate can expose accurate statistics. if ( minimalPutOverride && cache.containsKey( key ) ) { return false; } PutFromLoadValidator.Lock lock = putValidator.acquirePutFromLoadLock(session, key, txTimestamp); if ( lock == null) { if (trace) { log.tracef( "Put from load lock not acquired for key %s", key ); } return false; } try { writeCache.putForExternalRead( key, value ); } finally { putValidator.releasePutFromLoadLock( key, lock); } return true; }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"UnusedParameters\"", ")", "public", "boolean", "putFromLoad", "(", "Object", "session", ",", "Object", "key", ",", "Object", "value", ",", "long", "txTimestamp", ",", "Object", "version", ",", "boolean", "minimal...
Attempt to cache an object, after loading from the database, explicitly specifying the minimalPut behavior. @param session Current session @param key The item key @param value The item @param txTimestamp a timestamp prior to the transaction start time @param version the item version number @param minimalPutOverride Explicit minimalPut flag @return <tt>true</tt> if the object was successfully cached @throws CacheException if storing the object failed
[ "Attempt", "to", "cache", "an", "object", "after", "loading", "from", "the", "database", "explicitly", "specifying", "the", "minimalPut", "behavior", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/access/InvalidationCacheAccessDelegate.java#L85-L121
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/message/HttpCarbonMessage.java
HttpCarbonMessage.pushResponse
public HttpResponseFuture pushResponse(HttpCarbonMessage httpCarbonMessage, Http2PushPromise pushPromise) throws ServerConnectorException { httpOutboundRespFuture.notifyHttpListener(httpCarbonMessage, pushPromise); return httpOutboundRespStatusFuture; }
java
public HttpResponseFuture pushResponse(HttpCarbonMessage httpCarbonMessage, Http2PushPromise pushPromise) throws ServerConnectorException { httpOutboundRespFuture.notifyHttpListener(httpCarbonMessage, pushPromise); return httpOutboundRespStatusFuture; }
[ "public", "HttpResponseFuture", "pushResponse", "(", "HttpCarbonMessage", "httpCarbonMessage", ",", "Http2PushPromise", "pushPromise", ")", "throws", "ServerConnectorException", "{", "httpOutboundRespFuture", ".", "notifyHttpListener", "(", "httpCarbonMessage", ",", "pushPromis...
Sends a push response message back to the client. @param httpCarbonMessage the push response message @param pushPromise the push promise associated with the push response message @return HttpResponseFuture which gives the status of the operation @throws ServerConnectorException if there is an error occurs while doing the operation
[ "Sends", "a", "push", "response", "message", "back", "to", "the", "client", "." ]
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/message/HttpCarbonMessage.java#L311-L315
3pillarlabs/spring-data-simpledb
spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/repository/support/entityinformation/SimpleDbEntityInformationSupport.java
SimpleDbEntityInformationSupport.getMetadata
@SuppressWarnings({ "rawtypes", "unchecked" }) public static <T> SimpleDbEntityInformation<T, ?> getMetadata(Class<T> domainClass, String simpleDbDomain) { Assert.notNull(domainClass); Assert.notNull(simpleDbDomain); return new SimpleDbMetamodelEntityInformation(domainClass, simpleDbDomain); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public static <T> SimpleDbEntityInformation<T, ?> getMetadata(Class<T> domainClass, String simpleDbDomain) { Assert.notNull(domainClass); Assert.notNull(simpleDbDomain); return new SimpleDbMetamodelEntityInformation(domainClass, simpleDbDomain); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "<", "T", ">", "SimpleDbEntityInformation", "<", "T", ",", "?", ">", "getMetadata", "(", "Class", "<", "T", ">", "domainClass", ",", "String", "simpleDbDom...
Creates a {@link SimpleDbEntityInformation} for the given domain class. @param domainClass must not be {@literal null}. @return
[ "Creates", "a", "{", "@link", "SimpleDbEntityInformation", "}", "for", "the", "given", "domain", "class", "." ]
train
https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/repository/support/entityinformation/SimpleDbEntityInformationSupport.java#L48-L54
datastax/java-driver
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java
SchemaBuilder.createMaterializedView
@NonNull public static CreateMaterializedViewStart createMaterializedView( @Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier viewName) { return new DefaultCreateMaterializedView(keyspace, viewName); }
java
@NonNull public static CreateMaterializedViewStart createMaterializedView( @Nullable CqlIdentifier keyspace, @NonNull CqlIdentifier viewName) { return new DefaultCreateMaterializedView(keyspace, viewName); }
[ "@", "NonNull", "public", "static", "CreateMaterializedViewStart", "createMaterializedView", "(", "@", "Nullable", "CqlIdentifier", "keyspace", ",", "@", "NonNull", "CqlIdentifier", "viewName", ")", "{", "return", "new", "DefaultCreateMaterializedView", "(", "keyspace", ...
Starts a CREATE MATERIALIZED VIEW query with the given view name for the given keyspace name.
[ "Starts", "a", "CREATE", "MATERIALIZED", "VIEW", "query", "with", "the", "given", "view", "name", "for", "the", "given", "keyspace", "name", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/SchemaBuilder.java#L221-L225
apache/groovy
src/main/java/org/codehaus/groovy/runtime/typehandling/NumberMath.java
NumberMath.rightShiftUnsigned
public static Number rightShiftUnsigned(Number left, Number right) { if (isFloatingPoint(right) || isBigDecimal(right)) { throw new UnsupportedOperationException("Shift distance must be an integral type, but " + right + " (" + right.getClass().getName() + ") was supplied"); } return getMath(left).rightShiftUnsignedImpl(left, right); }
java
public static Number rightShiftUnsigned(Number left, Number right) { if (isFloatingPoint(right) || isBigDecimal(right)) { throw new UnsupportedOperationException("Shift distance must be an integral type, but " + right + " (" + right.getClass().getName() + ") was supplied"); } return getMath(left).rightShiftUnsignedImpl(left, right); }
[ "public", "static", "Number", "rightShiftUnsigned", "(", "Number", "left", ",", "Number", "right", ")", "{", "if", "(", "isFloatingPoint", "(", "right", ")", "||", "isBigDecimal", "(", "right", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(...
For this operation, consider the operands independently. Throw an exception if the right operand (shift distance) is not an integral type. For the left operand (shift value) also require an integral type, but do NOT promote from Integer to Long. This is consistent with Java, and makes sense for the shift operators.
[ "For", "this", "operation", "consider", "the", "operands", "independently", ".", "Throw", "an", "exception", "if", "the", "right", "operand", "(", "shift", "distance", ")", "is", "not", "an", "integral", "type", ".", "For", "the", "left", "operand", "(", "...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/typehandling/NumberMath.java#L123-L128
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/Table.java
Table.insertRow
void insertRow(Session session, PersistentStore store, Object[] data) { setIdentityColumn(session, data); if (triggerLists[Trigger.INSERT_BEFORE].length != 0) { fireBeforeTriggers(session, Trigger.INSERT_BEFORE, null, data, null); } if (isView) { return; } checkRowDataInsert(session, data); insertNoCheck(session, store, data); }
java
void insertRow(Session session, PersistentStore store, Object[] data) { setIdentityColumn(session, data); if (triggerLists[Trigger.INSERT_BEFORE].length != 0) { fireBeforeTriggers(session, Trigger.INSERT_BEFORE, null, data, null); } if (isView) { return; } checkRowDataInsert(session, data); insertNoCheck(session, store, data); }
[ "void", "insertRow", "(", "Session", "session", ",", "PersistentStore", "store", ",", "Object", "[", "]", "data", ")", "{", "setIdentityColumn", "(", "session", ",", "data", ")", ";", "if", "(", "triggerLists", "[", "Trigger", ".", "INSERT_BEFORE", "]", "....
Mid level method for inserting rows. Performs constraint checks and fires row level triggers.
[ "Mid", "level", "method", "for", "inserting", "rows", ".", "Performs", "constraint", "checks", "and", "fires", "row", "level", "triggers", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Table.java#L2241-L2256
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerImpl.java
TransformerImpl.executeChildTemplates
public void executeChildTemplates( ElemTemplateElement elem, ContentHandler handler) throws TransformerException { SerializationHandler xoh = this.getSerializationHandler(); // These may well not be the same! In this case when calling // the Redirect extension, it has already set the ContentHandler // in the Transformer. SerializationHandler savedHandler = xoh; try { xoh.flushPending(); // %REVIEW% Make sure current node is being pushed. LexicalHandler lex = null; if (handler instanceof LexicalHandler) { lex = (LexicalHandler) handler; } m_serializationHandler = new ToXMLSAXHandler(handler, lex, savedHandler.getEncoding()); m_serializationHandler.setTransformer(this); executeChildTemplates(elem, true); } catch (TransformerException e) { throw e; } catch (SAXException se) { throw new TransformerException(se); } finally { m_serializationHandler = savedHandler; } }
java
public void executeChildTemplates( ElemTemplateElement elem, ContentHandler handler) throws TransformerException { SerializationHandler xoh = this.getSerializationHandler(); // These may well not be the same! In this case when calling // the Redirect extension, it has already set the ContentHandler // in the Transformer. SerializationHandler savedHandler = xoh; try { xoh.flushPending(); // %REVIEW% Make sure current node is being pushed. LexicalHandler lex = null; if (handler instanceof LexicalHandler) { lex = (LexicalHandler) handler; } m_serializationHandler = new ToXMLSAXHandler(handler, lex, savedHandler.getEncoding()); m_serializationHandler.setTransformer(this); executeChildTemplates(elem, true); } catch (TransformerException e) { throw e; } catch (SAXException se) { throw new TransformerException(se); } finally { m_serializationHandler = savedHandler; } }
[ "public", "void", "executeChildTemplates", "(", "ElemTemplateElement", "elem", ",", "ContentHandler", "handler", ")", "throws", "TransformerException", "{", "SerializationHandler", "xoh", "=", "this", ".", "getSerializationHandler", "(", ")", ";", "// These may well not b...
Execute each of the children of a template element. @param elem The ElemTemplateElement that contains the children that should execute. @param handler The ContentHandler to where the result events should be fed. @throws TransformerException @xsl.usage advanced
[ "Execute", "each", "of", "the", "children", "of", "a", "template", "element", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerImpl.java#L2255-L2291
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.relativeQuadTo
public SVGPath relativeQuadTo(double[] c1xy, double[] xy) { return append(PATH_QUAD_TO_RELATIVE).append(c1xy[0]).append(c1xy[1]).append(xy[0]).append(xy[1]); }
java
public SVGPath relativeQuadTo(double[] c1xy, double[] xy) { return append(PATH_QUAD_TO_RELATIVE).append(c1xy[0]).append(c1xy[1]).append(xy[0]).append(xy[1]); }
[ "public", "SVGPath", "relativeQuadTo", "(", "double", "[", "]", "c1xy", ",", "double", "[", "]", "xy", ")", "{", "return", "append", "(", "PATH_QUAD_TO_RELATIVE", ")", ".", "append", "(", "c1xy", "[", "0", "]", ")", ".", "append", "(", "c1xy", "[", "...
Quadratic Bezier line to the given relative coordinates. @param c1xy first control point @param xy new coordinates @return path object, for compact syntax.
[ "Quadratic", "Bezier", "line", "to", "the", "given", "relative", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L492-L494
JoeKerouac/utils
src/main/java/com/joe/utils/reflect/ClassUtils.java
ClassUtils.getInstance
public static <T> T getInstance(String className, ClassLoader loader) { return getInstance(loadClass(className, loader)); }
java
public static <T> T getInstance(String className, ClassLoader loader) { return getInstance(loadClass(className, loader)); }
[ "public", "static", "<", "T", ">", "T", "getInstance", "(", "String", "className", ",", "ClassLoader", "loader", ")", "{", "return", "getInstance", "(", "loadClass", "(", "className", ",", "loader", ")", ")", ";", "}" ]
获取class实例 @param className class名字 @param loader 加载class的classloader @param <T> class类型 @return class的实例
[ "获取class实例" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/ClassUtils.java#L125-L127
httl/httl
httl/src/main/java/httl/Engine.java
Engine.getTemplate
public Template getTemplate(String name, Object args) throws IOException, ParseException { if (args instanceof String) return getTemplate(name, (String) args); if (args instanceof Locale) return getTemplate(name, (Locale) args); return getTemplate(name, null, null, args); }
java
public Template getTemplate(String name, Object args) throws IOException, ParseException { if (args instanceof String) return getTemplate(name, (String) args); if (args instanceof Locale) return getTemplate(name, (Locale) args); return getTemplate(name, null, null, args); }
[ "public", "Template", "getTemplate", "(", "String", "name", ",", "Object", "args", ")", "throws", "IOException", ",", "ParseException", "{", "if", "(", "args", "instanceof", "String", ")", "return", "getTemplate", "(", "name", ",", "(", "String", ")", "args"...
Get template. @param name - template name @return template instance @throws IOException - If an I/O error occurs @throws ParseException - If the template cannot be parsed @see #getEngine()
[ "Get", "template", "." ]
train
https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/Engine.java#L369-L375
m-m-m/util
pojopath/src/main/java/net/sf/mmm/util/pojo/path/base/AbstractPojoPathNavigator.java
AbstractPojoPathNavigator.createState
protected PojoPathState createState(Object initialPojo, String pojoPath, PojoPathMode mode, PojoPathContext context) { if (mode == null) { throw new NlsNullPointerException("mode"); } Map<Object, Object> rawCache = context.getCache(); if (rawCache == null) { CachingPojoPath rootPath = new CachingPojoPath(initialPojo, initialPojo.getClass()); return new PojoPathState(rootPath, mode, pojoPath); } HashKey<Object> hashKey = new HashKey<>(initialPojo); PojoPathCache masterCache = (PojoPathCache) rawCache.get(hashKey); if (masterCache == null) { masterCache = new PojoPathCache(initialPojo); rawCache.put(hashKey, masterCache); } return masterCache.createState(mode, pojoPath); }
java
protected PojoPathState createState(Object initialPojo, String pojoPath, PojoPathMode mode, PojoPathContext context) { if (mode == null) { throw new NlsNullPointerException("mode"); } Map<Object, Object> rawCache = context.getCache(); if (rawCache == null) { CachingPojoPath rootPath = new CachingPojoPath(initialPojo, initialPojo.getClass()); return new PojoPathState(rootPath, mode, pojoPath); } HashKey<Object> hashKey = new HashKey<>(initialPojo); PojoPathCache masterCache = (PojoPathCache) rawCache.get(hashKey); if (masterCache == null) { masterCache = new PojoPathCache(initialPojo); rawCache.put(hashKey, masterCache); } return masterCache.createState(mode, pojoPath); }
[ "protected", "PojoPathState", "createState", "(", "Object", "initialPojo", ",", "String", "pojoPath", ",", "PojoPathMode", "mode", ",", "PojoPathContext", "context", ")", "{", "if", "(", "mode", "==", "null", ")", "{", "throw", "new", "NlsNullPointerException", ...
This method gets the {@link PojoPathState} for the given {@code context}. @param initialPojo is the initial {@link net.sf.mmm.util.pojo.api.Pojo} this {@link PojoPathNavigator} was invoked with. @param pojoPath is the {@link net.sf.mmm.util.pojo.path.api.PojoPath} to navigate. @param mode is the {@link PojoPathMode mode} that determines how to deal {@code null} values. @param context is the {@link PojoPathContext context} for this operation. @return the {@link PojoPathState} or {@code null} if caching is disabled.
[ "This", "method", "gets", "the", "{", "@link", "PojoPathState", "}", "for", "the", "given", "{", "@code", "context", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/pojopath/src/main/java/net/sf/mmm/util/pojo/path/base/AbstractPojoPathNavigator.java#L219-L236
spring-projects/spring-boot
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateProperties.java
HibernateProperties.determineHibernateProperties
public Map<String, Object> determineHibernateProperties( Map<String, String> jpaProperties, HibernateSettings settings) { Assert.notNull(jpaProperties, "JpaProperties must not be null"); Assert.notNull(settings, "Settings must not be null"); return getAdditionalProperties(jpaProperties, settings); }
java
public Map<String, Object> determineHibernateProperties( Map<String, String> jpaProperties, HibernateSettings settings) { Assert.notNull(jpaProperties, "JpaProperties must not be null"); Assert.notNull(settings, "Settings must not be null"); return getAdditionalProperties(jpaProperties, settings); }
[ "public", "Map", "<", "String", ",", "Object", ">", "determineHibernateProperties", "(", "Map", "<", "String", ",", "String", ">", "jpaProperties", ",", "HibernateSettings", "settings", ")", "{", "Assert", ".", "notNull", "(", "jpaProperties", ",", "\"JpaPropert...
Determine the configuration properties for the initialization of the main Hibernate EntityManagerFactory based on standard JPA properties and {@link HibernateSettings}. @param jpaProperties standard JPA properties @param settings the settings to apply when determining the configuration properties @return the Hibernate properties to use
[ "Determine", "the", "configuration", "properties", "for", "the", "initialization", "of", "the", "main", "Hibernate", "EntityManagerFactory", "based", "on", "standard", "JPA", "properties", "and", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateProperties.java#L90-L95
code4everything/util
src/main/java/com/zhazhapan/util/FileExecutor.java
FileExecutor.readFile
public static String readFile(File file, long start, int length) throws IOException { byte[] bs = new byte[length]; try (FileInputStream fis = new FileInputStream(file)) { fis.skip(start); fis.read(bs); } return new String(bs); }
java
public static String readFile(File file, long start, int length) throws IOException { byte[] bs = new byte[length]; try (FileInputStream fis = new FileInputStream(file)) { fis.skip(start); fis.read(bs); } return new String(bs); }
[ "public", "static", "String", "readFile", "(", "File", "file", ",", "long", "start", ",", "int", "length", ")", "throws", "IOException", "{", "byte", "[", "]", "bs", "=", "new", "byte", "[", "length", "]", ";", "try", "(", "FileInputStream", "fis", "="...
从指定位置读取指定长度 @param file 文件 @param start 开始位置 @param length 读取长度 @return 文件内容 @throws IOException 异常
[ "从指定位置读取指定长度" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L946-L953
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java
MaterialAutoComplete.setup
protected void setup(SuggestOracle suggestions) { if (itemBoxKeyDownHandler != null) { itemBoxKeyDownHandler.removeHandler(); } list.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_LIST); this.suggestions = suggestions; final ListItem item = new ListItem(); item.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_INPUT_TOKEN); suggestBox = new SuggestBox(suggestions, itemBox); suggestBox.addSelectionHandler(selectionEvent -> { Suggestion selectedItem = selectionEvent.getSelectedItem(); itemBox.setValue(""); if (addItem(selectedItem)) { ValueChangeEvent.fire(MaterialAutoComplete.this, getValue()); } itemBox.setFocus(true); }); loadHandlers(); setLimit(this.limit); String autocompleteId = DOM.createUniqueId(); itemBox.getElement().setId(autocompleteId); item.add(suggestBox); item.add(label); list.add(item); panel.add(list); panel.getElement().setAttribute("onclick", "document.getElementById('" + autocompleteId + "').focus()"); panel.add(errorLabel); suggestBox.setFocus(true); }
java
protected void setup(SuggestOracle suggestions) { if (itemBoxKeyDownHandler != null) { itemBoxKeyDownHandler.removeHandler(); } list.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_LIST); this.suggestions = suggestions; final ListItem item = new ListItem(); item.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_INPUT_TOKEN); suggestBox = new SuggestBox(suggestions, itemBox); suggestBox.addSelectionHandler(selectionEvent -> { Suggestion selectedItem = selectionEvent.getSelectedItem(); itemBox.setValue(""); if (addItem(selectedItem)) { ValueChangeEvent.fire(MaterialAutoComplete.this, getValue()); } itemBox.setFocus(true); }); loadHandlers(); setLimit(this.limit); String autocompleteId = DOM.createUniqueId(); itemBox.getElement().setId(autocompleteId); item.add(suggestBox); item.add(label); list.add(item); panel.add(list); panel.getElement().setAttribute("onclick", "document.getElementById('" + autocompleteId + "').focus()"); panel.add(errorLabel); suggestBox.setFocus(true); }
[ "protected", "void", "setup", "(", "SuggestOracle", "suggestions", ")", "{", "if", "(", "itemBoxKeyDownHandler", "!=", "null", ")", "{", "itemBoxKeyDownHandler", ".", "removeHandler", "(", ")", ";", "}", "list", ".", "setStyleName", "(", "AddinsCssName", ".", ...
Generate and build the List Items to be set on Auto Complete box.
[ "Generate", "and", "build", "the", "List", "Items", "to", "be", "set", "on", "Auto", "Complete", "box", "." ]
train
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java#L312-L349
OpenLiberty/open-liberty
dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/utils/CommonExpectations.java
CommonExpectations.successfullyReachedUrl
public static Expectations successfullyReachedUrl(String testAction, String url) { Expectations expectations = new Expectations(); expectations.addSuccessStatusCodesForActions(new String[] { testAction }); expectations.addExpectation(new ResponseUrlExpectation(testAction, Constants.STRING_EQUALS, url, "Did not reach the expected URL.")); return expectations; }
java
public static Expectations successfullyReachedUrl(String testAction, String url) { Expectations expectations = new Expectations(); expectations.addSuccessStatusCodesForActions(new String[] { testAction }); expectations.addExpectation(new ResponseUrlExpectation(testAction, Constants.STRING_EQUALS, url, "Did not reach the expected URL.")); return expectations; }
[ "public", "static", "Expectations", "successfullyReachedUrl", "(", "String", "testAction", ",", "String", "url", ")", "{", "Expectations", "expectations", "=", "new", "Expectations", "(", ")", ";", "expectations", ".", "addSuccessStatusCodesForActions", "(", "new", ...
Sets expectations that will check: <ol> <li>200 status code in the response for the specified test action <li>Response URL is equivalent to provided URL </ol>
[ "Sets", "expectations", "that", "will", "check", ":", "<ol", ">", "<li", ">", "200", "status", "code", "in", "the", "response", "for", "the", "specified", "test", "action", "<li", ">", "Response", "URL", "is", "equivalent", "to", "provided", "URL", "<", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/utils/CommonExpectations.java#L30-L35
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/Languages.java
Languages.getLanguageForShortCode
public static Language getLanguageForShortCode(String langCode, List<String> noopLanguageCodes) { Language language = getLanguageForShortCodeOrNull(langCode); if (language == null) { if (noopLanguageCodes.contains(langCode)) { return NOOP_LANGUAGE; } else { List<String> codes = new ArrayList<>(); for (Language realLanguage : getStaticAndDynamicLanguages()) { codes.add(realLanguage.getShortCodeWithCountryAndVariant()); } Collections.sort(codes); throw new IllegalArgumentException("'" + langCode + "' is not a language code known to LanguageTool." + " Supported language codes are: " + String.join(", ", codes) + ". The list of languages is read from " + PROPERTIES_PATH + " in the Java classpath. See http://wiki.languagetool.org/java-api for details."); } } return language; }
java
public static Language getLanguageForShortCode(String langCode, List<String> noopLanguageCodes) { Language language = getLanguageForShortCodeOrNull(langCode); if (language == null) { if (noopLanguageCodes.contains(langCode)) { return NOOP_LANGUAGE; } else { List<String> codes = new ArrayList<>(); for (Language realLanguage : getStaticAndDynamicLanguages()) { codes.add(realLanguage.getShortCodeWithCountryAndVariant()); } Collections.sort(codes); throw new IllegalArgumentException("'" + langCode + "' is not a language code known to LanguageTool." + " Supported language codes are: " + String.join(", ", codes) + ". The list of languages is read from " + PROPERTIES_PATH + " in the Java classpath. See http://wiki.languagetool.org/java-api for details."); } } return language; }
[ "public", "static", "Language", "getLanguageForShortCode", "(", "String", "langCode", ",", "List", "<", "String", ">", "noopLanguageCodes", ")", "{", "Language", "language", "=", "getLanguageForShortCodeOrNull", "(", "langCode", ")", ";", "if", "(", "language", "=...
Get the Language object for the given language code. @param langCode e.g. <code>en</code> or <code>en-US</code> @param noopLanguageCodes list of languages that can be detected but that will not actually find any errors (can be used so non-supported languages are not detected as some other language) @throws IllegalArgumentException if the language is not supported or if the language code is invalid @since 4.4
[ "Get", "the", "Language", "object", "for", "the", "given", "language", "code", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/Languages.java#L225-L242
kmi/iserve
iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/api/impl/AbstractMatcher.java
AbstractMatcher.listMatchesAtMostOfType
@Override public Map<URI, MatchResult> listMatchesAtMostOfType(URI origin, MatchType maxType) { return listMatchesWithinRange(origin, this.matchTypesSupported.getLowest(), maxType); }
java
@Override public Map<URI, MatchResult> listMatchesAtMostOfType(URI origin, MatchType maxType) { return listMatchesWithinRange(origin, this.matchTypesSupported.getLowest(), maxType); }
[ "@", "Override", "public", "Map", "<", "URI", ",", "MatchResult", ">", "listMatchesAtMostOfType", "(", "URI", "origin", ",", "MatchType", "maxType", ")", "{", "return", "listMatchesWithinRange", "(", "origin", ",", "this", ".", "matchTypesSupported", ".", "getLo...
Obtain all the matching resources that have a MatchTyoe with the URI of {@code origin} of the type provided (inclusive) or less. @param origin URI to match @param maxType the maximum MatchType we want to obtain @return a Map containing indexed by the URI of the matching resource and containing the particular {@code MatchResult}. If no result is found the Map should be empty not null.
[ "Obtain", "all", "the", "matching", "resources", "that", "have", "a", "MatchTyoe", "with", "the", "URI", "of", "{", "@code", "origin", "}", "of", "the", "type", "provided", "(", "inclusive", ")", "or", "less", "." ]
train
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/api/impl/AbstractMatcher.java#L111-L114
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/InheritanceHelper.java
InheritanceHelper.isProxyOrSubTypeOf
public boolean isProxyOrSubTypeOf(LightweightTypeReference candidate, Class<?> jvmSuperType, Class<? extends XtendTypeDeclaration> sarlSuperType) { if (!candidate.isResolved()) { return true; } return isSubTypeOf(candidate, jvmSuperType, sarlSuperType); }
java
public boolean isProxyOrSubTypeOf(LightweightTypeReference candidate, Class<?> jvmSuperType, Class<? extends XtendTypeDeclaration> sarlSuperType) { if (!candidate.isResolved()) { return true; } return isSubTypeOf(candidate, jvmSuperType, sarlSuperType); }
[ "public", "boolean", "isProxyOrSubTypeOf", "(", "LightweightTypeReference", "candidate", ",", "Class", "<", "?", ">", "jvmSuperType", ",", "Class", "<", "?", "extends", "XtendTypeDeclaration", ">", "sarlSuperType", ")", "{", "if", "(", "!", "candidate", ".", "is...
Replies if the type candidate is a proxy (unresolved type) or a subtype of the given super type. @param candidate the type to test. @param jvmSuperType the expected JVM super-type. @param sarlSuperType the expected SARL super-type. @return <code>true</code> if the candidate is a sub-type of the super-type.
[ "Replies", "if", "the", "type", "candidate", "is", "a", "proxy", "(", "unresolved", "type", ")", "or", "a", "subtype", "of", "the", "given", "super", "type", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/InheritanceHelper.java#L198-L204
jayantk/jklol
src/com/jayantkrish/jklol/ccg/HeadedSyntacticCategory.java
HeadedSyntacticCategory.getSubcategories
public Set<HeadedSyntacticCategory> getSubcategories(Set<String> featureValues) { Set<HeadedSyntacticCategory> subcategories = Sets.newHashSet(); for (SyntacticCategory newSyntax : syntacticCategory.getSubcategories(featureValues)) { subcategories.add(new HeadedSyntacticCategory(newSyntax, semanticVariables, rootIndex)); } return subcategories; }
java
public Set<HeadedSyntacticCategory> getSubcategories(Set<String> featureValues) { Set<HeadedSyntacticCategory> subcategories = Sets.newHashSet(); for (SyntacticCategory newSyntax : syntacticCategory.getSubcategories(featureValues)) { subcategories.add(new HeadedSyntacticCategory(newSyntax, semanticVariables, rootIndex)); } return subcategories; }
[ "public", "Set", "<", "HeadedSyntacticCategory", ">", "getSubcategories", "(", "Set", "<", "String", ">", "featureValues", ")", "{", "Set", "<", "HeadedSyntacticCategory", ">", "subcategories", "=", "Sets", ".", "newHashSet", "(", ")", ";", "for", "(", "Syntac...
Gets all syntactic categories which can be formed by assigning values to the feature variables of this category. Returned categories may not be in canonical form. @param featureValues @return
[ "Gets", "all", "syntactic", "categories", "which", "can", "be", "formed", "by", "assigning", "values", "to", "the", "feature", "variables", "of", "this", "category", ".", "Returned", "categories", "may", "not", "be", "in", "canonical", "form", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/HeadedSyntacticCategory.java#L451-L457
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java
PlanNode.findAtOrBelow
public PlanNode findAtOrBelow( Type firstTypeToFind, Type... additionalTypesToFind ) { return findAtOrBelow(EnumSet.of(firstTypeToFind, additionalTypesToFind)); }
java
public PlanNode findAtOrBelow( Type firstTypeToFind, Type... additionalTypesToFind ) { return findAtOrBelow(EnumSet.of(firstTypeToFind, additionalTypesToFind)); }
[ "public", "PlanNode", "findAtOrBelow", "(", "Type", "firstTypeToFind", ",", "Type", "...", "additionalTypesToFind", ")", "{", "return", "findAtOrBelow", "(", "EnumSet", ".", "of", "(", "firstTypeToFind", ",", "additionalTypesToFind", ")", ")", ";", "}" ]
Find the first node with one of the specified types that are at or below this node. @param firstTypeToFind the first type of node to find; may not be null @param additionalTypesToFind the additional types of node to find; may not be null @return the first node that is at or below this node that has one of the supplied types; or null if there is no such node
[ "Find", "the", "first", "node", "with", "one", "of", "the", "specified", "types", "that", "are", "at", "or", "below", "this", "node", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1462-L1465
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/SessionUtil.java
SessionUtil.isPrefixEqual
static boolean isPrefixEqual(String aUrlStr, String bUrlStr) throws MalformedURLException { URL aUrl = new URL(aUrlStr); URL bUrl = new URL(bUrlStr); int aPort = aUrl.getPort(); int bPort = bUrl.getPort(); if (aPort == -1 && "https".equals(aUrl.getProtocol())) { // default port number for HTTPS aPort = 443; } if (bPort == -1 && "https".equals(bUrl.getProtocol())) { // default port number for HTTPS bPort = 443; } // no default port number for HTTP is supported. return aUrl.getHost().equalsIgnoreCase(bUrl.getHost()) && aUrl.getProtocol().equalsIgnoreCase(bUrl.getProtocol()) && aPort == bPort; }
java
static boolean isPrefixEqual(String aUrlStr, String bUrlStr) throws MalformedURLException { URL aUrl = new URL(aUrlStr); URL bUrl = new URL(bUrlStr); int aPort = aUrl.getPort(); int bPort = bUrl.getPort(); if (aPort == -1 && "https".equals(aUrl.getProtocol())) { // default port number for HTTPS aPort = 443; } if (bPort == -1 && "https".equals(bUrl.getProtocol())) { // default port number for HTTPS bPort = 443; } // no default port number for HTTP is supported. return aUrl.getHost().equalsIgnoreCase(bUrl.getHost()) && aUrl.getProtocol().equalsIgnoreCase(bUrl.getProtocol()) && aPort == bPort; }
[ "static", "boolean", "isPrefixEqual", "(", "String", "aUrlStr", ",", "String", "bUrlStr", ")", "throws", "MalformedURLException", "{", "URL", "aUrl", "=", "new", "URL", "(", "aUrlStr", ")", ";", "URL", "bUrl", "=", "new", "URL", "(", "bUrlStr", ")", ";", ...
Verify if two input urls have the same protocol, host, and port. @param aUrlStr a source URL string @param bUrlStr a target URL string @return true if matched otherwise false @throws MalformedURLException raises if a URL string is not valid.
[ "Verify", "if", "two", "input", "urls", "have", "the", "same", "protocol", "host", "and", "port", "." ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SessionUtil.java#L1401-L1422
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java
ClusterControllerClient.listClusters
public final ListClustersPagedResponse listClusters(String projectId, String region) { ListClustersRequest request = ListClustersRequest.newBuilder().setProjectId(projectId).setRegion(region).build(); return listClusters(request); }
java
public final ListClustersPagedResponse listClusters(String projectId, String region) { ListClustersRequest request = ListClustersRequest.newBuilder().setProjectId(projectId).setRegion(region).build(); return listClusters(request); }
[ "public", "final", "ListClustersPagedResponse", "listClusters", "(", "String", "projectId", ",", "String", "region", ")", "{", "ListClustersRequest", "request", "=", "ListClustersRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".",...
Lists all regions/{region}/clusters in a project. <p>Sample code: <pre><code> try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { String projectId = ""; String region = ""; for (Cluster element : clusterControllerClient.listClusters(projectId, region).iterateAll()) { // doThingsWith(element); } } </code></pre> @param projectId Required. The ID of the Google Cloud Platform project that the cluster belongs to. @param region Required. The Cloud Dataproc region in which to handle the request. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "all", "regions", "/", "{", "region", "}", "/", "clusters", "in", "a", "project", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java#L678-L682
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/KunderaMetadataManager.java
KunderaMetadataManager.getMetamodel
public static MetamodelImpl getMetamodel(final KunderaMetadata kunderaMetadata, String... persistenceUnits) { MetamodelImpl metamodel = null; for (String pu : persistenceUnits) { metamodel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(pu); if (metamodel != null) { return metamodel; } } // FIXME: I need to verify this why we need common entity metadata now! // if (metamodel == null) // { // metamodel = (MetamodelImpl) // kunderaMetadata.getApplicationMetadata().getMetamodel( // Constants.COMMON_ENTITY_METADATAS); // } return metamodel; }
java
public static MetamodelImpl getMetamodel(final KunderaMetadata kunderaMetadata, String... persistenceUnits) { MetamodelImpl metamodel = null; for (String pu : persistenceUnits) { metamodel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(pu); if (metamodel != null) { return metamodel; } } // FIXME: I need to verify this why we need common entity metadata now! // if (metamodel == null) // { // metamodel = (MetamodelImpl) // kunderaMetadata.getApplicationMetadata().getMetamodel( // Constants.COMMON_ENTITY_METADATAS); // } return metamodel; }
[ "public", "static", "MetamodelImpl", "getMetamodel", "(", "final", "KunderaMetadata", "kunderaMetadata", ",", "String", "...", "persistenceUnits", ")", "{", "MetamodelImpl", "metamodel", "=", "null", ";", "for", "(", "String", "pu", ":", "persistenceUnits", ")", "...
Gets the metamodel. @param persistenceUnits the persistence units @return the metamodel
[ "Gets", "the", "metamodel", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/KunderaMetadataManager.java#L79-L100
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java
CassandraDataHandlerBase.prepareCounterColumn
private CounterColumn prepareCounterColumn(String value, byte[] name) { CounterColumn counterColumn = new CounterColumn(); counterColumn.setName(name); LongAccessor accessor = new LongAccessor(); counterColumn.setValue(accessor.fromString(LongAccessor.class, value)); return counterColumn; }
java
private CounterColumn prepareCounterColumn(String value, byte[] name) { CounterColumn counterColumn = new CounterColumn(); counterColumn.setName(name); LongAccessor accessor = new LongAccessor(); counterColumn.setValue(accessor.fromString(LongAccessor.class, value)); return counterColumn; }
[ "private", "CounterColumn", "prepareCounterColumn", "(", "String", "value", ",", "byte", "[", "]", "name", ")", "{", "CounterColumn", "counterColumn", "=", "new", "CounterColumn", "(", ")", ";", "counterColumn", ".", "setName", "(", "name", ")", ";", "LongAcce...
Prepare counter column. @param value the value @param name the name @return the counter column
[ "Prepare", "counter", "column", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java#L2167-L2174
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java
BatchUpdateDaemon.pushAliasEntry
public synchronized void pushAliasEntry(AliasEntry aliasEntry, DCache cache) { BatchUpdateList bul = getUpdateList(cache); bul.aliasEntryEvents.add(aliasEntry); }
java
public synchronized void pushAliasEntry(AliasEntry aliasEntry, DCache cache) { BatchUpdateList bul = getUpdateList(cache); bul.aliasEntryEvents.add(aliasEntry); }
[ "public", "synchronized", "void", "pushAliasEntry", "(", "AliasEntry", "aliasEntry", ",", "DCache", "cache", ")", "{", "BatchUpdateList", "bul", "=", "getUpdateList", "(", "cache", ")", ";", "bul", ".", "aliasEntryEvents", ".", "add", "(", "aliasEntry", ")", "...
This allows a cache entry to be added to the BatchUpdateDaemon. The cache entry will be added to all caches. @param cacheEntry The cache entry to be added.
[ "This", "allows", "a", "cache", "entry", "to", "be", "added", "to", "the", "BatchUpdateDaemon", ".", "The", "cache", "entry", "will", "be", "added", "to", "all", "caches", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java#L213-L216
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.listQueryResultsForResourceGroupLevelPolicyAssignmentAsync
public Observable<PolicyStatesQueryResultsInner> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1<ServiceResponse<PolicyStatesQueryResultsInner>, PolicyStatesQueryResultsInner>() { @Override public PolicyStatesQueryResultsInner call(ServiceResponse<PolicyStatesQueryResultsInner> response) { return response.body(); } }); }
java
public Observable<PolicyStatesQueryResultsInner> listQueryResultsForResourceGroupLevelPolicyAssignmentAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, String policyAssignmentName) { return listQueryResultsForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1<ServiceResponse<PolicyStatesQueryResultsInner>, PolicyStatesQueryResultsInner>() { @Override public PolicyStatesQueryResultsInner call(ServiceResponse<PolicyStatesQueryResultsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PolicyStatesQueryResultsInner", ">", "listQueryResultsForResourceGroupLevelPolicyAssignmentAsync", "(", "PolicyStatesResource", "policyStatesResource", ",", "String", "subscriptionId", ",", "String", "resourceGroupName", ",", "String", "policyAssignmen...
Queries policy states for the resource group level policy assignment. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param subscriptionId Microsoft Azure subscription ID. @param resourceGroupName Resource group name. @param policyAssignmentName Policy assignment name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PolicyStatesQueryResultsInner object
[ "Queries", "policy", "states", "for", "the", "resource", "group", "level", "policy", "assignment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2909-L2916
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/ngmf/util/cosu/luca/Sorter.java
Sorter.compare
@Override public int compare(Integer o1, Integer o2) { double diff = dataArray[o2] - dataArray[o1]; if (diff == 0) { return 0; } if (sortType == ASCENDING) { return (diff > 0) ? -1 : 1; } else { return (diff > 0) ? 1 : -1; } }
java
@Override public int compare(Integer o1, Integer o2) { double diff = dataArray[o2] - dataArray[o1]; if (diff == 0) { return 0; } if (sortType == ASCENDING) { return (diff > 0) ? -1 : 1; } else { return (diff > 0) ? 1 : -1; } }
[ "@", "Override", "public", "int", "compare", "(", "Integer", "o1", ",", "Integer", "o2", ")", "{", "double", "diff", "=", "dataArray", "[", "o2", "]", "-", "dataArray", "[", "o1", "]", ";", "if", "(", "diff", "==", "0", ")", "{", "return", "0", "...
For ascending, return 1 if dataArray[o1] is greater than dataArray[o2] return 0 if dataArray[o1] is equal to dataArray[o2] return -1 if dataArray[o1] is less than dataArray[o2] For decending, do it in the opposize way.
[ "For", "ascending", "return", "1", "if", "dataArray", "[", "o1", "]", "is", "greater", "than", "dataArray", "[", "o2", "]", "return", "0", "if", "dataArray", "[", "o1", "]", "is", "equal", "to", "dataArray", "[", "o2", "]", "return", "-", "1", "if", ...
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/util/cosu/luca/Sorter.java#L32-L43
jcuda/jcuda
JCudaJava/src/main/java/jcuda/cuComplex.java
cuComplex.cuCmul
public static cuComplex cuCmul (cuComplex x, cuComplex y) { cuComplex prod; prod = cuCmplx ((cuCreal(x) * cuCreal(y)) - (cuCimag(x) * cuCimag(y)), (cuCreal(x) * cuCimag(y)) + (cuCimag(x) * cuCreal(y))); return prod; }
java
public static cuComplex cuCmul (cuComplex x, cuComplex y) { cuComplex prod; prod = cuCmplx ((cuCreal(x) * cuCreal(y)) - (cuCimag(x) * cuCimag(y)), (cuCreal(x) * cuCimag(y)) + (cuCimag(x) * cuCreal(y))); return prod; }
[ "public", "static", "cuComplex", "cuCmul", "(", "cuComplex", "x", ",", "cuComplex", "y", ")", "{", "cuComplex", "prod", ";", "prod", "=", "cuCmplx", "(", "(", "cuCreal", "(", "x", ")", "*", "cuCreal", "(", "y", ")", ")", "-", "(", "cuCimag", "(", "...
Returns the product of the given complex numbers.<br /> <br /> Original comment:<br /> <br /> This implementation could suffer from intermediate overflow even though the final result would be in range. However, various implementations do not guard against this (presumably to avoid losing performance), so we don't do it either to stay competitive. @param x The first factor @param y The second factor @return The product of the given factors
[ "Returns", "the", "product", "of", "the", "given", "complex", "numbers", ".", "<br", "/", ">", "<br", "/", ">", "Original", "comment", ":", "<br", "/", ">", "<br", "/", ">", "This", "implementation", "could", "suffer", "from", "intermediate", "overflow", ...
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/cuComplex.java#L122-L128
apache/groovy
src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
StaticTypeCheckingVisitor.storeInferredReturnType
protected ClassNode storeInferredReturnType(final ASTNode node, final ClassNode type) { if (!(node instanceof ClosureExpression)) { throw new IllegalArgumentException("Storing inferred return type is only allowed on closures but found " + node.getClass()); } return (ClassNode) node.putNodeMetaData(StaticTypesMarker.INFERRED_RETURN_TYPE, type); }
java
protected ClassNode storeInferredReturnType(final ASTNode node, final ClassNode type) { if (!(node instanceof ClosureExpression)) { throw new IllegalArgumentException("Storing inferred return type is only allowed on closures but found " + node.getClass()); } return (ClassNode) node.putNodeMetaData(StaticTypesMarker.INFERRED_RETURN_TYPE, type); }
[ "protected", "ClassNode", "storeInferredReturnType", "(", "final", "ASTNode", "node", ",", "final", "ClassNode", "type", ")", "{", "if", "(", "!", "(", "node", "instanceof", "ClosureExpression", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"...
Stores the inferred return type of a closure or a method. We are using a separate key to store inferred return type because the inferred type of a closure is {@link Closure}, which is different from the inferred type of the code of the closure. @param node a {@link ClosureExpression} or a {@link MethodNode} @param type the inferred return type of the code @return the old value of the inferred type
[ "Stores", "the", "inferred", "return", "type", "of", "a", "closure", "or", "a", "method", ".", "We", "are", "using", "a", "separate", "key", "to", "store", "inferred", "return", "type", "because", "the", "inferred", "type", "of", "a", "closure", "is", "{...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L5111-L5116
vdmeer/asciitable
src/main/java/de/vandermeer/asciitable/AsciiTable.java
AsciiTable.setPaddingLeftRight
public AsciiTable setPaddingLeftRight(int paddingLeft, int paddingRight){ for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingLeftRight(paddingLeft, paddingRight); } } return this; }
java
public AsciiTable setPaddingLeftRight(int paddingLeft, int paddingRight){ for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingLeftRight(paddingLeft, paddingRight); } } return this; }
[ "public", "AsciiTable", "setPaddingLeftRight", "(", "int", "paddingLeft", ",", "int", "paddingRight", ")", "{", "for", "(", "AT_Row", "row", ":", "this", ".", "rows", ")", "{", "if", "(", "row", ".", "getType", "(", ")", "==", "TableRowType", ".", "CONTE...
Sets left and right padding for all cells in the table (only if both values are not smaller than 0). @param paddingLeft new left padding, ignored if smaller than 0 @param paddingRight new right padding, ignored if smaller than 0 @return this to allow chaining
[ "Sets", "left", "and", "right", "padding", "for", "all", "cells", "in", "the", "table", "(", "only", "if", "both", "values", "are", "not", "smaller", "than", "0", ")", "." ]
train
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L329-L336
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/ALOCI.java
ALOCI.calculate_MDEF_norm
private static double calculate_MDEF_norm(Node sn, Node cg) { // get the square sum of the counting neighborhoods box counts long sq = sn.getSquareSum(cg.getLevel() - sn.getLevel()); /* * if the square sum is equal to box count of the sampling Neighborhood then * n_hat is equal one, and as cg needs to have at least one Element mdef * would get zero or lower than zero. This is the case when all of the * counting Neighborhoods contain one or zero Objects. Additionally, the * cubic sum, square sum and sampling Neighborhood box count are all equal, * which leads to sig_n_hat being zero and thus mdef_norm is either negative * infinite or undefined. As the distribution of the Objects seem quite * uniform, a mdef_norm value of zero ( = no outlier) is appropriate and * circumvents the problem of undefined values. */ if(sq == sn.getCount()) { return 0.0; } // calculation of mdef according to the paper and standardization as done in // LOCI long cb = sn.getCubicSum(cg.getLevel() - sn.getLevel()); double n_hat = (double) sq / sn.getCount(); double sig_n_hat = FastMath.sqrt(cb * sn.getCount() - (sq * sq)) / sn.getCount(); // Avoid NaN - correct result 0.0? if(sig_n_hat < Double.MIN_NORMAL) { return 0.0; } double mdef = n_hat - cg.getCount(); return mdef / sig_n_hat; }
java
private static double calculate_MDEF_norm(Node sn, Node cg) { // get the square sum of the counting neighborhoods box counts long sq = sn.getSquareSum(cg.getLevel() - sn.getLevel()); /* * if the square sum is equal to box count of the sampling Neighborhood then * n_hat is equal one, and as cg needs to have at least one Element mdef * would get zero or lower than zero. This is the case when all of the * counting Neighborhoods contain one or zero Objects. Additionally, the * cubic sum, square sum and sampling Neighborhood box count are all equal, * which leads to sig_n_hat being zero and thus mdef_norm is either negative * infinite or undefined. As the distribution of the Objects seem quite * uniform, a mdef_norm value of zero ( = no outlier) is appropriate and * circumvents the problem of undefined values. */ if(sq == sn.getCount()) { return 0.0; } // calculation of mdef according to the paper and standardization as done in // LOCI long cb = sn.getCubicSum(cg.getLevel() - sn.getLevel()); double n_hat = (double) sq / sn.getCount(); double sig_n_hat = FastMath.sqrt(cb * sn.getCount() - (sq * sq)) / sn.getCount(); // Avoid NaN - correct result 0.0? if(sig_n_hat < Double.MIN_NORMAL) { return 0.0; } double mdef = n_hat - cg.getCount(); return mdef / sig_n_hat; }
[ "private", "static", "double", "calculate_MDEF_norm", "(", "Node", "sn", ",", "Node", "cg", ")", "{", "// get the square sum of the counting neighborhoods box counts", "long", "sq", "=", "sn", ".", "getSquareSum", "(", "cg", ".", "getLevel", "(", ")", "-", "sn", ...
Method for the MDEF calculation @param sn Sampling Neighborhood @param cg Counting Neighborhood @return MDEF norm
[ "Method", "for", "the", "MDEF", "calculation" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/ALOCI.java#L259-L287
hawkular/hawkular-apm
client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java
APMSpan.initChildOf
protected void initChildOf(APMSpanBuilder builder, Reference ref) { APMSpan parent = (APMSpan) ref.getReferredTo(); if (parent.getNodeBuilder() != null) { nodeBuilder = new NodeBuilder(parent.getNodeBuilder()); traceContext = parent.traceContext; // As it is not possible to know if a tag has been set after span // creation, we use this situation to check if the parent span // has the 'transaction.name' specified, to set on the trace // context. This is required in case a child span is used to invoke // another service (and needs to propagate the transaction // name). if (parent.getTags().containsKey(Constants.PROP_TRANSACTION_NAME) && traceContext.getTransaction() == null) { traceContext.setTransaction( parent.getTags().get(Constants.PROP_TRANSACTION_NAME).toString()); } } processRemainingReferences(builder, ref); }
java
protected void initChildOf(APMSpanBuilder builder, Reference ref) { APMSpan parent = (APMSpan) ref.getReferredTo(); if (parent.getNodeBuilder() != null) { nodeBuilder = new NodeBuilder(parent.getNodeBuilder()); traceContext = parent.traceContext; // As it is not possible to know if a tag has been set after span // creation, we use this situation to check if the parent span // has the 'transaction.name' specified, to set on the trace // context. This is required in case a child span is used to invoke // another service (and needs to propagate the transaction // name). if (parent.getTags().containsKey(Constants.PROP_TRANSACTION_NAME) && traceContext.getTransaction() == null) { traceContext.setTransaction( parent.getTags().get(Constants.PROP_TRANSACTION_NAME).toString()); } } processRemainingReferences(builder, ref); }
[ "protected", "void", "initChildOf", "(", "APMSpanBuilder", "builder", ",", "Reference", "ref", ")", "{", "APMSpan", "parent", "=", "(", "APMSpan", ")", "ref", ".", "getReferredTo", "(", ")", ";", "if", "(", "parent", ".", "getNodeBuilder", "(", ")", "!=", ...
This method initialises the span based on a 'child-of' relationship. @param builder The span builder @param ref The 'child-of' relationship
[ "This", "method", "initialises", "the", "span", "based", "on", "a", "child", "-", "of", "relationship", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java#L204-L225
wisdom-framework/wisdom
extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java
RamlMonitorController.index
@Route(method = HttpMethod.GET, uri = "") public Result index(@PathParameter("name") String name) { if(names.contains(name)){ return ok(render(template,"source",RAML_ASSET_DIR+name+RAML_EXT)); } return notFound(); }
java
@Route(method = HttpMethod.GET, uri = "") public Result index(@PathParameter("name") String name) { if(names.contains(name)){ return ok(render(template,"source",RAML_ASSET_DIR+name+RAML_EXT)); } return notFound(); }
[ "@", "Route", "(", "method", "=", "HttpMethod", ".", "GET", ",", "uri", "=", "\"\"", ")", "public", "Result", "index", "(", "@", "PathParameter", "(", "\"name\"", ")", "String", "name", ")", "{", "if", "(", "names", ".", "contains", "(", "name", ")",...
Return the raml console api corresponding to the raml of given name. @response.mime text/html @param name Name of the raml api to display. @return the raml console api or 404 if the file of given name doesn't exist in wisdom
[ "Return", "the", "raml", "console", "api", "corresponding", "to", "the", "raml", "of", "given", "name", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-monitor-console/src/main/java/monitor/raml/console/RamlMonitorController.java#L92-L98
wonderpush/wonderpush-android-sdk
sdk/src/main/java/com/wonderpush/sdk/WonderPushFirebaseMessagingService.java
WonderPushFirebaseMessagingService.onMessageReceived
public static boolean onMessageReceived(Context context, RemoteMessage message) { try { WonderPush.ensureInitialized(context); WonderPush.logDebug("Received a push notification!"); NotificationModel notif; try { notif = NotificationModel.fromRemoteMessage(message); } catch (NotificationModel.NotTargetedForThisInstallationException ex) { WonderPush.logDebug(ex.getMessage()); return true; } if (notif == null) { return false; } NotificationManager.onReceivedNotification(context, message.toIntent(), notif); return true; } catch (Exception e) { Log.e(TAG, "Unexpected error while handling FCM message from:" + message.getFrom() + " bundle:" + message.getData(), e); } return false; }
java
public static boolean onMessageReceived(Context context, RemoteMessage message) { try { WonderPush.ensureInitialized(context); WonderPush.logDebug("Received a push notification!"); NotificationModel notif; try { notif = NotificationModel.fromRemoteMessage(message); } catch (NotificationModel.NotTargetedForThisInstallationException ex) { WonderPush.logDebug(ex.getMessage()); return true; } if (notif == null) { return false; } NotificationManager.onReceivedNotification(context, message.toIntent(), notif); return true; } catch (Exception e) { Log.e(TAG, "Unexpected error while handling FCM message from:" + message.getFrom() + " bundle:" + message.getData(), e); } return false; }
[ "public", "static", "boolean", "onMessageReceived", "(", "Context", "context", ",", "RemoteMessage", "message", ")", "{", "try", "{", "WonderPush", ".", "ensureInitialized", "(", "context", ")", ";", "WonderPush", ".", "logDebug", "(", "\"Received a push notificatio...
Method to be called in your own {@link FirebaseMessagingService} to handle WonderPush push notifications. <b>Note:</b> This is only required if you use your own {@link FirebaseMessagingService}. Implement your {@link FirebaseMessagingService#onMessageReceived(RemoteMessage)} method as follows: <pre><code>@Override public void onMessageReceived(RemoteMessage message) { if (WonderPushFirebaseMessagingService.onMessageReceived(this, message)) { return; } // Do your own handling here }</code></pre> @param context The current context @param message The received message @return Whether the notification has been handled by WonderPush
[ "Method", "to", "be", "called", "in", "your", "own", "{", "@link", "FirebaseMessagingService", "}", "to", "handle", "WonderPush", "push", "notifications", "." ]
train
https://github.com/wonderpush/wonderpush-android-sdk/blob/ba0a1568f705cdd6206639bfab1e5cf529084b59/sdk/src/main/java/com/wonderpush/sdk/WonderPushFirebaseMessagingService.java#L142-L164
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/util/Properties.java
Properties.getProperty
@SuppressWarnings("unchecked") public <T> T getProperty(String propName, T defaultValue) { String propValue = props.getProperty(propName); if (propValue == null) return defaultValue; return ReflectionUtil.<T>getObjectInstance(propValue); }
java
@SuppressWarnings("unchecked") public <T> T getProperty(String propName, T defaultValue) { String propValue = props.getProperty(propName); if (propValue == null) return defaultValue; return ReflectionUtil.<T>getObjectInstance(propValue); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "getProperty", "(", "String", "propName", ",", "T", "defaultValue", ")", "{", "String", "propValue", "=", "props", ".", "getProperty", "(", "propName", ")", ";", "if", "(", ...
Returns a class instance of the property associated with {@code propName}, or {@code defaultValue} if there is no property. This method assumes that the class has a no argument constructor.
[ "Returns", "a", "class", "instance", "of", "the", "property", "associated", "with", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/Properties.java#L92-L98
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxClientSpi.java
HylaFaxClientSpi.resumeFaxJob
protected void resumeFaxJob(HylaFaxJob faxJob,HylaFAXClient client) throws Exception { //get job Job job=faxJob.getHylaFaxJob(); //get job ID long faxJobID=job.getId(); //resume job client.retry(faxJobID); }
java
protected void resumeFaxJob(HylaFaxJob faxJob,HylaFAXClient client) throws Exception { //get job Job job=faxJob.getHylaFaxJob(); //get job ID long faxJobID=job.getId(); //resume job client.retry(faxJobID); }
[ "protected", "void", "resumeFaxJob", "(", "HylaFaxJob", "faxJob", ",", "HylaFAXClient", "client", ")", "throws", "Exception", "{", "//get job", "Job", "job", "=", "faxJob", ".", "getHylaFaxJob", "(", ")", ";", "//get job ID", "long", "faxJobID", "=", "job", "....
This function will resume an existing fax job. @param client The client instance @param faxJob The fax job object containing the needed information @throws Exception Any exception
[ "This", "function", "will", "resume", "an", "existing", "fax", "job", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxClientSpi.java#L469-L479
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java
GreenMailUtil.copyStream
public static void copyStream(final InputStream src, OutputStream dest) throws IOException { byte[] buffer = new byte[1024]; int read; while ((read = src.read(buffer)) > -1) { dest.write(buffer, 0, read); } dest.flush(); }
java
public static void copyStream(final InputStream src, OutputStream dest) throws IOException { byte[] buffer = new byte[1024]; int read; while ((read = src.read(buffer)) > -1) { dest.write(buffer, 0, read); } dest.flush(); }
[ "public", "static", "void", "copyStream", "(", "final", "InputStream", "src", ",", "OutputStream", "dest", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "1024", "]", ";", "int", "read", ";", "while", "(", "(", ...
Writes the content of an input stream to an output stream @throws IOException
[ "Writes", "the", "content", "of", "an", "input", "stream", "to", "an", "output", "stream" ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java#L56-L63
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveTargetPathHelper.java
HiveTargetPathHelper.resolvePath
protected static Path resolvePath(String pattern, String database, String table) { pattern = pattern.replace(HiveDataset.DATABASE_TOKEN, database); if (pattern.contains(HiveDataset.TABLE_TOKEN)) { pattern = pattern.replace(HiveDataset.TABLE_TOKEN, table); return new Path(pattern); } else { return new Path(pattern, table); } }
java
protected static Path resolvePath(String pattern, String database, String table) { pattern = pattern.replace(HiveDataset.DATABASE_TOKEN, database); if (pattern.contains(HiveDataset.TABLE_TOKEN)) { pattern = pattern.replace(HiveDataset.TABLE_TOKEN, table); return new Path(pattern); } else { return new Path(pattern, table); } }
[ "protected", "static", "Path", "resolvePath", "(", "String", "pattern", ",", "String", "database", ",", "String", "table", ")", "{", "pattern", "=", "pattern", ".", "replace", "(", "HiveDataset", ".", "DATABASE_TOKEN", ",", "database", ")", ";", "if", "(", ...
Takes a path with tokens {@link #databaseToken} or {@link #tableToken} and replaces these tokens with the actual database names and table name. For example, if db is myDatabase, table is myTable, then /data/$DB/$TABLE will be resolved to /data/myDatabase/myTable.
[ "Takes", "a", "path", "with", "tokens", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveTargetPathHelper.java#L106-L114
pf4j/pf4j
pf4j/src/main/java/org/pf4j/util/ClassUtils.java
ClassUtils.getAnnotationValue
public static AnnotationValue getAnnotationValue(TypeElement typeElement, Class<?> annotationClass, String annotationParameter) { AnnotationMirror annotationMirror = getAnnotationMirror(typeElement, annotationClass); return (annotationMirror != null) ? getAnnotationValue(annotationMirror, annotationParameter) : null; }
java
public static AnnotationValue getAnnotationValue(TypeElement typeElement, Class<?> annotationClass, String annotationParameter) { AnnotationMirror annotationMirror = getAnnotationMirror(typeElement, annotationClass); return (annotationMirror != null) ? getAnnotationValue(annotationMirror, annotationParameter) : null; }
[ "public", "static", "AnnotationValue", "getAnnotationValue", "(", "TypeElement", "typeElement", ",", "Class", "<", "?", ">", "annotationClass", ",", "String", "annotationParameter", ")", "{", "AnnotationMirror", "annotationMirror", "=", "getAnnotationMirror", "(", "type...
Get a certain annotation parameter of a {@link TypeElement}. See <a href="https://stackoverflow.com/a/10167558">stackoverflow.com</a> for more information. @param typeElement the type element, that contains the requested annotation @param annotationClass the class of the requested annotation @param annotationParameter the name of the requested annotation parameter @return the requested parameter or null, if no annotation for the provided class was found or no annotation parameter was found @throws NullPointerException if <code>typeElement</code> or <code>annotationClass</code> is null
[ "Get", "a", "certain", "annotation", "parameter", "of", "a", "{", "@link", "TypeElement", "}", ".", "See", "<a", "href", "=", "https", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "10167558", ">", "stackoverflow", ".", "com<", "/", "a", ">", ...
train
https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/util/ClassUtils.java#L127-L132
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/repository/TagRepository.java
TagRepository.getTagEntity
public Tag getTagEntity(String objectIRI, String label, Relation relation, String codeSystemIRI) { Tag tag = dataService .query(TAG, Tag.class) .eq(OBJECT_IRI, objectIRI) .and() .eq(RELATION_IRI, relation.getIRI()) .and() .eq(CODE_SYSTEM, codeSystemIRI) .findOne(); if (tag == null) { tag = tagFactory.create(); tag.setId(idGenerator.generateId()); tag.setObjectIri(objectIRI); tag.setLabel(label); tag.setRelationIri(relation.getIRI()); tag.setRelationLabel(relation.getLabel()); tag.setCodeSystem(codeSystemIRI); dataService.add(TAG, tag); } return tag; }
java
public Tag getTagEntity(String objectIRI, String label, Relation relation, String codeSystemIRI) { Tag tag = dataService .query(TAG, Tag.class) .eq(OBJECT_IRI, objectIRI) .and() .eq(RELATION_IRI, relation.getIRI()) .and() .eq(CODE_SYSTEM, codeSystemIRI) .findOne(); if (tag == null) { tag = tagFactory.create(); tag.setId(idGenerator.generateId()); tag.setObjectIri(objectIRI); tag.setLabel(label); tag.setRelationIri(relation.getIRI()); tag.setRelationLabel(relation.getLabel()); tag.setCodeSystem(codeSystemIRI); dataService.add(TAG, tag); } return tag; }
[ "public", "Tag", "getTagEntity", "(", "String", "objectIRI", ",", "String", "label", ",", "Relation", "relation", ",", "String", "codeSystemIRI", ")", "{", "Tag", "tag", "=", "dataService", ".", "query", "(", "TAG", ",", "Tag", ".", "class", ")", ".", "e...
Fetches a tag from the repository. Creates a new one if it does not yet exist. @param objectIRI IRI of the object @param label label of the object @param relation {@link Relation} of the tag @param codeSystemIRI the IRI of the code system of the tag @return {@link Tag} of type {@link TagMetadata}
[ "Fetches", "a", "tag", "from", "the", "repository", ".", "Creates", "a", "new", "one", "if", "it", "does", "not", "yet", "exist", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/repository/TagRepository.java#L41-L62
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.deleteCertificateIssuerAsync
public Observable<IssuerBundle> deleteCertificateIssuerAsync(String vaultBaseUrl, String issuerName) { return deleteCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).map(new Func1<ServiceResponse<IssuerBundle>, IssuerBundle>() { @Override public IssuerBundle call(ServiceResponse<IssuerBundle> response) { return response.body(); } }); }
java
public Observable<IssuerBundle> deleteCertificateIssuerAsync(String vaultBaseUrl, String issuerName) { return deleteCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName).map(new Func1<ServiceResponse<IssuerBundle>, IssuerBundle>() { @Override public IssuerBundle call(ServiceResponse<IssuerBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IssuerBundle", ">", "deleteCertificateIssuerAsync", "(", "String", "vaultBaseUrl", ",", "String", "issuerName", ")", "{", "return", "deleteCertificateIssuerWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "issuerName", ")", ".", "map", ...
Deletes the specified certificate issuer. The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This operation requires the certificates/manageissuers/deleteissuers permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param issuerName The name of the issuer. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IssuerBundle object
[ "Deletes", "the", "specified", "certificate", "issuer", ".", "The", "DeleteCertificateIssuer", "operation", "permanently", "removes", "the", "specified", "certificate", "issuer", "from", "the", "vault", ".", "This", "operation", "requires", "the", "certificates", "/",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6427-L6434
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java
GregorianCalendar.getFixedDateMonth1
private long getFixedDateMonth1(BaseCalendar.Date date, long fixedDate) { assert date.getNormalizedYear() == gregorianCutoverYear || date.getNormalizedYear() == gregorianCutoverYearJulian; BaseCalendar.Date gCutover = getGregorianCutoverDate(); if (gCutover.getMonth() == BaseCalendar.JANUARY && gCutover.getDayOfMonth() == 1) { // The cutover happened on January 1. return fixedDate - date.getDayOfMonth() + 1; } long fixedDateMonth1; // The cutover happened sometime during the year. if (date.getMonth() == gCutover.getMonth()) { // The cutover happened in the month. BaseCalendar.Date jLastDate = getLastJulianDate(); if (gregorianCutoverYear == gregorianCutoverYearJulian && gCutover.getMonth() == jLastDate.getMonth()) { // The "gap" fits in the same month. fixedDateMonth1 = jcal.getFixedDate(date.getNormalizedYear(), date.getMonth(), 1, null); } else { // Use the cutover date as the first day of the month. fixedDateMonth1 = gregorianCutoverDate; } } else { // The cutover happened before the month. fixedDateMonth1 = fixedDate - date.getDayOfMonth() + 1; } return fixedDateMonth1; }
java
private long getFixedDateMonth1(BaseCalendar.Date date, long fixedDate) { assert date.getNormalizedYear() == gregorianCutoverYear || date.getNormalizedYear() == gregorianCutoverYearJulian; BaseCalendar.Date gCutover = getGregorianCutoverDate(); if (gCutover.getMonth() == BaseCalendar.JANUARY && gCutover.getDayOfMonth() == 1) { // The cutover happened on January 1. return fixedDate - date.getDayOfMonth() + 1; } long fixedDateMonth1; // The cutover happened sometime during the year. if (date.getMonth() == gCutover.getMonth()) { // The cutover happened in the month. BaseCalendar.Date jLastDate = getLastJulianDate(); if (gregorianCutoverYear == gregorianCutoverYearJulian && gCutover.getMonth() == jLastDate.getMonth()) { // The "gap" fits in the same month. fixedDateMonth1 = jcal.getFixedDate(date.getNormalizedYear(), date.getMonth(), 1, null); } else { // Use the cutover date as the first day of the month. fixedDateMonth1 = gregorianCutoverDate; } } else { // The cutover happened before the month. fixedDateMonth1 = fixedDate - date.getDayOfMonth() + 1; } return fixedDateMonth1; }
[ "private", "long", "getFixedDateMonth1", "(", "BaseCalendar", ".", "Date", "date", ",", "long", "fixedDate", ")", "{", "assert", "date", ".", "getNormalizedYear", "(", ")", "==", "gregorianCutoverYear", "||", "date", ".", "getNormalizedYear", "(", ")", "==", "...
Returns the fixed date of the first date of the month (usually the 1st of the month) before the specified date. @param date the date for which the first day of the month is calculated. The date has to be in the cut-over year (Gregorian or Julian). @param fixedDate the fixed date representation of the date
[ "Returns", "the", "fixed", "date", "of", "the", "first", "date", "of", "the", "month", "(", "usually", "the", "1st", "of", "the", "month", ")", "before", "the", "specified", "date", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java#L3192-L3224
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.newInstance
public static <T> T newInstance(Class<T> clazz, Object... params) throws UtilException { if (ArrayUtil.isEmpty(params)) { final Constructor<T> constructor = getConstructor(clazz); try { return constructor.newInstance(); } catch (Exception e) { throw new UtilException(e, "Instance class [{}] error!", clazz); } } final Class<?>[] paramTypes = ClassUtil.getClasses(params); final Constructor<T> constructor = getConstructor(clazz, paramTypes); if (null == constructor) { throw new UtilException("No Constructor matched for parameter types: [{}]", new Object[] { paramTypes }); } try { return constructor.newInstance(params); } catch (Exception e) { throw new UtilException(e, "Instance class [{}] error!", clazz); } }
java
public static <T> T newInstance(Class<T> clazz, Object... params) throws UtilException { if (ArrayUtil.isEmpty(params)) { final Constructor<T> constructor = getConstructor(clazz); try { return constructor.newInstance(); } catch (Exception e) { throw new UtilException(e, "Instance class [{}] error!", clazz); } } final Class<?>[] paramTypes = ClassUtil.getClasses(params); final Constructor<T> constructor = getConstructor(clazz, paramTypes); if (null == constructor) { throw new UtilException("No Constructor matched for parameter types: [{}]", new Object[] { paramTypes }); } try { return constructor.newInstance(params); } catch (Exception e) { throw new UtilException(e, "Instance class [{}] error!", clazz); } }
[ "public", "static", "<", "T", ">", "T", "newInstance", "(", "Class", "<", "T", ">", "clazz", ",", "Object", "...", "params", ")", "throws", "UtilException", "{", "if", "(", "ArrayUtil", ".", "isEmpty", "(", "params", ")", ")", "{", "final", "Constructo...
实例化对象 @param <T> 对象类型 @param clazz 类 @param params 构造函数参数 @return 对象 @throws UtilException 包装各类异常
[ "实例化对象" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L669-L689
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.beginCaptureAsync
public Observable<VirtualMachineCaptureResultInner> beginCaptureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { return beginCaptureWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<VirtualMachineCaptureResultInner>, VirtualMachineCaptureResultInner>() { @Override public VirtualMachineCaptureResultInner call(ServiceResponse<VirtualMachineCaptureResultInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineCaptureResultInner> beginCaptureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { return beginCaptureWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<VirtualMachineCaptureResultInner>, VirtualMachineCaptureResultInner>() { @Override public VirtualMachineCaptureResultInner call(ServiceResponse<VirtualMachineCaptureResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineCaptureResultInner", ">", "beginCaptureAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "VirtualMachineCaptureParameters", "parameters", ")", "{", "return", "beginCaptureWithServiceResponseAsync", "(", "reso...
Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Capture Virtual Machine operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineCaptureResultInner object
[ "Captures", "the", "VM", "by", "copying", "virtual", "hard", "disks", "of", "the", "VM", "and", "outputs", "a", "template", "that", "can", "be", "used", "to", "create", "similar", "VMs", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L482-L489
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/injection/InjectionHelper.java
InjectionHelper.injectWebServiceContext
public static void injectWebServiceContext(final Object instance, final WebServiceContext ctx) { final Class<?> instanceClass = instance.getClass(); // inject @Resource annotated methods accepting WebServiceContext parameter Collection<Method> resourceAnnotatedMethods = WEB_SERVICE_CONTEXT_METHOD_FINDER.process(instanceClass); for(Method method : resourceAnnotatedMethods) { try { invokeMethod(instance, method, new Object[] {ctx}); } catch (Exception e) { final String message = "Cannot inject @Resource annotated method: " + method; InjectionException.rethrow(message, e); } } // inject @Resource annotated fields of WebServiceContext type final Collection<Field> resourceAnnotatedFields = WEB_SERVICE_CONTEXT_FIELD_FINDER.process(instanceClass); for (Field field : resourceAnnotatedFields) { try { setField(instance, field, ctx); } catch (Exception e) { final String message = "Cannot inject @Resource annotated field: " + field; InjectionException.rethrow(message, e); } } }
java
public static void injectWebServiceContext(final Object instance, final WebServiceContext ctx) { final Class<?> instanceClass = instance.getClass(); // inject @Resource annotated methods accepting WebServiceContext parameter Collection<Method> resourceAnnotatedMethods = WEB_SERVICE_CONTEXT_METHOD_FINDER.process(instanceClass); for(Method method : resourceAnnotatedMethods) { try { invokeMethod(instance, method, new Object[] {ctx}); } catch (Exception e) { final String message = "Cannot inject @Resource annotated method: " + method; InjectionException.rethrow(message, e); } } // inject @Resource annotated fields of WebServiceContext type final Collection<Field> resourceAnnotatedFields = WEB_SERVICE_CONTEXT_FIELD_FINDER.process(instanceClass); for (Field field : resourceAnnotatedFields) { try { setField(instance, field, ctx); } catch (Exception e) { final String message = "Cannot inject @Resource annotated field: " + field; InjectionException.rethrow(message, e); } } }
[ "public", "static", "void", "injectWebServiceContext", "(", "final", "Object", "instance", ",", "final", "WebServiceContext", "ctx", ")", "{", "final", "Class", "<", "?", ">", "instanceClass", "=", "instance", ".", "getClass", "(", ")", ";", "// inject @Resource...
Injects @Resource annotated accessible objects referencing WebServiceContext. @param instance to operate on @param ctx current web service context
[ "Injects", "@Resource", "annotated", "accessible", "objects", "referencing", "WebServiceContext", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/InjectionHelper.java#L62-L95