repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/returns/PackageUrl.java
PackageUrl.createPackageUrl
public static MozuUrl createPackageUrl(String responseFields, String returnId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/packages?responseFields={responseFields}"); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("returnId", returnId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl createPackageUrl(String responseFields, String returnId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/packages?responseFields={responseFields}"); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("returnId", returnId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "createPackageUrl", "(", "String", "responseFields", ",", "String", "returnId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/returns/{returnId}/packages?responseFields={responseFields}\"", ")", ";", ...
Get Resource Url for CreatePackage @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param returnId Unique identifier of the return whose items you want to get. @return String Resource Url
[ "Get", "Resource", "Url", "for", "CreatePackage" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/returns/PackageUrl.java#L54-L60
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Var2Data.java
Var2Data.getUnicodeString
public String getUnicodeString(Integer id, Integer type) { return (getUnicodeString(m_meta.getOffset(id, type))); }
java
public String getUnicodeString(Integer id, Integer type) { return (getUnicodeString(m_meta.getOffset(id, type))); }
[ "public", "String", "getUnicodeString", "(", "Integer", "id", ",", "Integer", "type", ")", "{", "return", "(", "getUnicodeString", "(", "m_meta", ".", "getOffset", "(", "id", ",", "type", ")", ")", ")", ";", "}" ]
This method retrieves a String of the specified type, belonging to the item with the specified unique ID. @param id unique ID of entity to which this data belongs @param type data type identifier @return string containing required data
[ "This", "method", "retrieves", "a", "String", "of", "the", "specified", "type", "belonging", "to", "the", "item", "with", "the", "specified", "unique", "ID", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Var2Data.java#L176-L179
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java
DownloadChemCompProvider.checkDoFirstInstall
public void checkDoFirstInstall(){ if ( ! downloadAll ) { return; } // this makes sure there is a file separator between every component, // if path has a trailing file separator or not, it will work for both cases File dir = new File(getPath(), CHEM_COMP_CACHE_DIRECTORY); File f = new File(dir, "components.cif.gz"); if ( ! f.exists()) { downloadAllDefinitions(); } else { // file exists.. did it get extracted? FilenameFilter filter =new FilenameFilter() { @Override public boolean accept(File dir, String file) { return file.endsWith(".cif.gz"); } }; String[] files = dir.list(filter); if ( files.length < 500) { // not all did get unpacked try { split(); } catch (IOException e) { logger.error("Could not split file {} into individual chemical component files. Error: {}", f.toString(), e.getMessage()); } } } }
java
public void checkDoFirstInstall(){ if ( ! downloadAll ) { return; } // this makes sure there is a file separator between every component, // if path has a trailing file separator or not, it will work for both cases File dir = new File(getPath(), CHEM_COMP_CACHE_DIRECTORY); File f = new File(dir, "components.cif.gz"); if ( ! f.exists()) { downloadAllDefinitions(); } else { // file exists.. did it get extracted? FilenameFilter filter =new FilenameFilter() { @Override public boolean accept(File dir, String file) { return file.endsWith(".cif.gz"); } }; String[] files = dir.list(filter); if ( files.length < 500) { // not all did get unpacked try { split(); } catch (IOException e) { logger.error("Could not split file {} into individual chemical component files. Error: {}", f.toString(), e.getMessage()); } } } }
[ "public", "void", "checkDoFirstInstall", "(", ")", "{", "if", "(", "!", "downloadAll", ")", "{", "return", ";", "}", "// this makes sure there is a file separator between every component,", "// if path has a trailing file separator or not, it will work for both cases", "File", "d...
Checks if the chemical components already have been installed into the PDB directory. If not, will download the chemical components definitions file and split it up into small subfiles.
[ "Checks", "if", "the", "chemical", "components", "already", "have", "been", "installed", "into", "the", "PDB", "directory", ".", "If", "not", "will", "download", "the", "chemical", "components", "definitions", "file", "and", "split", "it", "up", "into", "small...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java#L135-L172
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Entity.java
Entity.setEntity_mentions
public void setEntity_mentions(int i, EntityMention v) { if (Entity_Type.featOkTst && ((Entity_Type)jcasType).casFeat_entity_mentions == null) jcasType.jcas.throwFeatMissing("entity_mentions", "de.julielab.jules.types.ace.Entity"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Entity_Type)jcasType).casFeatCode_entity_mentions), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Entity_Type)jcasType).casFeatCode_entity_mentions), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setEntity_mentions(int i, EntityMention v) { if (Entity_Type.featOkTst && ((Entity_Type)jcasType).casFeat_entity_mentions == null) jcasType.jcas.throwFeatMissing("entity_mentions", "de.julielab.jules.types.ace.Entity"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Entity_Type)jcasType).casFeatCode_entity_mentions), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Entity_Type)jcasType).casFeatCode_entity_mentions), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setEntity_mentions", "(", "int", "i", ",", "EntityMention", "v", ")", "{", "if", "(", "Entity_Type", ".", "featOkTst", "&&", "(", "(", "Entity_Type", ")", "jcasType", ")", ".", "casFeat_entity_mentions", "==", "null", ")", "jcasType", ".",...
indexed setter for entity_mentions - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "entity_mentions", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Entity.java#L182-L186
leancloud/java-sdk-all
realtime/src/main/java/cn/leancloud/session/AVDefaultConnectionListener.java
AVDefaultConnectionListener.processMessageReceipt
private void processMessageReceipt(String msgId, String conversationId, int convType, long timestamp) { Object messageCache = MessageReceiptCache.get(session.getSelfPeerId(), msgId); if (messageCache == null) { return; } Message m = (Message) messageCache; AVIMMessage msg = new AVIMMessage(conversationId, session.getSelfPeerId(), m.timestamp, timestamp); msg.setMessageId(m.id); msg.setContent(m.msg); msg.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusReceipt); AVConversationHolder conversation = session.getConversationHolder(conversationId, convType); conversation.onMessageReceipt(msg); }
java
private void processMessageReceipt(String msgId, String conversationId, int convType, long timestamp) { Object messageCache = MessageReceiptCache.get(session.getSelfPeerId(), msgId); if (messageCache == null) { return; } Message m = (Message) messageCache; AVIMMessage msg = new AVIMMessage(conversationId, session.getSelfPeerId(), m.timestamp, timestamp); msg.setMessageId(m.id); msg.setContent(m.msg); msg.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusReceipt); AVConversationHolder conversation = session.getConversationHolder(conversationId, convType); conversation.onMessageReceipt(msg); }
[ "private", "void", "processMessageReceipt", "(", "String", "msgId", ",", "String", "conversationId", ",", "int", "convType", ",", "long", "timestamp", ")", "{", "Object", "messageCache", "=", "MessageReceiptCache", ".", "get", "(", "session", ".", "getSelfPeerId",...
处理 v2 版本中 message 的 rcp 消息 @param msgId @param conversationId @param timestamp
[ "处理", "v2", "版本中", "message", "的", "rcp", "消息" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/session/AVDefaultConnectionListener.java#L550-L564
i-net-software/jlessc
src/com/inet/lib/less/Operation.java
Operation.doubleValueLeftColor
private double doubleValueLeftColor( double color, double right ) { return rgba( doubleValue( red( color ), right ), // doubleValue( green( color ), right ), // doubleValue( blue( color ), right ), 1 ); }
java
private double doubleValueLeftColor( double color, double right ) { return rgba( doubleValue( red( color ), right ), // doubleValue( green( color ), right ), // doubleValue( blue( color ), right ), 1 ); }
[ "private", "double", "doubleValueLeftColor", "(", "double", "color", ",", "double", "right", ")", "{", "return", "rgba", "(", "doubleValue", "(", "red", "(", "color", ")", ",", "right", ")", ",", "//", "doubleValue", "(", "green", "(", "color", ")", ",",...
Calculate a color on left with a number on the right side. The calculation occur for every color channel. @param color the color @param right the right @return color value as long
[ "Calculate", "a", "color", "on", "left", "with", "a", "number", "on", "the", "right", "side", ".", "The", "calculation", "occur", "for", "every", "color", "channel", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Operation.java#L380-L384
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/core/IncidentUtil.java
IncidentUtil.generateIncidentV2WithException
public static Throwable generateIncidentV2WithException( String serverUrl, String sessionToken, Throwable exc, String jobId, String requestId) { new Incident(serverUrl, sessionToken, exc, jobId, requestId).trigger(); return exc; }
java
public static Throwable generateIncidentV2WithException( String serverUrl, String sessionToken, Throwable exc, String jobId, String requestId) { new Incident(serverUrl, sessionToken, exc, jobId, requestId).trigger(); return exc; }
[ "public", "static", "Throwable", "generateIncidentV2WithException", "(", "String", "serverUrl", ",", "String", "sessionToken", ",", "Throwable", "exc", ",", "String", "jobId", ",", "String", "requestId", ")", "{", "new", "Incident", "(", "serverUrl", ",", "session...
Makes a V2 incident object and triggers it, effectively reporting the given exception to GS and possibly to crashmanager. <p> This function should be proceeded by a throw as it returns the originally given exception. @param serverUrl url of GS to report incident to @param sessionToken session token to be used to report incident @param exc the Throwable we should report @param jobId jobId that failed @param requestId requestId that failed @return the given Exception object
[ "Makes", "a", "V2", "incident", "object", "and", "triggers", "it", "effectively", "reporting", "the", "given", "exception", "to", "GS", "and", "possibly", "to", "crashmanager", ".", "<p", ">", "This", "function", "should", "be", "proceeded", "by", "a", "thro...
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/IncidentUtil.java#L302-L311
whitesource/agents
wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java
ZipUtils.decompressChunks
public static void decompressChunks(InputStream inputStream, Path tempFileOut) throws IOException { try (BufferedWriter writer = Files.newBufferedWriter(tempFileOut)) { try (GZIPInputStream chunkZipper = new GZIPInputStream(inputStream); InputStream in = new BufferedInputStream(chunkZipper);) { byte[] buffer = new byte[BYTES_BUFFER_SIZE]; int len; while ((len = in.read(buffer)) > 0) { byte[] writtenBytes = new byte[len]; getBytes(buffer, 0, len, writtenBytes, 0); String val = new String(writtenBytes, StandardCharsets.UTF_8); writer.write(val); } } } }
java
public static void decompressChunks(InputStream inputStream, Path tempFileOut) throws IOException { try (BufferedWriter writer = Files.newBufferedWriter(tempFileOut)) { try (GZIPInputStream chunkZipper = new GZIPInputStream(inputStream); InputStream in = new BufferedInputStream(chunkZipper);) { byte[] buffer = new byte[BYTES_BUFFER_SIZE]; int len; while ((len = in.read(buffer)) > 0) { byte[] writtenBytes = new byte[len]; getBytes(buffer, 0, len, writtenBytes, 0); String val = new String(writtenBytes, StandardCharsets.UTF_8); writer.write(val); } } } }
[ "public", "static", "void", "decompressChunks", "(", "InputStream", "inputStream", ",", "Path", "tempFileOut", ")", "throws", "IOException", "{", "try", "(", "BufferedWriter", "writer", "=", "Files", ".", "newBufferedWriter", "(", "tempFileOut", ")", ")", "{", "...
The method decompresses the big strings using gzip - low memory via the File system @param inputStream @param tempFileOut @throws IOException
[ "The", "method", "decompresses", "the", "big", "strings", "using", "gzip", "-", "low", "memory", "via", "the", "File", "system" ]
train
https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java#L150-L164
grails/grails-core
grails-spring/src/main/groovy/org/grails/spring/GrailsApplicationContext.java
GrailsApplicationContext.registerPrototype
public void registerPrototype(String name, Class<?> clazz) throws BeansException { GenericBeanDefinition bd = new GenericBeanDefinition(); bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE); bd.setBeanClass(clazz); getDefaultListableBeanFactory().registerBeanDefinition(name, bd); }
java
public void registerPrototype(String name, Class<?> clazz) throws BeansException { GenericBeanDefinition bd = new GenericBeanDefinition(); bd.setScope(GenericBeanDefinition.SCOPE_PROTOTYPE); bd.setBeanClass(clazz); getDefaultListableBeanFactory().registerBeanDefinition(name, bd); }
[ "public", "void", "registerPrototype", "(", "String", "name", ",", "Class", "<", "?", ">", "clazz", ")", "throws", "BeansException", "{", "GenericBeanDefinition", "bd", "=", "new", "GenericBeanDefinition", "(", ")", ";", "bd", ".", "setScope", "(", "GenericBea...
Register a prototype bean with the underlying bean factory. <p>For more advanced needs, register with the underlying BeanFactory directly. @see #getDefaultListableBeanFactory
[ "Register", "a", "prototype", "bean", "with", "the", "underlying", "bean", "factory", ".", "<p", ">", "For", "more", "advanced", "needs", "register", "with", "the", "underlying", "BeanFactory", "directly", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-spring/src/main/groovy/org/grails/spring/GrailsApplicationContext.java#L155-L160
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/observer/SubjectRegistry.java
SubjectRegistry.removeRegistraion
@SuppressWarnings({ "unchecked", "rawtypes" }) public <T> void removeRegistraion(String subjectName, SubjectObserver<T> subjectObserver) { Subject subject = (Subject)this.registry.get(subjectName); if(subject == null) return; subject.remove(subjectObserver); }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public <T> void removeRegistraion(String subjectName, SubjectObserver<T> subjectObserver) { Subject subject = (Subject)this.registry.get(subjectName); if(subject == null) return; subject.remove(subjectObserver); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "<", "T", ">", "void", "removeRegistraion", "(", "String", "subjectName", ",", "SubjectObserver", "<", "T", ">", "subjectObserver", ")", "{", "Subject", "subject", "="...
Remove an observer for a registered observer @param <T> the class type @param subjectName the subject name to remove @param subjectObserver the subject observer
[ "Remove", "an", "observer", "for", "a", "registered", "observer" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/observer/SubjectRegistry.java#L81-L91
roboconf/roboconf-platform
core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2MachineConfigurator.java
Ec2MachineConfigurator.checkVmIsStarted
private boolean checkVmIsStarted() { DescribeInstancesRequest dis = new DescribeInstancesRequest(); dis.setInstanceIds(Collections.singletonList(this.machineId)); DescribeInstancesResult disresult = this.ec2Api.describeInstances( dis ); // Obtain availability zone (for later use, eg. volume attachment). // Necessary if no availability zone is specified in configuration // (because volumes must be attached to instances in the same availability zone). this.availabilityZone = disresult.getReservations().get(0).getInstances().get(0).getPlacement().getAvailabilityZone(); return "running".equalsIgnoreCase( disresult.getReservations().get(0).getInstances().get(0).getState().getName()); }
java
private boolean checkVmIsStarted() { DescribeInstancesRequest dis = new DescribeInstancesRequest(); dis.setInstanceIds(Collections.singletonList(this.machineId)); DescribeInstancesResult disresult = this.ec2Api.describeInstances( dis ); // Obtain availability zone (for later use, eg. volume attachment). // Necessary if no availability zone is specified in configuration // (because volumes must be attached to instances in the same availability zone). this.availabilityZone = disresult.getReservations().get(0).getInstances().get(0).getPlacement().getAvailabilityZone(); return "running".equalsIgnoreCase( disresult.getReservations().get(0).getInstances().get(0).getState().getName()); }
[ "private", "boolean", "checkVmIsStarted", "(", ")", "{", "DescribeInstancesRequest", "dis", "=", "new", "DescribeInstancesRequest", "(", ")", ";", "dis", ".", "setInstanceIds", "(", "Collections", ".", "singletonList", "(", "this", ".", "machineId", ")", ")", ";...
Checks whether a VM is started or not (which is stronger than {@link #checkVmIsKnown()}). @return true if the VM is started, false otherwise
[ "Checks", "whether", "a", "VM", "is", "started", "or", "not", "(", "which", "is", "stronger", "than", "{" ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2MachineConfigurator.java#L223-L234
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/PoolSchedulable.java
PoolSchedulable.addSession
public void addSession(String id, Session session) { synchronized (session) { SessionSchedulable schedulable = new SessionSchedulable(session, getType()); idToSession.put(id, schedulable); } }
java
public void addSession(String id, Session session) { synchronized (session) { SessionSchedulable schedulable = new SessionSchedulable(session, getType()); idToSession.put(id, schedulable); } }
[ "public", "void", "addSession", "(", "String", "id", ",", "Session", "session", ")", "{", "synchronized", "(", "session", ")", "{", "SessionSchedulable", "schedulable", "=", "new", "SessionSchedulable", "(", "session", ",", "getType", "(", ")", ")", ";", "id...
Add a session to the pool @param id the id of the session @param session the session to add to the pool
[ "Add", "a", "session", "to", "the", "pool" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/PoolSchedulable.java#L203-L209
hubrick/vertx-rest-client
src/main/java/com/hubrick/vertx/rest/converter/MultipartHttpMessageConverter.java
MultipartHttpMessageConverter.generateMultipartBoundary
private String generateMultipartBoundary() { byte[] boundary = new byte[this.random.nextInt(11) + 30]; for (int i = 0; i < boundary.length; i++) { boundary[i] = BOUNDARY_CHARS[this.random.nextInt(BOUNDARY_CHARS.length)]; } final String constructedBoundry = "----" + new String(boundary, Charsets.US_ASCII); return constructedBoundry.toLowerCase(); }
java
private String generateMultipartBoundary() { byte[] boundary = new byte[this.random.nextInt(11) + 30]; for (int i = 0; i < boundary.length; i++) { boundary[i] = BOUNDARY_CHARS[this.random.nextInt(BOUNDARY_CHARS.length)]; } final String constructedBoundry = "----" + new String(boundary, Charsets.US_ASCII); return constructedBoundry.toLowerCase(); }
[ "private", "String", "generateMultipartBoundary", "(", ")", "{", "byte", "[", "]", "boundary", "=", "new", "byte", "[", "this", ".", "random", ".", "nextInt", "(", "11", ")", "+", "30", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "...
Generate a multipart boundary. <p>The default implementation returns a random boundary. Can be overridden in subclasses.
[ "Generate", "a", "multipart", "boundary", ".", "<p", ">", "The", "default", "implementation", "returns", "a", "random", "boundary", ".", "Can", "be", "overridden", "in", "subclasses", "." ]
train
https://github.com/hubrick/vertx-rest-client/blob/4e6715bc2fb031555fc635adbf94a53b9cfba81e/src/main/java/com/hubrick/vertx/rest/converter/MultipartHttpMessageConverter.java#L273-L281
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java
RouteFilterRulesInner.beginUpdate
public RouteFilterRuleInner beginUpdate(String resourceGroupName, String routeFilterName, String ruleName, PatchRouteFilterRule routeFilterRuleParameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters).toBlocking().single().body(); }
java
public RouteFilterRuleInner beginUpdate(String resourceGroupName, String routeFilterName, String ruleName, PatchRouteFilterRule routeFilterRuleParameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters).toBlocking().single().body(); }
[ "public", "RouteFilterRuleInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "routeFilterName", ",", "String", "ruleName", ",", "PatchRouteFilterRule", "routeFilterRuleParameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourc...
Updates a route in the specified route filter. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @param ruleName The name of the route filter rule. @param routeFilterRuleParameters Parameters supplied to the update route filter rule 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 RouteFilterRuleInner object if successful.
[ "Updates", "a", "route", "in", "the", "specified", "route", "filter", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java#L636-L638
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java
SqlBuilderHelper.generateJavaDocForContentProvider
public static void generateJavaDocForContentProvider(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { // javadoc String operation = method.jql.operationType.toString(); methodBuilder.addJavadoc("<h1>Content provider URI ($L operation):</h1>\n", operation); methodBuilder.addJavadoc("<pre>$L</pre>\n\n", method.contentProviderUriTemplate.replace("*", "[*]")); methodBuilder.addJavadoc("<h2>JQL $L for Content Provider</h2>\n", operation); methodBuilder.addJavadoc("<pre>$L</pre>\n\n", method.jql.value); methodBuilder.addJavadoc("<h2>SQL $L for Content Provider</h2>\n", operation); String sql = JQLChecker.getInstance().replace(method, method.jql, new JQLReplacerListenerImpl(method) { @Override public String onColumnName(String columnName) { SQLProperty tempProperty = currentEntity.get(columnName); AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, columnName); return tempProperty.columnName; } @Override public String onColumnAlias(String alias) { SQLProperty tempProperty = currentEntity.findPropertyByName(alias); AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, alias); return tempProperty.columnName; } }); methodBuilder.addJavadoc("<pre>$L</pre>\n\n", sql); if (method.contentProviderUriVariables.size() > 0) { methodBuilder.addJavadoc("<h3>Path variables defined:</h3>\n<ul>\n"); for (ContentUriPlaceHolder variable : method.contentProviderUriVariables) { methodBuilder.addJavadoc("<li><strong>" + SqlAnalyzer.PARAM_PREFIX + "$L" + SqlAnalyzer.PARAM_SUFFIX + "</strong> at path segment $L</li>\n", variable.value, variable.pathSegmentIndex); } methodBuilder.addJavadoc("</ul>\n\n"); } if (!method.hasDynamicWhereConditions()) { methodBuilder.addJavadoc("<p><strong>Dynamic where statement is ignored, due no param with @$L was added.</strong></p>\n\n", BindSqlDynamicWhere.class.getSimpleName()); } methodBuilder.addJavadoc("<p><strong>In URI, * is replaced with [*] for javadoc rapresentation</strong></p>\n\n"); }
java
public static void generateJavaDocForContentProvider(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { // javadoc String operation = method.jql.operationType.toString(); methodBuilder.addJavadoc("<h1>Content provider URI ($L operation):</h1>\n", operation); methodBuilder.addJavadoc("<pre>$L</pre>\n\n", method.contentProviderUriTemplate.replace("*", "[*]")); methodBuilder.addJavadoc("<h2>JQL $L for Content Provider</h2>\n", operation); methodBuilder.addJavadoc("<pre>$L</pre>\n\n", method.jql.value); methodBuilder.addJavadoc("<h2>SQL $L for Content Provider</h2>\n", operation); String sql = JQLChecker.getInstance().replace(method, method.jql, new JQLReplacerListenerImpl(method) { @Override public String onColumnName(String columnName) { SQLProperty tempProperty = currentEntity.get(columnName); AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, columnName); return tempProperty.columnName; } @Override public String onColumnAlias(String alias) { SQLProperty tempProperty = currentEntity.findPropertyByName(alias); AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, alias); return tempProperty.columnName; } }); methodBuilder.addJavadoc("<pre>$L</pre>\n\n", sql); if (method.contentProviderUriVariables.size() > 0) { methodBuilder.addJavadoc("<h3>Path variables defined:</h3>\n<ul>\n"); for (ContentUriPlaceHolder variable : method.contentProviderUriVariables) { methodBuilder.addJavadoc("<li><strong>" + SqlAnalyzer.PARAM_PREFIX + "$L" + SqlAnalyzer.PARAM_SUFFIX + "</strong> at path segment $L</li>\n", variable.value, variable.pathSegmentIndex); } methodBuilder.addJavadoc("</ul>\n\n"); } if (!method.hasDynamicWhereConditions()) { methodBuilder.addJavadoc("<p><strong>Dynamic where statement is ignored, due no param with @$L was added.</strong></p>\n\n", BindSqlDynamicWhere.class.getSimpleName()); } methodBuilder.addJavadoc("<p><strong>In URI, * is replaced with [*] for javadoc rapresentation</strong></p>\n\n"); }
[ "public", "static", "void", "generateJavaDocForContentProvider", "(", "final", "SQLiteModelMethod", "method", ",", "MethodSpec", ".", "Builder", "methodBuilder", ")", "{", "// javadoc", "String", "operation", "=", "method", ".", "jql", ".", "operationType", ".", "to...
Generate java doc for content provider. @param method the method @param methodBuilder the method builder
[ "Generate", "java", "doc", "for", "content", "provider", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java#L165-L210
amaembo/streamex
src/main/java/one/util/streamex/LongStreamEx.java
LongStreamEx.minByDouble
public OptionalLong minByDouble(LongToDoubleFunction keyExtractor) { return collect(PrimitiveBox::new, (box, l) -> { double key = keyExtractor.applyAsDouble(l); if (!box.b || Double.compare(box.d, key) > 0) { box.b = true; box.d = key; box.l = l; } }, PrimitiveBox.MIN_DOUBLE).asLong(); }
java
public OptionalLong minByDouble(LongToDoubleFunction keyExtractor) { return collect(PrimitiveBox::new, (box, l) -> { double key = keyExtractor.applyAsDouble(l); if (!box.b || Double.compare(box.d, key) > 0) { box.b = true; box.d = key; box.l = l; } }, PrimitiveBox.MIN_DOUBLE).asLong(); }
[ "public", "OptionalLong", "minByDouble", "(", "LongToDoubleFunction", "keyExtractor", ")", "{", "return", "collect", "(", "PrimitiveBox", "::", "new", ",", "(", "box", ",", "l", ")", "->", "{", "double", "key", "=", "keyExtractor", ".", "applyAsDouble", "(", ...
Returns the minimum element of this stream according to the provided key extractor function. <p> This is a terminal operation. @param keyExtractor a non-interfering, stateless function @return an {@code OptionalLong} describing the first element of this stream for which the lowest value was returned by key extractor, or an empty {@code OptionalLong} if the stream is empty @since 0.1.2
[ "Returns", "the", "minimum", "element", "of", "this", "stream", "according", "to", "the", "provided", "key", "extractor", "function", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L990-L999
google/j2objc
jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java
MutableBigInteger.toBigDecimal
BigDecimal toBigDecimal(int sign, int scale) { if (intLen == 0 || sign == 0) return BigDecimal.zeroValueOf(scale); int[] mag = getMagnitudeArray(); int len = mag.length; int d = mag[0]; // If this MutableBigInteger can't be fit into long, we need to // make a BigInteger object for the resultant BigDecimal object. if (len > 2 || (d < 0 && len == 2)) return new BigDecimal(new BigInteger(mag, sign), INFLATED, scale, 0); long v = (len == 2) ? ((mag[1] & LONG_MASK) | (d & LONG_MASK) << 32) : d & LONG_MASK; return BigDecimal.valueOf(sign == -1 ? -v : v, scale); }
java
BigDecimal toBigDecimal(int sign, int scale) { if (intLen == 0 || sign == 0) return BigDecimal.zeroValueOf(scale); int[] mag = getMagnitudeArray(); int len = mag.length; int d = mag[0]; // If this MutableBigInteger can't be fit into long, we need to // make a BigInteger object for the resultant BigDecimal object. if (len > 2 || (d < 0 && len == 2)) return new BigDecimal(new BigInteger(mag, sign), INFLATED, scale, 0); long v = (len == 2) ? ((mag[1] & LONG_MASK) | (d & LONG_MASK) << 32) : d & LONG_MASK; return BigDecimal.valueOf(sign == -1 ? -v : v, scale); }
[ "BigDecimal", "toBigDecimal", "(", "int", "sign", ",", "int", "scale", ")", "{", "if", "(", "intLen", "==", "0", "||", "sign", "==", "0", ")", "return", "BigDecimal", ".", "zeroValueOf", "(", "scale", ")", ";", "int", "[", "]", "mag", "=", "getMagnit...
Convert this MutableBigInteger to BigDecimal object with the specified sign and scale.
[ "Convert", "this", "MutableBigInteger", "to", "BigDecimal", "object", "with", "the", "specified", "sign", "and", "scale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L201-L215
gallandarakhneorg/afc
core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/AbstractTreeNode.java
AbstractTreeNode.firePropertyParentChanged
void firePropertyParentChanged(N node, N oldParent, N newParent) { firePropertyParentChanged(new TreeNodeParentChangedEvent(node, oldParent, newParent)); }
java
void firePropertyParentChanged(N node, N oldParent, N newParent) { firePropertyParentChanged(new TreeNodeParentChangedEvent(node, oldParent, newParent)); }
[ "void", "firePropertyParentChanged", "(", "N", "node", ",", "N", "oldParent", ",", "N", "newParent", ")", "{", "firePropertyParentChanged", "(", "new", "TreeNodeParentChangedEvent", "(", "node", ",", "oldParent", ",", "newParent", ")", ")", ";", "}" ]
Fire the event for the changes node parents. @param node is the node for which the parent has changed. @param oldParent is the previous parent node @param newParent is the current parent node
[ "Fire", "the", "event", "for", "the", "changes", "node", "parents", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/AbstractTreeNode.java#L243-L245
imsweb/naaccr-xml
src/main/java/com/imsweb/naaccrxml/NaaccrXmlDictionaryUtils.java
NaaccrXmlDictionaryUtils.writeDictionary
public static void writeDictionary(NaaccrDictionary dictionary, File file) throws IOException { try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)) { writeDictionary(dictionary, writer); } }
java
public static void writeDictionary(NaaccrDictionary dictionary, File file) throws IOException { try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)) { writeDictionary(dictionary, writer); } }
[ "public", "static", "void", "writeDictionary", "(", "NaaccrDictionary", "dictionary", ",", "File", "file", ")", "throws", "IOException", "{", "try", "(", "Writer", "writer", "=", "new", "OutputStreamWriter", "(", "new", "FileOutputStream", "(", "file", ")", ",",...
Writes the given dictionary to the provided file. @param dictionary dictionary to write, cannot be null @param file file, cannot be null @throws IOException if the dictionary could not be written
[ "Writes", "the", "given", "dictionary", "to", "the", "provided", "file", "." ]
train
https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/NaaccrXmlDictionaryUtils.java#L301-L305
eclipse/xtext-extras
org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/binary/asm/SignatureUtil.java
SignatureUtil.scanArrayTypeSignature
private static int scanArrayTypeSignature(String string, int start) { int length = string.length(); // need a minimum 2 char if (start >= length - 1) { throw new IllegalArgumentException(); } char c = string.charAt(start); if (c != C_ARRAY) { throw new IllegalArgumentException(); } c = string.charAt(++start); while(c == C_ARRAY) { // need a minimum 2 char if (start >= length - 1) { throw new IllegalArgumentException(); } c = string.charAt(++start); } return scanTypeSignature(string, start); }
java
private static int scanArrayTypeSignature(String string, int start) { int length = string.length(); // need a minimum 2 char if (start >= length - 1) { throw new IllegalArgumentException(); } char c = string.charAt(start); if (c != C_ARRAY) { throw new IllegalArgumentException(); } c = string.charAt(++start); while(c == C_ARRAY) { // need a minimum 2 char if (start >= length - 1) { throw new IllegalArgumentException(); } c = string.charAt(++start); } return scanTypeSignature(string, start); }
[ "private", "static", "int", "scanArrayTypeSignature", "(", "String", "string", ",", "int", "start", ")", "{", "int", "length", "=", "string", ".", "length", "(", ")", ";", "// need a minimum 2 char", "if", "(", "start", ">=", "length", "-", "1", ")", "{", ...
Scans the given string for an array type signature starting at the given index and returns the index of the last character. <pre> ArrayTypeSignature: <b>[</b> TypeSignature </pre> @param string the signature string @param start the 0-based character index of the first character @return the 0-based character index of the last character @exception IllegalArgumentException if this is not an array type signature
[ "Scans", "the", "given", "string", "for", "an", "array", "type", "signature", "starting", "at", "the", "given", "index", "and", "returns", "the", "index", "of", "the", "last", "character", ".", "<pre", ">", "ArrayTypeSignature", ":", "<b", ">", "[", "<", ...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/access/binary/asm/SignatureUtil.java#L247-L267
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/QueryParsers.java
QueryParsers.registerParser
public void registerParser(Class<? extends SolrDataQuery> clazz, QueryParser parser) { Assert.notNull(parser, "Cannot register 'null' parser."); parserPairs.add(0, new QueryParserPair(clazz, parser)); cache.clear(); }
java
public void registerParser(Class<? extends SolrDataQuery> clazz, QueryParser parser) { Assert.notNull(parser, "Cannot register 'null' parser."); parserPairs.add(0, new QueryParserPair(clazz, parser)); cache.clear(); }
[ "public", "void", "registerParser", "(", "Class", "<", "?", "extends", "SolrDataQuery", ">", "clazz", ",", "QueryParser", "parser", ")", "{", "Assert", ".", "notNull", "(", "parser", ",", "\"Cannot register 'null' parser.\"", ")", ";", "parserPairs", ".", "add",...
Register additional {@link QueryParser} for {@link SolrQuery} @param clazz @param parser
[ "Register", "additional", "{", "@link", "QueryParser", "}", "for", "{", "@link", "SolrQuery", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParsers.java#L93-L97
facebookarchive/hadoop-20
src/core/org/apache/hadoop/http/HtmlQuoting.java
HtmlQuoting.needsQuoting
public static boolean needsQuoting(byte[] data, int off, int len) { for(int i=off; i< off+len; ++i) { switch(data[i]) { case '&': case '<': case '>': case '\'': case '"': return true; default: break; } } return false; }
java
public static boolean needsQuoting(byte[] data, int off, int len) { for(int i=off; i< off+len; ++i) { switch(data[i]) { case '&': case '<': case '>': case '\'': case '"': return true; default: break; } } return false; }
[ "public", "static", "boolean", "needsQuoting", "(", "byte", "[", "]", "data", ",", "int", "off", ",", "int", "len", ")", "{", "for", "(", "int", "i", "=", "off", ";", "i", "<", "off", "+", "len", ";", "++", "i", ")", "{", "switch", "(", "data",...
Does the given string need to be quoted? @param data the string to check @param off the starting position @param len the number of bytes to check @return does the string contain any of the active html characters?
[ "Does", "the", "given", "string", "need", "to", "be", "quoted?" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HtmlQuoting.java#L41-L55
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ShadowClassLoader.java
ShadowClassLoader.definePackage
@FFDCIgnore(IllegalArgumentException.class) private void definePackage(final ByteResourceInformation classBytesResourceInformation, String packageName) { /* * We don't extend URL classloader so we automatically pass the manifest from the JAR to our supertype, still try to get hold of it though so that we can see if * we can load the information ourselves from it */ Manifest manifest = classBytesResourceInformation.getManifest(); try { if (manifest == null) { definePackage(packageName, null, null, null, null, null, null, null); } else { String classResourceName = classBytesResourceInformation.getResourcePath(); /* * Strip the class name off the end of the package, should always have at least one '/' as we have at least one . in the name, also end with a trailing * '/' to match the name style for package definitions in manifest files */ String packageResourceName = classResourceName.substring(0, classResourceName.lastIndexOf('/') + 1); // Default all of the package info to null String specTitle = null; String specVersion = null; String specVendor = null; String implTitle = null; String implVersion = null; String implVendor = null; URL sealBaseUrl = null; // See if there is a package defined in the manifest Attributes packageAttributes = manifest.getAttributes(packageResourceName); if (packageAttributes != null && !packageAttributes.isEmpty()) { specTitle = packageAttributes.getValue(Attributes.Name.SPECIFICATION_TITLE); specVersion = packageAttributes.getValue(Attributes.Name.SPECIFICATION_VERSION); specVendor = packageAttributes.getValue(Attributes.Name.SPECIFICATION_VENDOR); implTitle = packageAttributes.getValue(Attributes.Name.IMPLEMENTATION_TITLE); implVersion = packageAttributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION); implVendor = packageAttributes.getValue(Attributes.Name.IMPLEMENTATION_VENDOR); String sealedValue = packageAttributes.getValue(Attributes.Name.SEALED); if (sealedValue != null && Boolean.parseBoolean(sealedValue)) { sealBaseUrl = classBytesResourceInformation.getResourceUrl(); } } definePackage(packageName, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBaseUrl); } } catch (IllegalArgumentException ignored) { // This happens if the package is already defined but it is hard to guard against this in a thread safe way. See: // http://bugs.sun.com/view_bug.do?bug_id=4841786 } }
java
@FFDCIgnore(IllegalArgumentException.class) private void definePackage(final ByteResourceInformation classBytesResourceInformation, String packageName) { /* * We don't extend URL classloader so we automatically pass the manifest from the JAR to our supertype, still try to get hold of it though so that we can see if * we can load the information ourselves from it */ Manifest manifest = classBytesResourceInformation.getManifest(); try { if (manifest == null) { definePackage(packageName, null, null, null, null, null, null, null); } else { String classResourceName = classBytesResourceInformation.getResourcePath(); /* * Strip the class name off the end of the package, should always have at least one '/' as we have at least one . in the name, also end with a trailing * '/' to match the name style for package definitions in manifest files */ String packageResourceName = classResourceName.substring(0, classResourceName.lastIndexOf('/') + 1); // Default all of the package info to null String specTitle = null; String specVersion = null; String specVendor = null; String implTitle = null; String implVersion = null; String implVendor = null; URL sealBaseUrl = null; // See if there is a package defined in the manifest Attributes packageAttributes = manifest.getAttributes(packageResourceName); if (packageAttributes != null && !packageAttributes.isEmpty()) { specTitle = packageAttributes.getValue(Attributes.Name.SPECIFICATION_TITLE); specVersion = packageAttributes.getValue(Attributes.Name.SPECIFICATION_VERSION); specVendor = packageAttributes.getValue(Attributes.Name.SPECIFICATION_VENDOR); implTitle = packageAttributes.getValue(Attributes.Name.IMPLEMENTATION_TITLE); implVersion = packageAttributes.getValue(Attributes.Name.IMPLEMENTATION_VERSION); implVendor = packageAttributes.getValue(Attributes.Name.IMPLEMENTATION_VENDOR); String sealedValue = packageAttributes.getValue(Attributes.Name.SEALED); if (sealedValue != null && Boolean.parseBoolean(sealedValue)) { sealBaseUrl = classBytesResourceInformation.getResourceUrl(); } } definePackage(packageName, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBaseUrl); } } catch (IllegalArgumentException ignored) { // This happens if the package is already defined but it is hard to guard against this in a thread safe way. See: // http://bugs.sun.com/view_bug.do?bug_id=4841786 } }
[ "@", "FFDCIgnore", "(", "IllegalArgumentException", ".", "class", ")", "private", "void", "definePackage", "(", "final", "ByteResourceInformation", "classBytesResourceInformation", ",", "String", "packageName", ")", "{", "/*\n * We don't extend URL classloader so we aut...
Defines the package for this class by trying to load the manifest for the package and if that fails just sets all of the package properties to <code>null</code>. @param classBytesResourceInformation @param packageName
[ "Defines", "the", "package", "for", "this", "class", "by", "trying", "to", "load", "the", "manifest", "for", "the", "package", "and", "if", "that", "fails", "just", "sets", "all", "of", "the", "package", "properties", "to", "<code", ">", "null<", "/", "c...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/ShadowClassLoader.java#L150-L201
amzn/ion-java
src/com/amazon/ion/impl/lite/IonLobLite.java
IonLobLite.lobHashCode
protected int lobHashCode(int seed, SymbolTableProvider symbolTableProvider) { int result = seed; if (!isNullValue()) { CRC32 crc = new CRC32(); crc.update(getBytes()); result ^= (int) crc.getValue(); } return hashTypeAnnotations(result, symbolTableProvider); }
java
protected int lobHashCode(int seed, SymbolTableProvider symbolTableProvider) { int result = seed; if (!isNullValue()) { CRC32 crc = new CRC32(); crc.update(getBytes()); result ^= (int) crc.getValue(); } return hashTypeAnnotations(result, symbolTableProvider); }
[ "protected", "int", "lobHashCode", "(", "int", "seed", ",", "SymbolTableProvider", "symbolTableProvider", ")", "{", "int", "result", "=", "seed", ";", "if", "(", "!", "isNullValue", "(", ")", ")", "{", "CRC32", "crc", "=", "new", "CRC32", "(", ")", ";", ...
Calculate LOB hash code as XOR of seed with CRC-32 of the LOB data. This distinguishes BLOBs from CLOBs @param seed Seed value @return hash code
[ "Calculate", "LOB", "hash", "code", "as", "XOR", "of", "seed", "with", "CRC", "-", "32", "of", "the", "LOB", "data", ".", "This", "distinguishes", "BLOBs", "from", "CLOBs" ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/IonLobLite.java#L55-L66
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java
GeoJsonToAssembler.fromTransferObject
public MultiPolygon fromTransferObject(MultiPolygonTo input, CrsId crsId) { if (input == null) { return null; } crsId = getCrsId(input, crsId); isValid(input); Polygon[] polygons = new Polygon[input.getCoordinates().length]; for (int i = 0; i < polygons.length; i++) { polygons[i] = createPolygon(input.getCoordinates()[i], crsId); } return new MultiPolygon(polygons); }
java
public MultiPolygon fromTransferObject(MultiPolygonTo input, CrsId crsId) { if (input == null) { return null; } crsId = getCrsId(input, crsId); isValid(input); Polygon[] polygons = new Polygon[input.getCoordinates().length]; for (int i = 0; i < polygons.length; i++) { polygons[i] = createPolygon(input.getCoordinates()[i], crsId); } return new MultiPolygon(polygons); }
[ "public", "MultiPolygon", "fromTransferObject", "(", "MultiPolygonTo", "input", ",", "CrsId", "crsId", ")", "{", "if", "(", "input", "==", "null", ")", "{", "return", "null", ";", "}", "crsId", "=", "getCrsId", "(", "input", ",", "crsId", ")", ";", "isVa...
Creates a multipolygon object starting from a transfer object. @param input the multipolygon transfer object @param crsId the crs id to use (ignores the crs of the input). If null, uses the crs of the input. @return the corresponding geometry @throws IllegalArgumentException If the geometry could not be constructed due to an invalid transfer object
[ "Creates", "a", "multipolygon", "object", "starting", "from", "a", "transfer", "object", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java#L304-L315
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Integer.java
Integer.getInteger
public static Integer getInteger(String nm, int val) { Integer result = getInteger(nm, null); return (result == null) ? Integer.valueOf(val) : result; }
java
public static Integer getInteger(String nm, int val) { Integer result = getInteger(nm, null); return (result == null) ? Integer.valueOf(val) : result; }
[ "public", "static", "Integer", "getInteger", "(", "String", "nm", ",", "int", "val", ")", "{", "Integer", "result", "=", "getInteger", "(", "nm", ",", "null", ")", ";", "return", "(", "result", "==", "null", ")", "?", "Integer", ".", "valueOf", "(", ...
Determines the integer value of the system property with the specified name. <p>The first argument is treated as the name of a system property. System properties are accessible through the {@link java.lang.System#getProperty(java.lang.String)} method. The string value of this property is then interpreted as an integer value using the grammar supported by {@link Integer#decode decode} and an {@code Integer} object representing this value is returned. <p>The second argument is the default value. An {@code Integer} object that represents the value of the second argument is returned if there is no property of the specified name, if the property does not have the correct numeric format, or if the specified name is empty or {@code null}. <p>In other words, this method returns an {@code Integer} object equal to the value of: <blockquote> {@code getInteger(nm, new Integer(val))} </blockquote> but in practice it may be implemented in a manner such as: <blockquote><pre> Integer result = getInteger(nm, null); return (result == null) ? new Integer(val) : result; </pre></blockquote> to avoid the unnecessary allocation of an {@code Integer} object when the default value is not needed. @param nm property name. @param val default value. @return the {@code Integer} value of the property. @throws SecurityException for the same reasons as {@link System#getProperty(String) System.getProperty} @see java.lang.System#getProperty(java.lang.String) @see java.lang.System#getProperty(java.lang.String, java.lang.String)
[ "Determines", "the", "integer", "value", "of", "the", "system", "property", "with", "the", "specified", "name", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Integer.java#L856-L859
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XString.java
XString.startsWith
public boolean startsWith(XMLString prefix, int toffset) { int to = toffset; int tlim = this.length(); int po = 0; int pc = prefix.length(); // Note: toffset might be near -1>>>1. if ((toffset < 0) || (toffset > tlim - pc)) { return false; } while (--pc >= 0) { if (this.charAt(to) != prefix.charAt(po)) { return false; } to++; po++; } return true; }
java
public boolean startsWith(XMLString prefix, int toffset) { int to = toffset; int tlim = this.length(); int po = 0; int pc = prefix.length(); // Note: toffset might be near -1>>>1. if ((toffset < 0) || (toffset > tlim - pc)) { return false; } while (--pc >= 0) { if (this.charAt(to) != prefix.charAt(po)) { return false; } to++; po++; } return true; }
[ "public", "boolean", "startsWith", "(", "XMLString", "prefix", ",", "int", "toffset", ")", "{", "int", "to", "=", "toffset", ";", "int", "tlim", "=", "this", ".", "length", "(", ")", ";", "int", "po", "=", "0", ";", "int", "pc", "=", "prefix", ".",...
Tests if this string starts with the specified prefix beginning a specified index. @param prefix the prefix. @param toffset where to begin looking in the string. @return <code>true</code> if the character sequence represented by the argument is a prefix of the substring of this object starting at index <code>toffset</code>; <code>false</code> otherwise. The result is <code>false</code> if <code>toffset</code> is negative or greater than the length of this <code>String</code> object; otherwise the result is the same as the result of the expression <pre> this.subString(toffset).startsWith(prefix) </pre> @exception java.lang.NullPointerException if <code>prefix</code> is <code>null</code>.
[ "Tests", "if", "this", "string", "starts", "with", "the", "specified", "prefix", "beginning", "a", "specified", "index", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XString.java#L547-L573
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.findResult
public static <T, U extends T, V extends T,E> T findResult(Collection<E> self, U defaultResult, @ClosureParams(FirstParam.FirstGenericType.class) Closure<V> closure) { T result = findResult(self, closure); if (result == null) return defaultResult; return result; }
java
public static <T, U extends T, V extends T,E> T findResult(Collection<E> self, U defaultResult, @ClosureParams(FirstParam.FirstGenericType.class) Closure<V> closure) { T result = findResult(self, closure); if (result == null) return defaultResult; return result; }
[ "public", "static", "<", "T", ",", "U", "extends", "T", ",", "V", "extends", "T", ",", "E", ">", "T", "findResult", "(", "Collection", "<", "E", ">", "self", ",", "U", "defaultResult", ",", "@", "ClosureParams", "(", "FirstParam", ".", "FirstGenericTyp...
Iterates through the collection calling the given closure for each item but stopping once the first non-null result is found and returning that result. If all are null, the defaultResult is returned. <p> Examples: <pre class="groovyTestCase"> def list = [1,2,3] assert "Found 2" == list.findResult("default") { it > 1 ? "Found $it" : null } assert "default" == list.findResult("default") { it > 3 ? "Found $it" : null } </pre> @param self a Collection @param defaultResult an Object that should be returned if all closure results are null @param closure a closure that returns a non-null value when processing should stop and a value should be returned @return the first non-null result from calling the closure, or the defaultValue @since 1.7.5
[ "Iterates", "through", "the", "collection", "calling", "the", "given", "closure", "for", "each", "item", "but", "stopping", "once", "the", "first", "non", "-", "null", "result", "is", "found", "and", "returning", "that", "result", ".", "If", "all", "are", ...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L3950-L3954
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java
ResourceManager.putCachedResource
private static void putCachedResource( String baseName, Resources resources ) { synchronized( ResourceManager.class ) { WeakReference<Resources> ref = new WeakReference<Resources>( resources ); RESOURCES.put( baseName, ref ); } }
java
private static void putCachedResource( String baseName, Resources resources ) { synchronized( ResourceManager.class ) { WeakReference<Resources> ref = new WeakReference<Resources>( resources ); RESOURCES.put( baseName, ref ); } }
[ "private", "static", "void", "putCachedResource", "(", "String", "baseName", ",", "Resources", "resources", ")", "{", "synchronized", "(", "ResourceManager", ".", "class", ")", "{", "WeakReference", "<", "Resources", ">", "ref", "=", "new", "WeakReference", "<",...
Cache specified resource in weak reference. @param baseName the resource key @param resources the resources object
[ "Cache", "specified", "resource", "in", "weak", "reference", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java#L138-L145
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationRequestManager.java
AuthorizationRequestManager.submitAnswer
public void submitAnswer(JSONObject answer, String realm) { if (answers == null) { answers = new JSONObject(); } try { answers.put(realm, answer); if (isAnswersFilled()) { resendRequest(); } } catch (Throwable t) { logger.error("submitAnswer failed with exception: " + t.getLocalizedMessage(), t); } }
java
public void submitAnswer(JSONObject answer, String realm) { if (answers == null) { answers = new JSONObject(); } try { answers.put(realm, answer); if (isAnswersFilled()) { resendRequest(); } } catch (Throwable t) { logger.error("submitAnswer failed with exception: " + t.getLocalizedMessage(), t); } }
[ "public", "void", "submitAnswer", "(", "JSONObject", "answer", ",", "String", "realm", ")", "{", "if", "(", "answers", "==", "null", ")", "{", "answers", "=", "new", "JSONObject", "(", ")", ";", "}", "try", "{", "answers", ".", "put", "(", "realm", "...
Adds an expected challenge answer to collection of answers. @param answer Answer to add. @param realm Authentication realm for the answer.
[ "Adds", "an", "expected", "challenge", "answer", "to", "collection", "of", "answers", "." ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationRequestManager.java#L306-L319
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/bitmap/Shingles.java
Shingles.addShingledSeries
public void addShingledSeries(String key, Map<String, Integer> shingledSeries) { // allocate the weights array corresponding to the time series int[] counts = new int[this.indexTable.size()]; // fill in the counts for (String str : shingledSeries.keySet()) { Integer idx = this.indexTable.get(str); if (null == idx) { throw new IndexOutOfBoundsException("the requested shingle " + str + " doesn't exist!"); } counts[idx] = shingledSeries.get(str); } shingles.put(key, counts); }
java
public void addShingledSeries(String key, Map<String, Integer> shingledSeries) { // allocate the weights array corresponding to the time series int[] counts = new int[this.indexTable.size()]; // fill in the counts for (String str : shingledSeries.keySet()) { Integer idx = this.indexTable.get(str); if (null == idx) { throw new IndexOutOfBoundsException("the requested shingle " + str + " doesn't exist!"); } counts[idx] = shingledSeries.get(str); } shingles.put(key, counts); }
[ "public", "void", "addShingledSeries", "(", "String", "key", ",", "Map", "<", "String", ",", "Integer", ">", "shingledSeries", ")", "{", "// allocate the weights array corresponding to the time series", "int", "[", "]", "counts", "=", "new", "int", "[", "this", "....
Adds a shingled series assuring the proper index. @param key the timeseries key (i.e., label). @param shingledSeries a shingled timeseries in a map of &lt;shingle, index&gt; entries.
[ "Adds", "a", "shingled", "series", "assuring", "the", "proper", "index", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/bitmap/Shingles.java#L75-L87
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java
CommonConfigUtils.getConfigAttribute
public String getConfigAttribute(Map<String, Object> props, String key) { return getConfigAttributeWithDefaultValue(props, key, null); }
java
public String getConfigAttribute(Map<String, Object> props, String key) { return getConfigAttributeWithDefaultValue(props, key, null); }
[ "public", "String", "getConfigAttribute", "(", "Map", "<", "String", ",", "Object", ">", "props", ",", "String", "key", ")", "{", "return", "getConfigAttributeWithDefaultValue", "(", "props", ",", "key", ",", "null", ")", ";", "}" ]
Returns the value for the configuration attribute matching the key provided. If the value does not exist or is empty, the resulting value will be {@code null}.
[ "Returns", "the", "value", "for", "the", "configuration", "attribute", "matching", "the", "key", "provided", ".", "If", "the", "value", "does", "not", "exist", "or", "is", "empty", "the", "resulting", "value", "will", "be", "{" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/config/CommonConfigUtils.java#L30-L32
lz4/lz4-java
src/java/net/jpountz/lz4/LZ4DecompressorWithLength.java
LZ4DecompressorWithLength.getDecompressedLength
public static int getDecompressedLength(ByteBuffer src, int srcOff) { return (src.get(srcOff) & 0xFF) | (src.get(srcOff + 1) & 0xFF) << 8 | (src.get(srcOff + 2) & 0xFF) << 16 | src.get(srcOff + 3) << 24; }
java
public static int getDecompressedLength(ByteBuffer src, int srcOff) { return (src.get(srcOff) & 0xFF) | (src.get(srcOff + 1) & 0xFF) << 8 | (src.get(srcOff + 2) & 0xFF) << 16 | src.get(srcOff + 3) << 24; }
[ "public", "static", "int", "getDecompressedLength", "(", "ByteBuffer", "src", ",", "int", "srcOff", ")", "{", "return", "(", "src", ".", "get", "(", "srcOff", ")", "&", "0xFF", ")", "|", "(", "src", ".", "get", "(", "srcOff", "+", "1", ")", "&", "0...
Returns the decompressed length of compressed data in <code>src[srcOff:]</code>. @param src the compressed data @param srcOff the start offset in src @return the decompressed length
[ "Returns", "the", "decompressed", "length", "of", "compressed", "data", "in", "<code", ">", "src", "[", "srcOff", ":", "]", "<", "/", "code", ">", "." ]
train
https://github.com/lz4/lz4-java/blob/c5ae694a3aa8b33ef87fd0486727a7d1e8f71367/src/java/net/jpountz/lz4/LZ4DecompressorWithLength.java#L70-L72
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
DatabaseUtils.dumpCurrentRow
public static void dumpCurrentRow(Cursor cursor, PrintStream stream) { String[] cols = cursor.getColumnNames(); stream.println("" + cursor.getPosition() + " {"); int length = cols.length; for (int i = 0; i< length; i++) { String value; try { value = cursor.getString(i); } catch (SQLiteException e) { // assume that if the getString threw this exception then the column is not // representable by a string, e.g. it is a BLOB. value = "<unprintable>"; } stream.println(" " + cols[i] + '=' + value); } stream.println("}"); }
java
public static void dumpCurrentRow(Cursor cursor, PrintStream stream) { String[] cols = cursor.getColumnNames(); stream.println("" + cursor.getPosition() + " {"); int length = cols.length; for (int i = 0; i< length; i++) { String value; try { value = cursor.getString(i); } catch (SQLiteException e) { // assume that if the getString threw this exception then the column is not // representable by a string, e.g. it is a BLOB. value = "<unprintable>"; } stream.println(" " + cols[i] + '=' + value); } stream.println("}"); }
[ "public", "static", "void", "dumpCurrentRow", "(", "Cursor", "cursor", ",", "PrintStream", "stream", ")", "{", "String", "[", "]", "cols", "=", "cursor", ".", "getColumnNames", "(", ")", ";", "stream", ".", "println", "(", "\"\"", "+", "cursor", ".", "ge...
Prints the contents of a Cursor's current row to a PrintSteam. @param cursor the cursor to print @param stream the stream to print to
[ "Prints", "the", "contents", "of", "a", "Cursor", "s", "current", "row", "to", "a", "PrintSteam", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L547-L563
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/LocaleDisplayNames.java
LocaleDisplayNames.getUiList
public List<UiListItem> getUiList(Set<ULocale> localeSet, boolean inSelf, Comparator<Object> collator) { return getUiListCompareWholeItems(localeSet, UiListItem.getComparator(collator, inSelf)); }
java
public List<UiListItem> getUiList(Set<ULocale> localeSet, boolean inSelf, Comparator<Object> collator) { return getUiListCompareWholeItems(localeSet, UiListItem.getComparator(collator, inSelf)); }
[ "public", "List", "<", "UiListItem", ">", "getUiList", "(", "Set", "<", "ULocale", ">", "localeSet", ",", "boolean", "inSelf", ",", "Comparator", "<", "Object", ">", "collator", ")", "{", "return", "getUiListCompareWholeItems", "(", "localeSet", ",", "UiListIt...
Return a list of information used to construct a UI list of locale names. @param collator how to collate—should normally be Collator.getInstance(getDisplayLocale()) @param inSelf if true, compares the nameInSelf, otherwise the nameInDisplayLocale. Set depending on which field (displayLocale vs self) is to show up in the UI. If both are to show up in the UI, then it should be the one used for the primary sort order. @param localeSet a list of locales to present in a UI list. The casing uses the settings in the LocaleDisplayNames instance. @return an ordered list of UiListItems. @throws IllformedLocaleException if any of the locales in localeSet are malformed.
[ "Return", "a", "list", "of", "information", "used", "to", "construct", "a", "UI", "list", "of", "locale", "names", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/LocaleDisplayNames.java#L264-L266
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.generatePublicKey
public static PublicKey generatePublicKey(String algorithm, KeySpec keySpec) { if (null == keySpec) { return null; } algorithm = getAlgorithmAfterWith(algorithm); try { return getKeyFactory(algorithm).generatePublic(keySpec); } catch (Exception e) { throw new CryptoException(e); } }
java
public static PublicKey generatePublicKey(String algorithm, KeySpec keySpec) { if (null == keySpec) { return null; } algorithm = getAlgorithmAfterWith(algorithm); try { return getKeyFactory(algorithm).generatePublic(keySpec); } catch (Exception e) { throw new CryptoException(e); } }
[ "public", "static", "PublicKey", "generatePublicKey", "(", "String", "algorithm", ",", "KeySpec", "keySpec", ")", "{", "if", "(", "null", "==", "keySpec", ")", "{", "return", "null", ";", "}", "algorithm", "=", "getAlgorithmAfterWith", "(", "algorithm", ")", ...
生成公钥,仅用于非对称加密<br> 算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyFactory @param algorithm 算法 @param keySpec {@link KeySpec} @return 公钥 {@link PublicKey} @since 3.1.1
[ "生成公钥,仅用于非对称加密<br", ">", "算法见:https", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "7", "/", "docs", "/", "technotes", "/", "guides", "/", "security", "/", "StandardNames", ".", "html#KeyFactory" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L301-L311
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/StoreCallback.java
StoreCallback.sessionAttributeSet
public void sessionAttributeSet(ISession session, Object name, Object oldValue, Boolean oldIsListener, Object newValue, Boolean newIsListener) { _sessionStateEventDispatcher.sessionAttributeSet(session, name, oldValue, oldIsListener, newValue, newIsListener); }
java
public void sessionAttributeSet(ISession session, Object name, Object oldValue, Boolean oldIsListener, Object newValue, Boolean newIsListener) { _sessionStateEventDispatcher.sessionAttributeSet(session, name, oldValue, oldIsListener, newValue, newIsListener); }
[ "public", "void", "sessionAttributeSet", "(", "ISession", "session", ",", "Object", "name", ",", "Object", "oldValue", ",", "Boolean", "oldIsListener", ",", "Object", "newValue", ",", "Boolean", "newIsListener", ")", "{", "_sessionStateEventDispatcher", ".", "sessio...
Method sessionAttributeSet <p> @param session @param name @param oldValue @param newValue @see com.ibm.wsspi.session.IStoreCallback#sessionAttributeSet(com.ibm.wsspi.session.ISession, java.lang.Object, java.lang.Object, java.lang.Object)
[ "Method", "sessionAttributeSet", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/StoreCallback.java#L168-L171
umeding/fuzzer
src/main/java/com/uwemeding/fuzzer/Member.java
Member.applyHedge
public Member applyHedge(Hedge hedge) { String newMemberName = hedge.getName() + "$" + name; Member member = new Member(newMemberName, functionCall, hedge); this.points.stream().forEach(point -> member.points.add(point)); return member; }
java
public Member applyHedge(Hedge hedge) { String newMemberName = hedge.getName() + "$" + name; Member member = new Member(newMemberName, functionCall, hedge); this.points.stream().forEach(point -> member.points.add(point)); return member; }
[ "public", "Member", "applyHedge", "(", "Hedge", "hedge", ")", "{", "String", "newMemberName", "=", "hedge", ".", "getName", "(", ")", "+", "\"$\"", "+", "name", ";", "Member", "member", "=", "new", "Member", "(", "newMemberName", ",", "functionCall", ",", ...
Apply a hedge to the member. <p> @param hedge is the hedge @return the hedged member
[ "Apply", "a", "hedge", "to", "the", "member", ".", "<p", ">" ]
train
https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/Member.java#L70-L75
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/Box.java
Box.getContainingBlock
public Rectangle getContainingBlock() { if (cbox instanceof Viewport) //initial containing block { Rectangle visible = ((Viewport) cbox).getVisibleRect(); return new Rectangle(0, 0, visible.width, visible.height); } else //static or relative position return cbox.getContentBounds(); }
java
public Rectangle getContainingBlock() { if (cbox instanceof Viewport) //initial containing block { Rectangle visible = ((Viewport) cbox).getVisibleRect(); return new Rectangle(0, 0, visible.width, visible.height); } else //static or relative position return cbox.getContentBounds(); }
[ "public", "Rectangle", "getContainingBlock", "(", ")", "{", "if", "(", "cbox", "instanceof", "Viewport", ")", "//initial containing block", "{", "Rectangle", "visible", "=", "(", "(", "Viewport", ")", "cbox", ")", ".", "getVisibleRect", "(", ")", ";", "return"...
Obtains the containing block bounds. @return the containing block bounds.
[ "Obtains", "the", "containing", "block", "bounds", "." ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/Box.java#L523-L532
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlSelectStatement.java
SqlSelectStatement.appendListOfColumns
protected List appendListOfColumns(String[] columns, StringBuffer buf) { ArrayList columnList = new ArrayList(); for (int i = 0; i < columns.length; i++) { if (i > 0) { buf.append(","); } appendColName(columns[i], false, null, buf); columnList.add(columns[i]); } return columnList; }
java
protected List appendListOfColumns(String[] columns, StringBuffer buf) { ArrayList columnList = new ArrayList(); for (int i = 0; i < columns.length; i++) { if (i > 0) { buf.append(","); } appendColName(columns[i], false, null, buf); columnList.add(columns[i]); } return columnList; }
[ "protected", "List", "appendListOfColumns", "(", "String", "[", "]", "columns", ",", "StringBuffer", "buf", ")", "{", "ArrayList", "columnList", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "columns", ".", "l...
Appends to the statement a comma separated list of column names. @param columns defines the columns to be selected (for reports) @return list of column names
[ "Appends", "to", "the", "statement", "a", "comma", "separated", "list", "of", "column", "names", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlSelectStatement.java#L248-L262
jhy/jsoup
src/main/java/org/jsoup/safety/Whitelist.java
Whitelist.removeEnforcedAttribute
public Whitelist removeEnforcedAttribute(String tag, String attribute) { Validate.notEmpty(tag); Validate.notEmpty(attribute); TagName tagName = TagName.valueOf(tag); if(tagNames.contains(tagName) && enforcedAttributes.containsKey(tagName)) { AttributeKey attrKey = AttributeKey.valueOf(attribute); Map<AttributeKey, AttributeValue> attrMap = enforcedAttributes.get(tagName); attrMap.remove(attrKey); if(attrMap.isEmpty()) // Remove tag from enforced attribute map if no enforced attributes are present enforcedAttributes.remove(tagName); } return this; }
java
public Whitelist removeEnforcedAttribute(String tag, String attribute) { Validate.notEmpty(tag); Validate.notEmpty(attribute); TagName tagName = TagName.valueOf(tag); if(tagNames.contains(tagName) && enforcedAttributes.containsKey(tagName)) { AttributeKey attrKey = AttributeKey.valueOf(attribute); Map<AttributeKey, AttributeValue> attrMap = enforcedAttributes.get(tagName); attrMap.remove(attrKey); if(attrMap.isEmpty()) // Remove tag from enforced attribute map if no enforced attributes are present enforcedAttributes.remove(tagName); } return this; }
[ "public", "Whitelist", "removeEnforcedAttribute", "(", "String", "tag", ",", "String", "attribute", ")", "{", "Validate", ".", "notEmpty", "(", "tag", ")", ";", "Validate", ".", "notEmpty", "(", "attribute", ")", ";", "TagName", "tagName", "=", "TagName", "....
Remove a previously configured enforced attribute from a tag. @param tag The tag the enforced attribute is for. @param attribute The attribute name @return this (for chaining)
[ "Remove", "a", "previously", "configured", "enforced", "attribute", "from", "a", "tag", "." ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/safety/Whitelist.java#L358-L372
broadinstitute/barclay
src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java
HelpDoclet.includeInDocs
public boolean includeInDocs(final DocumentedFeature documentedFeature, final ClassDoc classDoc, final Class<?> clazz) { boolean hidden = !showHiddenFeatures() && clazz.isAnnotationPresent(Hidden.class); return !hidden && JVMUtils.isConcrete(clazz); }
java
public boolean includeInDocs(final DocumentedFeature documentedFeature, final ClassDoc classDoc, final Class<?> clazz) { boolean hidden = !showHiddenFeatures() && clazz.isAnnotationPresent(Hidden.class); return !hidden && JVMUtils.isConcrete(clazz); }
[ "public", "boolean", "includeInDocs", "(", "final", "DocumentedFeature", "documentedFeature", ",", "final", "ClassDoc", "classDoc", ",", "final", "Class", "<", "?", ">", "clazz", ")", "{", "boolean", "hidden", "=", "!", "showHiddenFeatures", "(", ")", "&&", "c...
Determine if a particular class should be included in the output. This is called by the doclet to determine if a DocWorkUnit should be created for this feature. @param documentedFeature feature that is being considered for inclusion in the docs @param classDoc for the class that is being considered for inclusion in the docs @param clazz class that is being considered for inclusion in the docs @return true if the doc should be included, otherwise false
[ "Determine", "if", "a", "particular", "class", "should", "be", "included", "in", "the", "output", ".", "This", "is", "called", "by", "the", "doclet", "to", "determine", "if", "a", "DocWorkUnit", "should", "be", "created", "for", "this", "feature", "." ]
train
https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/help/HelpDoclet.java#L361-L364
qiniu/java-sdk
src/main/java/com/qiniu/storage/BucketManager.java
BucketManager.rename
public Response rename(String bucket, String oldFileKey, String newFileKey, boolean force) throws QiniuException { return move(bucket, oldFileKey, bucket, newFileKey, force); }
java
public Response rename(String bucket, String oldFileKey, String newFileKey, boolean force) throws QiniuException { return move(bucket, oldFileKey, bucket, newFileKey, force); }
[ "public", "Response", "rename", "(", "String", "bucket", ",", "String", "oldFileKey", ",", "String", "newFileKey", ",", "boolean", "force", ")", "throws", "QiniuException", "{", "return", "move", "(", "bucket", ",", "oldFileKey", ",", "bucket", ",", "newFileKe...
重命名空间中的文件,可以设置force参数为true强行覆盖空间已有同名文件 @param bucket 空间名称 @param oldFileKey 文件名称 @param newFileKey 新文件名 @param force 强制覆盖空间中已有同名(和 newFileKey 相同)的文件 @throws QiniuException
[ "重命名空间中的文件,可以设置force参数为true强行覆盖空间已有同名文件" ]
train
https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L340-L343
zaproxy/zaproxy
src/org/zaproxy/zap/extension/forceduser/ExtensionForcedUser.java
ExtensionForcedUser.setForcedUser
public void setForcedUser(int contextId, int userId) throws IllegalStateException { User user = getUserManagementExtension().getContextUserAuthManager(contextId).getUserById(userId); if (user == null) throw new IllegalStateException("No user matching the provided id was found."); setForcedUser(contextId, user); }
java
public void setForcedUser(int contextId, int userId) throws IllegalStateException { User user = getUserManagementExtension().getContextUserAuthManager(contextId).getUserById(userId); if (user == null) throw new IllegalStateException("No user matching the provided id was found."); setForcedUser(contextId, user); }
[ "public", "void", "setForcedUser", "(", "int", "contextId", ",", "int", "userId", ")", "throws", "IllegalStateException", "{", "User", "user", "=", "getUserManagementExtension", "(", ")", ".", "getContextUserAuthManager", "(", "contextId", ")", ".", "getUserById", ...
Sets the forced user for a context, based on the user id. @param contextId the context id @param userId the user id @throws IllegalStateException if no user was found that matches the provided id.
[ "Sets", "the", "forced", "user", "for", "a", "context", "based", "on", "the", "user", "id", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/forceduser/ExtensionForcedUser.java#L249-L254
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/hydrogeomorphology/energybalance/OmsEnergyBalance.java
OmsEnergyBalance.pVap
private double pVap( double T, double P ) { double A = 6.1121 * (1.0007 + 3.46E-6 * P); double b = 17.502; double c = 240.97; double e = A * exp(b * T / (c + T)); return e; }
java
private double pVap( double T, double P ) { double A = 6.1121 * (1.0007 + 3.46E-6 * P); double b = 17.502; double c = 240.97; double e = A * exp(b * T / (c + T)); return e; }
[ "private", "double", "pVap", "(", "double", "T", ",", "double", "P", ")", "{", "double", "A", "=", "6.1121", "*", "(", "1.0007", "+", "3.46E-6", "*", "P", ")", ";", "double", "b", "=", "17.502", ";", "double", "c", "=", "240.97", ";", "double", "...
calcola la pressione di vapore [mbar] a saturazione in dipendenza dalla temperatura [gradi Celsius]. @param T @param P @return la pressione di vapore [mbar] a saturazione
[ "calcola", "la", "pressione", "di", "vapore", "[", "mbar", "]", "a", "saturazione", "in", "dipendenza", "dalla", "temperatura", "[", "gradi", "Celsius", "]", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/hydrogeomorphology/energybalance/OmsEnergyBalance.java#L1254-L1260
jamesagnew/hapi-fhir
hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/conformance/ShExGenerator.java
ShExGenerator.genReference
private String genReference(String id, ElementDefinition.TypeRefComponent typ) { ST shex_ref = tmplt(REFERENCE_DEFN_TEMPLATE); String ref = getTypeName(typ); shex_ref.add("id", id); shex_ref.add("ref", ref); references.add(ref); return shex_ref.render(); }
java
private String genReference(String id, ElementDefinition.TypeRefComponent typ) { ST shex_ref = tmplt(REFERENCE_DEFN_TEMPLATE); String ref = getTypeName(typ); shex_ref.add("id", id); shex_ref.add("ref", ref); references.add(ref); return shex_ref.render(); }
[ "private", "String", "genReference", "(", "String", "id", ",", "ElementDefinition", ".", "TypeRefComponent", "typ", ")", "{", "ST", "shex_ref", "=", "tmplt", "(", "REFERENCE_DEFN_TEMPLATE", ")", ";", "String", "ref", "=", "getTypeName", "(", "typ", ")", ";", ...
Generate a reference to a resource @param id attribute identifier @param typ possible reference types @return string that represents the result
[ "Generate", "a", "reference", "to", "a", "resource" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/conformance/ShExGenerator.java#L707-L715
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/util/DrawerUIUtils.java
DrawerUIUtils.getTextColorStateList
public static ColorStateList getTextColorStateList(int text_color, int selected_text_color) { return new ColorStateList( new int[][]{ new int[]{android.R.attr.state_selected}, new int[]{} }, new int[]{ selected_text_color, text_color } ); }
java
public static ColorStateList getTextColorStateList(int text_color, int selected_text_color) { return new ColorStateList( new int[][]{ new int[]{android.R.attr.state_selected}, new int[]{} }, new int[]{ selected_text_color, text_color } ); }
[ "public", "static", "ColorStateList", "getTextColorStateList", "(", "int", "text_color", ",", "int", "selected_text_color", ")", "{", "return", "new", "ColorStateList", "(", "new", "int", "[", "]", "[", "]", "{", "new", "int", "[", "]", "{", "android", ".", ...
helper to create a colorStateList for the text @param text_color @param selected_text_color @return
[ "helper", "to", "create", "a", "colorStateList", "for", "the", "text" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/util/DrawerUIUtils.java#L135-L146
DavidPizarro/PinView
library/src/main/java/com/dpizarro/pinview/library/PinViewBaseHelper.java
PinViewBaseHelper.generatePinBox
EditText generatePinBox(int i, int inputType) { EditText editText = (EditText) LayoutInflater.from(getContext()).inflate(R.layout.partial_pin_box, this, false); int generateViewId = PinViewUtils.generateViewId(); editText.setId(generateViewId); editText.setTag(i); if (inputType != -1) { editText.setInputType(inputType); } setStylePinBox(editText); editText.addTextChangedListener(this); editText.setOnFocusChangeListener(this); pinBoxesIds[i] = generateViewId; return editText; }
java
EditText generatePinBox(int i, int inputType) { EditText editText = (EditText) LayoutInflater.from(getContext()).inflate(R.layout.partial_pin_box, this, false); int generateViewId = PinViewUtils.generateViewId(); editText.setId(generateViewId); editText.setTag(i); if (inputType != -1) { editText.setInputType(inputType); } setStylePinBox(editText); editText.addTextChangedListener(this); editText.setOnFocusChangeListener(this); pinBoxesIds[i] = generateViewId; return editText; }
[ "EditText", "generatePinBox", "(", "int", "i", ",", "int", "inputType", ")", "{", "EditText", "editText", "=", "(", "EditText", ")", "LayoutInflater", ".", "from", "(", "getContext", "(", ")", ")", ".", "inflate", "(", "R", ".", "layout", ".", "partial_p...
Generate a PinBox {@link EditText} with all attributes to add to {@link PinView} @param i index of new PinBox @param inputType inputType to new PinBox @return new PinBox
[ "Generate", "a", "PinBox", "{", "@link", "EditText", "}", "with", "all", "attributes", "to", "add", "to", "{", "@link", "PinView", "}" ]
train
https://github.com/DavidPizarro/PinView/blob/b171a89694921475b5442585810b8475ef1cfe35/library/src/main/java/com/dpizarro/pinview/library/PinViewBaseHelper.java#L178-L193
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/AddUniformScale.java
AddUniformScale.run
private ScalesResult run(Relation<? extends NumberVector> rel) { double[][] mms = RelationUtil.computeMinMax(rel); int dim = mms[0].length; double delta = 0.; for(int d = 0; d < dim; d++) { double del = mms[1][d] - mms[0][d]; delta = del > delta ? del : delta; } if(delta < Double.MIN_NORMAL) { delta = 1.; } int log10res = (int) Math.ceil(Math.log10(delta / (LinearScale.MAXTICKS - 1))); double res = MathUtil.powi(10, log10res); double target = Math.ceil(delta / res) * res; // Target width LinearScale[] scales = new LinearScale[dim]; for(int d = 0; d < dim; d++) { double mid = (mms[0][d] + mms[1][d] - target) * .5; double min = Math.floor(mid / res) * res; double max = Math.ceil((mid + target) / res) * res; scales[d] = new LinearScale(min, max); } return new ScalesResult(scales); }
java
private ScalesResult run(Relation<? extends NumberVector> rel) { double[][] mms = RelationUtil.computeMinMax(rel); int dim = mms[0].length; double delta = 0.; for(int d = 0; d < dim; d++) { double del = mms[1][d] - mms[0][d]; delta = del > delta ? del : delta; } if(delta < Double.MIN_NORMAL) { delta = 1.; } int log10res = (int) Math.ceil(Math.log10(delta / (LinearScale.MAXTICKS - 1))); double res = MathUtil.powi(10, log10res); double target = Math.ceil(delta / res) * res; // Target width LinearScale[] scales = new LinearScale[dim]; for(int d = 0; d < dim; d++) { double mid = (mms[0][d] + mms[1][d] - target) * .5; double min = Math.floor(mid / res) * res; double max = Math.ceil((mid + target) / res) * res; scales[d] = new LinearScale(min, max); } return new ScalesResult(scales); }
[ "private", "ScalesResult", "run", "(", "Relation", "<", "?", "extends", "NumberVector", ">", "rel", ")", "{", "double", "[", "]", "[", "]", "mms", "=", "RelationUtil", ".", "computeMinMax", "(", "rel", ")", ";", "int", "dim", "=", "mms", "[", "0", "]...
Add scales to a single vector relation. @param rel Relation @return Scales
[ "Add", "scales", "to", "a", "single", "vector", "relation", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/AddUniformScale.java#L73-L95
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/SamlSettingsApi.java
SamlSettingsApi.postAnyLocations
public SetAnyLocationsResponse postAnyLocations(String region, SettingsData data) throws ApiException { ApiResponse<SetAnyLocationsResponse> resp = postAnyLocationsWithHttpInfo(region, data); return resp.getData(); }
java
public SetAnyLocationsResponse postAnyLocations(String region, SettingsData data) throws ApiException { ApiResponse<SetAnyLocationsResponse> resp = postAnyLocationsWithHttpInfo(region, data); return resp.getData(); }
[ "public", "SetAnyLocationsResponse", "postAnyLocations", "(", "String", "region", ",", "SettingsData", "data", ")", "throws", "ApiException", "{", "ApiResponse", "<", "SetAnyLocationsResponse", ">", "resp", "=", "postAnyLocationsWithHttpInfo", "(", "region", ",", "data"...
Set region settings. Change region settings. @param region The name of region (required) @param data (required) @return SetAnyLocationsResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Set", "region", "settings", ".", "Change", "region", "settings", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/SamlSettingsApi.java#L757-L760
deephacks/confit
provider-hbase/src/main/java/org/deephacks/confit/internal/hbase/HBeanTable.java
HBeanTable.getEager
public HBeanRowCollector getEager(Set<HBeanRow> rows, FetchType... fetchType) throws HBeanNotFoundException { Set<HBeanRow> result; result = getLazy(rows, fetchType); HBeanRowCollector collector = new HBeanRowCollector(result); getEager(result, collector, FETCH_DEPTH_MAX, fetchType); return collector; }
java
public HBeanRowCollector getEager(Set<HBeanRow> rows, FetchType... fetchType) throws HBeanNotFoundException { Set<HBeanRow> result; result = getLazy(rows, fetchType); HBeanRowCollector collector = new HBeanRowCollector(result); getEager(result, collector, FETCH_DEPTH_MAX, fetchType); return collector; }
[ "public", "HBeanRowCollector", "getEager", "(", "Set", "<", "HBeanRow", ">", "rows", ",", "FetchType", "...", "fetchType", ")", "throws", "HBeanNotFoundException", "{", "Set", "<", "HBeanRow", ">", "result", ";", "result", "=", "getLazy", "(", "rows", ",", "...
Fetch a set of rows and traverse and fetch references eagerly. @param rows to fetch @param fetchType data to fetch @return collector carring the result from the query
[ "Fetch", "a", "set", "of", "rows", "and", "traverse", "and", "fetch", "references", "eagerly", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-hbase/src/main/java/org/deephacks/confit/internal/hbase/HBeanTable.java#L94-L101
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/TransactionWriteRequest.java
TransactionWriteRequest.addPut
public TransactionWriteRequest addPut(Object object, DynamoDBTransactionWriteExpression transactionWriteExpression, ReturnValuesOnConditionCheckFailure returnValuesOnConditionCheckFailure) { transactionWriteOperations.add(new TransactionWriteOperation(object, TransactionWriteOperationType.Put, transactionWriteExpression, returnValuesOnConditionCheckFailure)); return this; }
java
public TransactionWriteRequest addPut(Object object, DynamoDBTransactionWriteExpression transactionWriteExpression, ReturnValuesOnConditionCheckFailure returnValuesOnConditionCheckFailure) { transactionWriteOperations.add(new TransactionWriteOperation(object, TransactionWriteOperationType.Put, transactionWriteExpression, returnValuesOnConditionCheckFailure)); return this; }
[ "public", "TransactionWriteRequest", "addPut", "(", "Object", "object", ",", "DynamoDBTransactionWriteExpression", "transactionWriteExpression", ",", "ReturnValuesOnConditionCheckFailure", "returnValuesOnConditionCheckFailure", ")", "{", "transactionWriteOperations", ".", "add", "(...
Adds put operation (to be executed on object) to the list of transaction write operations. transactionWriteExpression is used to conditionally put object. returnValuesOnConditionCheckFailure specifies which attributes values (of existing item) should be returned if condition check fails.
[ "Adds", "put", "operation", "(", "to", "be", "executed", "on", "object", ")", "to", "the", "list", "of", "transaction", "write", "operations", ".", "transactionWriteExpression", "is", "used", "to", "conditionally", "put", "object", ".", "returnValuesOnConditionChe...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/TransactionWriteRequest.java#L67-L72
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/ObjectUtils.java
ObjectUtils.getFieldInstance
public static Object getFieldInstance(List chids, Field f) { if (Set.class.isAssignableFrom(f.getType())) { Set col = new HashSet(chids); return col; } return chids; }
java
public static Object getFieldInstance(List chids, Field f) { if (Set.class.isAssignableFrom(f.getType())) { Set col = new HashSet(chids); return col; } return chids; }
[ "public", "static", "Object", "getFieldInstance", "(", "List", "chids", ",", "Field", "f", ")", "{", "if", "(", "Set", ".", "class", ".", "isAssignableFrom", "(", "f", ".", "getType", "(", ")", ")", ")", "{", "Set", "col", "=", "new", "HashSet", "(",...
Gets the field instance. @param chids the chids @param f the f @return the field instance
[ "Gets", "the", "field", "instance", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/ObjectUtils.java#L420-L429
mozilla/rhino
src/org/mozilla/classfile/TypeInfo.java
TypeInfo.getPayloadAsType
static final String getPayloadAsType(int typeInfo, ConstantPool pool) { if (getTag(typeInfo) == OBJECT_TAG) { return (String) pool.getConstantData(getPayload(typeInfo)); } throw new IllegalArgumentException("expecting object type"); }
java
static final String getPayloadAsType(int typeInfo, ConstantPool pool) { if (getTag(typeInfo) == OBJECT_TAG) { return (String) pool.getConstantData(getPayload(typeInfo)); } throw new IllegalArgumentException("expecting object type"); }
[ "static", "final", "String", "getPayloadAsType", "(", "int", "typeInfo", ",", "ConstantPool", "pool", ")", "{", "if", "(", "getTag", "(", "typeInfo", ")", "==", "OBJECT_TAG", ")", "{", "return", "(", "String", ")", "pool", ".", "getConstantData", "(", "get...
Treat the result of getPayload as a constant pool index and fetch the corresponding String mapped to it. Only works on OBJECT types.
[ "Treat", "the", "result", "of", "getPayload", "as", "a", "constant", "pool", "index", "and", "fetch", "the", "corresponding", "String", "mapped", "to", "it", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/TypeInfo.java#L55-L60
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/retry/ClockSkewAdjuster.java
ClockSkewAdjuster.timeSkewInSeconds
private int timeSkewInSeconds(Date clientTime, Date serverTime) { ValidationUtils.assertNotNull(clientTime, "clientTime"); ValidationUtils.assertNotNull(serverTime, "serverTime"); long value = (clientTime.getTime() - serverTime.getTime()) / 1000; if ((int) value != value) { throw new IllegalStateException("Time is too skewed to adjust: (clientTime: " + clientTime.getTime() + ", " + "serverTime: " + serverTime.getTime() + ")"); } return (int) value; }
java
private int timeSkewInSeconds(Date clientTime, Date serverTime) { ValidationUtils.assertNotNull(clientTime, "clientTime"); ValidationUtils.assertNotNull(serverTime, "serverTime"); long value = (clientTime.getTime() - serverTime.getTime()) / 1000; if ((int) value != value) { throw new IllegalStateException("Time is too skewed to adjust: (clientTime: " + clientTime.getTime() + ", " + "serverTime: " + serverTime.getTime() + ")"); } return (int) value; }
[ "private", "int", "timeSkewInSeconds", "(", "Date", "clientTime", ",", "Date", "serverTime", ")", "{", "ValidationUtils", ".", "assertNotNull", "(", "clientTime", ",", "\"clientTime\"", ")", ";", "ValidationUtils", ".", "assertNotNull", "(", "serverTime", ",", "\"...
Calculate the time skew between a client and server date. This value has the same semantics of {@link Request#setTimeOffset(int)}. Positive values imply the client clock is "fast" and negative values imply the client clock is "slow".
[ "Calculate", "the", "time", "skew", "between", "a", "client", "and", "server", "date", ".", "This", "value", "has", "the", "same", "semantics", "of", "{" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/retry/ClockSkewAdjuster.java#L127-L138
Grasia/phatsim
phat-env/src/main/java/phat/world/WorldAppState.java
WorldAppState.setCalendar
public void setCalendar(int year, int month, int dayOfMonth, int hour, int minute, int second) { this.year = year; this.month = month; this.dayOfMonth = dayOfMonth; this.hour = hour; this.minute = minute; this.second = second; this.createCalendar(); }
java
public void setCalendar(int year, int month, int dayOfMonth, int hour, int minute, int second) { this.year = year; this.month = month; this.dayOfMonth = dayOfMonth; this.hour = hour; this.minute = minute; this.second = second; this.createCalendar(); }
[ "public", "void", "setCalendar", "(", "int", "year", ",", "int", "month", ",", "int", "dayOfMonth", ",", "int", "hour", ",", "int", "minute", ",", "int", "second", ")", "{", "this", ".", "year", "=", "year", ";", "this", ".", "month", "=", "month", ...
It sets the simulation time. @param year @param month @param dayOfMonth @param hour @param minute @param second
[ "It", "sets", "the", "simulation", "time", "." ]
train
https://github.com/Grasia/phatsim/blob/2d4fc8189be9730b34c8e3e1a08fb4800e01c5df/phat-env/src/main/java/phat/world/WorldAppState.java#L368-L376
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java
IOUtil.copy
public static void copy(InputStream input, OutputStream output) throws IOException { final byte[] buffer = new byte[4096]; int read = 0; while ((read = input.read(buffer)) != -1) { output.write(buffer, 0, read); } output.flush(); }
java
public static void copy(InputStream input, OutputStream output) throws IOException { final byte[] buffer = new byte[4096]; int read = 0; while ((read = input.read(buffer)) != -1) { output.write(buffer, 0, read); } output.flush(); }
[ "public", "static", "void", "copy", "(", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "4096", "]", ";", "int", "read", "=", "0", ";", "while", "(...
Copies the contents from an InputStream to an OutputStream. It is the responsibility of the caller to close the streams passed in when done, though the {@link OutputStream} will be fully flushed. @param input @param output @throws IOException If a problem occurred during any I/O operations
[ "Copies", "the", "contents", "from", "an", "InputStream", "to", "an", "OutputStream", ".", "It", "is", "the", "responsibility", "of", "the", "caller", "to", "close", "the", "streams", "passed", "in", "when", "done", "though", "the", "{", "@link", "OutputStre...
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/IOUtil.java#L135-L143
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplex.java
BigComplex.valueOfPolar
public static BigComplex valueOfPolar(BigDecimal radius, BigDecimal angle, MathContext mathContext) { if (radius.signum() == 0) { return ZERO; } return valueOf( radius.multiply(BigDecimalMath.cos(angle, mathContext), mathContext), radius.multiply(BigDecimalMath.sin(angle, mathContext), mathContext)); }
java
public static BigComplex valueOfPolar(BigDecimal radius, BigDecimal angle, MathContext mathContext) { if (radius.signum() == 0) { return ZERO; } return valueOf( radius.multiply(BigDecimalMath.cos(angle, mathContext), mathContext), radius.multiply(BigDecimalMath.sin(angle, mathContext), mathContext)); }
[ "public", "static", "BigComplex", "valueOfPolar", "(", "BigDecimal", "radius", ",", "BigDecimal", "angle", ",", "MathContext", "mathContext", ")", "{", "if", "(", "radius", ".", "signum", "(", ")", "==", "0", ")", "{", "return", "ZERO", ";", "}", "return",...
Returns a complex number with the specified polar {@link BigDecimal} radius and angle using the specified {@link MathContext}. @param radius the {@link BigDecimal} radius of the polar representation @param angle the {@link BigDecimal} angle in radians of the polar representation @param mathContext the {@link MathContext} used to calculate the result @return the complex number
[ "Returns", "a", "complex", "number", "with", "the", "specified", "polar", "{", "@link", "BigDecimal", "}", "radius", "and", "angle", "using", "the", "specified", "{", "@link", "MathContext", "}", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplex.java#L543-L551
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/cql/CqlFilterTransformation.java
CqlFilterTransformation.transform
public Boolean transform(T input) throws TransformationException { try { return cqlFilter.evaluate(input); } catch (ParseException e) { throw new TransformationException(e, input); } }
java
public Boolean transform(T input) throws TransformationException { try { return cqlFilter.evaluate(input); } catch (ParseException e) { throw new TransformationException(e, input); } }
[ "public", "Boolean", "transform", "(", "T", "input", ")", "throws", "TransformationException", "{", "try", "{", "return", "cqlFilter", ".", "evaluate", "(", "input", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "throw", "new", "Transformatio...
Checks whether the given input object passes the cql filter. @param input The object to evaluate @return True if the given object passes the cql filter, false otherwise.
[ "Checks", "whether", "the", "given", "input", "object", "passes", "the", "cql", "filter", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/cql/CqlFilterTransformation.java#L62-L73
greese/dasein-util
src/main/java/org/dasein/util/BrowseIterator.java
BrowseIterator.setup
private void setup(Collection<T> items, int ps, Comparator<T> sort) { Collection<T> list; Iterator<T> it; if( sort == null ) { list = items; } else { list = new TreeSet<T>(sort); list.addAll(items); } sorter = sort; pageSize = ps; pages = new ArrayList<Collection<T>>(); it = list.iterator(); while( it.hasNext() ) { ArrayList<T> page = new ArrayList<T>(); pages.add(page); for(int i=0; i<ps; i++ ) { T ob; if( !it.hasNext() ) { break; } ob = it.next(); page.add(ob); } } }
java
private void setup(Collection<T> items, int ps, Comparator<T> sort) { Collection<T> list; Iterator<T> it; if( sort == null ) { list = items; } else { list = new TreeSet<T>(sort); list.addAll(items); } sorter = sort; pageSize = ps; pages = new ArrayList<Collection<T>>(); it = list.iterator(); while( it.hasNext() ) { ArrayList<T> page = new ArrayList<T>(); pages.add(page); for(int i=0; i<ps; i++ ) { T ob; if( !it.hasNext() ) { break; } ob = it.next(); page.add(ob); } } }
[ "private", "void", "setup", "(", "Collection", "<", "T", ">", "items", ",", "int", "ps", ",", "Comparator", "<", "T", ">", "sort", ")", "{", "Collection", "<", "T", ">", "list", ";", "Iterator", "<", "T", ">", "it", ";", "if", "(", "sort", "==", ...
Sets the collection up using the specified parameters. @param items the items in the iterator @param ps the page size for the structure @param sort the sorter, if any, to use for sorting
[ "Sets", "the", "collection", "up", "using", "the", "specified", "parameters", "." ]
train
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/BrowseIterator.java#L401-L430
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java
CollectionLiteralsTypeComputer.normalizeElementType
protected LightweightTypeReference normalizeElementType(LightweightTypeReference collectionElementType, LightweightTypeReference expectedCollectionType, ITypeReferenceOwner owner) { if (isIterableExpectation(expectedCollectionType)) { LightweightTypeReference expectedElementType = getElementOrComponentType(expectedCollectionType, owner); return doNormalizeElementType(collectionElementType, expectedElementType); } return normalizeFunctionTypeReference(collectionElementType); }
java
protected LightweightTypeReference normalizeElementType(LightweightTypeReference collectionElementType, LightweightTypeReference expectedCollectionType, ITypeReferenceOwner owner) { if (isIterableExpectation(expectedCollectionType)) { LightweightTypeReference expectedElementType = getElementOrComponentType(expectedCollectionType, owner); return doNormalizeElementType(collectionElementType, expectedElementType); } return normalizeFunctionTypeReference(collectionElementType); }
[ "protected", "LightweightTypeReference", "normalizeElementType", "(", "LightweightTypeReference", "collectionElementType", ",", "LightweightTypeReference", "expectedCollectionType", ",", "ITypeReferenceOwner", "owner", ")", "{", "if", "(", "isIterableExpectation", "(", "expectedC...
The expected collection type may drive the type of the elements in the collection if the type is used as an invariant type. In other word, an expectation of the form {@code Collection<CharSequence>} may yield a type {@code List<CharSequence>} for the literal {@code ['a']} even though it would be {@code List<? extends String>} if no expectation was given.
[ "The", "expected", "collection", "type", "may", "drive", "the", "type", "of", "the", "elements", "in", "the", "collection", "if", "the", "type", "is", "used", "as", "an", "invariant", "type", ".", "In", "other", "word", "an", "expectation", "of", "the", ...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/computation/CollectionLiteralsTypeComputer.java#L314-L320
RestComm/media-core
control/mgcp/src/main/java/org/restcomm/media/core/control/mgcp/call/MgcpCall.java
MgcpCall.addConnection
public boolean addConnection(String endpointId, int connectionId) { boolean added = this.entries.put(endpointId, connectionId); if (added && log.isDebugEnabled()) { int left = this.entries.get(endpointId).size(); log.debug("Call " + getCallIdHex() + " registered connection " + Integer.toHexString(connectionId) + " at endpoint " + endpointId + ". Connection count: " + left); } return added; }
java
public boolean addConnection(String endpointId, int connectionId) { boolean added = this.entries.put(endpointId, connectionId); if (added && log.isDebugEnabled()) { int left = this.entries.get(endpointId).size(); log.debug("Call " + getCallIdHex() + " registered connection " + Integer.toHexString(connectionId) + " at endpoint " + endpointId + ". Connection count: " + left); } return added; }
[ "public", "boolean", "addConnection", "(", "String", "endpointId", ",", "int", "connectionId", ")", "{", "boolean", "added", "=", "this", ".", "entries", ".", "put", "(", "endpointId", ",", "connectionId", ")", ";", "if", "(", "added", "&&", "log", ".", ...
Registers a connection in the call. @param endpointId The identifier of the endpoint that owns the connection. @param connectionId The connection identifier. @return Returns <code>true</code> if connection was successfully registered. Returns <code>false</code> otherwise.
[ "Registers", "a", "connection", "in", "the", "call", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/control/mgcp/src/main/java/org/restcomm/media/core/control/mgcp/call/MgcpCall.java#L106-L113
linkedin/dexmaker
dexmaker/src/main/java/com/android/dx/Code.java
Code.loadConstant
public <T> void loadConstant(Local<T> target, T value) { Rop rop = value == null ? Rops.CONST_OBJECT_NOTHROW : Rops.opConst(target.type.ropType); if (rop.getBranchingness() == BRANCH_NONE) { addInstruction(new PlainCstInsn(rop, sourcePosition, target.spec(), RegisterSpecList.EMPTY, Constants.getConstant(value))); } else { addInstruction(new ThrowingCstInsn(rop, sourcePosition, RegisterSpecList.EMPTY, catches, Constants.getConstant(value))); moveResult(target, true); } }
java
public <T> void loadConstant(Local<T> target, T value) { Rop rop = value == null ? Rops.CONST_OBJECT_NOTHROW : Rops.opConst(target.type.ropType); if (rop.getBranchingness() == BRANCH_NONE) { addInstruction(new PlainCstInsn(rop, sourcePosition, target.spec(), RegisterSpecList.EMPTY, Constants.getConstant(value))); } else { addInstruction(new ThrowingCstInsn(rop, sourcePosition, RegisterSpecList.EMPTY, catches, Constants.getConstant(value))); moveResult(target, true); } }
[ "public", "<", "T", ">", "void", "loadConstant", "(", "Local", "<", "T", ">", "target", ",", "T", "value", ")", "{", "Rop", "rop", "=", "value", "==", "null", "?", "Rops", ".", "CONST_OBJECT_NOTHROW", ":", "Rops", ".", "opConst", "(", "target", ".", ...
Copies the constant value {@code value} to {@code target}. The constant must be a primitive, String, Class, TypeId, or null.
[ "Copies", "the", "constant", "value", "{" ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L478-L490
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/ContentSpec.java
ContentSpec.setFiles
public void setFiles(final List<File> files) { if (files == null && this.files == null) { return; } else if (files == null) { removeChild(this.files); this.files = null; } else if (this.files == null) { this.files = new FileList(CommonConstants.CS_FILE_TITLE, files); appendChild(this.files, false); } else { this.files.setValue(files); } }
java
public void setFiles(final List<File> files) { if (files == null && this.files == null) { return; } else if (files == null) { removeChild(this.files); this.files = null; } else if (this.files == null) { this.files = new FileList(CommonConstants.CS_FILE_TITLE, files); appendChild(this.files, false); } else { this.files.setValue(files); } }
[ "public", "void", "setFiles", "(", "final", "List", "<", "File", ">", "files", ")", "{", "if", "(", "files", "==", "null", "&&", "this", ".", "files", "==", "null", ")", "{", "return", ";", "}", "else", "if", "(", "files", "==", "null", ")", "{",...
Sets the list of additional files needed by the book. @param files The list of additional Files.
[ "Sets", "the", "list", "of", "additional", "files", "needed", "by", "the", "book", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/ContentSpec.java#L2118-L2130
google/closure-templates
java/src/com/google/template/soy/jssrc/dsl/ConditionalBuilder.java
ConditionalBuilder.addElseIf
public ConditionalBuilder addElseIf(Expression predicate, Statement consequent) { conditions.add(new IfThenPair<>(predicate, consequent)); return this; }
java
public ConditionalBuilder addElseIf(Expression predicate, Statement consequent) { conditions.add(new IfThenPair<>(predicate, consequent)); return this; }
[ "public", "ConditionalBuilder", "addElseIf", "(", "Expression", "predicate", ",", "Statement", "consequent", ")", "{", "conditions", ".", "add", "(", "new", "IfThenPair", "<>", "(", "predicate", ",", "consequent", ")", ")", ";", "return", "this", ";", "}" ]
Adds an {@code else if} clause with the given predicate and consequent to this conditional.
[ "Adds", "an", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/ConditionalBuilder.java#L36-L39
JetBrains/xodus
openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java
EnvironmentConfig.setGcFilesDeletionDelay
public EnvironmentConfig setGcFilesDeletionDelay(final int delay) throws InvalidSettingException { if (delay < 0) { throw new InvalidSettingException("Invalid GC files deletion delay: " + delay); } return setSetting(GC_FILES_DELETION_DELAY, delay); }
java
public EnvironmentConfig setGcFilesDeletionDelay(final int delay) throws InvalidSettingException { if (delay < 0) { throw new InvalidSettingException("Invalid GC files deletion delay: " + delay); } return setSetting(GC_FILES_DELETION_DELAY, delay); }
[ "public", "EnvironmentConfig", "setGcFilesDeletionDelay", "(", "final", "int", "delay", ")", "throws", "InvalidSettingException", "{", "if", "(", "delay", "<", "0", ")", "{", "throw", "new", "InvalidSettingException", "(", "\"Invalid GC files deletion delay: \"", "+", ...
Sets the number of milliseconds which deletion of any successfully cleaned {@code Log} file (.xd file) is postponed for. Default value is {@code 5000}. <p>Mutable at runtime: yes @param delay number of milliseconds which deletion of any successfully cleaned .xd file is postponed for @return this {@code EnvironmentConfig} instance @throws InvalidSettingException {@code delay} is less than {@code 0}.
[ "Sets", "the", "number", "of", "milliseconds", "which", "deletion", "of", "any", "successfully", "cleaned", "{", "@code", "Log", "}", "file", "(", ".", "xd", "file", ")", "is", "postponed", "for", ".", "Default", "value", "is", "{", "@code", "5000", "}",...
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java#L2165-L2170
OpenTSDB/opentsdb
src/tsd/client/MetricForm.java
MetricForm.parseRateOptions
static final public LocalRateOptions parseRateOptions(boolean rate, String spec) { if (!rate || spec.length() < 6) { return new LocalRateOptions(); } String[] parts = spec.split(spec.substring(5, spec.length() - 1), ','); if (parts.length < 1 || parts.length > 3) { return new LocalRateOptions(); } try { LocalRateOptions options = new LocalRateOptions(); options.is_counter = parts[0].endsWith("counter"); options.counter_max = (parts.length >= 2 && parts[1].length() > 0 ? Long .parseLong(parts[1]) : Long.MAX_VALUE); options.reset_value = (parts.length >= 3 && parts[2].length() > 0 ? Long .parseLong(parts[2]) : 0); return options; } catch (NumberFormatException e) { return new LocalRateOptions(); } }
java
static final public LocalRateOptions parseRateOptions(boolean rate, String spec) { if (!rate || spec.length() < 6) { return new LocalRateOptions(); } String[] parts = spec.split(spec.substring(5, spec.length() - 1), ','); if (parts.length < 1 || parts.length > 3) { return new LocalRateOptions(); } try { LocalRateOptions options = new LocalRateOptions(); options.is_counter = parts[0].endsWith("counter"); options.counter_max = (parts.length >= 2 && parts[1].length() > 0 ? Long .parseLong(parts[1]) : Long.MAX_VALUE); options.reset_value = (parts.length >= 3 && parts[2].length() > 0 ? Long .parseLong(parts[2]) : 0); return options; } catch (NumberFormatException e) { return new LocalRateOptions(); } }
[ "static", "final", "public", "LocalRateOptions", "parseRateOptions", "(", "boolean", "rate", ",", "String", "spec", ")", "{", "if", "(", "!", "rate", "||", "spec", ".", "length", "(", ")", "<", "6", ")", "{", "return", "new", "LocalRateOptions", "(", ")"...
Parses the "rate" section of the query string and returns an instance of the LocalRateOptions class that contains the values found. <p/> The format of the rate specification is rate[{counter[,#[,#]]}]. If the spec is invalid or we were unable to parse properly, it returns a default options object. @param rate If true, then the query is set as a rate query and the rate specification will be parsed. If false, a default RateOptions instance will be returned and largely ignored by the rest of the processing @param spec The part of the query string that pertains to the rate @return An initialized LocalRateOptions instance based on the specification @since 2.0
[ "Parses", "the", "rate", "section", "of", "the", "query", "string", "and", "returns", "an", "instance", "of", "the", "LocalRateOptions", "class", "that", "contains", "the", "values", "found", ".", "<p", "/", ">", "The", "format", "of", "the", "rate", "spec...
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/client/MetricForm.java#L722-L743
lamarios/sherdog-parser
src/main/java/com/ftpix/sherdogparser/parsers/EventParser.java
EventParser.getFights
private void getFights(Document doc, Event event) { logger.info("Getting fights for event #{}[{}]", event.getSherdogUrl(), event.getName()); SherdogBaseObject sEvent = new SherdogBaseObject(); sEvent.setName(event.getName()); sEvent.setSherdogUrl(event.getSherdogUrl()); List<Fight> fights = new ArrayList<>(); //Checking on main event Elements mainFightElement = doc.select(".content.event"); Elements fighters = mainFightElement.select("h3 a"); //First fighter SherdogBaseObject mainFighter1 = new SherdogBaseObject(); Element mainFighter1Element = fighters.get(0); mainFighter1.setSherdogUrl(mainFighter1Element.attr("abs:href")); mainFighter1.setName(mainFighter1Element.select("span[itemprop=\"name\"]").html()); //second fighter SherdogBaseObject mainFighter2 = new SherdogBaseObject(); Element mainFighter2Element = fighters.get(1); mainFighter2.setSherdogUrl(mainFighter2Element.attr("abs:href")); mainFighter2.setName(mainFighter2Element.select("span[itemprop=\"name\"]").html()); Fight mainFight = new Fight(); mainFight.setEvent(sEvent); mainFight.setFighter1(mainFighter1); mainFight.setFighter2(mainFighter2); mainFight.setResult(ParserUtils.getFightResult(mainFightElement.first())); //getting method Elements mainTd = mainFightElement.select("td"); if (mainTd.size() > 0) { mainFight.setWinMethod(mainTd.get(1).html().replaceAll("<em(.*)<br>", "").trim()); mainFight.setWinRound(Integer.parseInt(mainTd.get(3).html().replaceAll("<em(.*)<br>", "").trim())); mainFight.setWinTime(mainTd.get(4).html().replaceAll("<em(.*)<br>", "").trim()); } mainFight.setDate(event.getDate()); fights.add(mainFight); logger.info("Fight added: {}", mainFight); //Checking on card results logger.info("Found {} fights", fights.size()); Elements tds = doc.select(".event_match table tr"); fights.addAll(parseEventFights(tds, event)); event.setFights(fights); }
java
private void getFights(Document doc, Event event) { logger.info("Getting fights for event #{}[{}]", event.getSherdogUrl(), event.getName()); SherdogBaseObject sEvent = new SherdogBaseObject(); sEvent.setName(event.getName()); sEvent.setSherdogUrl(event.getSherdogUrl()); List<Fight> fights = new ArrayList<>(); //Checking on main event Elements mainFightElement = doc.select(".content.event"); Elements fighters = mainFightElement.select("h3 a"); //First fighter SherdogBaseObject mainFighter1 = new SherdogBaseObject(); Element mainFighter1Element = fighters.get(0); mainFighter1.setSherdogUrl(mainFighter1Element.attr("abs:href")); mainFighter1.setName(mainFighter1Element.select("span[itemprop=\"name\"]").html()); //second fighter SherdogBaseObject mainFighter2 = new SherdogBaseObject(); Element mainFighter2Element = fighters.get(1); mainFighter2.setSherdogUrl(mainFighter2Element.attr("abs:href")); mainFighter2.setName(mainFighter2Element.select("span[itemprop=\"name\"]").html()); Fight mainFight = new Fight(); mainFight.setEvent(sEvent); mainFight.setFighter1(mainFighter1); mainFight.setFighter2(mainFighter2); mainFight.setResult(ParserUtils.getFightResult(mainFightElement.first())); //getting method Elements mainTd = mainFightElement.select("td"); if (mainTd.size() > 0) { mainFight.setWinMethod(mainTd.get(1).html().replaceAll("<em(.*)<br>", "").trim()); mainFight.setWinRound(Integer.parseInt(mainTd.get(3).html().replaceAll("<em(.*)<br>", "").trim())); mainFight.setWinTime(mainTd.get(4).html().replaceAll("<em(.*)<br>", "").trim()); } mainFight.setDate(event.getDate()); fights.add(mainFight); logger.info("Fight added: {}", mainFight); //Checking on card results logger.info("Found {} fights", fights.size()); Elements tds = doc.select(".event_match table tr"); fights.addAll(parseEventFights(tds, event)); event.setFights(fights); }
[ "private", "void", "getFights", "(", "Document", "doc", ",", "Event", "event", ")", "{", "logger", ".", "info", "(", "\"Getting fights for event #{}[{}]\"", ",", "event", ".", "getSherdogUrl", "(", ")", ",", "event", ".", "getName", "(", ")", ")", ";", "Sh...
Gets the fight of the event @param doc the jsoup HTML document @param event The current event
[ "Gets", "the", "fight", "of", "the", "event" ]
train
https://github.com/lamarios/sherdog-parser/blob/7cdb36280317caeaaa54db77c04dc4b4e1db053e/src/main/java/com/ftpix/sherdogparser/parsers/EventParser.java#L87-L141
akarnokd/akarnokd-xml
src/main/java/hu/akarnokd/xml/XNElement.java
XNElement.hasName
public boolean hasName(String name, String namespace) { return hasName(name) && Objects.equals(this.namespace, namespace); }
java
public boolean hasName(String name, String namespace) { return hasName(name) && Objects.equals(this.namespace, namespace); }
[ "public", "boolean", "hasName", "(", "String", "name", ",", "String", "namespace", ")", "{", "return", "hasName", "(", "name", ")", "&&", "Objects", ".", "equals", "(", "this", ".", "namespace", ",", "namespace", ")", ";", "}" ]
Test if this XElement has the given name and namespace. @param name the name to test against @param namespace the namespace to test against @return true if the names and namespaces equal
[ "Test", "if", "this", "XElement", "has", "the", "given", "name", "and", "namespace", "." ]
train
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L975-L977
rjeschke/txtmark
src/main/java/com/github/rjeschke/txtmark/Utils.java
Utils.appendCode
public final static void appendCode(final StringBuilder out, final String in, final int start, final int end) { for (int i = start; i < end; i++) { final char c; switch (c = in.charAt(i)) { case '&': out.append("&amp;"); break; case '<': out.append("&lt;"); break; case '>': out.append("&gt;"); break; default: out.append(c); break; } } }
java
public final static void appendCode(final StringBuilder out, final String in, final int start, final int end) { for (int i = start; i < end; i++) { final char c; switch (c = in.charAt(i)) { case '&': out.append("&amp;"); break; case '<': out.append("&lt;"); break; case '>': out.append("&gt;"); break; default: out.append(c); break; } } }
[ "public", "final", "static", "void", "appendCode", "(", "final", "StringBuilder", "out", ",", "final", "String", "in", ",", "final", "int", "start", ",", "final", "int", "end", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "end", ";"...
Appends the given string encoding special HTML characters. @param out The StringBuilder to write to. @param in Input String. @param start Input String starting position. @param end Input String end position.
[ "Appends", "the", "given", "string", "encoding", "special", "HTML", "characters", "." ]
train
https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L449-L470
ical4j/ical4j
src/main/java/net/fortuna/ical4j/util/Dates.java
Dates.getAbsWeekNo
public static int getAbsWeekNo(final java.util.Date date, final int weekNo) { if (weekNo == 0 || weekNo < -MAX_WEEKS_PER_YEAR || weekNo > MAX_WEEKS_PER_YEAR) { throw new IllegalArgumentException(MessageFormat.format(INVALID_WEEK_MESSAGE, weekNo)); } if (weekNo > 0) { return weekNo; } final Calendar cal = Calendar.getInstance(); cal.setTime(date); final int year = cal.get(Calendar.YEAR); // construct a list of possible week numbers.. final List<Integer> weeks = new ArrayList<Integer>(); cal.set(Calendar.WEEK_OF_YEAR, 1); while (cal.get(Calendar.YEAR) == year) { weeks.add(cal.get(Calendar.WEEK_OF_YEAR)); cal.add(Calendar.WEEK_OF_YEAR, 1); } return weeks.get(weeks.size() + weekNo); }
java
public static int getAbsWeekNo(final java.util.Date date, final int weekNo) { if (weekNo == 0 || weekNo < -MAX_WEEKS_PER_YEAR || weekNo > MAX_WEEKS_PER_YEAR) { throw new IllegalArgumentException(MessageFormat.format(INVALID_WEEK_MESSAGE, weekNo)); } if (weekNo > 0) { return weekNo; } final Calendar cal = Calendar.getInstance(); cal.setTime(date); final int year = cal.get(Calendar.YEAR); // construct a list of possible week numbers.. final List<Integer> weeks = new ArrayList<Integer>(); cal.set(Calendar.WEEK_OF_YEAR, 1); while (cal.get(Calendar.YEAR) == year) { weeks.add(cal.get(Calendar.WEEK_OF_YEAR)); cal.add(Calendar.WEEK_OF_YEAR, 1); } return weeks.get(weeks.size() + weekNo); }
[ "public", "static", "int", "getAbsWeekNo", "(", "final", "java", ".", "util", ".", "Date", "date", ",", "final", "int", "weekNo", ")", "{", "if", "(", "weekNo", "==", "0", "||", "weekNo", "<", "-", "MAX_WEEKS_PER_YEAR", "||", "weekNo", ">", "MAX_WEEKS_PE...
Returns the absolute week number for the year specified by the supplied date. Note that a value of zero (0) is invalid for the weekNo parameter and an <code>IllegalArgumentException</code> will be thrown. @param date a date instance representing a week of the year @param weekNo a week number offset @return the absolute week of the year for the specified offset
[ "Returns", "the", "absolute", "week", "number", "for", "the", "year", "specified", "by", "the", "supplied", "date", ".", "Note", "that", "a", "value", "of", "zero", "(", "0", ")", "is", "invalid", "for", "the", "weekNo", "parameter", "and", "an", "<code"...
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/util/Dates.java#L132-L151
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/buffer/factory/CudaDataBufferFactory.java
CudaDataBufferFactory.createHalf
@Override public DataBuffer createHalf(long offset, byte[] data, int length) { return new CudaHalfDataBuffer(ArrayUtil.toFloatArray(data), true, offset); }
java
@Override public DataBuffer createHalf(long offset, byte[] data, int length) { return new CudaHalfDataBuffer(ArrayUtil.toFloatArray(data), true, offset); }
[ "@", "Override", "public", "DataBuffer", "createHalf", "(", "long", "offset", ",", "byte", "[", "]", "data", ",", "int", "length", ")", "{", "return", "new", "CudaHalfDataBuffer", "(", "ArrayUtil", ".", "toFloatArray", "(", "data", ")", ",", "true", ",", ...
Creates a half-precision data buffer @param offset @param data the data to create the buffer from @param length @return the new buffer
[ "Creates", "a", "half", "-", "precision", "data", "buffer" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/buffer/factory/CudaDataBufferFactory.java#L775-L778
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java
MigrationTool.migrate
void migrate() throws RepositoryException { try { LOG.info("Migration started."); moveOldStructure(); service.createStructure(); //Migration order is important due to removal of nodes. migrateGroups(); migrateMembershipTypes(); migrateUsers(); migrateProfiles(); migrateMemberships(); removeOldStructure(); LOG.info("Migration completed."); } catch (Exception e)//NOSONAR { throw new RepositoryException("Migration failed", e); } }
java
void migrate() throws RepositoryException { try { LOG.info("Migration started."); moveOldStructure(); service.createStructure(); //Migration order is important due to removal of nodes. migrateGroups(); migrateMembershipTypes(); migrateUsers(); migrateProfiles(); migrateMemberships(); removeOldStructure(); LOG.info("Migration completed."); } catch (Exception e)//NOSONAR { throw new RepositoryException("Migration failed", e); } }
[ "void", "migrate", "(", ")", "throws", "RepositoryException", "{", "try", "{", "LOG", ".", "info", "(", "\"Migration started.\"", ")", ";", "moveOldStructure", "(", ")", ";", "service", ".", "createStructure", "(", ")", ";", "//Migration order is important due to ...
Method that aggregates all needed migration operations in needed order. @throws RepositoryException
[ "Method", "that", "aggregates", "all", "needed", "migration", "operations", "in", "needed", "order", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MigrationTool.java#L117-L141
azkaban/azkaban
az-core/src/main/java/azkaban/utils/ExecutorServiceUtils.java
ExecutorServiceUtils.gracefulShutdown
public void gracefulShutdown(final ExecutorService service, final Duration timeout) throws InterruptedException { service.shutdown(); // Disable new tasks from being submitted final long timeout_in_unit_of_miliseconds = timeout.toMillis(); // Wait a while for existing tasks to terminate if (!service.awaitTermination(timeout_in_unit_of_miliseconds, MILLI_SECONDS_TIME_UNIT)) { service.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if (!service.awaitTermination(timeout_in_unit_of_miliseconds, MILLI_SECONDS_TIME_UNIT)) { logger.error("The executor service did not terminate."); } } }
java
public void gracefulShutdown(final ExecutorService service, final Duration timeout) throws InterruptedException { service.shutdown(); // Disable new tasks from being submitted final long timeout_in_unit_of_miliseconds = timeout.toMillis(); // Wait a while for existing tasks to terminate if (!service.awaitTermination(timeout_in_unit_of_miliseconds, MILLI_SECONDS_TIME_UNIT)) { service.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if (!service.awaitTermination(timeout_in_unit_of_miliseconds, MILLI_SECONDS_TIME_UNIT)) { logger.error("The executor service did not terminate."); } } }
[ "public", "void", "gracefulShutdown", "(", "final", "ExecutorService", "service", ",", "final", "Duration", "timeout", ")", "throws", "InterruptedException", "{", "service", ".", "shutdown", "(", ")", ";", "// Disable new tasks from being submitted", "final", "long", ...
Gracefully shuts down the given executor service. <p>Adopted from <a href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ExecutorService.html"> the Oracle JAVA Documentation. </a> @param service the service to shutdown @param timeout max wait time for the tasks to shutdown. Note that the max wait time is 2 times this value due to the two stages shutdown strategy. @throws InterruptedException if the current thread is interrupted
[ "Gracefully", "shuts", "down", "the", "given", "executor", "service", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/ExecutorServiceUtils.java#L46-L58
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.callService
public void callService(String url, String templateName, Object model, XmlHttpResponse result, Map<String, Object> headers) { doHttpPost(url, templateName, model, result, headers, XmlHttpResponse.CONTENT_TYPE_XML_TEXT_UTF8); setContext(result); }
java
public void callService(String url, String templateName, Object model, XmlHttpResponse result, Map<String, Object> headers) { doHttpPost(url, templateName, model, result, headers, XmlHttpResponse.CONTENT_TYPE_XML_TEXT_UTF8); setContext(result); }
[ "public", "void", "callService", "(", "String", "url", ",", "String", "templateName", ",", "Object", "model", ",", "XmlHttpResponse", "result", ",", "Map", "<", "String", ",", "Object", ">", "headers", ")", "{", "doHttpPost", "(", "url", ",", "templateName",...
Performs POST to supplied url of result of applying template with model. All namespaces registered in this environment will be registered with result. @param url url to post to. @param templateName name of template to use. @param model model for template. @param result result to populate with response. @param headers headers to add.
[ "Performs", "POST", "to", "supplied", "url", "of", "result", "of", "applying", "template", "with", "model", ".", "All", "namespaces", "registered", "in", "this", "environment", "will", "be", "registered", "with", "result", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L247-L250
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/document/Bson.java
Bson.getDateFormatter
public static DateFormat getDateFormatter() { SoftReference<DateFormat> ref = dateFormatter.get(); DateFormat formatter = ref != null ? ref.get() : null; if (formatter == null) { formatter = new SimpleDateFormat(DATE_FORMAT); formatter.setCalendar(new GregorianCalendar(new SimpleTimeZone(0, "GMT"))); dateFormatter.set(new SoftReference<DateFormat>(formatter)); } return formatter; }
java
public static DateFormat getDateFormatter() { SoftReference<DateFormat> ref = dateFormatter.get(); DateFormat formatter = ref != null ? ref.get() : null; if (formatter == null) { formatter = new SimpleDateFormat(DATE_FORMAT); formatter.setCalendar(new GregorianCalendar(new SimpleTimeZone(0, "GMT"))); dateFormatter.set(new SoftReference<DateFormat>(formatter)); } return formatter; }
[ "public", "static", "DateFormat", "getDateFormatter", "(", ")", "{", "SoftReference", "<", "DateFormat", ">", "ref", "=", "dateFormatter", ".", "get", "(", ")", ";", "DateFormat", "formatter", "=", "ref", "!=", "null", "?", "ref", ".", "get", "(", ")", "...
Obtain a {@link DateFormat} object that can be used within the current thread to format {@link Date} objects. @return the formatter; never null
[ "Obtain", "a", "{", "@link", "DateFormat", "}", "object", "that", "can", "be", "used", "within", "the", "current", "thread", "to", "format", "{", "@link", "Date", "}", "objects", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/document/Bson.java#L52-L61
JadiraOrg/jadira
cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java
UnsafeOperations.putByte
public final void putByte(Object parent, long offset, byte value) { THE_UNSAFE.putByte(parent, offset, value); }
java
public final void putByte(Object parent, long offset, byte value) { THE_UNSAFE.putByte(parent, offset, value); }
[ "public", "final", "void", "putByte", "(", "Object", "parent", ",", "long", "offset", ",", "byte", "value", ")", "{", "THE_UNSAFE", ".", "putByte", "(", "parent", ",", "offset", ",", "value", ")", ";", "}" ]
Puts the value at the given offset of the supplied parent object @param parent The Object's parent @param offset The offset @param value byte to be put
[ "Puts", "the", "value", "at", "the", "given", "offset", "of", "the", "supplied", "parent", "object" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L1023-L1025
Erudika/para
para-core/src/main/java/com/erudika/para/utils/Utils.java
Utils.formatMessage
public static String formatMessage(String msg, Object... params) { try { // required by MessageFormat, single quotes break string interpolation! msg = StringUtils.replace(msg, "'", "''"); return StringUtils.isBlank(msg) ? "" : MessageFormat.format(msg, params); } catch (IllegalArgumentException e) { return msg; } }
java
public static String formatMessage(String msg, Object... params) { try { // required by MessageFormat, single quotes break string interpolation! msg = StringUtils.replace(msg, "'", "''"); return StringUtils.isBlank(msg) ? "" : MessageFormat.format(msg, params); } catch (IllegalArgumentException e) { return msg; } }
[ "public", "static", "String", "formatMessage", "(", "String", "msg", ",", "Object", "...", "params", ")", "{", "try", "{", "// required by MessageFormat, single quotes break string interpolation!", "msg", "=", "StringUtils", ".", "replace", "(", "msg", ",", "\"'\"", ...
Formats a messages containing {0}, {1}... etc. Used for translation. @param msg a message with placeholders @param params objects used to populate the placeholders @return a formatted message
[ "Formats", "a", "messages", "containing", "{", "0", "}", "{", "1", "}", "...", "etc", ".", "Used", "for", "translation", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Utils.java#L375-L383
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/OrcDataSourceUtils.java
OrcDataSourceUtils.getDiskRangeSlice
public static Slice getDiskRangeSlice(DiskRange diskRange, Map<DiskRange, byte[]> buffers) { for (Entry<DiskRange, byte[]> bufferEntry : buffers.entrySet()) { DiskRange bufferRange = bufferEntry.getKey(); byte[] buffer = bufferEntry.getValue(); if (bufferRange.contains(diskRange)) { int offset = toIntExact(diskRange.getOffset() - bufferRange.getOffset()); return Slices.wrappedBuffer(buffer, offset, diskRange.getLength()); } } throw new IllegalStateException("No matching buffer for disk range"); }
java
public static Slice getDiskRangeSlice(DiskRange diskRange, Map<DiskRange, byte[]> buffers) { for (Entry<DiskRange, byte[]> bufferEntry : buffers.entrySet()) { DiskRange bufferRange = bufferEntry.getKey(); byte[] buffer = bufferEntry.getValue(); if (bufferRange.contains(diskRange)) { int offset = toIntExact(diskRange.getOffset() - bufferRange.getOffset()); return Slices.wrappedBuffer(buffer, offset, diskRange.getLength()); } } throw new IllegalStateException("No matching buffer for disk range"); }
[ "public", "static", "Slice", "getDiskRangeSlice", "(", "DiskRange", "diskRange", ",", "Map", "<", "DiskRange", ",", "byte", "[", "]", ">", "buffers", ")", "{", "for", "(", "Entry", "<", "DiskRange", ",", "byte", "[", "]", ">", "bufferEntry", ":", "buffer...
Get a slice for the disk range from the provided buffers. The buffers ranges do not have to exactly match {@code diskRange}, but {@code diskRange} must be completely contained within one of the buffer ranges.
[ "Get", "a", "slice", "for", "the", "disk", "range", "from", "the", "provided", "buffers", ".", "The", "buffers", "ranges", "do", "not", "have", "to", "exactly", "match", "{" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/OrcDataSourceUtils.java#L79-L90
sualeh/magnetictrackparser
src/main/java/us/fatehi/magnetictrack/bankcard/Track3.java
Track3.from
public static Track3 from(final String rawTrackData) { final Matcher matcher = track3Pattern.matcher(trimToEmpty(rawTrackData)); final String rawTrack3Data; final String discretionaryData; if (matcher.matches()) { rawTrack3Data = getGroup(matcher, 1); discretionaryData = getGroup(matcher, 2); } else { rawTrack3Data = null; discretionaryData = ""; } return new Track3(rawTrack3Data, discretionaryData); }
java
public static Track3 from(final String rawTrackData) { final Matcher matcher = track3Pattern.matcher(trimToEmpty(rawTrackData)); final String rawTrack3Data; final String discretionaryData; if (matcher.matches()) { rawTrack3Data = getGroup(matcher, 1); discretionaryData = getGroup(matcher, 2); } else { rawTrack3Data = null; discretionaryData = ""; } return new Track3(rawTrack3Data, discretionaryData); }
[ "public", "static", "Track3", "from", "(", "final", "String", "rawTrackData", ")", "{", "final", "Matcher", "matcher", "=", "track3Pattern", ".", "matcher", "(", "trimToEmpty", "(", "rawTrackData", ")", ")", ";", "final", "String", "rawTrack3Data", ";", "final...
Parses magnetic track 3 data into a Track3 object. @param rawTrackData Raw track data as a string. Can include newlines, and other tracks as well. @return A Track3instance, corresponding to the parsed data.
[ "Parses", "magnetic", "track", "3", "data", "into", "a", "Track3", "object", "." ]
train
https://github.com/sualeh/magnetictrackparser/blob/1da8ff20ac6269b1d523875157278978ba71d260/src/main/java/us/fatehi/magnetictrack/bankcard/Track3.java#L50-L67
zxing/zxing
android/src/com/google/zxing/client/android/CaptureActivity.java
CaptureActivity.drawResultPoints
private void drawResultPoints(Bitmap barcode, float scaleFactor, Result rawResult) { ResultPoint[] points = rawResult.getResultPoints(); if (points != null && points.length > 0) { Canvas canvas = new Canvas(barcode); Paint paint = new Paint(); paint.setColor(getResources().getColor(R.color.result_points)); if (points.length == 2) { paint.setStrokeWidth(4.0f); drawLine(canvas, paint, points[0], points[1], scaleFactor); } else if (points.length == 4 && (rawResult.getBarcodeFormat() == BarcodeFormat.UPC_A || rawResult.getBarcodeFormat() == BarcodeFormat.EAN_13)) { // Hacky special case -- draw two lines, for the barcode and metadata drawLine(canvas, paint, points[0], points[1], scaleFactor); drawLine(canvas, paint, points[2], points[3], scaleFactor); } else { paint.setStrokeWidth(10.0f); for (ResultPoint point : points) { if (point != null) { canvas.drawPoint(scaleFactor * point.getX(), scaleFactor * point.getY(), paint); } } } } }
java
private void drawResultPoints(Bitmap barcode, float scaleFactor, Result rawResult) { ResultPoint[] points = rawResult.getResultPoints(); if (points != null && points.length > 0) { Canvas canvas = new Canvas(barcode); Paint paint = new Paint(); paint.setColor(getResources().getColor(R.color.result_points)); if (points.length == 2) { paint.setStrokeWidth(4.0f); drawLine(canvas, paint, points[0], points[1], scaleFactor); } else if (points.length == 4 && (rawResult.getBarcodeFormat() == BarcodeFormat.UPC_A || rawResult.getBarcodeFormat() == BarcodeFormat.EAN_13)) { // Hacky special case -- draw two lines, for the barcode and metadata drawLine(canvas, paint, points[0], points[1], scaleFactor); drawLine(canvas, paint, points[2], points[3], scaleFactor); } else { paint.setStrokeWidth(10.0f); for (ResultPoint point : points) { if (point != null) { canvas.drawPoint(scaleFactor * point.getX(), scaleFactor * point.getY(), paint); } } } } }
[ "private", "void", "drawResultPoints", "(", "Bitmap", "barcode", ",", "float", "scaleFactor", ",", "Result", "rawResult", ")", "{", "ResultPoint", "[", "]", "points", "=", "rawResult", ".", "getResultPoints", "(", ")", ";", "if", "(", "points", "!=", "null",...
Superimpose a line for 1D or dots for 2D to highlight the key features of the barcode. @param barcode A bitmap of the captured image. @param scaleFactor amount by which thumbnail was scaled @param rawResult The decoded results which contains the points to draw.
[ "Superimpose", "a", "line", "for", "1D", "or", "dots", "for", "2D", "to", "highlight", "the", "key", "features", "of", "the", "barcode", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/CaptureActivity.java#L491-L515
cdk/cdk
legacy/src/main/java/org/openscience/cdk/math/qm/OneElectronJob.java
OneElectronJob.calculateV
private Matrix calculateV(IBasis basis) { int size = basis.getSize(); Matrix V = new Matrix(size, size); int i, j; for (i = 0; i < size; i++) for (j = 0; j < size; j++) V.matrix[i][j] = basis.calcV(i, j); return V; }
java
private Matrix calculateV(IBasis basis) { int size = basis.getSize(); Matrix V = new Matrix(size, size); int i, j; for (i = 0; i < size; i++) for (j = 0; j < size; j++) V.matrix[i][j] = basis.calcV(i, j); return V; }
[ "private", "Matrix", "calculateV", "(", "IBasis", "basis", ")", "{", "int", "size", "=", "basis", ".", "getSize", "(", ")", ";", "Matrix", "V", "=", "new", "Matrix", "(", "size", ",", "size", ")", ";", "int", "i", ",", "j", ";", "for", "(", "i", ...
Calculates the matrix for the potential matrix V_i,j = <chi_i | 1/r | chi_j>
[ "Calculates", "the", "matrix", "for", "the", "potential", "matrix" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/math/qm/OneElectronJob.java#L119-L128
thiagokimo/Faker
faker-core/src/main/java/io/kimo/lib/faker/Faker.java
Faker.fillWithProgress
public void fillWithProgress(ProgressBar view, FakerNumericComponent component) { validateNotNullableView(view); validateIfIsAProgressBar(view); validateNotNullableFakerComponent(component); view.setProgress(Math.abs(component.randomNumber().intValue())); }
java
public void fillWithProgress(ProgressBar view, FakerNumericComponent component) { validateNotNullableView(view); validateIfIsAProgressBar(view); validateNotNullableFakerComponent(component); view.setProgress(Math.abs(component.randomNumber().intValue())); }
[ "public", "void", "fillWithProgress", "(", "ProgressBar", "view", ",", "FakerNumericComponent", "component", ")", "{", "validateNotNullableView", "(", "view", ")", ";", "validateIfIsAProgressBar", "(", "view", ")", ";", "validateNotNullableFakerComponent", "(", "compone...
Fill a @{link ProgressBar} with a random progress @param view @param component
[ "Fill", "a" ]
train
https://github.com/thiagokimo/Faker/blob/8b0eccd499817a2bc3377db0c6e1b50736d0f034/faker-core/src/main/java/io/kimo/lib/faker/Faker.java#L177-L183
jcustenborder/connect-utils
connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ValidPort.java
ValidPort.ensureValid
@Override public void ensureValid(String setting, Object value) { if (null == value || !(value instanceof Integer)) { throw new ConfigException(setting, "Must be an integer."); } final Integer port = (Integer) value; if (!(port >= this.start && port <= this.end)) { throw new ConfigException( setting, String.format("(%s) must be between %s and %s.", port, this.start, this.end) ); } }
java
@Override public void ensureValid(String setting, Object value) { if (null == value || !(value instanceof Integer)) { throw new ConfigException(setting, "Must be an integer."); } final Integer port = (Integer) value; if (!(port >= this.start && port <= this.end)) { throw new ConfigException( setting, String.format("(%s) must be between %s and %s.", port, this.start, this.end) ); } }
[ "@", "Override", "public", "void", "ensureValid", "(", "String", "setting", ",", "Object", "value", ")", "{", "if", "(", "null", "==", "value", "||", "!", "(", "value", "instanceof", "Integer", ")", ")", "{", "throw", "new", "ConfigException", "(", "sett...
Method is used to validate that the supplied port is within the valid range. @param setting name of the setting being tested. @param value value being tested.
[ "Method", "is", "used", "to", "validate", "that", "the", "supplied", "port", "is", "within", "the", "valid", "range", "." ]
train
https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ValidPort.java#L75-L88
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/Type1Font.java
Type1Font.getRawWidth
int getRawWidth(int c, String name) { Object metrics[]; if (name == null) { // font specific metrics = (Object[])CharMetrics.get(Integer.valueOf(c)); } else { if (name.equals(".notdef")) return 0; metrics = (Object[])CharMetrics.get(name); } if (metrics != null) return ((Integer)(metrics[1])).intValue(); return 0; }
java
int getRawWidth(int c, String name) { Object metrics[]; if (name == null) { // font specific metrics = (Object[])CharMetrics.get(Integer.valueOf(c)); } else { if (name.equals(".notdef")) return 0; metrics = (Object[])CharMetrics.get(name); } if (metrics != null) return ((Integer)(metrics[1])).intValue(); return 0; }
[ "int", "getRawWidth", "(", "int", "c", ",", "String", "name", ")", "{", "Object", "metrics", "[", "]", ";", "if", "(", "name", "==", "null", ")", "{", "// font specific", "metrics", "=", "(", "Object", "[", "]", ")", "CharMetrics", ".", "get", "(", ...
Gets the width from the font according to the <CODE>name</CODE> or, if the <CODE>name</CODE> is null, meaning it is a symbolic font, the char <CODE>c</CODE>. @param c the char if the font is symbolic @param name the glyph name @return the width of the char
[ "Gets", "the", "width", "from", "the", "font", "according", "to", "the", "<CODE", ">", "name<", "/", "CODE", ">", "or", "if", "the", "<CODE", ">", "name<", "/", "CODE", ">", "is", "null", "meaning", "it", "is", "a", "symbolic", "font", "the", "char",...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/Type1Font.java#L295-L308
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java
BookKeeperLog.getWritesToExecute
private List<Write> getWritesToExecute() { // Calculate how much estimated space there is in the current ledger. final long maxTotalSize = this.config.getBkLedgerMaxSize() - getWriteLedger().ledger.getLength(); // Get the writes to execute from the queue. List<Write> toExecute = this.writes.getWritesToExecute(maxTotalSize); // Check to see if any writes executed on closed ledgers, in which case they either need to be failed (if deemed // appropriate, or retried). if (handleClosedLedgers(toExecute)) { // If any changes were made to the Writes in the list, re-do the search to get a more accurate list of Writes // to execute (since some may have changed Ledgers, more writes may not be eligible for execution). toExecute = this.writes.getWritesToExecute(maxTotalSize); } return toExecute; }
java
private List<Write> getWritesToExecute() { // Calculate how much estimated space there is in the current ledger. final long maxTotalSize = this.config.getBkLedgerMaxSize() - getWriteLedger().ledger.getLength(); // Get the writes to execute from the queue. List<Write> toExecute = this.writes.getWritesToExecute(maxTotalSize); // Check to see if any writes executed on closed ledgers, in which case they either need to be failed (if deemed // appropriate, or retried). if (handleClosedLedgers(toExecute)) { // If any changes were made to the Writes in the list, re-do the search to get a more accurate list of Writes // to execute (since some may have changed Ledgers, more writes may not be eligible for execution). toExecute = this.writes.getWritesToExecute(maxTotalSize); } return toExecute; }
[ "private", "List", "<", "Write", ">", "getWritesToExecute", "(", ")", "{", "// Calculate how much estimated space there is in the current ledger.", "final", "long", "maxTotalSize", "=", "this", ".", "config", ".", "getBkLedgerMaxSize", "(", ")", "-", "getWriteLedger", "...
Collects an ordered list of Writes to execute to BookKeeper. @return The list of Writes to execute.
[ "Collects", "an", "ordered", "list", "of", "Writes", "to", "execute", "to", "BookKeeper", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java#L416-L432
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/junit/jupiter/CitrusBaseExtension.java
CitrusBaseExtension.packageScan
public static Stream<DynamicTest> packageScan(String ... packagesToScan) { List<DynamicTest> tests = new ArrayList<>(); for (String packageScan : packagesToScan) { try { for (String fileNamePattern : Citrus.getXmlTestFileNamePattern()) { Resource[] fileResources = new PathMatchingResourcePatternResolver().getResources(packageScan.replace('.', File.separatorChar) + fileNamePattern); for (Resource fileResource : fileResources) { String filePath = fileResource.getFile().getParentFile().getCanonicalPath(); if (packageScan.startsWith("file:")) { filePath = "file:" + filePath; } filePath = filePath.substring(filePath.indexOf(packageScan.replace('.', File.separatorChar))); String testName = fileResource.getFilename().substring(0, fileResource.getFilename().length() - ".xml".length()); XmlTestLoader testLoader = new XmlTestLoader(DynamicTest.class, testName, filePath, citrus.getApplicationContext()); tests.add(DynamicTest.dynamicTest(testName, () -> citrus.run(testLoader.load()))); } } } catch (IOException e) { throw new CitrusRuntimeException("Unable to locate file resources for test package '" + packageScan + "'", e); } } return tests.stream(); }
java
public static Stream<DynamicTest> packageScan(String ... packagesToScan) { List<DynamicTest> tests = new ArrayList<>(); for (String packageScan : packagesToScan) { try { for (String fileNamePattern : Citrus.getXmlTestFileNamePattern()) { Resource[] fileResources = new PathMatchingResourcePatternResolver().getResources(packageScan.replace('.', File.separatorChar) + fileNamePattern); for (Resource fileResource : fileResources) { String filePath = fileResource.getFile().getParentFile().getCanonicalPath(); if (packageScan.startsWith("file:")) { filePath = "file:" + filePath; } filePath = filePath.substring(filePath.indexOf(packageScan.replace('.', File.separatorChar))); String testName = fileResource.getFilename().substring(0, fileResource.getFilename().length() - ".xml".length()); XmlTestLoader testLoader = new XmlTestLoader(DynamicTest.class, testName, filePath, citrus.getApplicationContext()); tests.add(DynamicTest.dynamicTest(testName, () -> citrus.run(testLoader.load()))); } } } catch (IOException e) { throw new CitrusRuntimeException("Unable to locate file resources for test package '" + packageScan + "'", e); } } return tests.stream(); }
[ "public", "static", "Stream", "<", "DynamicTest", ">", "packageScan", "(", "String", "...", "packagesToScan", ")", "{", "List", "<", "DynamicTest", ">", "tests", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "packageScan", ":", "packa...
Creates stream of dynamic tests based on package scan. Scans package for all Xml test case files and creates dynamic test instance for it. @param packagesToScan @return
[ "Creates", "stream", "of", "dynamic", "tests", "based", "on", "package", "scan", ".", "Scans", "package", "for", "all", "Xml", "test", "case", "files", "and", "creates", "dynamic", "test", "instance", "for", "it", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/junit/jupiter/CitrusBaseExtension.java#L190-L218
Bernardo-MG/repository-pattern-java
src/main/java/com/wandrell/pattern/repository/spring/SpringJdbcRepository.java
SpringJdbcRepository.getEntity
@Override public final V getEntity(final NamedParameterQueryData query) { V entity; // Entity acquired from the query checkNotNull(query, "Received a null pointer as the query"); // Tries to acquire the entity try { entity = getTemplate().queryForObject(query.getQuery(), query.getParameters(), BeanPropertyRowMapper.newInstance(getType())); } catch (final EmptyResultDataAccessException exception) { entity = null; } return entity; }
java
@Override public final V getEntity(final NamedParameterQueryData query) { V entity; // Entity acquired from the query checkNotNull(query, "Received a null pointer as the query"); // Tries to acquire the entity try { entity = getTemplate().queryForObject(query.getQuery(), query.getParameters(), BeanPropertyRowMapper.newInstance(getType())); } catch (final EmptyResultDataAccessException exception) { entity = null; } return entity; }
[ "@", "Override", "public", "final", "V", "getEntity", "(", "final", "NamedParameterQueryData", "query", ")", "{", "V", "entity", ";", "// Entity acquired from the query", "checkNotNull", "(", "query", ",", "\"Received a null pointer as the query\"", ")", ";", "// Tries ...
Queries the entities in the repository and returns a single one. <p> The entity is acquired by building a query from the received {@code QueryData} and executing it. @param query the query user to acquire the entities @return the queried entity
[ "Queries", "the", "entities", "in", "the", "repository", "and", "returns", "a", "single", "one", ".", "<p", ">", "The", "entity", "is", "acquired", "by", "building", "a", "query", "from", "the", "received", "{", "@code", "QueryData", "}", "and", "executing...
train
https://github.com/Bernardo-MG/repository-pattern-java/blob/e94d5bbf9aeeb45acc8485f3686a6e791b082ea8/src/main/java/com/wandrell/pattern/repository/spring/SpringJdbcRepository.java#L342-L358
xcesco/kripton
kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/commons/IOUtils.java
IOUtils.readTextFile
public static String readTextFile(Context context, int resId) { InputStream inputStream = context.getResources().openRawResource(resId); return readText(inputStream); }
java
public static String readTextFile(Context context, int resId) { InputStream inputStream = context.getResources().openRawResource(resId); return readText(inputStream); }
[ "public", "static", "String", "readTextFile", "(", "Context", "context", ",", "int", "resId", ")", "{", "InputStream", "inputStream", "=", "context", ".", "getResources", "(", ")", ".", "openRawResource", "(", "resId", ")", ";", "return", "readText", "(", "i...
Read text file. @param context the context @param resId the res id @return the string
[ "Read", "text", "file", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-orm/src/main/java/com/abubusoft/kripton/android/sqlite/commons/IOUtils.java#L66-L70
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/ShipmentUrl.java
ShipmentUrl.deleteShipmentUrl
public static MozuUrl deleteShipmentUrl(String orderId, String shipmentId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/shipments/{shipmentId}"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("shipmentId", shipmentId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl deleteShipmentUrl(String orderId, String shipmentId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/shipments/{shipmentId}"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("shipmentId", shipmentId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "deleteShipmentUrl", "(", "String", "orderId", ",", "String", "shipmentId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/orders/{orderId}/shipments/{shipmentId}\"", ")", ";", "formatter", ".", "f...
Get Resource Url for DeleteShipment @param orderId Unique identifier of the order. @param shipmentId Unique identifier of the shipment to retrieve. @return String Resource Url
[ "Get", "Resource", "Url", "for", "DeleteShipment" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/ShipmentUrl.java#L64-L70
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.serviceName_glueRecord_GET
public ArrayList<String> serviceName_glueRecord_GET(String serviceName, String host) throws IOException { String qPath = "/domain/{serviceName}/glueRecord"; StringBuilder sb = path(qPath, serviceName); query(sb, "host", host); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<String> serviceName_glueRecord_GET(String serviceName, String host) throws IOException { String qPath = "/domain/{serviceName}/glueRecord"; StringBuilder sb = path(qPath, serviceName); query(sb, "host", host); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "String", ">", "serviceName_glueRecord_GET", "(", "String", "serviceName", ",", "String", "host", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/{serviceName}/glueRecord\"", ";", "StringBuilder", "sb", "=", "path", ...
List of glue record REST: GET /domain/{serviceName}/glueRecord @param host [required] Filter the value of host property (like) @param serviceName [required] The internal name of your domain
[ "List", "of", "glue", "record" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1243-L1249
netty/netty
common/src/main/java/io/netty/util/internal/PromiseNotificationUtil.java
PromiseNotificationUtil.tryFailure
public static void tryFailure(Promise<?> p, Throwable cause, InternalLogger logger) { if (!p.tryFailure(cause) && logger != null) { Throwable err = p.cause(); if (err == null) { logger.warn("Failed to mark a promise as failure because it has succeeded already: {}", p, cause); } else { logger.warn( "Failed to mark a promise as failure because it has failed already: {}, unnotified cause: {}", p, ThrowableUtil.stackTraceToString(err), cause); } } }
java
public static void tryFailure(Promise<?> p, Throwable cause, InternalLogger logger) { if (!p.tryFailure(cause) && logger != null) { Throwable err = p.cause(); if (err == null) { logger.warn("Failed to mark a promise as failure because it has succeeded already: {}", p, cause); } else { logger.warn( "Failed to mark a promise as failure because it has failed already: {}, unnotified cause: {}", p, ThrowableUtil.stackTraceToString(err), cause); } } }
[ "public", "static", "void", "tryFailure", "(", "Promise", "<", "?", ">", "p", ",", "Throwable", "cause", ",", "InternalLogger", "logger", ")", "{", "if", "(", "!", "p", ".", "tryFailure", "(", "cause", ")", "&&", "logger", "!=", "null", ")", "{", "Th...
Try to mark the {@link Promise} as failure and log if {@code logger} is not {@code null} in case this fails.
[ "Try", "to", "mark", "the", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PromiseNotificationUtil.java#L63-L74
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.java
OWLSymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLSymmetricObjectPropertyAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLSymmetricObjectPropertyAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLSymmetricObjectPropertyAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}"...
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSymmetricObjectPropertyAxiomImpl_CustomFieldSerializer.java#L73-L76
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
IdentityPatchContext.writePatch
static void writePatch(final Patch rollbackPatch, final File file) throws IOException { final File parent = file.getParentFile(); if (!parent.isDirectory()) { if (!parent.mkdirs() && !parent.exists()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath()); } } try { try (final OutputStream os = new FileOutputStream(file)){ PatchXml.marshal(os, rollbackPatch); } } catch (XMLStreamException e) { throw new IOException(e); } }
java
static void writePatch(final Patch rollbackPatch, final File file) throws IOException { final File parent = file.getParentFile(); if (!parent.isDirectory()) { if (!parent.mkdirs() && !parent.exists()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath()); } } try { try (final OutputStream os = new FileOutputStream(file)){ PatchXml.marshal(os, rollbackPatch); } } catch (XMLStreamException e) { throw new IOException(e); } }
[ "static", "void", "writePatch", "(", "final", "Patch", "rollbackPatch", ",", "final", "File", "file", ")", "throws", "IOException", "{", "final", "File", "parent", "=", "file", ".", "getParentFile", "(", ")", ";", "if", "(", "!", "parent", ".", "isDirector...
Write the patch.xml @param rollbackPatch the patch @param file the target file @throws IOException
[ "Write", "the", "patch", ".", "xml" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L1073-L1087
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPOptionCategoryUtil.java
CPOptionCategoryUtil.removeByUUID_G
public static CPOptionCategory removeByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPOptionCategoryException { return getPersistence().removeByUUID_G(uuid, groupId); }
java
public static CPOptionCategory removeByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPOptionCategoryException { return getPersistence().removeByUUID_G(uuid, groupId); }
[ "public", "static", "CPOptionCategory", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "product", ".", "exception", ".", "NoSuchCPOptionCategoryException", "{", "return", "getPersistence",...
Removes the cp option category where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the cp option category that was removed
[ "Removes", "the", "cp", "option", "category", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPOptionCategoryUtil.java#L315-L318
alkacon/opencms-core
src/org/opencms/cmis/CmsCmisRelationHelper.java
CmsCmisRelationHelper.parseRelationKey
protected RelationKey parseRelationKey(String id) { Matcher matcher = RELATION_PATTERN.matcher(id); matcher.find(); CmsUUID src = new CmsUUID(matcher.group(1)); CmsUUID tgt = new CmsUUID(matcher.group(2)); String tp = matcher.group(3); return new RelationKey(src, tgt, tp); }
java
protected RelationKey parseRelationKey(String id) { Matcher matcher = RELATION_PATTERN.matcher(id); matcher.find(); CmsUUID src = new CmsUUID(matcher.group(1)); CmsUUID tgt = new CmsUUID(matcher.group(2)); String tp = matcher.group(3); return new RelationKey(src, tgt, tp); }
[ "protected", "RelationKey", "parseRelationKey", "(", "String", "id", ")", "{", "Matcher", "matcher", "=", "RELATION_PATTERN", ".", "matcher", "(", "id", ")", ";", "matcher", ".", "find", "(", ")", ";", "CmsUUID", "src", "=", "new", "CmsUUID", "(", "matcher...
Extracts the source/target ids and the type from a relation id.<p> @param id the relation id @return the relation key object
[ "Extracts", "the", "source", "/", "target", "ids", "and", "the", "type", "from", "a", "relation", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisRelationHelper.java#L583-L591
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java
FindbugsPlugin.getProjectPreferences
public static UserPreferences getProjectPreferences(IProject project, boolean forceRead) { try { UserPreferences prefs = (UserPreferences) project.getSessionProperty(SESSION_PROPERTY_USERPREFS); if (prefs == null || forceRead) { prefs = readUserPreferences(project); if (prefs == null) { prefs = getWorkspacePreferences().clone(); } project.setSessionProperty(SESSION_PROPERTY_USERPREFS, prefs); } return prefs; } catch (CoreException e) { FindbugsPlugin.getDefault().logException(e, "Error getting SpotBugs preferences for project"); return getWorkspacePreferences().clone(); } }
java
public static UserPreferences getProjectPreferences(IProject project, boolean forceRead) { try { UserPreferences prefs = (UserPreferences) project.getSessionProperty(SESSION_PROPERTY_USERPREFS); if (prefs == null || forceRead) { prefs = readUserPreferences(project); if (prefs == null) { prefs = getWorkspacePreferences().clone(); } project.setSessionProperty(SESSION_PROPERTY_USERPREFS, prefs); } return prefs; } catch (CoreException e) { FindbugsPlugin.getDefault().logException(e, "Error getting SpotBugs preferences for project"); return getWorkspacePreferences().clone(); } }
[ "public", "static", "UserPreferences", "getProjectPreferences", "(", "IProject", "project", ",", "boolean", "forceRead", ")", "{", "try", "{", "UserPreferences", "prefs", "=", "(", "UserPreferences", ")", "project", ".", "getSessionProperty", "(", "SESSION_PROPERTY_US...
Get project own preferences set. @param project must be non null, exist and be opened @param forceRead @return current project preferences, independently if project preferences are enabled or disabled for given project.
[ "Get", "project", "own", "preferences", "set", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L907-L922
redkale/redkale
src/org/redkale/util/ResourceFactory.java
ResourceFactory.register
public <A> A register(final Class<? extends A> clazz, final A rs) { return register(true, clazz, rs); }
java
public <A> A register(final Class<? extends A> clazz, final A rs) { return register(true, clazz, rs); }
[ "public", "<", "A", ">", "A", "register", "(", "final", "Class", "<", "?", "extends", "A", ">", "clazz", ",", "final", "A", "rs", ")", "{", "return", "register", "(", "true", ",", "clazz", ",", "rs", ")", ";", "}" ]
将对象指定类型且name=""注入到资源池中,并同步已被注入的资源 @param <A> 泛型 @param clazz 资源类型 @param rs 资源对象 @return 旧资源对象
[ "将对象指定类型且name", "=", "注入到资源池中,并同步已被注入的资源" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/util/ResourceFactory.java#L120-L122
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java
BytecodeUtils.nullCoalesce
public static void nullCoalesce(CodeBuilder builder, Label nullExit) { builder.dup(); Label nonNull = new Label(); builder.ifNonNull(nonNull); // See http://mail.ow2.org/wws/arc/asm/2016-02/msg00001.html for a discussion of this pattern // but even though the value at the top of the stack here is null, its type isn't. So we need // to pop and push. This is the idiomatic pattern. builder.pop(); builder.pushNull(); builder.goTo(nullExit); builder.mark(nonNull); }
java
public static void nullCoalesce(CodeBuilder builder, Label nullExit) { builder.dup(); Label nonNull = new Label(); builder.ifNonNull(nonNull); // See http://mail.ow2.org/wws/arc/asm/2016-02/msg00001.html for a discussion of this pattern // but even though the value at the top of the stack here is null, its type isn't. So we need // to pop and push. This is the idiomatic pattern. builder.pop(); builder.pushNull(); builder.goTo(nullExit); builder.mark(nonNull); }
[ "public", "static", "void", "nullCoalesce", "(", "CodeBuilder", "builder", ",", "Label", "nullExit", ")", "{", "builder", ".", "dup", "(", ")", ";", "Label", "nonNull", "=", "new", "Label", "(", ")", ";", "builder", ".", "ifNonNull", "(", "nonNull", ")",...
Outputs bytecode that will test the item at the top of the stack for null, and branch to {@code nullExit} if it is {@code null}. At {@code nullSafeExit} there will be a null value at the top of the stack.
[ "Outputs", "bytecode", "that", "will", "test", "the", "item", "at", "the", "top", "of", "the", "stack", "for", "null", "and", "branch", "to", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java#L821-L832
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/MessageUtils.java
MessageUtils.getMessage
public static FacesMessage getMessage(String bundleBaseName, String messageId, Object params[]) { return getMessage(bundleBaseName, getCurrentLocale(), messageId, params); }
java
public static FacesMessage getMessage(String bundleBaseName, String messageId, Object params[]) { return getMessage(bundleBaseName, getCurrentLocale(), messageId, params); }
[ "public", "static", "FacesMessage", "getMessage", "(", "String", "bundleBaseName", ",", "String", "messageId", ",", "Object", "params", "[", "]", ")", "{", "return", "getMessage", "(", "bundleBaseName", ",", "getCurrentLocale", "(", ")", ",", "messageId", ",", ...
Retrieve the message from a specific bundle. It does not look on application message bundle or default message bundle. If it is required to look on those bundles use getMessageFromBundle instead @param bundleBaseName baseName of ResourceBundle to load localized messages @param messageId id of message @param params parameters to set at localized message @return generated FacesMessage
[ "Retrieve", "the", "message", "from", "a", "specific", "bundle", ".", "It", "does", "not", "look", "on", "application", "message", "bundle", "or", "default", "message", "bundle", ".", "If", "it", "is", "required", "to", "look", "on", "those", "bundles", "u...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/MessageUtils.java#L452-L455