repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java
RDBMEntityGroupStore.findParentGroups
public java.util.Iterator findParentGroups(IEntity ent) throws GroupsException { String memberKey = ent.getKey(); Integer type = EntityTypesLocator.getEntityTypes().getEntityIDFromType(ent.getLeafType()); return findParentGroupsForEntity(memberKey, type.intValue()); }
java
public java.util.Iterator findParentGroups(IEntity ent) throws GroupsException { String memberKey = ent.getKey(); Integer type = EntityTypesLocator.getEntityTypes().getEntityIDFromType(ent.getLeafType()); return findParentGroupsForEntity(memberKey, type.intValue()); }
[ "public", "java", ".", "util", ".", "Iterator", "findParentGroups", "(", "IEntity", "ent", ")", "throws", "GroupsException", "{", "String", "memberKey", "=", "ent", ".", "getKey", "(", ")", ";", "Integer", "type", "=", "EntityTypesLocator", ".", "getEntityType...
Find the groups that this entity belongs to. @param ent the entity in question @return java.util.Iterator
[ "Find", "the", "groups", "that", "this", "entity", "belongs", "to", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java#L298-L302
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java
EventHubConnectionsInner.eventhubConnectionValidation
public EventHubConnectionValidationListResultInner eventhubConnectionValidation(String resourceGroupName, String clusterName, String databaseName, EventHubConnectionValidation parameters) { return eventhubConnectionValidationWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).toBlocking().single().body(); }
java
public EventHubConnectionValidationListResultInner eventhubConnectionValidation(String resourceGroupName, String clusterName, String databaseName, EventHubConnectionValidation parameters) { return eventhubConnectionValidationWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).toBlocking().single().body(); }
[ "public", "EventHubConnectionValidationListResultInner", "eventhubConnectionValidation", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ",", "EventHubConnectionValidation", "parameters", ")", "{", "return", "eventhubConnectionVali...
Checks that the Event Hub data connection parameters are valid. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param parameters The Event Hub connection parameters supplied to the CreateOrUpdate 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 EventHubConnectionValidationListResultInner object if successful.
[ "Checks", "that", "the", "Event", "Hub", "data", "connection", "parameters", "are", "valid", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L211-L213
aehrc/snorocket
snorocket-core/src/main/java/au/csiro/snorocket/core/concurrent/Context.java
Context.processExternalEdge
public void processExternalEdge(final int role, final int src) { externalQueue.add(new IRoleQueueEntry() { /** * Serialisation version. */ private static final long serialVersionUID = 1L; @Override public int getR() { return role; } @Override public int getB() { return src; } }); }
java
public void processExternalEdge(final int role, final int src) { externalQueue.add(new IRoleQueueEntry() { /** * Serialisation version. */ private static final long serialVersionUID = 1L; @Override public int getR() { return role; } @Override public int getB() { return src; } }); }
[ "public", "void", "processExternalEdge", "(", "final", "int", "role", ",", "final", "int", "src", ")", "{", "externalQueue", ".", "add", "(", "new", "IRoleQueueEntry", "(", ")", "{", "/**\r\n * Serialisation version.\r\n */", "private", "static...
Triggers the processing of an edge based on events that happened in another {@link Context}. @param role @param src
[ "Triggers", "the", "processing", "of", "an", "edge", "based", "on", "events", "that", "happened", "in", "another", "{", "@link", "Context", "}", "." ]
train
https://github.com/aehrc/snorocket/blob/e33c1e216f8a66d6502e3a14e80876811feedd8b/snorocket-core/src/main/java/au/csiro/snorocket/core/concurrent/Context.java#L370-L387
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.directory.server/src/com/ibm/ws/apacheds/EmbeddedApacheDS.java
EmbeddedApacheDS.addPartition
public Partition addPartition(String partitionId, String partitionDn) throws Exception { Log.info(c, "addPartition", "entry " + partitionId + " " + partitionDn); JdbmPartition partition = new JdbmPartition(this.service.getSchemaManager()); partition.setId(partitionId); partition.setPartitionPath(new File(this.service.getInstanceLayout().getPartitionsDirectory(), partitionId).toURI()); partition.setSuffixDn(new Dn(partitionDn)); service.addPartition(partition); Log.info(c, "addPartition", "exit"); return partition; }
java
public Partition addPartition(String partitionId, String partitionDn) throws Exception { Log.info(c, "addPartition", "entry " + partitionId + " " + partitionDn); JdbmPartition partition = new JdbmPartition(this.service.getSchemaManager()); partition.setId(partitionId); partition.setPartitionPath(new File(this.service.getInstanceLayout().getPartitionsDirectory(), partitionId).toURI()); partition.setSuffixDn(new Dn(partitionDn)); service.addPartition(partition); Log.info(c, "addPartition", "exit"); return partition; }
[ "public", "Partition", "addPartition", "(", "String", "partitionId", ",", "String", "partitionDn", ")", "throws", "Exception", "{", "Log", ".", "info", "(", "c", ",", "\"addPartition\"", ",", "\"entry \"", "+", "partitionId", "+", "\" \"", "+", "partitionDn", ...
Add a new partition to the server @param partitionId The partition ID @param partitionDn The partition DN @return The newly added partition @throws Exception If the partition can't be added
[ "Add", "a", "new", "partition", "to", "the", "server" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.directory.server/src/com/ibm/ws/apacheds/EmbeddedApacheDS.java#L172-L182
rzwitserloot/lombok
src/core/lombok/javac/handlers/JavacHandlerUtil.java
JavacHandlerUtil.injectField
public static JavacNode injectField(JavacNode typeNode, JCVariableDecl field) { return injectField(typeNode, field, false); }
java
public static JavacNode injectField(JavacNode typeNode, JCVariableDecl field) { return injectField(typeNode, field, false); }
[ "public", "static", "JavacNode", "injectField", "(", "JavacNode", "typeNode", ",", "JCVariableDecl", "field", ")", "{", "return", "injectField", "(", "typeNode", ",", "field", ",", "false", ")", ";", "}" ]
Adds the given new field declaration to the provided type AST Node. Also takes care of updating the JavacAST.
[ "Adds", "the", "given", "new", "field", "declaration", "to", "the", "provided", "type", "AST", "Node", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1015-L1017
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/VentoFoggia.java
VentoFoggia.findSubstructure
public static Pattern findSubstructure(IAtomContainer query, AtomMatcher atomMatcher, BondMatcher bondMatcher) { return new VentoFoggia(query, atomMatcher, bondMatcher, true); }
java
public static Pattern findSubstructure(IAtomContainer query, AtomMatcher atomMatcher, BondMatcher bondMatcher) { return new VentoFoggia(query, atomMatcher, bondMatcher, true); }
[ "public", "static", "Pattern", "findSubstructure", "(", "IAtomContainer", "query", ",", "AtomMatcher", "atomMatcher", ",", "BondMatcher", "bondMatcher", ")", "{", "return", "new", "VentoFoggia", "(", "query", ",", "atomMatcher", ",", "bondMatcher", ",", "true", ")...
Create a pattern which can be used to find molecules which contain the {@code query} structure. @param query the substructure to find @param atomMatcher how atoms are matched @param bondMatcher how bonds are matched @return a pattern for finding the {@code query}
[ "Create", "a", "pattern", "which", "can", "be", "used", "to", "find", "molecules", "which", "contain", "the", "{", "@code", "query", "}", "structure", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/VentoFoggia.java#L184-L186
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/PageSection.java
PageSection.simpleFooter
public static Footer simpleFooter(final String text, final TextStyle ts) { return new SimplePageSectionBuilder().text(Text.styledContent(text, ts)).buildFooter(); }
java
public static Footer simpleFooter(final String text, final TextStyle ts) { return new SimplePageSectionBuilder().text(Text.styledContent(text, ts)).buildFooter(); }
[ "public", "static", "Footer", "simpleFooter", "(", "final", "String", "text", ",", "final", "TextStyle", "ts", ")", "{", "return", "new", "SimplePageSectionBuilder", "(", ")", ".", "text", "(", "Text", ".", "styledContent", "(", "text", ",", "ts", ")", ")"...
Create a simple footer, with a styled text @param text the text @param ts the style @return the footer
[ "Create", "a", "simple", "footer", "with", "a", "styled", "text" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/PageSection.java#L105-L107
google/closure-compiler
src/com/google/javascript/jscomp/ProcessClosureProvidesAndRequires.java
ProcessClosureProvidesAndRequires.handleStubDefinition
private void handleStubDefinition(NodeTraversal t, Node n) { if (!t.inGlobalHoistScope()) { return; } JSDocInfo info = n.getFirstChild().getJSDocInfo(); boolean hasStubDefinition = info != null && (n.isFromExterns() || info.hasTypedefType()); if (hasStubDefinition) { if (n.getFirstChild().isQualifiedName()) { String name = n.getFirstChild().getQualifiedName(); ProvidedName pn = providedNames.get(name); if (pn != null) { n.putBooleanProp(Node.WAS_PREVIOUSLY_PROVIDED, true); pn.addDefinition(n, t.getModule()); } else if (n.getBooleanProp(Node.WAS_PREVIOUSLY_PROVIDED)) { // We didn't find it in the providedNames, but it was previously marked as provided. // This implies we're in hotswap pass and the current typedef is a provided namespace. ProvidedName provided = new ProvidedName(name, n, t.getModule(), true, true); providedNames.put(name, provided); provided.addDefinition(n, t.getModule()); } } } }
java
private void handleStubDefinition(NodeTraversal t, Node n) { if (!t.inGlobalHoistScope()) { return; } JSDocInfo info = n.getFirstChild().getJSDocInfo(); boolean hasStubDefinition = info != null && (n.isFromExterns() || info.hasTypedefType()); if (hasStubDefinition) { if (n.getFirstChild().isQualifiedName()) { String name = n.getFirstChild().getQualifiedName(); ProvidedName pn = providedNames.get(name); if (pn != null) { n.putBooleanProp(Node.WAS_PREVIOUSLY_PROVIDED, true); pn.addDefinition(n, t.getModule()); } else if (n.getBooleanProp(Node.WAS_PREVIOUSLY_PROVIDED)) { // We didn't find it in the providedNames, but it was previously marked as provided. // This implies we're in hotswap pass and the current typedef is a provided namespace. ProvidedName provided = new ProvidedName(name, n, t.getModule(), true, true); providedNames.put(name, provided); provided.addDefinition(n, t.getModule()); } } } }
[ "private", "void", "handleStubDefinition", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "if", "(", "!", "t", ".", "inGlobalHoistScope", "(", ")", ")", "{", "return", ";", "}", "JSDocInfo", "info", "=", "n", ".", "getFirstChild", "(", ")", "."...
Handles a stub definition for a goog.provided name (e.g. a @typedef or a definition from externs) @param n EXPR_RESULT node.
[ "Handles", "a", "stub", "definition", "for", "a", "goog", ".", "provided", "name", "(", "e", ".", "g", ".", "a", "@typedef", "or", "a", "definition", "from", "externs", ")" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ProcessClosureProvidesAndRequires.java#L392-L414
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java
StringIterate.collectCodePoint
public static String collectCodePoint(String string, CodePointFunction function) { int size = string.length(); StringBuilder builder = new StringBuilder(size); for (int i = 0; i < size; ) { int codePoint = string.codePointAt(i); builder.appendCodePoint(function.valueOf(codePoint)); i += Character.charCount(codePoint); } return builder.toString(); }
java
public static String collectCodePoint(String string, CodePointFunction function) { int size = string.length(); StringBuilder builder = new StringBuilder(size); for (int i = 0; i < size; ) { int codePoint = string.codePointAt(i); builder.appendCodePoint(function.valueOf(codePoint)); i += Character.charCount(codePoint); } return builder.toString(); }
[ "public", "static", "String", "collectCodePoint", "(", "String", "string", ",", "CodePointFunction", "function", ")", "{", "int", "size", "=", "string", ".", "length", "(", ")", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "size", ")", ...
Transform the int code point elements to a new string using the specified function {@code function}. @since 7.0
[ "Transform", "the", "int", "code", "point", "elements", "to", "a", "new", "string", "using", "the", "specified", "function", "{", "@code", "function", "}", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L615-L626
alibaba/vlayout
vlayout/src/main/java/com/alibaba/android/vlayout/DelegateAdapter.java
DelegateAdapter.addAdapters
public void addAdapters(int position, @Nullable List<Adapter> adapters) { if (adapters == null || adapters.size() == 0) { return; } if (position < 0) { position = 0; } if (position > mAdapters.size()) { position = mAdapters.size(); } List<Adapter> newAdapter = new ArrayList<>(); Iterator<Pair<AdapterDataObserver, Adapter>> itr = mAdapters.iterator(); while (itr.hasNext()) { Pair<AdapterDataObserver, Adapter> pair = itr.next(); Adapter theOrigin = pair.second; newAdapter.add(theOrigin); } for (Adapter adapter : adapters) { newAdapter.add(position, adapter); position++; } setAdapters(newAdapter); }
java
public void addAdapters(int position, @Nullable List<Adapter> adapters) { if (adapters == null || adapters.size() == 0) { return; } if (position < 0) { position = 0; } if (position > mAdapters.size()) { position = mAdapters.size(); } List<Adapter> newAdapter = new ArrayList<>(); Iterator<Pair<AdapterDataObserver, Adapter>> itr = mAdapters.iterator(); while (itr.hasNext()) { Pair<AdapterDataObserver, Adapter> pair = itr.next(); Adapter theOrigin = pair.second; newAdapter.add(theOrigin); } for (Adapter adapter : adapters) { newAdapter.add(position, adapter); position++; } setAdapters(newAdapter); }
[ "public", "void", "addAdapters", "(", "int", "position", ",", "@", "Nullable", "List", "<", "Adapter", ">", "adapters", ")", "{", "if", "(", "adapters", "==", "null", "||", "adapters", ".", "size", "(", ")", "==", "0", ")", "{", "return", ";", "}", ...
Add adapters in <code>position</code> @param position the index where adapters added @param adapters adapters
[ "Add", "adapters", "in", "<code", ">", "position<", "/", "code", ">" ]
train
https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/DelegateAdapter.java#L310-L334
groupon/odo
proxyserver/src/main/java/com/groupon/odo/RemoveHeaderFilter.java
RemoveHeaderFilter.doFilter
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final ServletRequest r1 = request; chain.doFilter(request, new HttpServletResponseWrapper((HttpServletResponse) response) { @SuppressWarnings("unchecked") public void setHeader(String name, String value) { ArrayList<String> headersToRemove = new ArrayList<String>(); if (r1.getAttribute("com.groupon.odo.removeHeaders") != null) headersToRemove = (ArrayList<String>) r1.getAttribute("com.groupon.odo.removeHeaders"); boolean removeHeader = false; // need to loop through removeHeaders to make things case insensitive for (String headerToRemove : headersToRemove) { if (headerToRemove.toLowerCase().equals(name.toLowerCase())) { removeHeader = true; break; } } if (! removeHeader) { super.setHeader(name, value); } } }); }
java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final ServletRequest r1 = request; chain.doFilter(request, new HttpServletResponseWrapper((HttpServletResponse) response) { @SuppressWarnings("unchecked") public void setHeader(String name, String value) { ArrayList<String> headersToRemove = new ArrayList<String>(); if (r1.getAttribute("com.groupon.odo.removeHeaders") != null) headersToRemove = (ArrayList<String>) r1.getAttribute("com.groupon.odo.removeHeaders"); boolean removeHeader = false; // need to loop through removeHeaders to make things case insensitive for (String headerToRemove : headersToRemove) { if (headerToRemove.toLowerCase().equals(name.toLowerCase())) { removeHeader = true; break; } } if (! removeHeader) { super.setHeader(name, value); } } }); }
[ "@", "Override", "public", "void", "doFilter", "(", "ServletRequest", "request", ",", "ServletResponse", "response", ",", "FilterChain", "chain", ")", "throws", "IOException", ",", "ServletException", "{", "final", "ServletRequest", "r1", "=", "request", ";", "cha...
This looks at the servlet attributes to get the list of response headers to remove while the response object gets created by the servlet
[ "This", "looks", "at", "the", "servlet", "attributes", "to", "get", "the", "list", "of", "response", "headers", "to", "remove", "while", "the", "response", "object", "gets", "created", "by", "the", "servlet" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyserver/src/main/java/com/groupon/odo/RemoveHeaderFilter.java#L28-L53
hawkular/hawkular-apm
client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java
FragmentBuilder.addUncompletedCorrelationId
public void addUncompletedCorrelationId(String id, Node node, int position) { NodePlaceholder placeholder = new NodePlaceholder(); placeholder.setNode(node); placeholder.setPosition(position); uncompletedCorrelationIdsNodeMap.put(id, placeholder); }
java
public void addUncompletedCorrelationId(String id, Node node, int position) { NodePlaceholder placeholder = new NodePlaceholder(); placeholder.setNode(node); placeholder.setPosition(position); uncompletedCorrelationIdsNodeMap.put(id, placeholder); }
[ "public", "void", "addUncompletedCorrelationId", "(", "String", "id", ",", "Node", "node", ",", "int", "position", ")", "{", "NodePlaceholder", "placeholder", "=", "new", "NodePlaceholder", "(", ")", ";", "placeholder", ".", "setNode", "(", "node", ")", ";", ...
This method associates a parent node and child position with a correlation id. @param id The correlation id @param node The parent node @param position The child node position within the parent node
[ "This", "method", "associates", "a", "parent", "node", "and", "child", "position", "with", "a", "correlation", "id", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java#L406-L411
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java
Util.decodeCertChain
@SuppressWarnings("unchecked") @Sensitive public static X509Certificate[] decodeCertChain(Codec codec, @Sensitive byte[] encodedCertChain) throws SASException { X509Certificate[] certificateChain = null; try { Any any = codec.decode_value(encodedCertChain, X509CertificateChainHelper.type()); byte[] decodedCertificateChain = X509CertificateChainHelper.extract(any); CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); ByteArrayInputStream bais = new ByteArrayInputStream(decodedCertificateChain); CertPath certPath = certificateFactory.generateCertPath(bais); List<X509Certificate> certificates = (List<X509Certificate>) certPath.getCertificates(); certificateChain = new X509Certificate[certificates.size()]; for (int i = 0; i < certificates.size(); i++) { certificateChain[i] = certificates.get(i); } } catch (Exception e) { throw new SASException(1, e); } return certificateChain; }
java
@SuppressWarnings("unchecked") @Sensitive public static X509Certificate[] decodeCertChain(Codec codec, @Sensitive byte[] encodedCertChain) throws SASException { X509Certificate[] certificateChain = null; try { Any any = codec.decode_value(encodedCertChain, X509CertificateChainHelper.type()); byte[] decodedCertificateChain = X509CertificateChainHelper.extract(any); CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); ByteArrayInputStream bais = new ByteArrayInputStream(decodedCertificateChain); CertPath certPath = certificateFactory.generateCertPath(bais); List<X509Certificate> certificates = (List<X509Certificate>) certPath.getCertificates(); certificateChain = new X509Certificate[certificates.size()]; for (int i = 0; i < certificates.size(); i++) { certificateChain[i] = certificates.get(i); } } catch (Exception e) { throw new SASException(1, e); } return certificateChain; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Sensitive", "public", "static", "X509Certificate", "[", "]", "decodeCertChain", "(", "Codec", "codec", ",", "@", "Sensitive", "byte", "[", "]", "encodedCertChain", ")", "throws", "SASException", "{", "X50...
Decode an X509 certificate chain. @param codec The codec to do the decoding of the Any. @param encodedCertChain The codec encoded byte[] containing the X509 certificate chain. @return the X509 certificate chain @throws SASException
[ "Decode", "an", "X509", "certificate", "chain", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L783-L805
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newConversionException
public static ConversionException newConversionException(String message, Object... args) { return newConversionException(null, message, args); }
java
public static ConversionException newConversionException(String message, Object... args) { return newConversionException(null, message, args); }
[ "public", "static", "ConversionException", "newConversionException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newConversionException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link ConversionException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link ConversionException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link ConversionException} with the given {@link String message}. @see #newConversionException(Throwable, String, Object...) @see org.cp.elements.data.conversion.ConversionException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "ConversionException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L789-L791
FINRAOS/DataGenerator
dg-core/src/main/java/org/finra/datagenerator/engine/scxml/tags/boundary/BoundaryDate.java
BoundaryDate.numOccurrences
public int numOccurrences(int year, int month, int day) { DateTimeFormatter parser = ISODateTimeFormat.date(); DateTime date = parser.parseDateTime(year + "-" + month + "-" + "01"); Calendar cal = Calendar.getInstance(); cal.setTime(date.toDate()); GregorianChronology calendar = GregorianChronology.getInstance(); DateTimeField field = calendar.dayOfMonth(); int days = 0; int count = 0; int num = field.getMaximumValue(new LocalDate(year, month, day, calendar)); while (days < num) { if (cal.get(Calendar.DAY_OF_WEEK) == day) { count++; } date = date.plusDays(1); cal.setTime(date.toDate()); days++; } return count; }
java
public int numOccurrences(int year, int month, int day) { DateTimeFormatter parser = ISODateTimeFormat.date(); DateTime date = parser.parseDateTime(year + "-" + month + "-" + "01"); Calendar cal = Calendar.getInstance(); cal.setTime(date.toDate()); GregorianChronology calendar = GregorianChronology.getInstance(); DateTimeField field = calendar.dayOfMonth(); int days = 0; int count = 0; int num = field.getMaximumValue(new LocalDate(year, month, day, calendar)); while (days < num) { if (cal.get(Calendar.DAY_OF_WEEK) == day) { count++; } date = date.plusDays(1); cal.setTime(date.toDate()); days++; } return count; }
[ "public", "int", "numOccurrences", "(", "int", "year", ",", "int", "month", ",", "int", "day", ")", "{", "DateTimeFormatter", "parser", "=", "ISODateTimeFormat", ".", "date", "(", ")", ";", "DateTime", "date", "=", "parser", ".", "parseDateTime", "(", "yea...
Given a year, month, and day, find the number of occurrences of that day in the month @param year the year @param month the month @param day the day @return the number of occurrences of the day in the month
[ "Given", "a", "year", "month", "and", "day", "find", "the", "number", "of", "occurrences", "of", "that", "day", "in", "the", "month" ]
train
https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-core/src/main/java/org/finra/datagenerator/engine/scxml/tags/boundary/BoundaryDate.java#L264-L285
cdapio/tigon
tigon-sql/src/main/java/co/cask/tigon/sql/internal/MetricsRecorder.java
MetricsRecorder.recordMetrics
public void recordMetrics(String processName, JsonObject metricsData) { for (Map.Entry<String, JsonElement> entry : metricsData.entrySet()) { metrics.count(processName + "." + entry.getKey(), Math.round(entry.getValue().getAsFloat())); } }
java
public void recordMetrics(String processName, JsonObject metricsData) { for (Map.Entry<String, JsonElement> entry : metricsData.entrySet()) { metrics.count(processName + "." + entry.getKey(), Math.round(entry.getValue().getAsFloat())); } }
[ "public", "void", "recordMetrics", "(", "String", "processName", ",", "JsonObject", "metricsData", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "JsonElement", ">", "entry", ":", "metricsData", ".", "entrySet", "(", ")", ")", "{", "metrics...
This methods logs the received metrics into the underlying {@link Metrics} object. This method should be invoked every time metrics are received from a SQL Compiler process. @param processName Name of the process which sent these metrics @param metricsData The metrics sent by the process in a JSON format
[ "This", "methods", "logs", "the", "received", "metrics", "into", "the", "underlying", "{", "@link", "Metrics", "}", "object", ".", "This", "method", "should", "be", "invoked", "every", "time", "metrics", "are", "received", "from", "a", "SQL", "Compiler", "pr...
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-sql/src/main/java/co/cask/tigon/sql/internal/MetricsRecorder.java#L49-L54
molgenis/molgenis
molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/mapping/model/MappingTarget.java
MappingTarget.addSource
public EntityMapping addSource(EntityType source) { if (entityMappings.containsKey(source.getId())) { throw new IllegalStateException("Mapping already present for source " + source.getId()); } EntityMapping result = new EntityMapping(source, target); entityMappings.put(source.getId(), result); return result; }
java
public EntityMapping addSource(EntityType source) { if (entityMappings.containsKey(source.getId())) { throw new IllegalStateException("Mapping already present for source " + source.getId()); } EntityMapping result = new EntityMapping(source, target); entityMappings.put(source.getId(), result); return result; }
[ "public", "EntityMapping", "addSource", "(", "EntityType", "source", ")", "{", "if", "(", "entityMappings", ".", "containsKey", "(", "source", ".", "getId", "(", ")", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Mapping already present for sourc...
Adds a new {@link EntityMapping} to this target for a certain source. @param source {@link EntityType} for the source entity that is mapped to this target @return the newly created empty {@link EntityMapping}
[ "Adds", "a", "new", "{", "@link", "EntityMapping", "}", "to", "this", "target", "for", "a", "certain", "source", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/mapping/model/MappingTarget.java#L67-L74
Coveros/selenified
src/main/java/com/coveros/selenified/application/WaitFor.java
WaitFor.titleEquals
public void titleEquals(double seconds, String expectedTitle) { double end = System.currentTimeMillis() + (seconds * 1000); try { WebDriverWait wait = new WebDriverWait(app.getDriver(), (long) seconds, DEFAULT_POLLING_INTERVAL); wait.until(ExpectedConditions.titleIs(expectedTitle)); double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkTitleEquals(expectedTitle, seconds, timeTook); } catch (TimeoutException e) { checkTitleEquals(expectedTitle, seconds, seconds); } }
java
public void titleEquals(double seconds, String expectedTitle) { double end = System.currentTimeMillis() + (seconds * 1000); try { WebDriverWait wait = new WebDriverWait(app.getDriver(), (long) seconds, DEFAULT_POLLING_INTERVAL); wait.until(ExpectedConditions.titleIs(expectedTitle)); double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkTitleEquals(expectedTitle, seconds, timeTook); } catch (TimeoutException e) { checkTitleEquals(expectedTitle, seconds, seconds); } }
[ "public", "void", "titleEquals", "(", "double", "seconds", ",", "String", "expectedTitle", ")", "{", "double", "end", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "(", "seconds", "*", "1000", ")", ";", "try", "{", "WebDriverWait", "wait", "=", ...
Waits up to the default wait time (5 seconds unless changed) for the provided title equals the actual title of the current page the application is on. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param seconds the number of seconds to wait @param expectedTitle - the title to wait for
[ "Waits", "up", "to", "the", "default", "wait", "time", "(", "5", "seconds", "unless", "changed", ")", "for", "the", "provided", "title", "equals", "the", "actual", "title", "of", "the", "current", "page", "the", "application", "is", "on", ".", "This", "i...
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L368-L378
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRCursorController.java
GVRCursorController.updatePicker
protected void updatePicker(MotionEvent event, boolean isActive) { final MotionEvent newEvent = (event != null) ? event : null; final ControllerPick controllerPick = new ControllerPick(mPicker, newEvent, isActive); context.runOnGlThread(controllerPick); }
java
protected void updatePicker(MotionEvent event, boolean isActive) { final MotionEvent newEvent = (event != null) ? event : null; final ControllerPick controllerPick = new ControllerPick(mPicker, newEvent, isActive); context.runOnGlThread(controllerPick); }
[ "protected", "void", "updatePicker", "(", "MotionEvent", "event", ",", "boolean", "isActive", ")", "{", "final", "MotionEvent", "newEvent", "=", "(", "event", "!=", "null", ")", "?", "event", ":", "null", ";", "final", "ControllerPick", "controllerPick", "=", ...
Update the state of the picker. If it has an owner, the picker will use that object to derive its position and orientation. The "active" state of this controller is used to indicate touch. The cursor position is updated after picking.
[ "Update", "the", "state", "of", "the", "picker", ".", "If", "it", "has", "an", "owner", "the", "picker", "will", "use", "that", "object", "to", "derive", "its", "position", "and", "orientation", ".", "The", "active", "state", "of", "this", "controller", ...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/io/GVRCursorController.java#L1120-L1125
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupBean.java
CmsSetupBean.setDbParamaters
public boolean setDbParamaters(HttpServletRequest request, String provider) { return setDbParamaters(request.getParameterMap(), provider, request.getContextPath(), request.getSession()); }
java
public boolean setDbParamaters(HttpServletRequest request, String provider) { return setDbParamaters(request.getParameterMap(), provider, request.getContextPath(), request.getSession()); }
[ "public", "boolean", "setDbParamaters", "(", "HttpServletRequest", "request", ",", "String", "provider", ")", "{", "return", "setDbParamaters", "(", "request", ".", "getParameterMap", "(", ")", ",", "provider", ",", "request", ".", "getContextPath", "(", ")", ",...
Sets the needed database parameters.<p> @param request the http request @param provider the db provider @return true if already submitted
[ "Sets", "the", "needed", "database", "parameters", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L1933-L1936
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/corona/Schedulable.java
Schedulable.distributeShareFair
private static void distributeShareFair( double total, final Collection<? extends Schedulable> schedulables) { BinarySearcher searcher = new BinarySearcher() { @Override protected double targetFunction(double x) { return totalShareWithRatio(schedulables, x); } }; double ratio = searcher.getSolution(total); for (Schedulable schedulable : schedulables) { schedulable.share = shareWithRatio(schedulable, ratio); } }
java
private static void distributeShareFair( double total, final Collection<? extends Schedulable> schedulables) { BinarySearcher searcher = new BinarySearcher() { @Override protected double targetFunction(double x) { return totalShareWithRatio(schedulables, x); } }; double ratio = searcher.getSolution(total); for (Schedulable schedulable : schedulables) { schedulable.share = shareWithRatio(schedulable, ratio); } }
[ "private", "static", "void", "distributeShareFair", "(", "double", "total", ",", "final", "Collection", "<", "?", "extends", "Schedulable", ">", "schedulables", ")", "{", "BinarySearcher", "searcher", "=", "new", "BinarySearcher", "(", ")", "{", "@", "Override",...
Distribute the total share among the list of schedulables according to the FAIR model. Finds a way to distribute the share in such a way that all the min and max reservations of the schedulables are satisfied @param total the share to be distributed @param schedulables the list of schedulables
[ "Distribute", "the", "total", "share", "among", "the", "list", "of", "schedulables", "according", "to", "the", "FAIR", "model", ".", "Finds", "a", "way", "to", "distribute", "the", "share", "in", "such", "a", "way", "that", "all", "the", "min", "and", "m...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Schedulable.java#L223-L235
fuinorg/units4j
src/main/java/org/fuin/units4j/dependency/Dependencies.java
Dependencies.validate
public final void validate() throws InvalidDependenciesDefinitionException { int errorCount = 0; final StringBuilder sb = new StringBuilder("Duplicate package entries in 'allowed' and 'forbidden': "); final List<Package<NotDependsOn>> list = getForbidden(); for (int i = 0; i < list.size(); i++) { final String name = list.get(i).getName(); final Package<DependsOn> dep = new Package<DependsOn>(name); if (getAllowed().indexOf(dep) > -1) { if (errorCount > 0) { sb.append(", "); } sb.append(name); errorCount++; } } if (errorCount > 0) { throw new InvalidDependenciesDefinitionException(this, sb.toString()); } }
java
public final void validate() throws InvalidDependenciesDefinitionException { int errorCount = 0; final StringBuilder sb = new StringBuilder("Duplicate package entries in 'allowed' and 'forbidden': "); final List<Package<NotDependsOn>> list = getForbidden(); for (int i = 0; i < list.size(); i++) { final String name = list.get(i).getName(); final Package<DependsOn> dep = new Package<DependsOn>(name); if (getAllowed().indexOf(dep) > -1) { if (errorCount > 0) { sb.append(", "); } sb.append(name); errorCount++; } } if (errorCount > 0) { throw new InvalidDependenciesDefinitionException(this, sb.toString()); } }
[ "public", "final", "void", "validate", "(", ")", "throws", "InvalidDependenciesDefinitionException", "{", "int", "errorCount", "=", "0", ";", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"Duplicate package entries in 'allowed' and 'forbidden': \"", ...
Checks if the definition is valid - Especially if no package is in both lists. @throws InvalidDependenciesDefinitionException This instance is invalid.
[ "Checks", "if", "the", "definition", "is", "valid", "-", "Especially", "if", "no", "package", "is", "in", "both", "lists", "." ]
train
https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/dependency/Dependencies.java#L136-L155
tvesalainen/hoski-lib
src/main/java/fi/hoski/datastore/repository/DataObject.java
DataObject.writeCSV
public static void writeCSV(DataObjectModel model, Collection<? extends DataObject> collection, OutputStream os) throws IOException { BufferedOutputStream bos = new BufferedOutputStream(os); OutputStreamWriter osw = new OutputStreamWriter(bos, "ISO-8859-1"); CSVWriter writer = new CSVWriter(osw, ',', '"', "\r\n"); String[] line = model.getProperties(); writer.writeNext(line); for (DataObject dob : collection) { int index = 0; for (String property : model.getPropertyList()) { Object value = dob.get(property); if (value != null) { line[index++] = value.toString(); } else { line[index++] = ""; } } writer.writeNext(line); } writer.flush(); }
java
public static void writeCSV(DataObjectModel model, Collection<? extends DataObject> collection, OutputStream os) throws IOException { BufferedOutputStream bos = new BufferedOutputStream(os); OutputStreamWriter osw = new OutputStreamWriter(bos, "ISO-8859-1"); CSVWriter writer = new CSVWriter(osw, ',', '"', "\r\n"); String[] line = model.getProperties(); writer.writeNext(line); for (DataObject dob : collection) { int index = 0; for (String property : model.getPropertyList()) { Object value = dob.get(property); if (value != null) { line[index++] = value.toString(); } else { line[index++] = ""; } } writer.writeNext(line); } writer.flush(); }
[ "public", "static", "void", "writeCSV", "(", "DataObjectModel", "model", ",", "Collection", "<", "?", "extends", "DataObject", ">", "collection", ",", "OutputStream", "os", ")", "throws", "IOException", "{", "BufferedOutputStream", "bos", "=", "new", "BufferedOutp...
Writes collection of DataObjects in csv format. OutputStream is not closed after operation. @param os @param collection @throws IOException
[ "Writes", "collection", "of", "DataObjects", "in", "csv", "format", ".", "OutputStream", "is", "not", "closed", "after", "operation", "." ]
train
https://github.com/tvesalainen/hoski-lib/blob/9b5bab44113e0adb74bf1ee436013e8a7c608d00/src/main/java/fi/hoski/datastore/repository/DataObject.java#L483-L508
mnlipp/jgrapes
org.jgrapes.http.freemarker/src/org/jgrapes/http/freemarker/FreeMarkerRequestHandler.java
FreeMarkerRequestHandler.sendProcessedTemplate
protected boolean sendProcessedTemplate( Request.In event, IOSubchannel channel, String path) { try { // Get template (no need to continue if this fails). Template tpl = freemarkerConfig().getTemplate(path); return sendProcessedTemplate(event, channel, tpl); } catch (IOException e) { fire(new Error(event, e), channel); return false; } }
java
protected boolean sendProcessedTemplate( Request.In event, IOSubchannel channel, String path) { try { // Get template (no need to continue if this fails). Template tpl = freemarkerConfig().getTemplate(path); return sendProcessedTemplate(event, channel, tpl); } catch (IOException e) { fire(new Error(event, e), channel); return false; } }
[ "protected", "boolean", "sendProcessedTemplate", "(", "Request", ".", "In", "event", ",", "IOSubchannel", "channel", ",", "String", "path", ")", "{", "try", "{", "// Get template (no need to continue if this fails).", "Template", "tpl", "=", "freemarkerConfig", "(", "...
Render a response using the template obtained from the config with {@link Configuration#getTemplate(String)} and the given path. @param event the event @param channel the channel @param path the path
[ "Render", "a", "response", "using", "the", "template", "obtained", "from", "the", "config", "with", "{", "@link", "Configuration#getTemplate", "(", "String", ")", "}", "and", "the", "given", "path", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http.freemarker/src/org/jgrapes/http/freemarker/FreeMarkerRequestHandler.java#L285-L295
opentelecoms-org/jsmpp
jsmpp/src/main/java/org/jsmpp/session/BindRequestReceiver.java
BindRequestReceiver.notifyAcceptBind
void notifyAcceptBind(Bind bindParameter) throws IllegalStateException { lock.lock(); try { if (request == null) { request = new BindRequest(bindParameter, responseHandler); requestCondition.signal(); } else { throw new IllegalStateException("Already waiting for acceptance bind"); } } finally { lock.unlock(); } }
java
void notifyAcceptBind(Bind bindParameter) throws IllegalStateException { lock.lock(); try { if (request == null) { request = new BindRequest(bindParameter, responseHandler); requestCondition.signal(); } else { throw new IllegalStateException("Already waiting for acceptance bind"); } } finally { lock.unlock(); } }
[ "void", "notifyAcceptBind", "(", "Bind", "bindParameter", ")", "throws", "IllegalStateException", "{", "lock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "request", "==", "null", ")", "{", "request", "=", "new", "BindRequest", "(", "bindParameter", ...
Notify that the bind has accepted. @param bindParameter is the {@link Bind} command. @throws IllegalStateException if this method is already called before.
[ "Notify", "that", "the", "bind", "has", "accepted", "." ]
train
https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/BindRequestReceiver.java#L79-L91
tipsy/javalin
src/main/java/io/javalin/Javalin.java
Javalin.ws
public Javalin ws(@NotNull String path, @NotNull Consumer<WsHandler> ws) { return ws(path, ws, new HashSet<>()); }
java
public Javalin ws(@NotNull String path, @NotNull Consumer<WsHandler> ws) { return ws(path, ws, new HashSet<>()); }
[ "public", "Javalin", "ws", "(", "@", "NotNull", "String", "path", ",", "@", "NotNull", "Consumer", "<", "WsHandler", ">", "ws", ")", "{", "return", "ws", "(", "path", ",", "ws", ",", "new", "HashSet", "<>", "(", ")", ")", ";", "}" ]
Adds a WebSocket handler on the specified path. @see <a href="https://javalin.io/documentation#websockets">WebSockets in docs</a>
[ "Adds", "a", "WebSocket", "handler", "on", "the", "specified", "path", "." ]
train
https://github.com/tipsy/javalin/blob/68b2f7592f237db1c2b597e645697eb75fdaee53/src/main/java/io/javalin/Javalin.java#L523-L525
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
OjbTagsHandler.ifPropertyValueEquals
public void ifPropertyValueEquals(String template, Properties attributes) throws XDocletException { String value = getPropertyValue(attributes.getProperty(ATTRIBUTE_LEVEL), attributes.getProperty(ATTRIBUTE_NAME)); String expected = attributes.getProperty(ATTRIBUTE_VALUE); if (value == null) { value = attributes.getProperty(ATTRIBUTE_DEFAULT); } if (expected.equals(value)) { generate(template); } }
java
public void ifPropertyValueEquals(String template, Properties attributes) throws XDocletException { String value = getPropertyValue(attributes.getProperty(ATTRIBUTE_LEVEL), attributes.getProperty(ATTRIBUTE_NAME)); String expected = attributes.getProperty(ATTRIBUTE_VALUE); if (value == null) { value = attributes.getProperty(ATTRIBUTE_DEFAULT); } if (expected.equals(value)) { generate(template); } }
[ "public", "void", "ifPropertyValueEquals", "(", "String", "template", ",", "Properties", "attributes", ")", "throws", "XDocletException", "{", "String", "value", "=", "getPropertyValue", "(", "attributes", ".", "getProperty", "(", "ATTRIBUTE_LEVEL", ")", ",", "attri...
Processes the template if the property value of the current object on the specified level equals the given value. @param template The template @param attributes The attributes of the tag @exception XDocletException If an error occurs @doc.tag type="block" @doc.param name="level" optional="false" description="The level for the current object" values="class,field,reference,collection" @doc.param name="name" optional="false" description="The name of the property" @doc.param name="value" optional="false" description="The value to check for" @doc.param name="default" optional="true" description="A default value to use if the property is not defined"
[ "Processes", "the", "template", "if", "the", "property", "value", "of", "the", "current", "object", "on", "the", "specified", "level", "equals", "the", "given", "value", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L1560-L1573
foundation-runtime/service-directory
1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/DirectoryLookupService.java
DirectoryLookupService.getModelServiceInstanceByAddress
public ModelServiceInstance getModelServiceInstanceByAddress(String serviceName, String instanceAddress) { ModelService service = getModelService(serviceName); if (service != null && service.getServiceInstances() != null) { for (ModelServiceInstance instance : service.getServiceInstances()) { if (instance.getAddress().equals(instanceAddress)) { return instance; } } } return null; }
java
public ModelServiceInstance getModelServiceInstanceByAddress(String serviceName, String instanceAddress) { ModelService service = getModelService(serviceName); if (service != null && service.getServiceInstances() != null) { for (ModelServiceInstance instance : service.getServiceInstances()) { if (instance.getAddress().equals(instanceAddress)) { return instance; } } } return null; }
[ "public", "ModelServiceInstance", "getModelServiceInstanceByAddress", "(", "String", "serviceName", ",", "String", "instanceAddress", ")", "{", "ModelService", "service", "=", "getModelService", "(", "serviceName", ")", ";", "if", "(", "service", "!=", "null", "&&", ...
Get the ModelServiceInstance by serviceName and instanceAddress. @param serviceName the service name. @param instanceAddress the instanceAddress. @return the ModelServiceInstance. @since 1.2
[ "Get", "the", "ModelServiceInstance", "by", "serviceName", "and", "instanceAddress", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/DirectoryLookupService.java#L313-L323
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/protocol/protocolicmp_stats.java
protocolicmp_stats.get_nitro_response
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { protocolicmp_stats[] resources = new protocolicmp_stats[1]; protocolicmp_response result = (protocolicmp_response) service.get_payload_formatter().string_to_resource(protocolicmp_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.protocolicmp; return resources; }
java
protected base_resource[] get_nitro_response(nitro_service service, String response) throws Exception { protocolicmp_stats[] resources = new protocolicmp_stats[1]; protocolicmp_response result = (protocolicmp_response) service.get_payload_formatter().string_to_resource(protocolicmp_response.class, response); if(result.errorcode != 0) { if (result.errorcode == 444) { service.clear_session(); } if(result.severity != null) { if (result.severity.equals("ERROR")) throw new nitro_exception(result.message,result.errorcode); } else { throw new nitro_exception(result.message,result.errorcode); } } resources[0] = result.protocolicmp; return resources; }
[ "protected", "base_resource", "[", "]", "get_nitro_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "protocolicmp_stats", "[", "]", "resources", "=", "new", "protocolicmp_stats", "[", "1", "]", ";", "protocoli...
<pre> converts nitro response into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "converts", "nitro", "response", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/protocol/protocolicmp_stats.java#L392-L411
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.matchesPattern
public static void matchesPattern(final CharSequence input, final String pattern, final String message, final Object... values) { // TODO when breaking BC, consider returning input if (input == null || !input.toString().matches(pattern)) { throw new IllegalArgumentException(StringUtils.simpleFormat(message, values)); } }
java
public static void matchesPattern(final CharSequence input, final String pattern, final String message, final Object... values) { // TODO when breaking BC, consider returning input if (input == null || !input.toString().matches(pattern)) { throw new IllegalArgumentException(StringUtils.simpleFormat(message, values)); } }
[ "public", "static", "void", "matchesPattern", "(", "final", "CharSequence", "input", ",", "final", "String", "pattern", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "// TODO when breaking BC, consider returning input", "if", ...
<p>Validate that the specified argument character sequence matches the specified regular expression pattern; otherwise throwing an exception with the specified message.</p> <pre>Validate.matchesPattern("hi", "[a-z]*", "%s does not match %s", "hi" "[a-z]*");</pre> <p>The syntax of the pattern is the one used in the {@link Pattern} class.</p> @param input the character sequence to validate, not null @param pattern the regular expression pattern, not null @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @throws IllegalArgumentException if the character sequence does not match the pattern @see #matchesPattern(CharSequence, String) @since 3.0
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "character", "sequence", "matches", "the", "specified", "regular", "expression", "pattern", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", ".", "<", "/", "p",...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L881-L886
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/util/BitVector.java
BitVector.createBitVector
public static BitVector createBitVector(byte[] data, int size) { BitVector bv = new BitVector(data.length * 8); bv.setBytes(data); bv.size = size; return bv; }
java
public static BitVector createBitVector(byte[] data, int size) { BitVector bv = new BitVector(data.length * 8); bv.setBytes(data); bv.size = size; return bv; }
[ "public", "static", "BitVector", "createBitVector", "(", "byte", "[", "]", "data", ",", "int", "size", ")", "{", "BitVector", "bv", "=", "new", "BitVector", "(", "data", ".", "length", "*", "8", ")", ";", "bv", ".", "setBytes", "(", "data", ")", ";",...
Factory method for creating a <tt>BitVector</tt> instance wrapping the given byte data. @param data a byte[] containing packed bits. @param size Size to set the bit vector to @return the newly created <tt>BitVector</tt> instance.
[ "Factory", "method", "for", "creating", "a", "<tt", ">", "BitVector<", "/", "tt", ">", "instance", "wrapping", "the", "given", "byte", "data", "." ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/util/BitVector.java#L72-L77
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newImmutableObjectException
public static ImmutableObjectException newImmutableObjectException(String message, Object... args) { return newImmutableObjectException(null, message, args); }
java
public static ImmutableObjectException newImmutableObjectException(String message, Object... args) { return newImmutableObjectException(null, message, args); }
[ "public", "static", "ImmutableObjectException", "newImmutableObjectException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newImmutableObjectException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link ImmutableObjectException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link ImmutableObjectException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link ImmutableObjectException} with the given {@link String message}. @see #newImmutableObjectException(Throwable, String, Object...) @see org.cp.elements.lang.ImmutableObjectException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "ImmutableObjectException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L411-L413
Labs64/swid-generator
src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java
ExtendedSwidProcessor.setDataSource
public ExtendedSwidProcessor setDataSource(final String dataSource) { swidTag.setDataSource(new Token(dataSource, idGenerator.nextId())); return this; }
java
public ExtendedSwidProcessor setDataSource(final String dataSource) { swidTag.setDataSource(new Token(dataSource, idGenerator.nextId())); return this; }
[ "public", "ExtendedSwidProcessor", "setDataSource", "(", "final", "String", "dataSource", ")", "{", "swidTag", ".", "setDataSource", "(", "new", "Token", "(", "dataSource", ",", "idGenerator", ".", "nextId", "(", ")", ")", ")", ";", "return", "this", ";", "}...
Defines product data source (tag: data_source). @param dataSource product data source @return a reference to this object.
[ "Defines", "product", "data", "source", "(", "tag", ":", "data_source", ")", "." ]
train
https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java#L89-L92
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/util/ExceptionUtils.java
ExceptionUtils.stackTrace
public static String stackTrace( Throwable t, String separator ) { return stackTrace( t, separator, FULL); }
java
public static String stackTrace( Throwable t, String separator ) { return stackTrace( t, separator, FULL); }
[ "public", "static", "String", "stackTrace", "(", "Throwable", "t", ",", "String", "separator", ")", "{", "return", "stackTrace", "(", "t", ",", "separator", ",", "FULL", ")", ";", "}" ]
<p>stackTrace.</p> @param t a {@link java.lang.Throwable} object. @param separator a {@link java.lang.String} object. @return a {@link java.lang.String} object.
[ "<p", ">", "stackTrace", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/ExceptionUtils.java#L47-L50
alkacon/opencms-core
src/org/opencms/workflow/CmsDefaultPublishResourceFormatter.java
CmsDefaultPublishResourceFormatter.createPublishResource
protected CmsPublishResource createPublishResource(CmsResource resource) throws CmsException { CmsResourceUtil resUtil = new CmsResourceUtil(m_cms, resource); CmsPermissionInfo permissionInfo = OpenCms.getADEManager().getPermissionInfo(m_cms, resource, null); String typeName = CmsIconUtil.getDisplayType(m_cms, resource); String detailTypeName = CmsResourceIcon.getDefaultFileOrDetailType(m_cms, resource); CmsPublishResource pubResource = new CmsPublishResource( resource.getStructureId(), resUtil.getFullPath(), resUtil.getTitle(), typeName, resource.getState(), permissionInfo, resource.getDateLastModified(), resUtil.getUserLastModified(), CmsVfsService.formatDateTime(m_cms, resource.getDateLastModified()), false, null, new ArrayList<CmsPublishResource>()); pubResource.setBigIconClasses(CmsIconUtil.getIconClasses(typeName, resource.getName(), false)); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(detailTypeName)) { pubResource.setSmallIconClasses(CmsIconUtil.getIconClasses(detailTypeName, null, true)); } return pubResource; }
java
protected CmsPublishResource createPublishResource(CmsResource resource) throws CmsException { CmsResourceUtil resUtil = new CmsResourceUtil(m_cms, resource); CmsPermissionInfo permissionInfo = OpenCms.getADEManager().getPermissionInfo(m_cms, resource, null); String typeName = CmsIconUtil.getDisplayType(m_cms, resource); String detailTypeName = CmsResourceIcon.getDefaultFileOrDetailType(m_cms, resource); CmsPublishResource pubResource = new CmsPublishResource( resource.getStructureId(), resUtil.getFullPath(), resUtil.getTitle(), typeName, resource.getState(), permissionInfo, resource.getDateLastModified(), resUtil.getUserLastModified(), CmsVfsService.formatDateTime(m_cms, resource.getDateLastModified()), false, null, new ArrayList<CmsPublishResource>()); pubResource.setBigIconClasses(CmsIconUtil.getIconClasses(typeName, resource.getName(), false)); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(detailTypeName)) { pubResource.setSmallIconClasses(CmsIconUtil.getIconClasses(detailTypeName, null, true)); } return pubResource; }
[ "protected", "CmsPublishResource", "createPublishResource", "(", "CmsResource", "resource", ")", "throws", "CmsException", "{", "CmsResourceUtil", "resUtil", "=", "new", "CmsResourceUtil", "(", "m_cms", ",", "resource", ")", ";", "CmsPermissionInfo", "permissionInfo", "...
Creates a publish resource bean from a resource.<p> @param resource the resource @return the publish resource bean @throws CmsException if something goes wrong
[ "Creates", "a", "publish", "resource", "bean", "from", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/CmsDefaultPublishResourceFormatter.java#L418-L443
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java
NodeServiceImpl.moveObject
@Override public void moveObject(final FedoraSession session, final String source, final String destination) { final Session jcrSession = getJcrSession(session); try { final FedoraResource srcResource = find(session, source); final Node sourceNode = getJcrNode(srcResource); final String name = sourceNode.getName(); final Node parent = sourceNode.getDepth() > 0 ? sourceNode.getParent() : null; jcrSession.getWorkspace().move(source, destination); if (parent != null) { createTombstone(parent, name); } touchLdpMembershipResource(getJcrNode(find(session, source))); touchLdpMembershipResource(getJcrNode(find(session, destination))); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } }
java
@Override public void moveObject(final FedoraSession session, final String source, final String destination) { final Session jcrSession = getJcrSession(session); try { final FedoraResource srcResource = find(session, source); final Node sourceNode = getJcrNode(srcResource); final String name = sourceNode.getName(); final Node parent = sourceNode.getDepth() > 0 ? sourceNode.getParent() : null; jcrSession.getWorkspace().move(source, destination); if (parent != null) { createTombstone(parent, name); } touchLdpMembershipResource(getJcrNode(find(session, source))); touchLdpMembershipResource(getJcrNode(find(session, destination))); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } }
[ "@", "Override", "public", "void", "moveObject", "(", "final", "FedoraSession", "session", ",", "final", "String", "source", ",", "final", "String", "destination", ")", "{", "final", "Session", "jcrSession", "=", "getJcrSession", "(", "session", ")", ";", "try...
Move an existing object from the source path to the destination path @param session the session @param source the source path @param destination the destination path
[ "Move", "an", "existing", "object", "from", "the", "source", "path", "to", "the", "destination", "path" ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java#L110-L131
PureWriter/ToastCompat
library/src/main/java/me/drakeet/support/toast/ToastCompat.java
ToastCompat.makeText
public static ToastCompat makeText(Context context, CharSequence text, int duration) { // We cannot pass the SafeToastContext to Toast.makeText() because // the View will unwrap the base context and we are in vain. @SuppressLint("ShowToast") Toast toast = Toast.makeText(context, text, duration); setContextCompat(toast.getView(), new SafeToastContext(context, toast)); return new ToastCompat(context, toast); }
java
public static ToastCompat makeText(Context context, CharSequence text, int duration) { // We cannot pass the SafeToastContext to Toast.makeText() because // the View will unwrap the base context and we are in vain. @SuppressLint("ShowToast") Toast toast = Toast.makeText(context, text, duration); setContextCompat(toast.getView(), new SafeToastContext(context, toast)); return new ToastCompat(context, toast); }
[ "public", "static", "ToastCompat", "makeText", "(", "Context", "context", ",", "CharSequence", "text", ",", "int", "duration", ")", "{", "// We cannot pass the SafeToastContext to Toast.makeText() because", "// the View will unwrap the base context and we are in vain.", "@", "Sup...
Make a standard toast that just contains a text view. @param context The context to use. Usually your {@link android.app.Application} or {@link android.app.Activity} object. @param text The text to show. Can be formatted text. @param duration How long to display the message. Either {@link #LENGTH_SHORT} or {@link #LENGTH_LONG}
[ "Make", "a", "standard", "toast", "that", "just", "contains", "a", "text", "view", "." ]
train
https://github.com/PureWriter/ToastCompat/blob/79c629c2ca8b2d7803f6dc4a458971b5fa19e7f7/library/src/main/java/me/drakeet/support/toast/ToastCompat.java#L46-L53
taimos/RESTUtils
src/main/java/de/taimos/restutils/RESTAssert.java
RESTAssert.assertEquals
public static void assertEquals(final Object one, final Object two) { RESTAssert.assertEquals(one, two, RESTAssert.DEFAULT_STATUS_CODE); }
java
public static void assertEquals(final Object one, final Object two) { RESTAssert.assertEquals(one, two, RESTAssert.DEFAULT_STATUS_CODE); }
[ "public", "static", "void", "assertEquals", "(", "final", "Object", "one", ",", "final", "Object", "two", ")", "{", "RESTAssert", ".", "assertEquals", "(", "one", ",", "two", ",", "RESTAssert", ".", "DEFAULT_STATUS_CODE", ")", ";", "}" ]
assert that objects are equal.<br> This means they are both <i>null</i> or <code>one.equals(two)</code> returns <i>true</i> @param one the first object @param two the second object @throws WebApplicationException with status code 422 (Unprocessable Entity)
[ "assert", "that", "objects", "are", "equal", ".", "<br", ">", "This", "means", "they", "are", "both", "<i", ">", "null<", "/", "i", ">", "or", "<code", ">", "one", ".", "equals", "(", "two", ")", "<", "/", "code", ">", "returns", "<i", ">", "true...
train
https://github.com/taimos/RESTUtils/blob/bdb1bf9a2eb13ede0eec6f071c10cb2698313501/src/main/java/de/taimos/restutils/RESTAssert.java#L238-L240
ops4j/org.ops4j.base
ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java
PropertiesUtils.readListFile
public static String[] readListFile( URL listFile ) throws IOException { ArrayList<String> list = new ArrayList<String>(); InputStream stream = listFile.openStream(); try { InputStreamReader isr = new InputStreamReader( stream, "UTF-8" ); BufferedReader reader = new BufferedReader( isr ); String line = reader.readLine(); while( line != null ) { list.add( line ); line = reader.readLine(); } String[] items = new String[list.size()]; list.toArray( items ); return items; } finally { stream.close(); } }
java
public static String[] readListFile( URL listFile ) throws IOException { ArrayList<String> list = new ArrayList<String>(); InputStream stream = listFile.openStream(); try { InputStreamReader isr = new InputStreamReader( stream, "UTF-8" ); BufferedReader reader = new BufferedReader( isr ); String line = reader.readLine(); while( line != null ) { list.add( line ); line = reader.readLine(); } String[] items = new String[list.size()]; list.toArray( items ); return items; } finally { stream.close(); } }
[ "public", "static", "String", "[", "]", "readListFile", "(", "URL", "listFile", ")", "throws", "IOException", "{", "ArrayList", "<", "String", ">", "list", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "InputStream", "stream", "=", "listFile"...
Read a file and return the list of lines in an array of strings. @param listFile the url to read from @return the lines @throws IOException if a read error occurs
[ "Read", "a", "file", "and", "return", "the", "list", "of", "lines", "in", "an", "array", "of", "strings", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java#L177-L200
jhg023/SimpleNet
src/main/java/simplenet/packet/Packet.java
Packet.putShort
public Packet putShort(int s, ByteOrder order) { var buffer = HEAP_BUFFER_POOL.take(Short.BYTES); var value = (short) s; var array = buffer.putShort(order == ByteOrder.LITTLE_ENDIAN ? Short.reverseBytes(value) : value).array(); try { return enqueue(Arrays.copyOfRange(array, 0, Short.BYTES)); } finally { HEAP_BUFFER_POOL.give(buffer); } }
java
public Packet putShort(int s, ByteOrder order) { var buffer = HEAP_BUFFER_POOL.take(Short.BYTES); var value = (short) s; var array = buffer.putShort(order == ByteOrder.LITTLE_ENDIAN ? Short.reverseBytes(value) : value).array(); try { return enqueue(Arrays.copyOfRange(array, 0, Short.BYTES)); } finally { HEAP_BUFFER_POOL.give(buffer); } }
[ "public", "Packet", "putShort", "(", "int", "s", ",", "ByteOrder", "order", ")", "{", "var", "buffer", "=", "HEAP_BUFFER_POOL", ".", "take", "(", "Short", ".", "BYTES", ")", ";", "var", "value", "=", "(", "short", ")", "s", ";", "var", "array", "=", ...
Writes a single {@code short} with the specified {@link ByteOrder} to this {@link Packet}'s payload. @param s An {@code int} for ease-of-use, but internally down-casted to a {@code short}. @param order The internal byte order of the {@code short}. @return The {@link Packet} to allow for chained writes.
[ "Writes", "a", "single", "{", "@code", "short", "}", "with", "the", "specified", "{", "@link", "ByteOrder", "}", "to", "this", "{", "@link", "Packet", "}", "s", "payload", "." ]
train
https://github.com/jhg023/SimpleNet/blob/a5b55cbfe1768c6a28874f12adac3c748f2b509a/src/main/java/simplenet/packet/Packet.java#L288-L298
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.3/src/com/ibm/ws/microprofile/config13/sources/OSGiConfigUtils.java
OSGiConfigUtils.getService
public static <T> T getService(BundleContext bundleContext, Class<T> serviceClass) { T service = null; if (FrameworkState.isValid()) { ServiceReference<T> ref = bundleContext.getServiceReference(serviceClass); if (ref != null) { service = bundleContext.getService(ref); } } return service; }
java
public static <T> T getService(BundleContext bundleContext, Class<T> serviceClass) { T service = null; if (FrameworkState.isValid()) { ServiceReference<T> ref = bundleContext.getServiceReference(serviceClass); if (ref != null) { service = bundleContext.getService(ref); } } return service; }
[ "public", "static", "<", "T", ">", "T", "getService", "(", "BundleContext", "bundleContext", ",", "Class", "<", "T", ">", "serviceClass", ")", "{", "T", "service", "=", "null", ";", "if", "(", "FrameworkState", ".", "isValid", "(", ")", ")", "{", "Serv...
Find a service of the given type @param bundleContext The context to use to find the service @param serviceClass The class of the required service @return the service instance or null
[ "Find", "a", "service", "of", "the", "given", "type" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.3/src/com/ibm/ws/microprofile/config13/sources/OSGiConfigUtils.java#L143-L153
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggerHistoriesInner.java
WorkflowTriggerHistoriesInner.resubmitAsync
public Observable<Void> resubmitAsync(String resourceGroupName, String workflowName, String triggerName, String historyName) { return resubmitWithServiceResponseAsync(resourceGroupName, workflowName, triggerName, historyName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> resubmitAsync(String resourceGroupName, String workflowName, String triggerName, String historyName) { return resubmitWithServiceResponseAsync(resourceGroupName, workflowName, triggerName, historyName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "resubmitAsync", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "String", "triggerName", ",", "String", "historyName", ")", "{", "return", "resubmitWithServiceResponseAsync", "(", "resourceGroupName", ...
Resubmits a workflow run based on the trigger history. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param triggerName The workflow trigger name. @param historyName The workflow trigger history name. Corresponds to the run name for triggers that resulted in a run. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Resubmits", "a", "workflow", "run", "based", "on", "the", "trigger", "history", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggerHistoriesInner.java#L486-L493
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Clicker.java
Clicker.clickLongOnScreen
public void clickLongOnScreen(float x, float y, int time, View view) { boolean successfull = false; int retry = 0; SecurityException ex = null; long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0); while(!successfull && retry < 20) { try{ inst.sendPointerSync(event); successfull = true; sleeper.sleep(MINI_WAIT); }catch(SecurityException e){ ex = e; dialogUtils.hideSoftKeyboard(null, false, true); sleeper.sleep(MINI_WAIT); retry++; View identicalView = viewFetcher.getIdenticalView(view); if(identicalView != null){ float[] xyToClick = getClickCoordinates(identicalView); x = xyToClick[0]; y = xyToClick[1]; } } } if(!successfull) { Assert.fail("Long click at ("+x+", "+y+") can not be completed! ("+(ex != null ? ex.getClass().getName()+": "+ex.getMessage() : "null")+")"); } eventTime = SystemClock.uptimeMillis(); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, x + 1.0f, y + 1.0f, 0); inst.sendPointerSync(event); if(time > 0) sleeper.sleep(time); else sleeper.sleep((int)(ViewConfiguration.getLongPressTimeout() * 2.5f)); eventTime = SystemClock.uptimeMillis(); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, x, y, 0); inst.sendPointerSync(event); sleeper.sleep(); }
java
public void clickLongOnScreen(float x, float y, int time, View view) { boolean successfull = false; int retry = 0; SecurityException ex = null; long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0); while(!successfull && retry < 20) { try{ inst.sendPointerSync(event); successfull = true; sleeper.sleep(MINI_WAIT); }catch(SecurityException e){ ex = e; dialogUtils.hideSoftKeyboard(null, false, true); sleeper.sleep(MINI_WAIT); retry++; View identicalView = viewFetcher.getIdenticalView(view); if(identicalView != null){ float[] xyToClick = getClickCoordinates(identicalView); x = xyToClick[0]; y = xyToClick[1]; } } } if(!successfull) { Assert.fail("Long click at ("+x+", "+y+") can not be completed! ("+(ex != null ? ex.getClass().getName()+": "+ex.getMessage() : "null")+")"); } eventTime = SystemClock.uptimeMillis(); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, x + 1.0f, y + 1.0f, 0); inst.sendPointerSync(event); if(time > 0) sleeper.sleep(time); else sleeper.sleep((int)(ViewConfiguration.getLongPressTimeout() * 2.5f)); eventTime = SystemClock.uptimeMillis(); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, x, y, 0); inst.sendPointerSync(event); sleeper.sleep(); }
[ "public", "void", "clickLongOnScreen", "(", "float", "x", ",", "float", "y", ",", "int", "time", ",", "View", "view", ")", "{", "boolean", "successfull", "=", "false", ";", "int", "retry", "=", "0", ";", "SecurityException", "ex", "=", "null", ";", "lo...
Long clicks a given coordinate on the screen. @param x the x coordinate @param y the y coordinate @param time the amount of time to long click
[ "Long", "clicks", "a", "given", "coordinate", "on", "the", "screen", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Clicker.java#L121-L163
hawkular/hawkular-agent
hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/inventory/ResourceManager.java
ResourceManager.getAllDescendants
private void getAllDescendants(Resource<L> parent, List<Resource<L>> descendants) { for (Resource<L> child : getChildren(parent)) { if (!descendants.contains(child)) { getAllDescendants(child, descendants); descendants.add(child); } } return; }
java
private void getAllDescendants(Resource<L> parent, List<Resource<L>> descendants) { for (Resource<L> child : getChildren(parent)) { if (!descendants.contains(child)) { getAllDescendants(child, descendants); descendants.add(child); } } return; }
[ "private", "void", "getAllDescendants", "(", "Resource", "<", "L", ">", "parent", ",", "List", "<", "Resource", "<", "L", ">", ">", "descendants", ")", "{", "for", "(", "Resource", "<", "L", ">", "child", ":", "getChildren", "(", "parent", ")", ")", ...
make sure you call this with a graph lock - either read or write
[ "make", "sure", "you", "call", "this", "with", "a", "graph", "lock", "-", "either", "read", "or", "write" ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/inventory/ResourceManager.java#L537-L545
janus-project/guava.janusproject.io
guava/src/com/google/common/eventbus/EventBus.java
EventBus.handleSubscriberException
void handleSubscriberException(Throwable e, SubscriberExceptionContext context) { checkNotNull(e); checkNotNull(context); try { exceptionHandler.handleException(e, context); } catch (Throwable e2) { // if the handler threw an exception... well, just log it logger.log(Level.SEVERE, String.format("Exception %s thrown while handling exception: %s", e2, e), e2); } }
java
void handleSubscriberException(Throwable e, SubscriberExceptionContext context) { checkNotNull(e); checkNotNull(context); try { exceptionHandler.handleException(e, context); } catch (Throwable e2) { // if the handler threw an exception... well, just log it logger.log(Level.SEVERE, String.format("Exception %s thrown while handling exception: %s", e2, e), e2); } }
[ "void", "handleSubscriberException", "(", "Throwable", "e", ",", "SubscriberExceptionContext", "context", ")", "{", "checkNotNull", "(", "e", ")", ";", "checkNotNull", "(", "context", ")", ";", "try", "{", "exceptionHandler", ".", "handleException", "(", "e", ",...
Handles the given exception thrown by a subscriber with the given context.
[ "Handles", "the", "given", "exception", "thrown", "by", "a", "subscriber", "with", "the", "given", "context", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/eventbus/EventBus.java#L215-L225
DDTH/ddth-zookeeper
src/main/java/com/github/ddth/zookeeper/ZooKeeperClient.java
ZooKeeperClient.setData
public boolean setData(String path, String value) throws ZooKeeperException { return setData(path, value, false); }
java
public boolean setData(String path, String value) throws ZooKeeperException { return setData(path, value, false); }
[ "public", "boolean", "setData", "(", "String", "path", ",", "String", "value", ")", "throws", "ZooKeeperException", "{", "return", "setData", "(", "path", ",", "value", ",", "false", ")", ";", "}" ]
Writes data to a node. @param path @param value @return {@code true} if write successfully, {@code false} otherwise (note does not exist, for example) @throws ZooKeeperException
[ "Writes", "data", "to", "a", "node", "." ]
train
https://github.com/DDTH/ddth-zookeeper/blob/0994eea8b25fa3d885f3da4579768b7d08c1c32b/src/main/java/com/github/ddth/zookeeper/ZooKeeperClient.java#L670-L672
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/cli/Setup.java
Setup.getRelativePath
public String getRelativePath(File from, File to) { Path fromPath = Paths.get(from.getPath()).normalize().toAbsolutePath(); Path toPath = Paths.get(to.getPath()).normalize().toAbsolutePath(); return fromPath.relativize(toPath).toString().replace('\\', '/'); }
java
public String getRelativePath(File from, File to) { Path fromPath = Paths.get(from.getPath()).normalize().toAbsolutePath(); Path toPath = Paths.get(to.getPath()).normalize().toAbsolutePath(); return fromPath.relativize(toPath).toString().replace('\\', '/'); }
[ "public", "String", "getRelativePath", "(", "File", "from", ",", "File", "to", ")", "{", "Path", "fromPath", "=", "Paths", ".", "get", "(", "from", ".", "getPath", "(", ")", ")", ".", "normalize", "(", ")", ".", "toAbsolutePath", "(", ")", ";", "Path...
Returns 'to' file or dir path relative to 'from' dir. Result always uses forward slashes and has no trailing slash.
[ "Returns", "to", "file", "or", "dir", "path", "relative", "to", "from", "dir", ".", "Result", "always", "uses", "forward", "slashes", "and", "has", "no", "trailing", "slash", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/cli/Setup.java#L405-L409
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/commons/IOUtils.java
IOUtils.copyLarge
public static long copyLarge(Reader input, Writer output) throws IOException { return copyLarge(input, output, new char[DEFAULT_BUFFER_SIZE]); }
java
public static long copyLarge(Reader input, Writer output) throws IOException { return copyLarge(input, output, new char[DEFAULT_BUFFER_SIZE]); }
[ "public", "static", "long", "copyLarge", "(", "Reader", "input", ",", "Writer", "output", ")", "throws", "IOException", "{", "return", "copyLarge", "(", "input", ",", "output", ",", "new", "char", "[", "DEFAULT_BUFFER_SIZE", "]", ")", ";", "}" ]
Copy chars from a large (over 2GB) <code>Reader</code> to a <code>Writer</code>. <p> This method buffers the input internally, so there is no need to use a <code>BufferedReader</code>. <p> The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}. @param input the <code>Reader</code> to read from @param output the <code>Writer</code> to write to @return the number of characters copied @throws NullPointerException if the input or output is null @throws IOException if an I/O error occurs @since 1.3
[ "Copy", "chars", "from", "a", "large", "(", "over", "2GB", ")", "<code", ">", "Reader<", "/", "code", ">", "to", "a", "<code", ">", "Writer<", "/", "code", ">", ".", "<p", ">", "This", "method", "buffers", "the", "input", "internally", "so", "there",...
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/IOUtils.java#L422-L424
sarxos/webcam-capture
webcam-capture-drivers/driver-ffmpeg-cli/src/main/java/com/github/sarxos/webcam/ds/ffmpegcli/FFmpegCliDevice.java
FFmpegCliDevice.buildImage
private BufferedImage buildImage(byte[] bgr) { BufferedImage image = new BufferedImage(resolution.width, resolution.height, BufferedImage.TYPE_3BYTE_BGR); byte[] imageData = ((DataBufferByte) image.getRaster().getDataBuffer()).getData(); System.arraycopy(bgr, 0, imageData, 0, bgr.length); return image; }
java
private BufferedImage buildImage(byte[] bgr) { BufferedImage image = new BufferedImage(resolution.width, resolution.height, BufferedImage.TYPE_3BYTE_BGR); byte[] imageData = ((DataBufferByte) image.getRaster().getDataBuffer()).getData(); System.arraycopy(bgr, 0, imageData, 0, bgr.length); return image; }
[ "private", "BufferedImage", "buildImage", "(", "byte", "[", "]", "bgr", ")", "{", "BufferedImage", "image", "=", "new", "BufferedImage", "(", "resolution", ".", "width", ",", "resolution", ".", "height", ",", "BufferedImage", ".", "TYPE_3BYTE_BGR", ")", ";", ...
Based on answer: https://stackoverflow.com/a/12062505/7030976 @param bgr - byte array in bgr format @return new image
[ "Based", "on", "answer", ":", "https", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "12062505", "/", "7030976" ]
train
https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture-drivers/driver-ffmpeg-cli/src/main/java/com/github/sarxos/webcam/ds/ffmpegcli/FFmpegCliDevice.java#L85-L91
apiman/apiman
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java
AuditUtils.clientCreated
public static AuditEntryBean clientCreated(ClientBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Client, securityContext); entry.setEntityId(bean.getId()); entry.setEntityVersion(null); entry.setData(null); entry.setWhat(AuditEntryType.Create); return entry; }
java
public static AuditEntryBean clientCreated(ClientBean bean, ISecurityContext securityContext) { AuditEntryBean entry = newEntry(bean.getOrganization().getId(), AuditEntityType.Client, securityContext); entry.setEntityId(bean.getId()); entry.setEntityVersion(null); entry.setData(null); entry.setWhat(AuditEntryType.Create); return entry; }
[ "public", "static", "AuditEntryBean", "clientCreated", "(", "ClientBean", "bean", ",", "ISecurityContext", "securityContext", ")", "{", "AuditEntryBean", "entry", "=", "newEntry", "(", "bean", ".", "getOrganization", "(", ")", ".", "getId", "(", ")", ",", "Audit...
Creates an audit entry for the 'client created' event. @param bean the bean @param securityContext the security context @return the audit entry
[ "Creates", "an", "audit", "entry", "for", "the", "client", "created", "event", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/audit/AuditUtils.java#L354-L361
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java
ShanksAgentBayesianReasoningCapability.getNode
public static ProbabilisticNode getNode(ProbabilisticNetwork bn, String nodeName) throws ShanksException { ProbabilisticNode node = (ProbabilisticNode) bn.getNode(nodeName); if (node == null) { throw new UnknownNodeException(bn, nodeName); } return node; }
java
public static ProbabilisticNode getNode(ProbabilisticNetwork bn, String nodeName) throws ShanksException { ProbabilisticNode node = (ProbabilisticNode) bn.getNode(nodeName); if (node == null) { throw new UnknownNodeException(bn, nodeName); } return node; }
[ "public", "static", "ProbabilisticNode", "getNode", "(", "ProbabilisticNetwork", "bn", ",", "String", "nodeName", ")", "throws", "ShanksException", "{", "ProbabilisticNode", "node", "=", "(", "ProbabilisticNode", ")", "bn", ".", "getNode", "(", "nodeName", ")", ";...
Return the complete node @param bn @param nodeName @return the ProbabilisticNode object @throws UnknownNodeException
[ "Return", "the", "complete", "node" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/unbbayes/ShanksAgentBayesianReasoningCapability.java#L399-L406
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.removeByC_ERC
@Override public CPInstance removeByC_ERC(long companyId, String externalReferenceCode) throws NoSuchCPInstanceException { CPInstance cpInstance = findByC_ERC(companyId, externalReferenceCode); return remove(cpInstance); }
java
@Override public CPInstance removeByC_ERC(long companyId, String externalReferenceCode) throws NoSuchCPInstanceException { CPInstance cpInstance = findByC_ERC(companyId, externalReferenceCode); return remove(cpInstance); }
[ "@", "Override", "public", "CPInstance", "removeByC_ERC", "(", "long", "companyId", ",", "String", "externalReferenceCode", ")", "throws", "NoSuchCPInstanceException", "{", "CPInstance", "cpInstance", "=", "findByC_ERC", "(", "companyId", ",", "externalReferenceCode", "...
Removes the cp instance where companyId = &#63; and externalReferenceCode = &#63; from the database. @param companyId the company ID @param externalReferenceCode the external reference code @return the cp instance that was removed
[ "Removes", "the", "cp", "instance", "where", "companyId", "=", "&#63", ";", "and", "externalReferenceCode", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L6984-L6990
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java
SVGPlot.svgCircle
public Element svgCircle(double cx, double cy, double r) { return SVGUtil.svgCircle(document, cx, cy, r); }
java
public Element svgCircle(double cx, double cy, double r) { return SVGUtil.svgCircle(document, cx, cy, r); }
[ "public", "Element", "svgCircle", "(", "double", "cx", ",", "double", "cy", ",", "double", "r", ")", "{", "return", "SVGUtil", ".", "svgCircle", "(", "document", ",", "cx", ",", "cy", ",", "r", ")", ";", "}" ]
Create a SVG circle @param cx center X @param cy center Y @param r radius @return new element
[ "Create", "a", "SVG", "circle" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java#L266-L268
CenturyLinkCloud/mdw
mdw-hub/src/com/centurylink/mdw/hub/servlet/SoapServlet.java
SoapServlet.getSoapVersion
private String getSoapVersion(String requestString, boolean goodguess) { String guessedVersion = SOAPConstants.SOAP_1_1_PROTOCOL; String otherVersion = SOAPConstants.SOAP_1_2_PROTOCOL; if (requestString.contains(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) { guessedVersion = SOAPConstants.SOAP_1_2_PROTOCOL; otherVersion = SOAPConstants.SOAP_1_1_PROTOCOL; } return goodguess ? guessedVersion : otherVersion; }
java
private String getSoapVersion(String requestString, boolean goodguess) { String guessedVersion = SOAPConstants.SOAP_1_1_PROTOCOL; String otherVersion = SOAPConstants.SOAP_1_2_PROTOCOL; if (requestString.contains(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) { guessedVersion = SOAPConstants.SOAP_1_2_PROTOCOL; otherVersion = SOAPConstants.SOAP_1_1_PROTOCOL; } return goodguess ? guessedVersion : otherVersion; }
[ "private", "String", "getSoapVersion", "(", "String", "requestString", ",", "boolean", "goodguess", ")", "{", "String", "guessedVersion", "=", "SOAPConstants", ".", "SOAP_1_1_PROTOCOL", ";", "String", "otherVersion", "=", "SOAPConstants", ".", "SOAP_1_2_PROTOCOL", ";"...
<p> Gives a hint as to which version of SOAP using the rudimentary check below. If the hint fails, it'll try the other version anyway. </p> <ul> <li>SOAP 1.1 : http://schemas.xmlsoap.org/soap/envelope/</li> <li>SOAP 1.2 : http://www.w3.org/2003/05/soap-envelope</li> </ul> <p> This is on a per-request basis and can't be static since we need to support SOAP 1.1 and 1.2 </p> @param requestString @param goodguess @return SOAP version 1 or 2 @throws IOException @throws SOAPException
[ "<p", ">", "Gives", "a", "hint", "as", "to", "which", "version", "of", "SOAP", "using", "the", "rudimentary", "check", "below", ".", "If", "the", "hint", "fails", "it", "ll", "try", "the", "other", "version", "anyway", ".", "<", "/", "p", ">", "<ul",...
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-hub/src/com/centurylink/mdw/hub/servlet/SoapServlet.java#L308-L318
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.warnf
public void warnf(Throwable t, String format, Object... params) { doLogf(Level.WARN, FQCN, format, params, t); }
java
public void warnf(Throwable t, String format, Object... params) { doLogf(Level.WARN, FQCN, format, params, t); }
[ "public", "void", "warnf", "(", "Throwable", "t", ",", "String", "format", ",", "Object", "...", "params", ")", "{", "doLogf", "(", "Level", ".", "WARN", ",", "FQCN", ",", "format", ",", "params", ",", "t", ")", ";", "}" ]
Issue a formatted log message with a level of WARN. @param t the throwable @param format the format string, as per {@link String#format(String, Object...)} @param params the parameters
[ "Issue", "a", "formatted", "log", "message", "with", "a", "level", "of", "WARN", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1445-L1447
upwork/java-upwork
src/com/Upwork/api/Routers/Reports/Finance/Billings.java
Billings.getByBuyersTeam
public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException { return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/billings", params); }
java
public JSONObject getByBuyersTeam(String buyerTeamReference, HashMap<String, String> params) throws JSONException { return oClient.get("/finreports/v2/buyer_teams/" + buyerTeamReference + "/billings", params); }
[ "public", "JSONObject", "getByBuyersTeam", "(", "String", "buyerTeamReference", ",", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "oClient", ".", "get", "(", "\"/finreports/v2/buyer_teams/\"", "+", "buyerTeam...
Generate Billing Reports for a Specific Buyer's Team @param buyerTeamReference Buyer team reference @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Generate", "Billing", "Reports", "for", "a", "Specific", "Buyer", "s", "Team" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Finance/Billings.java#L90-L92
goshippo/shippo-java-client
src/main/java/com/shippo/model/Track.java
Track.getTrackingInfo
public static Track getTrackingInfo(String carrier, String trackingNumber, String apiKey) throws AuthenticationException, InvalidRequestException, APIConnectionException, APIException { return request(RequestMethod.GET, trackingNumberURL(carrier, trackingNumber), null, Track.class, apiKey); }
java
public static Track getTrackingInfo(String carrier, String trackingNumber, String apiKey) throws AuthenticationException, InvalidRequestException, APIConnectionException, APIException { return request(RequestMethod.GET, trackingNumberURL(carrier, trackingNumber), null, Track.class, apiKey); }
[ "public", "static", "Track", "getTrackingInfo", "(", "String", "carrier", ",", "String", "trackingNumber", ",", "String", "apiKey", ")", "throws", "AuthenticationException", ",", "InvalidRequestException", ",", "APIConnectionException", ",", "APIException", "{", "return...
Get tracking information of any package from given carrier. This corresponds to https://api.goshippo.com/tracks/<i>carrier</i>/<i>tracking_number</i> API defined in https://goshippo.com/docs/reference#tracks-retrieve @param carrier Name of the carrier (like "usps") tracking the package @param trackingNumber Tracking number provided by the carrier for a package @return Track object containing tracking info
[ "Get", "tracking", "information", "of", "any", "package", "from", "given", "carrier", ".", "This", "corresponds", "to", "https", ":", "//", "api", ".", "goshippo", ".", "com", "/", "tracks", "/", "<i", ">", "carrier<", "/", "i", ">", "/", "<i", ">", ...
train
https://github.com/goshippo/shippo-java-client/blob/eecf801c7e07a627c3677a331c0cfcf36cb1678b/src/main/java/com/shippo/model/Track.java#L187-L190
Bedework/bw-util
bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/XSLTFilterConfigInfo.java
XSLTFilterConfigInfo.makeLocale
public static String makeLocale(String lang, String country) { if ((lang == null) || (lang.length() == 0)) { return localeInfoDefaultDefault; } if ((country == null) || (country.length() == 0)) { return localeInfoDefaultDefault; } return lang + "_" + country; }
java
public static String makeLocale(String lang, String country) { if ((lang == null) || (lang.length() == 0)) { return localeInfoDefaultDefault; } if ((country == null) || (country.length() == 0)) { return localeInfoDefaultDefault; } return lang + "_" + country; }
[ "public", "static", "String", "makeLocale", "(", "String", "lang", ",", "String", "country", ")", "{", "if", "(", "(", "lang", "==", "null", ")", "||", "(", "lang", ".", "length", "(", ")", "==", "0", ")", ")", "{", "return", "localeInfoDefaultDefault"...
If either the lang or country is null we provide a default value for the whole locale. Otherwise we construct one. @param lang @param country @return locale
[ "If", "either", "the", "lang", "or", "country", "is", "null", "we", "provide", "a", "default", "value", "for", "the", "whole", "locale", ".", "Otherwise", "we", "construct", "one", "." ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/XSLTFilterConfigInfo.java#L355-L365
nominanuda/zen-project
zen-base/src/main/java/com/nominanuda/xml/DOMBuilder.java
DOMBuilder.charactersRaw
public void charactersRaw(char ch[], int start, int length) throws org.xml.sax.SAXException { if (isOutsideDocElem() && saxHelper.isWhiteSpace(ch, start, length)) return; // avoid DOM006 Hierarchy request error String s = new String(ch, start, length); append(m_doc.createProcessingInstruction("xslt-next-is-raw", "formatter-to-dom")); append(m_doc.createTextNode(s)); }
java
public void charactersRaw(char ch[], int start, int length) throws org.xml.sax.SAXException { if (isOutsideDocElem() && saxHelper.isWhiteSpace(ch, start, length)) return; // avoid DOM006 Hierarchy request error String s = new String(ch, start, length); append(m_doc.createProcessingInstruction("xslt-next-is-raw", "formatter-to-dom")); append(m_doc.createTextNode(s)); }
[ "public", "void", "charactersRaw", "(", "char", "ch", "[", "]", ",", "int", "start", ",", "int", "length", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "if", "(", "isOutsideDocElem", "(", ")", "&&", "saxHelper", ".", "isWhite...
If available, when the disable-output-escaping attribute is used, output raw text without escaping. A PI will be inserted in front of the node with the name "lotusxsl-next-is-raw" and a value of "formatter-to-dom". @param ch Array containing the characters @param start Index to start of characters in the array @param length Number of characters in the array
[ "If", "available", "when", "the", "disable", "-", "output", "-", "escaping", "attribute", "is", "used", "output", "raw", "text", "without", "escaping", ".", "A", "PI", "will", "be", "inserted", "in", "front", "of", "the", "node", "with", "the", "name", "...
train
https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-base/src/main/java/com/nominanuda/xml/DOMBuilder.java#L477-L488
xwiki/xwiki-rendering
xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/WikiParameters.java
WikiParameters.addParameter
public WikiParameters addParameter(String key, String value) { WikiParameters result = new WikiParameters(); result.fList.addAll(fList); result.fList.add(new WikiParameter(key, value)); return result; }
java
public WikiParameters addParameter(String key, String value) { WikiParameters result = new WikiParameters(); result.fList.addAll(fList); result.fList.add(new WikiParameter(key, value)); return result; }
[ "public", "WikiParameters", "addParameter", "(", "String", "key", ",", "String", "value", ")", "{", "WikiParameters", "result", "=", "new", "WikiParameters", "(", ")", ";", "result", ".", "fList", ".", "addAll", "(", "fList", ")", ";", "result", ".", "fLis...
Creates a new copy of this parameter object with new specified key/value pair. @param key the parameter name @param value the value of the parameter @return a new copy of parameters object with the given key/value pair
[ "Creates", "a", "new", "copy", "of", "this", "parameter", "object", "with", "new", "specified", "key", "/", "value", "pair", "." ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/WikiParameters.java#L124-L130
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java
ConnectionsInner.deleteAsync
public Observable<ConnectionInner> deleteAsync(String resourceGroupName, String automationAccountName, String connectionName) { return deleteWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionName).map(new Func1<ServiceResponse<ConnectionInner>, ConnectionInner>() { @Override public ConnectionInner call(ServiceResponse<ConnectionInner> response) { return response.body(); } }); }
java
public Observable<ConnectionInner> deleteAsync(String resourceGroupName, String automationAccountName, String connectionName) { return deleteWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionName).map(new Func1<ServiceResponse<ConnectionInner>, ConnectionInner>() { @Override public ConnectionInner call(ServiceResponse<ConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ConnectionInner", ">", "deleteAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "connectionName", ")", "{", "return", "deleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "automatio...
Delete the connection. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param connectionName The name of connection. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ConnectionInner object
[ "Delete", "the", "connection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java#L131-L138
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/DerivativeIntegralImage.java
DerivativeIntegralImage.kernelHaarY
public static IntegralKernel kernelHaarY( int r , IntegralKernel ret) { if( ret == null ) ret = new IntegralKernel(2); ret.blocks[0].set(-r,-r,r,0); ret.blocks[1].set(-r,0,r,r); ret.scales[0] = -1; ret.scales[1] = 1; return ret; }
java
public static IntegralKernel kernelHaarY( int r , IntegralKernel ret) { if( ret == null ) ret = new IntegralKernel(2); ret.blocks[0].set(-r,-r,r,0); ret.blocks[1].set(-r,0,r,r); ret.scales[0] = -1; ret.scales[1] = 1; return ret; }
[ "public", "static", "IntegralKernel", "kernelHaarY", "(", "int", "r", ",", "IntegralKernel", "ret", ")", "{", "if", "(", "ret", "==", "null", ")", "ret", "=", "new", "IntegralKernel", "(", "2", ")", ";", "ret", ".", "blocks", "[", "0", "]", ".", "set...
Creates a kernel for the Haar wavelet "centered" around the target pixel. @param r Radius of the box. width is 2*r @return Kernel for a Haar y-axis wavelet.
[ "Creates", "a", "kernel", "for", "the", "Haar", "wavelet", "centered", "around", "the", "target", "pixel", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/DerivativeIntegralImage.java#L90-L100
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.addHierarchicalEntityAsync
public Observable<UUID> addHierarchicalEntityAsync(UUID appId, String versionId, HierarchicalEntityModel hierarchicalModelCreateObject) { return addHierarchicalEntityWithServiceResponseAsync(appId, versionId, hierarchicalModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() { @Override public UUID call(ServiceResponse<UUID> response) { return response.body(); } }); }
java
public Observable<UUID> addHierarchicalEntityAsync(UUID appId, String versionId, HierarchicalEntityModel hierarchicalModelCreateObject) { return addHierarchicalEntityWithServiceResponseAsync(appId, versionId, hierarchicalModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() { @Override public UUID call(ServiceResponse<UUID> response) { return response.body(); } }); }
[ "public", "Observable", "<", "UUID", ">", "addHierarchicalEntityAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "HierarchicalEntityModel", "hierarchicalModelCreateObject", ")", "{", "return", "addHierarchicalEntityWithServiceResponseAsync", "(", "appId", ",",...
Adds a hierarchical entity extractor to the application version. @param appId The application ID. @param versionId The version ID. @param hierarchicalModelCreateObject A model containing the name and children of the new entity extractor. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object
[ "Adds", "a", "hierarchical", "entity", "extractor", "to", "the", "application", "version", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1307-L1314
akberc/ceylon-maven-plugin
src/main/java/com/dgwave/car/repo/CeylonRepoLayout.java
CeylonRepoLayout.toUri
private URI toUri(final String path) { try { return new URI(null, null, path, null); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }
java
private URI toUri(final String path) { try { return new URI(null, null, path, null); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }
[ "private", "URI", "toUri", "(", "final", "String", "path", ")", "{", "try", "{", "return", "new", "URI", "(", "null", ",", "null", ",", "path", ",", "null", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "IllegalArg...
Converts from String to URI. @param path The string to convert @return URI if there was no exception
[ "Converts", "from", "String", "to", "URI", "." ]
train
https://github.com/akberc/ceylon-maven-plugin/blob/b7f6c4a2b24f2fa237350c9e715f4193e83415ef/src/main/java/com/dgwave/car/repo/CeylonRepoLayout.java#L84-L90
attribyte/wpdb
src/main/java/org/attribyte/wp/db/DB.java
DB.appendPostTypes
private StringBuilder appendPostTypes(final EnumSet<Post.Type> types, final StringBuilder sql) { int typesCount = types != null ? types.size() : 0; switch(typesCount) { case 0: break; case 1: sql.append(" AND post_type=").append(String.format("'%s'", types.iterator().next().toString())); break; default: sql.append(" AND post_type IN ("); sql.append(inJoiner.join(types.stream().map(t -> String.format("'%s'", t.toString())).collect(Collectors.toSet()))); sql.append(")"); break; } return sql; }
java
private StringBuilder appendPostTypes(final EnumSet<Post.Type> types, final StringBuilder sql) { int typesCount = types != null ? types.size() : 0; switch(typesCount) { case 0: break; case 1: sql.append(" AND post_type=").append(String.format("'%s'", types.iterator().next().toString())); break; default: sql.append(" AND post_type IN ("); sql.append(inJoiner.join(types.stream().map(t -> String.format("'%s'", t.toString())).collect(Collectors.toSet()))); sql.append(")"); break; } return sql; }
[ "private", "StringBuilder", "appendPostTypes", "(", "final", "EnumSet", "<", "Post", ".", "Type", ">", "types", ",", "final", "StringBuilder", "sql", ")", "{", "int", "typesCount", "=", "types", "!=", "null", "?", "types", ".", "size", "(", ")", ":", "0"...
Appends post type constraint. @param types The types. @param sql The buffer to append to. @return The input buffer.
[ "Appends", "post", "type", "constraint", "." ]
train
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L1198-L1214
aboutsip/pkts
pkts-buffers/src/main/java/io/pkts/buffer/BoundedInputStreamBuffer.java
BoundedInputStreamBuffer.internalReadBytes
private int internalReadBytes(final int length) throws IOException { if (length > localCapacity) { throw new IllegalArgumentException("Length is larger than buffer. Request=" + length + ", capacity=" + localCapacity); } // check if we already have enough bytes available for reading // and if so, just return the length the user is asking for if (checkReadableBytesSafe(length)) { return length; } return readFromStream(length - getReadableBytes()); }
java
private int internalReadBytes(final int length) throws IOException { if (length > localCapacity) { throw new IllegalArgumentException("Length is larger than buffer. Request=" + length + ", capacity=" + localCapacity); } // check if we already have enough bytes available for reading // and if so, just return the length the user is asking for if (checkReadableBytesSafe(length)) { return length; } return readFromStream(length - getReadableBytes()); }
[ "private", "int", "internalReadBytes", "(", "final", "int", "length", ")", "throws", "IOException", "{", "if", "(", "length", ">", "localCapacity", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Length is larger than buffer. Request=\"", "+", "length", ...
Ensure that <code>length</code> more bytes are available in the internal buffer. Read more bytes from the underlying stream if needed. This method is blocking in case we don't have enough bytes to read. @param length the amount of bytes we wishes to read @return the actual number of bytes read. @throws IOException
[ "Ensure", "that", "<code", ">", "length<", "/", "code", ">", "more", "bytes", "are", "available", "in", "the", "internal", "buffer", ".", "Read", "more", "bytes", "from", "the", "underlying", "stream", "if", "needed", ".", "This", "method", "is", "blocking...
train
https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-buffers/src/main/java/io/pkts/buffer/BoundedInputStreamBuffer.java#L168-L182
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/SpellcheckOptions.java
SpellcheckOptions.collateParam
public SpellcheckOptions collateParam(String param, Object value) { return potentiallySetCollate().createNewAndAppend(SpellingParams.SPELLCHECK_COLLATE_PARAM_OVERRIDE + param, value); }
java
public SpellcheckOptions collateParam(String param, Object value) { return potentiallySetCollate().createNewAndAppend(SpellingParams.SPELLCHECK_COLLATE_PARAM_OVERRIDE + param, value); }
[ "public", "SpellcheckOptions", "collateParam", "(", "String", "param", ",", "Object", "value", ")", "{", "return", "potentiallySetCollate", "(", ")", ".", "createNewAndAppend", "(", "SpellingParams", ".", "SPELLCHECK_COLLATE_PARAM_OVERRIDE", "+", "param", ",", "value"...
This parameter prefix can be used to specify any additional parameters that you wish to the Spellchecker to use when internally validating collation queries. @param param @param value @return
[ "This", "parameter", "prefix", "can", "be", "used", "to", "specify", "any", "additional", "parameters", "that", "you", "wish", "to", "the", "Spellchecker", "to", "use", "when", "internally", "validating", "collation", "queries", "." ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/SpellcheckOptions.java#L232-L234
kuali/ojb-1.0.4
src/ejb/org/apache/ojb/ejb/pb/RollbackBean.java
RollbackBean.rollbackOtherBeanUsing_2
public void rollbackOtherBeanUsing_2(ArticleVO article, List persons) { log.info("rollbackOtherBeanUsing_2 method was called"); ArticleManagerPBLocal am = getArticleManager(); PersonManagerPBLocal pm = getPersonManager(); pm.storePersons(persons); am.failureStore(article); }
java
public void rollbackOtherBeanUsing_2(ArticleVO article, List persons) { log.info("rollbackOtherBeanUsing_2 method was called"); ArticleManagerPBLocal am = getArticleManager(); PersonManagerPBLocal pm = getPersonManager(); pm.storePersons(persons); am.failureStore(article); }
[ "public", "void", "rollbackOtherBeanUsing_2", "(", "ArticleVO", "article", ",", "List", "persons", ")", "{", "log", ".", "info", "(", "\"rollbackOtherBeanUsing_2 method was called\"", ")", ";", "ArticleManagerPBLocal", "am", "=", "getArticleManager", "(", ")", ";", ...
First store a list of persons then we store the article using a failure store method in ArticleManager. @ejb:interface-method
[ "First", "store", "a", "list", "of", "persons", "then", "we", "store", "the", "article", "using", "a", "failure", "store", "method", "in", "ArticleManager", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/ejb/org/apache/ojb/ejb/pb/RollbackBean.java#L117-L124
netty/netty
common/src/main/java/io/netty/util/NetUtil.java
NetUtil.sysctlGetInt
private static Integer sysctlGetInt(String sysctlKey) throws IOException { Process process = new ProcessBuilder("sysctl", sysctlKey).start(); try { InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); try { String line = br.readLine(); if (line.startsWith(sysctlKey)) { for (int i = line.length() - 1; i > sysctlKey.length(); --i) { if (!Character.isDigit(line.charAt(i))) { return Integer.valueOf(line.substring(i + 1, line.length())); } } } return null; } finally { br.close(); } } finally { if (process != null) { process.destroy(); } } }
java
private static Integer sysctlGetInt(String sysctlKey) throws IOException { Process process = new ProcessBuilder("sysctl", sysctlKey).start(); try { InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); try { String line = br.readLine(); if (line.startsWith(sysctlKey)) { for (int i = line.length() - 1; i > sysctlKey.length(); --i) { if (!Character.isDigit(line.charAt(i))) { return Integer.valueOf(line.substring(i + 1, line.length())); } } } return null; } finally { br.close(); } } finally { if (process != null) { process.destroy(); } } }
[ "private", "static", "Integer", "sysctlGetInt", "(", "String", "sysctlKey", ")", "throws", "IOException", "{", "Process", "process", "=", "new", "ProcessBuilder", "(", "\"sysctl\"", ",", "sysctlKey", ")", ".", "start", "(", ")", ";", "try", "{", "InputStream",...
This will execute <a href ="https://www.freebsd.org/cgi/man.cgi?sysctl(8)">sysctl</a> with the {@code sysctlKey} which is expected to return the numeric value for for {@code sysctlKey}. @param sysctlKey The key which the return value corresponds to. @return The <a href ="https://www.freebsd.org/cgi/man.cgi?sysctl(8)">sysctl</a> value for {@code sysctlKey}.
[ "This", "will", "execute", "<a", "href", "=", "https", ":", "//", "www", ".", "freebsd", ".", "org", "/", "cgi", "/", "man", ".", "cgi?sysctl", "(", "8", ")", ">", "sysctl<", "/", "a", ">", "with", "the", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L315-L339
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.setLineDash
public void setLineDash(float unitsOn, float phase) { content.append("[").append(unitsOn).append("] ").append(phase).append(" d").append_i(separator); }
java
public void setLineDash(float unitsOn, float phase) { content.append("[").append(unitsOn).append("] ").append(phase).append(" d").append_i(separator); }
[ "public", "void", "setLineDash", "(", "float", "unitsOn", ",", "float", "phase", ")", "{", "content", ".", "append", "(", "\"[\"", ")", ".", "append", "(", "unitsOn", ")", ".", "append", "(", "\"] \"", ")", ".", "append", "(", "phase", ")", ".", "app...
Changes the value of the <VAR>line dash pattern</VAR>. <P> The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by an <I>array</I> and a <I>phase</I>. The array specifies the length of the alternating dashes and gaps. The phase specifies the distance into the dash pattern to start the dash.<BR> @param phase the value of the phase @param unitsOn the number of units that must be 'on' (equals the number of units that must be 'off').
[ "Changes", "the", "value", "of", "the", "<VAR", ">", "line", "dash", "pattern<", "/", "VAR", ">", ".", "<P", ">", "The", "line", "dash", "pattern", "controls", "the", "pattern", "of", "dashes", "and", "gaps", "used", "to", "stroke", "paths", ".", "It",...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L382-L384
RestComm/jss7
mtp/mtp-impl/src/main/java/org/restcomm/protocols/ss7/mtp/util/MTPUtility.java
MTPUtility.getFromSif_OPC
public static final int getFromSif_OPC(byte[] sif, int shift) { int opc = ((sif[1 + shift] & 0xC0) >> 6) | ((sif[2 + shift] & 0xff) << 2) | ((sif[3 + shift] & 0x0f) << 10); return opc; }
java
public static final int getFromSif_OPC(byte[] sif, int shift) { int opc = ((sif[1 + shift] & 0xC0) >> 6) | ((sif[2 + shift] & 0xff) << 2) | ((sif[3 + shift] & 0x0f) << 10); return opc; }
[ "public", "static", "final", "int", "getFromSif_OPC", "(", "byte", "[", "]", "sif", ",", "int", "shift", ")", "{", "int", "opc", "=", "(", "(", "sif", "[", "1", "+", "shift", "]", "&", "0xC0", ")", ">>", "6", ")", "|", "(", "(", "sif", "[", "...
Retrieves OPC from SIF. SIF starts from byte 1 in MSU. For MSU [SIO,DPC,OPC,SLS,Data], call would look as following: int opc = getFromSif_OPC(MSU,1); @param sif - byte[] - either SIF or MSU @param shift - shift in passed byte[]. For MSU its 1. For SIF part of MSU it will be 0; @return
[ "Retrieves", "OPC", "from", "SIF", ".", "SIF", "starts", "from", "byte", "1", "in", "MSU", ".", "For", "MSU", "[", "SIO", "DPC", "OPC", "SLS", "Data", "]", "call", "would", "look", "as", "following", ":", "int", "opc", "=", "getFromSif_OPC", "(", "MS...
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/mtp/mtp-impl/src/main/java/org/restcomm/protocols/ss7/mtp/util/MTPUtility.java#L70-L73
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java
GenericIHEAuditEventMessage.addHumanRequestorActiveParticipant
public void addHumanRequestorActiveParticipant(String userId, String altUserId, String userName, List<CodedValueType> roles) { addActiveParticipant( userId, altUserId, userName, true, roles, null); }
java
public void addHumanRequestorActiveParticipant(String userId, String altUserId, String userName, List<CodedValueType> roles) { addActiveParticipant( userId, altUserId, userName, true, roles, null); }
[ "public", "void", "addHumanRequestorActiveParticipant", "(", "String", "userId", ",", "String", "altUserId", ",", "String", "userName", ",", "List", "<", "CodedValueType", ">", "roles", ")", "{", "addActiveParticipant", "(", "userId", ",", "altUserId", ",", "userN...
Adds an Active Participant block representing the human requestor participant @param userId The Active Participant's User ID @param altUserId The Active Participant's Alternate UserID @param userName The Active Participant's UserName @param roles The participant's roles
[ "Adds", "an", "Active", "Participant", "block", "representing", "the", "human", "requestor", "participant" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L133-L142
dlew/joda-time-android
library/src/main/java/net/danlew/android/joda/DateUtils.java
DateUtils.formatDuration
public static CharSequence formatDuration(Context context, ReadableDuration readableDuration) { Resources res = context.getResources(); Duration duration = readableDuration.toDuration(); final int hours = (int) duration.getStandardHours(); if (hours != 0) { return res.getQuantityString(R.plurals.joda_time_android_duration_hours, hours, hours); } final int minutes = (int) duration.getStandardMinutes(); if (minutes != 0) { return res.getQuantityString(R.plurals.joda_time_android_duration_minutes, minutes, minutes); } final int seconds = (int) duration.getStandardSeconds(); return res.getQuantityString(R.plurals.joda_time_android_duration_seconds, seconds, seconds); }
java
public static CharSequence formatDuration(Context context, ReadableDuration readableDuration) { Resources res = context.getResources(); Duration duration = readableDuration.toDuration(); final int hours = (int) duration.getStandardHours(); if (hours != 0) { return res.getQuantityString(R.plurals.joda_time_android_duration_hours, hours, hours); } final int minutes = (int) duration.getStandardMinutes(); if (minutes != 0) { return res.getQuantityString(R.plurals.joda_time_android_duration_minutes, minutes, minutes); } final int seconds = (int) duration.getStandardSeconds(); return res.getQuantityString(R.plurals.joda_time_android_duration_seconds, seconds, seconds); }
[ "public", "static", "CharSequence", "formatDuration", "(", "Context", "context", ",", "ReadableDuration", "readableDuration", ")", "{", "Resources", "res", "=", "context", ".", "getResources", "(", ")", ";", "Duration", "duration", "=", "readableDuration", ".", "t...
Return given duration in a human-friendly format. For example, "4 minutes" or "1 second". Returns only largest meaningful unit of time, from seconds up to hours. The longest duration it supports is hours. This method assumes that there are 60 minutes in an hour, 60 seconds in a minute and 1000 milliseconds in a second. All currently supplied chronologies use this definition.
[ "Return", "given", "duration", "in", "a", "human", "-", "friendly", "format", ".", "For", "example", "4", "minutes", "or", "1", "second", ".", "Returns", "only", "largest", "meaningful", "unit", "of", "time", "from", "seconds", "up", "to", "hours", "." ]
train
https://github.com/dlew/joda-time-android/blob/5bf96f6ef4ea63ee91e73e1e528896fa00108dec/library/src/main/java/net/danlew/android/joda/DateUtils.java#L489-L505
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java
MtoNCollectionPrefetcher.buildPrefetchCriteria
private Criteria buildPrefetchCriteria(Collection ids, String[] fkCols, String[] itemFkCols, FieldDescriptor[] itemPkFields) { if (fkCols.length == 1 && itemFkCols.length == 1) { return buildPrefetchCriteriaSingleKey(ids, fkCols[0], itemFkCols[0], itemPkFields[0]); } else { return buildPrefetchCriteriaMultipleKeys(ids, fkCols, itemFkCols, itemPkFields); } }
java
private Criteria buildPrefetchCriteria(Collection ids, String[] fkCols, String[] itemFkCols, FieldDescriptor[] itemPkFields) { if (fkCols.length == 1 && itemFkCols.length == 1) { return buildPrefetchCriteriaSingleKey(ids, fkCols[0], itemFkCols[0], itemPkFields[0]); } else { return buildPrefetchCriteriaMultipleKeys(ids, fkCols, itemFkCols, itemPkFields); } }
[ "private", "Criteria", "buildPrefetchCriteria", "(", "Collection", "ids", ",", "String", "[", "]", "fkCols", ",", "String", "[", "]", "itemFkCols", ",", "FieldDescriptor", "[", "]", "itemPkFields", ")", "{", "if", "(", "fkCols", ".", "length", "==", "1", "...
Build the prefetch criteria @param ids Collection of identities of M side @param fkCols indirection table fks to this class @param itemFkCols indirection table fks to item class @param itemPkFields
[ "Build", "the", "prefetch", "criteria" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/MtoNCollectionPrefetcher.java#L260-L272
hawkular/hawkular-apm
client/instrumenter/src/main/java/org/hawkular/apm/instrumenter/RuleHelper.java
RuleHelper.removeSuffix
public String removeSuffix(String original, String suffix) { if (original.endsWith(suffix)) { return original.substring(0, original.length() - suffix.length()); } return original; }
java
public String removeSuffix(String original, String suffix) { if (original.endsWith(suffix)) { return original.substring(0, original.length() - suffix.length()); } return original; }
[ "public", "String", "removeSuffix", "(", "String", "original", ",", "String", "suffix", ")", "{", "if", "(", "original", ".", "endsWith", "(", "suffix", ")", ")", "{", "return", "original", ".", "substring", "(", "0", ",", "original", ".", "length", "(",...
This method removes the supplied suffix (if it exists) in the supplied 'original' string. @param original The original string @param suffix The suffix to remove @return The modified string
[ "This", "method", "removes", "the", "supplied", "suffix", "(", "if", "it", "exists", ")", "in", "the", "supplied", "original", "string", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/instrumenter/src/main/java/org/hawkular/apm/instrumenter/RuleHelper.java#L270-L275
bmwcarit/joynr
java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java
AbstractSubscriptionPublisher.fireMulticast
protected void fireMulticast(String multicastName, String[] partitions, Object... values) { List<MulticastListener> listeners; synchronized (multicastListeners) { listeners = new ArrayList<>(multicastListeners); } for (MulticastListener listener : listeners) { listener.multicastOccurred(multicastName, partitions, values); } }
java
protected void fireMulticast(String multicastName, String[] partitions, Object... values) { List<MulticastListener> listeners; synchronized (multicastListeners) { listeners = new ArrayList<>(multicastListeners); } for (MulticastListener listener : listeners) { listener.multicastOccurred(multicastName, partitions, values); } }
[ "protected", "void", "fireMulticast", "(", "String", "multicastName", ",", "String", "[", "]", "partitions", ",", "Object", "...", "values", ")", "{", "List", "<", "MulticastListener", ">", "listeners", ";", "synchronized", "(", "multicastListeners", ")", "{", ...
Called by generated {@code <Interface>AbstractProvider} classes to notify all registered multicast listeners about the fired multicast. <p> NOTE: Provider implementations should _not_ call this method but use multicast specific {@code <Interface>AbstractProvider.fire<Multicast>} methods. @param multicastName the multicast name as defined in the Franca model (as a non-selective broadcast). @param partitions the partitions which will be used in transmitting the multicast @param values the broadcast arguments.
[ "Called", "by", "generated", "{", "@code", "<Interface", ">", "AbstractProvider", "}", "classes", "to", "notify", "all", "registered", "multicast", "listeners", "about", "the", "fired", "multicast", ".", "<p", ">", "NOTE", ":", "Provider", "implementations", "sh...
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java#L109-L117
looly/hutool
hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPatternUtil.java
CronPatternUtil.matchedDates
public static List<Date> matchedDates(String patternStr, Date start, int count, boolean isMatchSecond) { return matchedDates(patternStr, start, DateUtil.endOfYear(start), count, isMatchSecond); }
java
public static List<Date> matchedDates(String patternStr, Date start, int count, boolean isMatchSecond) { return matchedDates(patternStr, start, DateUtil.endOfYear(start), count, isMatchSecond); }
[ "public", "static", "List", "<", "Date", ">", "matchedDates", "(", "String", "patternStr", ",", "Date", "start", ",", "int", "count", ",", "boolean", "isMatchSecond", ")", "{", "return", "matchedDates", "(", "patternStr", ",", "start", ",", "DateUtil", ".", ...
列举指定日期之后(到开始日期对应年年底)内所有匹配表达式的日期 @param patternStr 表达式字符串 @param start 起始时间 @param count 列举数量 @param isMatchSecond 是否匹配秒 @return 日期列表
[ "列举指定日期之后(到开始日期对应年年底)内所有匹配表达式的日期" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/CronPatternUtil.java#L28-L30
actorapp/actor-platform
actor-sdk/sdk-core/runtime/runtime-android/src/main/java/im/actor/runtime/android/crypto/PRNGFixes.java
PRNGFixes.applyOpenSSLFix
private static void applyOpenSSLFix() throws SecurityException { if ((Build.VERSION.SDK_INT < VERSION_CODE_JELLY_BEAN) || (Build.VERSION.SDK_INT > VERSION_CODE_JELLY_BEAN_MR2)) { // No need to apply the fix return; } try { // Mix in the device- and invocation-specific seed. Class.forName("org.apache.harmony.xnet.provider.jsse.NativeCrypto") .getMethod("RAND_seed", byte[].class) .invoke(null, (Object) generateSeed()); // Mix output of Linux PRNG into OpenSSL's PRNG int bytesRead = (Integer) Class.forName( "org.apache.harmony.xnet.provider.jsse.NativeCrypto") .getMethod("RAND_load_file", String.class, long.class) .invoke(null, "/dev/urandom", 1024); if (bytesRead != 1024) { throw new IOException( "Unexpected number of bytes read from Linux PRNG: " + bytesRead); } } catch (Exception e) { throw new SecurityException("Failed to seed OpenSSL PRNG", e); } }
java
private static void applyOpenSSLFix() throws SecurityException { if ((Build.VERSION.SDK_INT < VERSION_CODE_JELLY_BEAN) || (Build.VERSION.SDK_INT > VERSION_CODE_JELLY_BEAN_MR2)) { // No need to apply the fix return; } try { // Mix in the device- and invocation-specific seed. Class.forName("org.apache.harmony.xnet.provider.jsse.NativeCrypto") .getMethod("RAND_seed", byte[].class) .invoke(null, (Object) generateSeed()); // Mix output of Linux PRNG into OpenSSL's PRNG int bytesRead = (Integer) Class.forName( "org.apache.harmony.xnet.provider.jsse.NativeCrypto") .getMethod("RAND_load_file", String.class, long.class) .invoke(null, "/dev/urandom", 1024); if (bytesRead != 1024) { throw new IOException( "Unexpected number of bytes read from Linux PRNG: " + bytesRead); } } catch (Exception e) { throw new SecurityException("Failed to seed OpenSSL PRNG", e); } }
[ "private", "static", "void", "applyOpenSSLFix", "(", ")", "throws", "SecurityException", "{", "if", "(", "(", "Build", ".", "VERSION", ".", "SDK_INT", "<", "VERSION_CODE_JELLY_BEAN", ")", "||", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">", "VERSION_CODE_J...
Applies the fix for OpenSSL PRNG having low entropy. Does nothing if the fix is not needed. @throws SecurityException if the fix is needed but could not be applied.
[ "Applies", "the", "fix", "for", "OpenSSL", "PRNG", "having", "low", "entropy", ".", "Does", "nothing", "if", "the", "fix", "is", "not", "needed", "." ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-android/src/main/java/im/actor/runtime/android/crypto/PRNGFixes.java#L81-L107
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/QueryResultImpl.java
QueryResultImpl.collectScoreNodes
private void collectScoreNodes(MultiColumnQueryHits hits, List<ScoreNode[]> collector, long maxResults, boolean isOffset) throws IOException, RepositoryException { while (collector.size() < maxResults) { ScoreNode[] sn = hits.nextScoreNodes(); if (sn == null) { // no more results break; } // check access if ((!docOrder && !isOffset ) || isAccessGranted(sn)) { collector.add(sn); } else { invalid++; } } }
java
private void collectScoreNodes(MultiColumnQueryHits hits, List<ScoreNode[]> collector, long maxResults, boolean isOffset) throws IOException, RepositoryException { while (collector.size() < maxResults) { ScoreNode[] sn = hits.nextScoreNodes(); if (sn == null) { // no more results break; } // check access if ((!docOrder && !isOffset ) || isAccessGranted(sn)) { collector.add(sn); } else { invalid++; } } }
[ "private", "void", "collectScoreNodes", "(", "MultiColumnQueryHits", "hits", ",", "List", "<", "ScoreNode", "[", "]", ">", "collector", ",", "long", "maxResults", ",", "boolean", "isOffset", ")", "throws", "IOException", ",", "RepositoryException", "{", "while", ...
Collect score nodes from <code>hits</code> into the <code>collector</code> list until the size of <code>collector</code> reaches <code>maxResults</code> or there are not more results. @param hits the raw hits. @param collector where the access checked score nodes are collected. @param maxResults the maximum number of results in the collector. @param isOffset if true the access is checked for the offset result. @throws IOException if an error occurs while reading from hits. @throws RepositoryException if an error occurs while checking access rights.
[ "Collect", "score", "nodes", "from", "<code", ">", "hits<", "/", "code", ">", "into", "the", "<code", ">", "collector<", "/", "code", ">", "list", "until", "the", "size", "of", "<code", ">", "collector<", "/", "code", ">", "reaches", "<code", ">", "max...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/QueryResultImpl.java#L391-L412
RestComm/Restcomm-Connect
restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/PermissionEvaluator.java
PermissionEvaluator.hasAccountRole
public boolean hasAccountRole(final String role,UserIdentityContext userIdentityContext) { if (userIdentityContext.getEffectiveAccount() != null) { return userIdentityContext.getEffectiveAccountRoles().contains(role); } return false; }
java
public boolean hasAccountRole(final String role,UserIdentityContext userIdentityContext) { if (userIdentityContext.getEffectiveAccount() != null) { return userIdentityContext.getEffectiveAccountRoles().contains(role); } return false; }
[ "public", "boolean", "hasAccountRole", "(", "final", "String", "role", ",", "UserIdentityContext", "userIdentityContext", ")", "{", "if", "(", "userIdentityContext", ".", "getEffectiveAccount", "(", ")", "!=", "null", ")", "{", "return", "userIdentityContext", ".", ...
Checks is the effective account has the specified role. Only role values contained in the Restcomm Account are take into account. @param role @return true if the role exists in the Account. Otherwise it returns false.
[ "Checks", "is", "the", "effective", "account", "has", "the", "specified", "role", ".", "Only", "role", "values", "contained", "in", "the", "Restcomm", "Account", "are", "take", "into", "account", "." ]
train
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/PermissionEvaluator.java#L255-L260
Whiley/WhileyCompiler
src/main/java/wyil/interpreter/Interpreter.java
Interpreter.executeDebug
private Status executeDebug(Stmt.Debug stmt, CallStack frame, EnclosingScope scope) { // // FIXME: need to do something with this RValue.Array arr = executeExpression(ARRAY_T, stmt.getOperand(), frame); for (RValue item : arr.getElements()) { RValue.Int i = (RValue.Int) item; char c = (char) i.intValue(); debug.print(c); } // return Status.NEXT; }
java
private Status executeDebug(Stmt.Debug stmt, CallStack frame, EnclosingScope scope) { // // FIXME: need to do something with this RValue.Array arr = executeExpression(ARRAY_T, stmt.getOperand(), frame); for (RValue item : arr.getElements()) { RValue.Int i = (RValue.Int) item; char c = (char) i.intValue(); debug.print(c); } // return Status.NEXT; }
[ "private", "Status", "executeDebug", "(", "Stmt", ".", "Debug", "stmt", ",", "CallStack", "frame", ",", "EnclosingScope", "scope", ")", "{", "//", "// FIXME: need to do something with this", "RValue", ".", "Array", "arr", "=", "executeExpression", "(", "ARRAY_T", ...
Execute a Debug statement at a given point in the function or method body. This will write the provided string out to the debug stream. @param stmt --- Debug statement to executed @param frame --- The current stack frame @return
[ "Execute", "a", "Debug", "statement", "at", "a", "given", "point", "in", "the", "function", "or", "method", "body", ".", "This", "will", "write", "the", "provided", "string", "out", "to", "the", "debug", "stream", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L312-L323
olavloite/spanner-jdbc
src/main/java/nl/topicus/jdbc/util/Base64.java
Base64.encodeBytes
public static String encodeBytes(byte[] source, int off, int len, int options) { // Isolate options int dontBreakLines = (options & DONT_BREAK_LINES); return encodeBytes(source, off, len, dontBreakLines == 0); }
java
public static String encodeBytes(byte[] source, int off, int len, int options) { // Isolate options int dontBreakLines = (options & DONT_BREAK_LINES); return encodeBytes(source, off, len, dontBreakLines == 0); }
[ "public", "static", "String", "encodeBytes", "(", "byte", "[", "]", "source", ",", "int", "off", ",", "int", "len", ",", "int", "options", ")", "{", "// Isolate options\r", "int", "dontBreakLines", "=", "(", "options", "&", "DONT_BREAK_LINES", ")", ";", "r...
Encodes a byte array into Base64 notation. <p> Valid options: <pre> GZIP: gzip-compresses object before encoding it. DONT_BREAK_LINES: don't break lines at 76 characters <i>Note: Technically, this makes your encoding non-compliant.</i> </pre> <p> Example: <code>encodeBytes( myData, Base64.GZIP )</code> or <p> Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code> @param source The data to convert @param off Offset in array where conversion should begin @param len Length of data to convert @param options Specified options @return Base64 notation @see Base64#DONT_BREAK_LINES @since 2.0
[ "Encodes", "a", "byte", "array", "into", "Base64", "notation", ".", "<p", ">", "Valid", "options", ":" ]
train
https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/util/Base64.java#L351-L355
js-lib-com/template.xhtml
src/main/java/js/template/xhtml/Content.java
Content.getObject
Object getObject(Object scope, String propertyPath) throws TemplateException { Object object = getValue(scope, propertyPath); if(object == null) { warn(scope.getClass(), propertyPath); } return object; }
java
Object getObject(Object scope, String propertyPath) throws TemplateException { Object object = getValue(scope, propertyPath); if(object == null) { warn(scope.getClass(), propertyPath); } return object; }
[ "Object", "getObject", "(", "Object", "scope", ",", "String", "propertyPath", ")", "throws", "TemplateException", "{", "Object", "object", "=", "getValue", "(", "scope", ",", "propertyPath", ")", ";", "if", "(", "object", "==", "null", ")", "{", "warn", "(...
Retrieve content object. Delegates {@link #getValue(Object, String)} to obtain the requested value. If value is null warn the event; in any case return value. @param scope scope object, @param propertyPath object property path. @return content object or null. @throws TemplateException if requested value is undefined.
[ "Retrieve", "content", "object", ".", "Delegates", "{", "@link", "#getValue", "(", "Object", "String", ")", "}", "to", "obtain", "the", "requested", "value", ".", "If", "value", "is", "null", "warn", "the", "event", ";", "in", "any", "case", "return", "v...
train
https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/Content.java#L140-L147
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/pq/pqpolicy_stats.java
pqpolicy_stats.get
public static pqpolicy_stats get(nitro_service service, String policyname) throws Exception{ pqpolicy_stats obj = new pqpolicy_stats(); obj.set_policyname(policyname); pqpolicy_stats response = (pqpolicy_stats) obj.stat_resource(service); return response; }
java
public static pqpolicy_stats get(nitro_service service, String policyname) throws Exception{ pqpolicy_stats obj = new pqpolicy_stats(); obj.set_policyname(policyname); pqpolicy_stats response = (pqpolicy_stats) obj.stat_resource(service); return response; }
[ "public", "static", "pqpolicy_stats", "get", "(", "nitro_service", "service", ",", "String", "policyname", ")", "throws", "Exception", "{", "pqpolicy_stats", "obj", "=", "new", "pqpolicy_stats", "(", ")", ";", "obj", ".", "set_policyname", "(", "policyname", ")"...
Use this API to fetch statistics of pqpolicy_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "pqpolicy_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/pq/pqpolicy_stats.java#L309-L314
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/CookieManager.java
CookieManager.pathMatches
private static boolean pathMatches(URI uri, HttpCookie cookie) { return normalizePath(uri.getPath()).startsWith(normalizePath(cookie.getPath())); }
java
private static boolean pathMatches(URI uri, HttpCookie cookie) { return normalizePath(uri.getPath()).startsWith(normalizePath(cookie.getPath())); }
[ "private", "static", "boolean", "pathMatches", "(", "URI", "uri", ",", "HttpCookie", "cookie", ")", "{", "return", "normalizePath", "(", "uri", ".", "getPath", "(", ")", ")", ".", "startsWith", "(", "normalizePath", "(", "cookie", ".", "getPath", "(", ")",...
Return true iff. the path from {@code cookie} matches the path from {@code uri}.
[ "Return", "true", "iff", ".", "the", "path", "from", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/CookieManager.java#L394-L396
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.containsSubflowState
public boolean containsSubflowState(final Flow flow, final String stateId) { if (containsFlowState(flow, stateId)) { return getState(flow, stateId, SubflowState.class) != null; } return false; }
java
public boolean containsSubflowState(final Flow flow, final String stateId) { if (containsFlowState(flow, stateId)) { return getState(flow, stateId, SubflowState.class) != null; } return false; }
[ "public", "boolean", "containsSubflowState", "(", "final", "Flow", "flow", ",", "final", "String", "stateId", ")", "{", "if", "(", "containsFlowState", "(", "flow", ",", "stateId", ")", ")", "{", "return", "getState", "(", "flow", ",", "stateId", ",", "Sub...
Contains subflow state. @param flow the flow @param stateId the state id @return the boolean
[ "Contains", "subflow", "state", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L561-L566
phax/ph-css
ph-css/src/main/java/com/helger/css/handler/CSSHandler.java
CSSHandler.readCascadingStyleSheetFromNode
@Nonnull @Deprecated public static CascadingStyleSheet readCascadingStyleSheetFromNode (@Nonnull final ECSSVersion eVersion, @Nonnull final CSSNode aNode) { return readCascadingStyleSheetFromNode (eVersion, aNode, CSSReader.getDefaultInterpretErrorHandler ()); }
java
@Nonnull @Deprecated public static CascadingStyleSheet readCascadingStyleSheetFromNode (@Nonnull final ECSSVersion eVersion, @Nonnull final CSSNode aNode) { return readCascadingStyleSheetFromNode (eVersion, aNode, CSSReader.getDefaultInterpretErrorHandler ()); }
[ "@", "Nonnull", "@", "Deprecated", "public", "static", "CascadingStyleSheet", "readCascadingStyleSheetFromNode", "(", "@", "Nonnull", "final", "ECSSVersion", "eVersion", ",", "@", "Nonnull", "final", "CSSNode", "aNode", ")", "{", "return", "readCascadingStyleSheetFromNo...
Create a {@link CascadingStyleSheet} object from a parsed object. @param eVersion The CSS version to use. May not be <code>null</code>. @param aNode The parsed CSS object to read. May not be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "{", "@link", "CascadingStyleSheet", "}", "object", "from", "a", "parsed", "object", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/handler/CSSHandler.java#L55-L61
crawljax/crawljax
core/src/main/java/com/crawljax/util/UrlUtils.java
UrlUtils.isSameDomain
public static boolean isSameDomain(String currentUrl, URI url) { String current = URI.create(getBaseUrl(currentUrl)).getHost() .toLowerCase(); String original = url.getHost().toLowerCase(); return current.endsWith(original); }
java
public static boolean isSameDomain(String currentUrl, URI url) { String current = URI.create(getBaseUrl(currentUrl)).getHost() .toLowerCase(); String original = url.getHost().toLowerCase(); return current.endsWith(original); }
[ "public", "static", "boolean", "isSameDomain", "(", "String", "currentUrl", ",", "URI", "url", ")", "{", "String", "current", "=", "URI", ".", "create", "(", "getBaseUrl", "(", "currentUrl", ")", ")", ".", "getHost", "(", ")", ".", "toLowerCase", "(", ")...
Checks if the given URL is part of the domain, or a sub-domain of the given {@link java.net.URI}. @param currentUrl The url you want to check. @param url The URL acting as the base. @return If the URL is part of the domain.
[ "Checks", "if", "the", "given", "URL", "is", "part", "of", "the", "domain", "or", "a", "sub", "-", "domain", "of", "the", "given", "{", "@link", "java", ".", "net", ".", "URI", "}", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/util/UrlUtils.java#L87-L93
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.writeUtf8
public static int writeUtf8(ByteBuf buf, CharSequence seq) { return reserveAndWriteUtf8(buf, seq, utf8MaxBytes(seq)); }
java
public static int writeUtf8(ByteBuf buf, CharSequence seq) { return reserveAndWriteUtf8(buf, seq, utf8MaxBytes(seq)); }
[ "public", "static", "int", "writeUtf8", "(", "ByteBuf", "buf", ",", "CharSequence", "seq", ")", "{", "return", "reserveAndWriteUtf8", "(", "buf", ",", "seq", ",", "utf8MaxBytes", "(", "seq", ")", ")", ";", "}" ]
Encode a {@link CharSequence} in <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> and write it to a {@link ByteBuf}. <p> It behaves like {@link #reserveAndWriteUtf8(ByteBuf, CharSequence, int)} with {@code reserveBytes} computed by {@link #utf8MaxBytes(CharSequence)}.<br> This method returns the actual number of bytes written.
[ "Encode", "a", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L498-L500
jayantk/jklol
src/com/jayantkrish/jklol/cfg/CfgParseChart.java
CfgParseChart.updateOutsideEntry
public void updateOutsideEntry(int spanStart, int spanEnd, double[] values, Factor factor, VariableNumMap var) { if (sumProduct) { updateEntrySumProduct(outsideChart[spanStart][spanEnd], values, factor.coerceToDiscrete().getWeights(), var.getOnlyVariableNum()); } else { updateEntryMaxProduct(outsideChart[spanStart][spanEnd], values, factor.coerceToDiscrete().getWeights(), var.getOnlyVariableNum()); } }
java
public void updateOutsideEntry(int spanStart, int spanEnd, double[] values, Factor factor, VariableNumMap var) { if (sumProduct) { updateEntrySumProduct(outsideChart[spanStart][spanEnd], values, factor.coerceToDiscrete().getWeights(), var.getOnlyVariableNum()); } else { updateEntryMaxProduct(outsideChart[spanStart][spanEnd], values, factor.coerceToDiscrete().getWeights(), var.getOnlyVariableNum()); } }
[ "public", "void", "updateOutsideEntry", "(", "int", "spanStart", ",", "int", "spanEnd", ",", "double", "[", "]", "values", ",", "Factor", "factor", ",", "VariableNumMap", "var", ")", "{", "if", "(", "sumProduct", ")", "{", "updateEntrySumProduct", "(", "outs...
Update an entry of the outside chart with a new production. Depending on the type of the chart, this performs either a sum or max over productions of the same type in the same entry.
[ "Update", "an", "entry", "of", "the", "outside", "chart", "with", "a", "new", "production", ".", "Depending", "on", "the", "type", "of", "the", "chart", "this", "performs", "either", "a", "sum", "or", "max", "over", "productions", "of", "the", "same", "t...
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cfg/CfgParseChart.java#L185-L193
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.setupIconView
public ScreenComponent setupIconView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, boolean bIncludeBlankOption) { ScreenComponent screenField = null; Record record = this.makeReferenceRecord(); // Set up the listener to read the current record on a valid main record ImageField fldDisplayFieldDesc = this.getIconField(record); if (fldDisplayFieldDesc.getListener(BlankButtonHandler.class) == null) fldDisplayFieldDesc.addListener(new BlankButtonHandler(null)); if (fldDisplayFieldDesc != null) { // The next two lines are so in GridScreen(s), the converter leads to this field, while it displays the fielddesc. FieldConverter fldDescConverter = new FieldDescConverter(fldDisplayFieldDesc, (Converter)converter); Map<String,Object> properties = new HashMap<String,Object>(); properties.put(ScreenModel.IMAGE, ScreenModel.NONE); properties.put(ScreenModel.NEVER_DISABLE, Constants.TRUE); screenField = createScreenComponent(ScreenModel.BUTTON_BOX, itsLocation, targetScreen, fldDescConverter, iDisplayFieldDesc, properties); //?{ //? public void setEnabled(boolean bEnabled) //? { //? super.setEnabled(true); // Never disable //? } //?}; String strDisplay = converter.getFieldDesc(); if (!(targetScreen instanceof GridScreenParent)) if ((strDisplay != null) && (strDisplay.length() > 0)) { // Since display string does not come with buttons ScreenLoc descLocation = targetScreen.getNextLocation(ScreenConstants.FIELD_DESC, ScreenConstants.DONT_SET_ANCHOR); properties = new HashMap<String,Object>(); properties.put(ScreenModel.DISPLAY_STRING, strDisplay); createScreenComponent(ScreenModel.STATIC_STRING, descLocation, targetScreen, converter, iDisplayFieldDesc, properties); } } if (((targetScreen instanceof GridScreenParent)) || (iDisplayFieldDesc == ScreenConstants.DONT_DISPLAY_FIELD_DESC)) { // If there is no popupbox to display the icon, I must explicitly read it. this.addListener(new ReadSecondaryHandler(fldDisplayFieldDesc.getRecord())); } return screenField; }
java
public ScreenComponent setupIconView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, boolean bIncludeBlankOption) { ScreenComponent screenField = null; Record record = this.makeReferenceRecord(); // Set up the listener to read the current record on a valid main record ImageField fldDisplayFieldDesc = this.getIconField(record); if (fldDisplayFieldDesc.getListener(BlankButtonHandler.class) == null) fldDisplayFieldDesc.addListener(new BlankButtonHandler(null)); if (fldDisplayFieldDesc != null) { // The next two lines are so in GridScreen(s), the converter leads to this field, while it displays the fielddesc. FieldConverter fldDescConverter = new FieldDescConverter(fldDisplayFieldDesc, (Converter)converter); Map<String,Object> properties = new HashMap<String,Object>(); properties.put(ScreenModel.IMAGE, ScreenModel.NONE); properties.put(ScreenModel.NEVER_DISABLE, Constants.TRUE); screenField = createScreenComponent(ScreenModel.BUTTON_BOX, itsLocation, targetScreen, fldDescConverter, iDisplayFieldDesc, properties); //?{ //? public void setEnabled(boolean bEnabled) //? { //? super.setEnabled(true); // Never disable //? } //?}; String strDisplay = converter.getFieldDesc(); if (!(targetScreen instanceof GridScreenParent)) if ((strDisplay != null) && (strDisplay.length() > 0)) { // Since display string does not come with buttons ScreenLoc descLocation = targetScreen.getNextLocation(ScreenConstants.FIELD_DESC, ScreenConstants.DONT_SET_ANCHOR); properties = new HashMap<String,Object>(); properties.put(ScreenModel.DISPLAY_STRING, strDisplay); createScreenComponent(ScreenModel.STATIC_STRING, descLocation, targetScreen, converter, iDisplayFieldDesc, properties); } } if (((targetScreen instanceof GridScreenParent)) || (iDisplayFieldDesc == ScreenConstants.DONT_DISPLAY_FIELD_DESC)) { // If there is no popupbox to display the icon, I must explicitly read it. this.addListener(new ReadSecondaryHandler(fldDisplayFieldDesc.getRecord())); } return screenField; }
[ "public", "ScreenComponent", "setupIconView", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "Convert", "converter", ",", "int", "iDisplayFieldDesc", ",", "boolean", "bIncludeBlankOption", ")", "{", "ScreenComponent", "screenField", "=", "...
Display a button that shows the icon from the current record in the secondary file.
[ "Display", "a", "button", "that", "shows", "the", "icon", "from", "the", "current", "record", "in", "the", "secondary", "file", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L305-L343
rythmengine/rythmengine
src/main/java/org/rythmengine/utils/S.java
S.ne
public static boolean ne(String s1, String s2, int modifier) { return !isEqual(s1, s2, modifier); }
java
public static boolean ne(String s1, String s2, int modifier) { return !isEqual(s1, s2, modifier); }
[ "public", "static", "boolean", "ne", "(", "String", "s1", ",", "String", "s2", ",", "int", "modifier", ")", "{", "return", "!", "isEqual", "(", "s1", ",", "s2", ",", "modifier", ")", ";", "}" ]
Alias of {@link #isNotEqual(String, String, int)} @param s1 @param s2 @param modifier @return true if o1's str not equals o2's str
[ "Alias", "of", "{", "@link", "#isNotEqual", "(", "String", "String", "int", ")", "}" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/utils/S.java#L263-L265
tiesebarrell/process-assertions
process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/MessageLogger.java
MessageLogger.logInfo
public final void logInfo(final Logger logger, final String messageKey, final Object... objects) { logger.info(getMessage(messageKey, objects)); }
java
public final void logInfo(final Logger logger, final String messageKey, final Object... objects) { logger.info(getMessage(messageKey, objects)); }
[ "public", "final", "void", "logInfo", "(", "final", "Logger", "logger", ",", "final", "String", "messageKey", ",", "final", "Object", "...", "objects", ")", "{", "logger", ".", "info", "(", "getMessage", "(", "messageKey", ",", "objects", ")", ")", ";", ...
Logs a message by the provided key to the provided {@link Logger} at info level after substituting the parameters in the message by the provided objects. @param logger the logger to log to @param messageKey the key of the message in the bundle @param objects the substitution parameters
[ "Logs", "a", "message", "by", "the", "provided", "key", "to", "the", "provided", "{" ]
train
https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/MessageLogger.java#L48-L50
3redronin/mu-server
src/main/java/io/muserver/Cookie.java
Cookie.secureCookie
@Deprecated public static Cookie secureCookie(String name, String value) { return CookieBuilder.newSecureCookie() .withName(name) .withValue(value) .build(); }
java
@Deprecated public static Cookie secureCookie(String name, String value) { return CookieBuilder.newSecureCookie() .withName(name) .withValue(value) .build(); }
[ "@", "Deprecated", "public", "static", "Cookie", "secureCookie", "(", "String", "name", ",", "String", "value", ")", "{", "return", "CookieBuilder", ".", "newSecureCookie", "(", ")", ".", "withName", "(", "name", ")", ".", "withValue", "(", "value", ")", "...
<p>Creates a new cookie with secure settings such as HttpOnly and Secure set to true.</p> @param name The name of the cookie @param value The value of the cookie @return Returns a new cookie that can be sent to the response @deprecated Please use {@link CookieBuilder#newSecureCookie()} instead
[ "<p", ">", "Creates", "a", "new", "cookie", "with", "secure", "settings", "such", "as", "HttpOnly", "and", "Secure", "set", "to", "true", ".", "<", "/", "p", ">" ]
train
https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/Cookie.java#L23-L29
liyiorg/weixin-popular
src/main/java/weixin/popular/util/JsUtil.java
JsUtil.generateConfigJson
public static String generateConfigJson(String jsapi_ticket,boolean debug,String appId,String url,String... jsApiList){ long timestamp = System.currentTimeMillis()/1000; String nonceStr = UUID.randomUUID().toString(); String signature = generateConfigSignature(nonceStr, jsapi_ticket, timestamp + "", url); Map<String,Object> map = new LinkedHashMap<>(); map.put("debug", debug); map.put("appId", appId); map.put("timestamp", timestamp); map.put("nonceStr", nonceStr); map.put("signature", signature); map.put("jsApiList", jsApiList == null ? ALL_JS_API_LIST : jsApiList); return JsonUtil.toJSONString(map); }
java
public static String generateConfigJson(String jsapi_ticket,boolean debug,String appId,String url,String... jsApiList){ long timestamp = System.currentTimeMillis()/1000; String nonceStr = UUID.randomUUID().toString(); String signature = generateConfigSignature(nonceStr, jsapi_ticket, timestamp + "", url); Map<String,Object> map = new LinkedHashMap<>(); map.put("debug", debug); map.put("appId", appId); map.put("timestamp", timestamp); map.put("nonceStr", nonceStr); map.put("signature", signature); map.put("jsApiList", jsApiList == null ? ALL_JS_API_LIST : jsApiList); return JsonUtil.toJSONString(map); }
[ "public", "static", "String", "generateConfigJson", "(", "String", "jsapi_ticket", ",", "boolean", "debug", ",", "String", "appId", ",", "String", "url", ",", "String", "...", "jsApiList", ")", "{", "long", "timestamp", "=", "System", ".", "currentTimeMillis", ...
生成 config接口注入权限验证 JSON @param jsapi_ticket jsapi_ticket @param debug debug @param appId appId @param url url @param jsApiList 可以为空<br> 基础接口<br> checkJsApi 判断当前客户端版本是否支持指定JS接口<br> 分享接口<br> updateAppMessageShareData 分享到朋友及QQ<br> updateTimelineShareData 分享到朋友圈及QQ空间<br> onMenuShareTimeline 分享到朋友圈<br> onMenuShareAppMessage 分享给朋友<br> onMenuShareQQ 分享到QQ<br> onMenuShareWeibo 分享到腾讯微博<br> onMenuShareQZone 分享到QQ空间<br> 图像接口<br> chooseImage 拍照或从手机相册中选图<br> previewImage 预览图片<br> uploadImage 上传图片<br> downloadImage 下载图片<br> 音频接口<br> startRecord 开始录音<br> stopRecord 停止录音<br> onVoiceRecordEnd 监听录音自动停止<br> playVoice 播放语音<br> pauseVoice 暂停播放<br> stopVoice 停止播放<br> onVoicePlayEnd 监听语音播放完毕<br> uploadVoice 上传语音<br> downloadVoice 下载语音<br> 智能接口<br> translateVoice 识别音频并返回识别结果<br> 设备信息<br> getNetworkType 获取网络状态<br> 地理位置<br> openLocation 使用微信内置地图查看位置<br> getLocation 获取地理位置<br> 摇一摇周边<br> startSearchBeacons 开启查找周边ibeacon设备<br> stopSearchBeacons 关闭查找周边ibeacon设备<br> onSearchBeacons 监听周边ibeacon设备<br> 界面操作<br> hideOptionMenu 隐藏右上角菜单<br> showOptionMenu 显示右上角菜单<br> closeWindow 关闭当前网页窗口<br> hideMenuItems 批量隐藏功能按钮<br> showMenuItems 批量显示功能按钮<br> hideAllNonBaseMenuItem 隐藏所有非基础按钮<br> showAllNonBaseMenuItem 显示所有功能按钮<br> 微信扫一扫<br> scanQRCode 调起微信扫一扫<br> 微信小店<br> openProductSpecificView 跳转微信商品页<br> 微信卡券<br> chooseCard 拉取适用卡券列表并获取用户选择信息<br> addCard 批量添加卡券<br> openCard 查看微信卡包中的卡券<br> 微信支付<br> chooseWXPay 发起一个微信支付<br> openAddress 共享收货地址接口<br> @return 配置JSON数据
[ "生成", "config接口注入权限验证", "JSON", "@param", "jsapi_ticket", "jsapi_ticket", "@param", "debug", "debug", "@param", "appId", "appId", "@param", "url", "url", "@param", "jsApiList", "可以为空<br", ">", "基础接口<br", ">", "checkJsApi", "判断当前客户端版本是否支持指定JS接口<br", ">", "分享接口<br", "...
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/JsUtil.java#L158-L170
forge/furnace
container-api/src/main/java/org/jboss/forge/furnace/versions/Versions.java
Versions.isApiCompatible
public static boolean isApiCompatible(Version runtimeVersion, Version addonApiVersion) { if (addonApiVersion == null || addonApiVersion.toString().length() == 0 || runtimeVersion == null || runtimeVersion.toString().length() == 0) return true; int runtimeMajorVersion = runtimeVersion.getMajorVersion(); int runtimeMinorVersion = runtimeVersion.getMinorVersion(); int addonApiMajorVersion = addonApiVersion.getMajorVersion(); int addonApiMinorVersion = addonApiVersion.getMinorVersion(); return (addonApiMajorVersion == runtimeMajorVersion && addonApiMinorVersion <= runtimeMinorVersion); }
java
public static boolean isApiCompatible(Version runtimeVersion, Version addonApiVersion) { if (addonApiVersion == null || addonApiVersion.toString().length() == 0 || runtimeVersion == null || runtimeVersion.toString().length() == 0) return true; int runtimeMajorVersion = runtimeVersion.getMajorVersion(); int runtimeMinorVersion = runtimeVersion.getMinorVersion(); int addonApiMajorVersion = addonApiVersion.getMajorVersion(); int addonApiMinorVersion = addonApiVersion.getMinorVersion(); return (addonApiMajorVersion == runtimeMajorVersion && addonApiMinorVersion <= runtimeMinorVersion); }
[ "public", "static", "boolean", "isApiCompatible", "(", "Version", "runtimeVersion", ",", "Version", "addonApiVersion", ")", "{", "if", "(", "addonApiVersion", "==", "null", "||", "addonApiVersion", ".", "toString", "(", ")", ".", "length", "(", ")", "==", "0",...
This method only returns true if: - The major version of addonApiVersion is equal to the major version of runtimeVersion AND - The minor version of addonApiVersion is less or equal to the minor version of runtimeVersion - The addonApiVersion is null @param runtimeVersion a version in the format x.x.x @param addonApiVersion a version in the format x.x.x
[ "This", "method", "only", "returns", "true", "if", ":" ]
train
https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/container-api/src/main/java/org/jboss/forge/furnace/versions/Versions.java#L38-L49
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.hardTouch
private void hardTouch(CmsObject cms, CmsResource resource) throws CmsException { CmsFile file = cms.readFile(resource); cms = OpenCms.initCmsObject(cms); cms.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE); file.setContents(file.getContents()); cms.writeFile(file); }
java
private void hardTouch(CmsObject cms, CmsResource resource) throws CmsException { CmsFile file = cms.readFile(resource); cms = OpenCms.initCmsObject(cms); cms.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE); file.setContents(file.getContents()); cms.writeFile(file); }
[ "private", "void", "hardTouch", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "CmsFile", "file", "=", "cms", ".", "readFile", "(", "resource", ")", ";", "cms", "=", "OpenCms", ".", "initCmsObject", "(", "cms", ...
Rewrites the content of the given file.<p> @param cms the CmsObject @param resource the resource to rewrite the content for @throws CmsException if something goes wrong
[ "Rewrites", "the", "content", "of", "the", "given", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L1857-L1864
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java
CPOptionValuePersistenceImpl.findByCPOptionId
@Override public List<CPOptionValue> findByCPOptionId(long CPOptionId, int start, int end) { return findByCPOptionId(CPOptionId, start, end, null); }
java
@Override public List<CPOptionValue> findByCPOptionId(long CPOptionId, int start, int end) { return findByCPOptionId(CPOptionId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPOptionValue", ">", "findByCPOptionId", "(", "long", "CPOptionId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCPOptionId", "(", "CPOptionId", ",", "start", ",", "end", ",", "null", ")", ";",...
Returns a range of all the cp option values where CPOptionId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPOptionValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPOptionId the cp option ID @param start the lower bound of the range of cp option values @param end the upper bound of the range of cp option values (not inclusive) @return the range of matching cp option values
[ "Returns", "a", "range", "of", "all", "the", "cp", "option", "values", "where", "CPOptionId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java#L2545-L2549
code4everything/util
src/main/java/com/zhazhapan/util/Checker.java
Checker.isLimited
public static boolean isLimited(String string, int min, int max) { return isNotEmpty(string) && string.length() >= min && string.length() <= max; }
java
public static boolean isLimited(String string, int min, int max) { return isNotEmpty(string) && string.length() >= min && string.length() <= max; }
[ "public", "static", "boolean", "isLimited", "(", "String", "string", ",", "int", "min", ",", "int", "max", ")", "{", "return", "isNotEmpty", "(", "string", ")", "&&", "string", ".", "length", "(", ")", ">=", "min", "&&", "string", ".", "length", "(", ...
判断字符串的长度是否在某个范围 @param string 字符串 @param min 最小长度 @param max 最大长度 @return {@link Boolean}
[ "判断字符串的长度是否在某个范围" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L750-L752
apache/spark
core/src/main/java/org/apache/spark/shuffle/sort/PackedRecordPointer.java
PackedRecordPointer.packPointer
public static long packPointer(long recordPointer, int partitionId) { assert (partitionId <= MAXIMUM_PARTITION_ID); // Note that without word alignment we can address 2^27 bytes = 128 megabytes per page. // Also note that this relies on some internals of how TaskMemoryManager encodes its addresses. final long pageNumber = (recordPointer & MASK_LONG_UPPER_13_BITS) >>> 24; final long compressedAddress = pageNumber | (recordPointer & MASK_LONG_LOWER_27_BITS); return (((long) partitionId) << 40) | compressedAddress; }
java
public static long packPointer(long recordPointer, int partitionId) { assert (partitionId <= MAXIMUM_PARTITION_ID); // Note that without word alignment we can address 2^27 bytes = 128 megabytes per page. // Also note that this relies on some internals of how TaskMemoryManager encodes its addresses. final long pageNumber = (recordPointer & MASK_LONG_UPPER_13_BITS) >>> 24; final long compressedAddress = pageNumber | (recordPointer & MASK_LONG_LOWER_27_BITS); return (((long) partitionId) << 40) | compressedAddress; }
[ "public", "static", "long", "packPointer", "(", "long", "recordPointer", ",", "int", "partitionId", ")", "{", "assert", "(", "partitionId", "<=", "MAXIMUM_PARTITION_ID", ")", ";", "// Note that without word alignment we can address 2^27 bytes = 128 megabytes per page.", "// A...
Pack a record address and partition id into a single word. @param recordPointer a record pointer encoded by TaskMemoryManager. @param partitionId a shuffle partition id (maximum value of 2^24). @return a packed pointer that can be decoded using the {@link PackedRecordPointer} class.
[ "Pack", "a", "record", "address", "and", "partition", "id", "into", "a", "single", "word", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/shuffle/sort/PackedRecordPointer.java#L77-L84