repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Symtab.java
Symtab.makeOperatorName
private Name makeOperatorName(String name) { Name opName = names.fromString(name); operatorNames.add(opName); return opName; }
java
private Name makeOperatorName(String name) { Name opName = names.fromString(name); operatorNames.add(opName); return opName; }
[ "private", "Name", "makeOperatorName", "(", "String", "name", ")", "{", "Name", "opName", "=", "names", ".", "fromString", "(", "name", ")", ";", "operatorNames", ".", "add", "(", "opName", ")", ";", "return", "opName", ";", "}" ]
Create a new operator name from corresponding String representation and add the name to the set of known operator names.
[ "Create", "a", "new", "operator", "name", "from", "corresponding", "String", "representation", "and", "add", "the", "name", "to", "the", "set", "of", "known", "operator", "names", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Symtab.java#L302-L306
train
magik6k/JWWF
src/main/java/net/magik6k/jwwf/widgets/basic/panel/generic/NamedPanel.java
NamedPanel.put
public Widget put(IWidgetFactory factory, String name) { Widget widget = factory.getWidget(); put(widget, name); return widget; }
java
public Widget put(IWidgetFactory factory, String name) { Widget widget = factory.getWidget(); put(widget, name); return widget; }
[ "public", "Widget", "put", "(", "IWidgetFactory", "factory", ",", "String", "name", ")", "{", "Widget", "widget", "=", "factory", ".", "getWidget", "(", ")", ";", "put", "(", "widget", ",", "name", ")", ";", "return", "widget", ";", "}" ]
Creates new widget and puts it to container at first free index @param factory Factory of new widget @param name Name of tab @return Instance of created widget
[ "Creates", "new", "widget", "and", "puts", "it", "to", "container", "at", "first", "free", "index" ]
8ba334501396c3301495da8708733f6014f20665
https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/widgets/basic/panel/generic/NamedPanel.java#L33-L37
train
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.getEventTypeDescription
public static String getEventTypeDescription(final XMLStreamReader reader) { final int eventType = reader.getEventType(); if (eventType == XMLStreamConstants.START_ELEMENT) { final String namespace = reader.getNamespaceURI(); return "<" + reader.getLocalName() + (!StringUtils.isEmpty(namespace) ? "@" + namespace : StringUtils.EMPTY) + ">"; } if (eventType == XMLStreamConstants.END_ELEMENT) { final String namespace = reader.getNamespaceURI(); return "</" + reader.getLocalName() + (!StringUtils.isEmpty(namespace) ? "@" + namespace : StringUtils.EMPTY) + ">"; } return NAMES_OF_EVENTS[reader.getEventType()]; }
java
public static String getEventTypeDescription(final XMLStreamReader reader) { final int eventType = reader.getEventType(); if (eventType == XMLStreamConstants.START_ELEMENT) { final String namespace = reader.getNamespaceURI(); return "<" + reader.getLocalName() + (!StringUtils.isEmpty(namespace) ? "@" + namespace : StringUtils.EMPTY) + ">"; } if (eventType == XMLStreamConstants.END_ELEMENT) { final String namespace = reader.getNamespaceURI(); return "</" + reader.getLocalName() + (!StringUtils.isEmpty(namespace) ? "@" + namespace : StringUtils.EMPTY) + ">"; } return NAMES_OF_EVENTS[reader.getEventType()]; }
[ "public", "static", "String", "getEventTypeDescription", "(", "final", "XMLStreamReader", "reader", ")", "{", "final", "int", "eventType", "=", "reader", ".", "getEventType", "(", ")", ";", "if", "(", "eventType", "==", "XMLStreamConstants", ".", "START_ELEMENT", ...
Returns string describing the current event. @param reader pull parser that contains event information @return string describing the current event.
[ "Returns", "string", "describing", "the", "current", "event", "." ]
83c607044f64a7f6c005a67866c0ef7cb68d6e29
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L487-L500
train
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.isStartElement
public static boolean isStartElement( final XMLStreamReader reader, final String namespace, final String localName) { return reader.getEventType() == XMLStreamConstants.START_ELEMENT && nameEquals(reader, namespace, localName); }
java
public static boolean isStartElement( final XMLStreamReader reader, final String namespace, final String localName) { return reader.getEventType() == XMLStreamConstants.START_ELEMENT && nameEquals(reader, namespace, localName); }
[ "public", "static", "boolean", "isStartElement", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "namespace", ",", "final", "String", "localName", ")", "{", "return", "reader", ".", "getEventType", "(", ")", "==", "XMLStreamConstants", ".", "S...
Method isStartElement. @param reader XMLStreamReader @param namespace String @param localName String @return boolean
[ "Method", "isStartElement", "." ]
83c607044f64a7f6c005a67866c0ef7cb68d6e29
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L513-L519
train
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.nameEquals
public static boolean nameEquals( final XMLStreamReader reader, final String namespace, final String localName) { if (!reader.getLocalName().equals(localName)) { return false; } if (namespace == null) { return true; } final String namespaceURI = reader.getNamespaceURI(); if (namespaceURI == null) { return StringUtils.isEmpty(namespace); } return namespaceURI.equals(StringUtils.defaultString(namespace)); }
java
public static boolean nameEquals( final XMLStreamReader reader, final String namespace, final String localName) { if (!reader.getLocalName().equals(localName)) { return false; } if (namespace == null) { return true; } final String namespaceURI = reader.getNamespaceURI(); if (namespaceURI == null) { return StringUtils.isEmpty(namespace); } return namespaceURI.equals(StringUtils.defaultString(namespace)); }
[ "public", "static", "boolean", "nameEquals", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "namespace", ",", "final", "String", "localName", ")", "{", "if", "(", "!", "reader", ".", "getLocalName", "(", ")", ".", "equals", "(", "localNam...
Method nameEquals. @param reader XMLStreamReader @param namespace String @param localName String @return boolean
[ "Method", "nameEquals", "." ]
83c607044f64a7f6c005a67866c0ef7cb68d6e29
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L532-L547
train
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.optionalClassAttribute
public static Class optionalClassAttribute( final XMLStreamReader reader, final String localName, final Class defaultValue) throws XMLStreamException { return optionalClassAttribute(reader, null, localName, defaultValue); }
java
public static Class optionalClassAttribute( final XMLStreamReader reader, final String localName, final Class defaultValue) throws XMLStreamException { return optionalClassAttribute(reader, null, localName, defaultValue); }
[ "public", "static", "Class", "optionalClassAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ",", "final", "Class", "defaultValue", ")", "throws", "XMLStreamException", "{", "return", "optionalClassAttribute", "(", "reader", "...
Returns the value of an attribute as a Class. If the attribute is empty, this method returns the default value provided. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @param defaultValue default value @return value of attribute, or the default value if the attribute is empty. @throws XMLStreamException if there is error processing stream
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "Class", ".", "If", "the", "attribute", "is", "empty", "this", "method", "returns", "the", "default", "value", "provided", "." ]
83c607044f64a7f6c005a67866c0ef7cb68d6e29
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L653-L658
train
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.skipElement
public static void skipElement(final XMLStreamReader reader) throws XMLStreamException, IOException { if (reader.getEventType() != XMLStreamConstants.START_ELEMENT) { return; } final String namespace = reader.getNamespaceURI(); final String name = reader.getLocalName(); for (;;) { switch (reader.nextTag()) { case XMLStreamConstants.START_ELEMENT: // call ourselves recursively if we encounter START_ELEMENT skipElement(reader); break; case XMLStreamConstants.END_ELEMENT: case XMLStreamConstants.END_DOCUMENT: // discard events until we encounter matching END_ELEMENT reader.require(XMLStreamConstants.END_ELEMENT, namespace, name); reader.next(); return; } } }
java
public static void skipElement(final XMLStreamReader reader) throws XMLStreamException, IOException { if (reader.getEventType() != XMLStreamConstants.START_ELEMENT) { return; } final String namespace = reader.getNamespaceURI(); final String name = reader.getLocalName(); for (;;) { switch (reader.nextTag()) { case XMLStreamConstants.START_ELEMENT: // call ourselves recursively if we encounter START_ELEMENT skipElement(reader); break; case XMLStreamConstants.END_ELEMENT: case XMLStreamConstants.END_DOCUMENT: // discard events until we encounter matching END_ELEMENT reader.require(XMLStreamConstants.END_ELEMENT, namespace, name); reader.next(); return; } } }
[ "public", "static", "void", "skipElement", "(", "final", "XMLStreamReader", "reader", ")", "throws", "XMLStreamException", ",", "IOException", "{", "if", "(", "reader", ".", "getEventType", "(", ")", "!=", "XMLStreamConstants", ".", "START_ELEMENT", ")", "{", "r...
Method skipElement. @param reader XMLStreamReader @throws XMLStreamException if there is error skipping element @throws IOException if there is error skipping element
[ "Method", "skipElement", "." ]
83c607044f64a7f6c005a67866c0ef7cb68d6e29
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L1392-L1412
train
redlink-gmbh/redlink-java-sdk
src/main/java/io/redlink/sdk/util/UriBuilder.java
UriBuilder.path
public UriBuilder path(String path) throws URISyntaxException { path = path.trim(); if (getPath().endsWith("/")) { return new UriBuilder(setPath(String.format("%s%s", getPath(), path))); } else { return new UriBuilder(setPath(String.format("%s/%s", getPath(), path))); } }
java
public UriBuilder path(String path) throws URISyntaxException { path = path.trim(); if (getPath().endsWith("/")) { return new UriBuilder(setPath(String.format("%s%s", getPath(), path))); } else { return new UriBuilder(setPath(String.format("%s/%s", getPath(), path))); } }
[ "public", "UriBuilder", "path", "(", "String", "path", ")", "throws", "URISyntaxException", "{", "path", "=", "path", ".", "trim", "(", ")", ";", "if", "(", "getPath", "(", ")", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "return", "new", "UriBuilder...
Appends a path to the current one @param path @return @throws URISyntaxException
[ "Appends", "a", "path", "to", "the", "current", "one" ]
c412ff11bd80da52ade09f2483ab29cdbff5a28a
https://github.com/redlink-gmbh/redlink-java-sdk/blob/c412ff11bd80da52ade09f2483ab29cdbff5a28a/src/main/java/io/redlink/sdk/util/UriBuilder.java#L56-L63
train
apruve/apruve-java
src/main/java/com/apruve/ApruveClient.java
ApruveClient.index
public <T> ApruveResponse<List<T>> index(String path, GenericType<List<T>> resultType) { Response response = restRequest(path).get(); List<T> responseObject = null; ApruveResponse<List<T>> result; if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) { responseObject = response.readEntity(resultType); result = new ApruveResponse<List<T>>(response.getStatus(), responseObject); } else { result = new ApruveResponse<List<T>>(response.getStatus(), null, response.readEntity(String.class)); } return result; }
java
public <T> ApruveResponse<List<T>> index(String path, GenericType<List<T>> resultType) { Response response = restRequest(path).get(); List<T> responseObject = null; ApruveResponse<List<T>> result; if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) { responseObject = response.readEntity(resultType); result = new ApruveResponse<List<T>>(response.getStatus(), responseObject); } else { result = new ApruveResponse<List<T>>(response.getStatus(), null, response.readEntity(String.class)); } return result; }
[ "public", "<", "T", ">", "ApruveResponse", "<", "List", "<", "T", ">", ">", "index", "(", "String", "path", ",", "GenericType", "<", "List", "<", "T", ">", ">", "resultType", ")", "{", "Response", "response", "=", "restRequest", "(", "path", ")", "."...
is kind of a pain, and it duplicates processResponse.
[ "is", "kind", "of", "a", "pain", "and", "it", "duplicates", "processResponse", "." ]
b188d6b17f777823c2e46427847318849978685e
https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/ApruveClient.java#L139-L153
train
apruve/apruve-java
src/main/java/com/apruve/ApruveClient.java
ApruveClient.get
public <T> ApruveResponse<T> get(String path, Class<T> resultType) { Response response = restRequest(path).get(); return processResponse(response, resultType); }
java
public <T> ApruveResponse<T> get(String path, Class<T> resultType) { Response response = restRequest(path).get(); return processResponse(response, resultType); }
[ "public", "<", "T", ">", "ApruveResponse", "<", "T", ">", "get", "(", "String", "path", ",", "Class", "<", "T", ">", "resultType", ")", "{", "Response", "response", "=", "restRequest", "(", "path", ")", ".", "get", "(", ")", ";", "return", "processRe...
Issues a GET request against to the Apruve REST API, using the specified path. @param path The path to issue the GET against @param resultType The type of the response @return A single object of type resultType
[ "Issues", "a", "GET", "request", "against", "to", "the", "Apruve", "REST", "API", "using", "the", "specified", "path", "." ]
b188d6b17f777823c2e46427847318849978685e
https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/ApruveClient.java#L165-L168
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/NewRelicManager.java
NewRelicManager.sync
public boolean sync(NewRelicCache cache) { if(cache == null) throw new IllegalArgumentException("null cache"); checkInitialize(cache); boolean ret = isInitialized(); if(!ret) throw new IllegalStateException("cache not initialized"); clear(cache); if(ret) ret = syncApplications(cache); if(ret) ret = syncPlugins(cache); if(ret) ret = syncMonitors(cache); if(ret) ret = syncServers(cache); if(ret) ret = syncLabels(cache); if(ret) ret = syncAlerts(cache); if(ret) ret = syncDashboards(cache); return ret; }
java
public boolean sync(NewRelicCache cache) { if(cache == null) throw new IllegalArgumentException("null cache"); checkInitialize(cache); boolean ret = isInitialized(); if(!ret) throw new IllegalStateException("cache not initialized"); clear(cache); if(ret) ret = syncApplications(cache); if(ret) ret = syncPlugins(cache); if(ret) ret = syncMonitors(cache); if(ret) ret = syncServers(cache); if(ret) ret = syncLabels(cache); if(ret) ret = syncAlerts(cache); if(ret) ret = syncDashboards(cache); return ret; }
[ "public", "boolean", "sync", "(", "NewRelicCache", "cache", ")", "{", "if", "(", "cache", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null cache\"", ")", ";", "checkInitialize", "(", "cache", ")", ";", "boolean", "ret", "=", "isIni...
Synchronises the cache. @param cache The provider cache
[ "Synchronises", "the", "cache", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/NewRelicManager.java#L121-L149
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/NewRelicManager.java
NewRelicManager.syncAlerts
public boolean syncAlerts(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the alert configuration using the REST API if(cache.isAlertsEnabled()) { ret = false; // Get the alert policies logger.info("Getting the alert policies"); Collection<AlertPolicy> policies = apiClient.alertPolicies().list(); for(AlertPolicy policy : policies) { cache.alertPolicies().add(policy); // Add the alert conditions if(cache.isApmEnabled() || cache.isServersEnabled() || cache.isBrowserEnabled() || cache.isMobileEnabled()) cache.alertPolicies().alertConditions(policy.getId()).add(apiClient.alertConditions().list(policy.getId())); cache.alertPolicies().nrqlAlertConditions(policy.getId()).add(apiClient.nrqlAlertConditions().list(policy.getId())); if(cache.isApmEnabled() || cache.isMobileEnabled()) cache.alertPolicies().externalServiceAlertConditions(policy.getId()).add(apiClient.externalServiceAlertConditions().list(policy.getId())); if(cache.isSyntheticsEnabled()) cache.alertPolicies().syntheticsAlertConditions(policy.getId()).add(apiClient.syntheticsAlertConditions().list(policy.getId())); if(cache.isPluginsEnabled()) cache.alertPolicies().pluginsAlertConditions(policy.getId()).add(apiClient.pluginsAlertConditions().list(policy.getId())); if(cache.isInfrastructureEnabled()) cache.alertPolicies().infraAlertConditions(policy.getId()).add(infraApiClient.infraAlertConditions().list(policy.getId())); } // Get the alert channels logger.info("Getting the alert channels"); Collection<AlertChannel> channels = apiClient.alertChannels().list(); cache.alertChannels().set(channels); cache.alertPolicies().setAlertChannels(channels); cache.setUpdatedAt(); ret = true; } return ret; }
java
public boolean syncAlerts(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the alert configuration using the REST API if(cache.isAlertsEnabled()) { ret = false; // Get the alert policies logger.info("Getting the alert policies"); Collection<AlertPolicy> policies = apiClient.alertPolicies().list(); for(AlertPolicy policy : policies) { cache.alertPolicies().add(policy); // Add the alert conditions if(cache.isApmEnabled() || cache.isServersEnabled() || cache.isBrowserEnabled() || cache.isMobileEnabled()) cache.alertPolicies().alertConditions(policy.getId()).add(apiClient.alertConditions().list(policy.getId())); cache.alertPolicies().nrqlAlertConditions(policy.getId()).add(apiClient.nrqlAlertConditions().list(policy.getId())); if(cache.isApmEnabled() || cache.isMobileEnabled()) cache.alertPolicies().externalServiceAlertConditions(policy.getId()).add(apiClient.externalServiceAlertConditions().list(policy.getId())); if(cache.isSyntheticsEnabled()) cache.alertPolicies().syntheticsAlertConditions(policy.getId()).add(apiClient.syntheticsAlertConditions().list(policy.getId())); if(cache.isPluginsEnabled()) cache.alertPolicies().pluginsAlertConditions(policy.getId()).add(apiClient.pluginsAlertConditions().list(policy.getId())); if(cache.isInfrastructureEnabled()) cache.alertPolicies().infraAlertConditions(policy.getId()).add(infraApiClient.infraAlertConditions().list(policy.getId())); } // Get the alert channels logger.info("Getting the alert channels"); Collection<AlertChannel> channels = apiClient.alertChannels().list(); cache.alertChannels().set(channels); cache.alertPolicies().setAlertChannels(channels); cache.setUpdatedAt(); ret = true; } return ret; }
[ "public", "boolean", "syncAlerts", "(", "NewRelicCache", "cache", ")", "{", "boolean", "ret", "=", "true", ";", "if", "(", "apiClient", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null API client\"", ")", ";", "// Get the alert configura...
Synchronise the alerts configuration with the cache. @param cache The provider cache @return <CODE>true</CODE> if the operation was successful
[ "Synchronise", "the", "alerts", "configuration", "with", "the", "cache", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/NewRelicManager.java#L156-L200
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/NewRelicManager.java
NewRelicManager.syncApplications
public boolean syncApplications(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the application configuration using the REST API if(cache.isApmEnabled() || cache.isBrowserEnabled() || cache.isMobileEnabled()) { ret = false; if(cache.isApmEnabled()) { logger.info("Getting the applications"); Collection<Application> applications = apiClient.applications().list(); for(Application application : applications) { cache.applications().add(application); logger.fine("Getting the hosts for application: "+application.getId()); cache.applications().applicationHosts(application.getId()).add(apiClient.applicationHosts().list(application.getId())); logger.fine("Getting the instances for application: "+application.getId()); cache.applications().applicationHosts(application.getId()).addApplicationInstances(apiClient.applicationInstances().list(application.getId())); logger.fine("Getting the deployments for application: "+application.getId()); cache.applications().deployments(application.getId()).add(apiClient.deployments().list(application.getId())); } // Get the key transaction configuration using the REST API try { logger.info("Getting the key transactions"); cache.applications().addKeyTransactions(apiClient.keyTransactions().list()); } catch(ErrorResponseException e) { if(e.getStatus() == 403) // throws 403 if not allowed by subscription logger.warning("Error in get key transactions: "+e.getMessage()); else throw e; } } if(cache.isBrowserEnabled()) { logger.info("Getting the browser applications"); cache.browserApplications().add(apiClient.browserApplications().list()); } if(cache.isBrowserEnabled()) { logger.info("Getting the mobile applications"); cache.mobileApplications().add(apiClient.mobileApplications().list()); } cache.setUpdatedAt(); ret = true; } return ret; }
java
public boolean syncApplications(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the application configuration using the REST API if(cache.isApmEnabled() || cache.isBrowserEnabled() || cache.isMobileEnabled()) { ret = false; if(cache.isApmEnabled()) { logger.info("Getting the applications"); Collection<Application> applications = apiClient.applications().list(); for(Application application : applications) { cache.applications().add(application); logger.fine("Getting the hosts for application: "+application.getId()); cache.applications().applicationHosts(application.getId()).add(apiClient.applicationHosts().list(application.getId())); logger.fine("Getting the instances for application: "+application.getId()); cache.applications().applicationHosts(application.getId()).addApplicationInstances(apiClient.applicationInstances().list(application.getId())); logger.fine("Getting the deployments for application: "+application.getId()); cache.applications().deployments(application.getId()).add(apiClient.deployments().list(application.getId())); } // Get the key transaction configuration using the REST API try { logger.info("Getting the key transactions"); cache.applications().addKeyTransactions(apiClient.keyTransactions().list()); } catch(ErrorResponseException e) { if(e.getStatus() == 403) // throws 403 if not allowed by subscription logger.warning("Error in get key transactions: "+e.getMessage()); else throw e; } } if(cache.isBrowserEnabled()) { logger.info("Getting the browser applications"); cache.browserApplications().add(apiClient.browserApplications().list()); } if(cache.isBrowserEnabled()) { logger.info("Getting the mobile applications"); cache.mobileApplications().add(apiClient.mobileApplications().list()); } cache.setUpdatedAt(); ret = true; } return ret; }
[ "public", "boolean", "syncApplications", "(", "NewRelicCache", "cache", ")", "{", "boolean", "ret", "=", "true", ";", "if", "(", "apiClient", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null API client\"", ")", ";", "// Get the applicati...
Synchronise the application configuration with the cache. @param cache The provider cache @return <CODE>true</CODE> if the operation was successful
[ "Synchronise", "the", "application", "configuration", "with", "the", "cache", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/NewRelicManager.java#L207-L270
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/NewRelicManager.java
NewRelicManager.syncPlugins
public boolean syncPlugins(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the Plugins configuration using the REST API if(cache.isPluginsEnabled()) { ret = false; logger.info("Getting the plugins"); Collection<Plugin> plugins = apiClient.plugins().list(true); for(Plugin plugin : plugins) { cache.plugins().add(plugin); logger.fine("Getting the components for plugin: "+plugin.getId()); Collection<PluginComponent> components = apiClient.pluginComponents().list(PluginComponentService.filters().pluginId(plugin.getId()).build()); cache.plugins().components(plugin.getId()).add(components); } cache.setUpdatedAt(); ret = true; } return ret; }
java
public boolean syncPlugins(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the Plugins configuration using the REST API if(cache.isPluginsEnabled()) { ret = false; logger.info("Getting the plugins"); Collection<Plugin> plugins = apiClient.plugins().list(true); for(Plugin plugin : plugins) { cache.plugins().add(plugin); logger.fine("Getting the components for plugin: "+plugin.getId()); Collection<PluginComponent> components = apiClient.pluginComponents().list(PluginComponentService.filters().pluginId(plugin.getId()).build()); cache.plugins().components(plugin.getId()).add(components); } cache.setUpdatedAt(); ret = true; } return ret; }
[ "public", "boolean", "syncPlugins", "(", "NewRelicCache", "cache", ")", "{", "boolean", "ret", "=", "true", ";", "if", "(", "apiClient", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null API client\"", ")", ";", "// Get the Plugins config...
Synchronise the Plugins configuration with the cache. @param cache The provider cache @return <CODE>true</CODE> if the operation was successful
[ "Synchronise", "the", "Plugins", "configuration", "with", "the", "cache", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/NewRelicManager.java#L277-L306
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/NewRelicManager.java
NewRelicManager.syncMonitors
public boolean syncMonitors(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the Synthetics configuration using the REST API if(cache.isSyntheticsEnabled()) { ret = false; logger.info("Getting the monitors"); cache.monitors().add(syntheticsApiClient.monitors().list()); cache.setUpdatedAt(); ret = true; } return ret; }
java
public boolean syncMonitors(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the Synthetics configuration using the REST API if(cache.isSyntheticsEnabled()) { ret = false; logger.info("Getting the monitors"); cache.monitors().add(syntheticsApiClient.monitors().list()); cache.setUpdatedAt(); ret = true; } return ret; }
[ "public", "boolean", "syncMonitors", "(", "NewRelicCache", "cache", ")", "{", "boolean", "ret", "=", "true", ";", "if", "(", "apiClient", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null API client\"", ")", ";", "// Get the Synthetics co...
Synchronise the Synthetics configuration with the cache. @param cache The provider cache @return <CODE>true</CODE> if the operation was successful
[ "Synchronise", "the", "Synthetics", "configuration", "with", "the", "cache", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/NewRelicManager.java#L313-L333
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/NewRelicManager.java
NewRelicManager.syncServers
public boolean syncServers(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the server configuration using the REST API if(cache.isServersEnabled()) { ret = false; logger.info("Getting the servers"); cache.servers().add(apiClient.servers().list()); cache.setUpdatedAt(); ret = true; } return ret; }
java
public boolean syncServers(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the server configuration using the REST API if(cache.isServersEnabled()) { ret = false; logger.info("Getting the servers"); cache.servers().add(apiClient.servers().list()); cache.setUpdatedAt(); ret = true; } return ret; }
[ "public", "boolean", "syncServers", "(", "NewRelicCache", "cache", ")", "{", "boolean", "ret", "=", "true", ";", "if", "(", "apiClient", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null API client\"", ")", ";", "// Get the server configu...
Synchronise the server configuration with the cache. @param cache The provider cache @return <CODE>true</CODE> if the operation was successful
[ "Synchronise", "the", "server", "configuration", "with", "the", "cache", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/NewRelicManager.java#L340-L360
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/NewRelicManager.java
NewRelicManager.syncLabels
public boolean syncLabels(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the label configuration using the REST API if(cache.isApmEnabled() || cache.isSyntheticsEnabled()) { ret = false; logger.info("Getting the labels"); Collection<Label> labels = apiClient.labels().list(); for(Label label : labels) { cache.applications().addLabel(label); try { // Also check to see if this label is associated with any monitors Collection<Monitor> monitors = syntheticsApiClient.monitors().list(label); for(Monitor monitor : monitors) cache.monitors().labels(monitor.getId()).add(label); } catch(NullPointerException e) { logger.severe("Unable to get monitor labels: "+e.getClass().getName()+": "+e.getMessage()); } } cache.setUpdatedAt(); ret = true; } return ret; }
java
public boolean syncLabels(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the label configuration using the REST API if(cache.isApmEnabled() || cache.isSyntheticsEnabled()) { ret = false; logger.info("Getting the labels"); Collection<Label> labels = apiClient.labels().list(); for(Label label : labels) { cache.applications().addLabel(label); try { // Also check to see if this label is associated with any monitors Collection<Monitor> monitors = syntheticsApiClient.monitors().list(label); for(Monitor monitor : monitors) cache.monitors().labels(monitor.getId()).add(label); } catch(NullPointerException e) { logger.severe("Unable to get monitor labels: "+e.getClass().getName()+": "+e.getMessage()); } } cache.setUpdatedAt(); ret = true; } return ret; }
[ "public", "boolean", "syncLabels", "(", "NewRelicCache", "cache", ")", "{", "boolean", "ret", "=", "true", ";", "if", "(", "apiClient", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null API client\"", ")", ";", "// Get the label configura...
Synchronise the label configuration with the cache. @param cache The provider cache @return <CODE>true</CODE> if the operation was successful
[ "Synchronise", "the", "label", "configuration", "with", "the", "cache", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/NewRelicManager.java#L367-L404
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/NewRelicManager.java
NewRelicManager.syncDashboards
public boolean syncDashboards(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the dashboard configuration using the REST API if(cache.isInsightsEnabled()) { ret = false; logger.info("Getting the dashboards"); cache.dashboards().set(apiClient.dashboards().list()); cache.setUpdatedAt(); ret = true; } return ret; }
java
public boolean syncDashboards(NewRelicCache cache) { boolean ret = true; if(apiClient == null) throw new IllegalArgumentException("null API client"); // Get the dashboard configuration using the REST API if(cache.isInsightsEnabled()) { ret = false; logger.info("Getting the dashboards"); cache.dashboards().set(apiClient.dashboards().list()); cache.setUpdatedAt(); ret = true; } return ret; }
[ "public", "boolean", "syncDashboards", "(", "NewRelicCache", "cache", ")", "{", "boolean", "ret", "=", "true", ";", "if", "(", "apiClient", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null API client\"", ")", ";", "// Get the dashboard c...
Synchronise the dashboard configuration with the cache. @param cache The provider cache @return <CODE>true</CODE> if the operation was successful
[ "Synchronise", "the", "dashboard", "configuration", "with", "the", "cache", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/NewRelicManager.java#L411-L431
train
jcuda/jcufft
JCufftJava/src/main/java/jcuda/jcufft/cufftResult.java
cufftResult.stringFor
public static String stringFor(int m) { switch (m) { case CUFFT_SUCCESS : return "CUFFT_SUCCESS"; case CUFFT_INVALID_PLAN : return "CUFFT_INVALID_PLAN"; case CUFFT_ALLOC_FAILED : return "CUFFT_ALLOC_FAILED"; case CUFFT_INVALID_TYPE : return "CUFFT_INVALID_TYPE"; case CUFFT_INVALID_VALUE : return "CUFFT_INVALID_VALUE"; case CUFFT_INTERNAL_ERROR : return "CUFFT_INTERNAL_ERROR"; case CUFFT_EXEC_FAILED : return "CUFFT_EXEC_FAILED"; case CUFFT_SETUP_FAILED : return "CUFFT_SETUP_FAILED"; case CUFFT_INVALID_SIZE : return "CUFFT_INVALID_SIZE"; case CUFFT_UNALIGNED_DATA : return "CUFFT_UNALIGNED_DATA"; case CUFFT_INCOMPLETE_PARAMETER_LIST : return "CUFFT_INCOMPLETE_PARAMETER_LIST"; case CUFFT_INVALID_DEVICE : return "CUFFT_INVALID_DEVICE"; case CUFFT_PARSE_ERROR : return "CUFFT_PARSE_ERROR"; case CUFFT_NO_WORKSPACE : return "CUFFT_NO_WORKSPACE"; case CUFFT_NOT_IMPLEMENTED : return "CUFFT_NOT_IMPLEMENTED"; case CUFFT_LICENSE_ERROR : return "CUFFT_LICENSE_ERROR"; case CUFFT_NOT_SUPPORTED : return "CUFFT_NOT_SUPPORTED"; case JCUFFT_INTERNAL_ERROR : return "JCUFFT_INTERNAL_ERROR"; } return "INVALID cufftResult: " + m; }
java
public static String stringFor(int m) { switch (m) { case CUFFT_SUCCESS : return "CUFFT_SUCCESS"; case CUFFT_INVALID_PLAN : return "CUFFT_INVALID_PLAN"; case CUFFT_ALLOC_FAILED : return "CUFFT_ALLOC_FAILED"; case CUFFT_INVALID_TYPE : return "CUFFT_INVALID_TYPE"; case CUFFT_INVALID_VALUE : return "CUFFT_INVALID_VALUE"; case CUFFT_INTERNAL_ERROR : return "CUFFT_INTERNAL_ERROR"; case CUFFT_EXEC_FAILED : return "CUFFT_EXEC_FAILED"; case CUFFT_SETUP_FAILED : return "CUFFT_SETUP_FAILED"; case CUFFT_INVALID_SIZE : return "CUFFT_INVALID_SIZE"; case CUFFT_UNALIGNED_DATA : return "CUFFT_UNALIGNED_DATA"; case CUFFT_INCOMPLETE_PARAMETER_LIST : return "CUFFT_INCOMPLETE_PARAMETER_LIST"; case CUFFT_INVALID_DEVICE : return "CUFFT_INVALID_DEVICE"; case CUFFT_PARSE_ERROR : return "CUFFT_PARSE_ERROR"; case CUFFT_NO_WORKSPACE : return "CUFFT_NO_WORKSPACE"; case CUFFT_NOT_IMPLEMENTED : return "CUFFT_NOT_IMPLEMENTED"; case CUFFT_LICENSE_ERROR : return "CUFFT_LICENSE_ERROR"; case CUFFT_NOT_SUPPORTED : return "CUFFT_NOT_SUPPORTED"; case JCUFFT_INTERNAL_ERROR : return "JCUFFT_INTERNAL_ERROR"; } return "INVALID cufftResult: " + m; }
[ "public", "static", "String", "stringFor", "(", "int", "m", ")", "{", "switch", "(", "m", ")", "{", "case", "CUFFT_SUCCESS", ":", "return", "\"CUFFT_SUCCESS\"", ";", "case", "CUFFT_INVALID_PLAN", ":", "return", "\"CUFFT_INVALID_PLAN\"", ";", "case", "CUFFT_ALLOC...
Returns the String identifying the given cufftResult @param m The cufftResult @return The String identifying the given cufftResult
[ "Returns", "the", "String", "identifying", "the", "given", "cufftResult" ]
833c87ffb0864f7ee7270fddef8af57f48939b3a
https://github.com/jcuda/jcufft/blob/833c87ffb0864f7ee7270fddef8af57f48939b3a/JCufftJava/src/main/java/jcuda/jcufft/cufftResult.java#L132-L156
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/social/SocialTemplate.java
SocialTemplate.parseProfile
protected SocialProfile parseProfile(Map<String, Object> props) { if (!props.containsKey("id")) { throw new IllegalArgumentException("No id in profile"); } SocialProfile profile = SocialProfile.with(props) .displayName("name") .first("first_name") .last("last_name") .id("id") .username("username") .profileUrl("link") .build(); profile.setThumbnailUrl(getBaseUrl() + "/" + profile.getId() + "/picture"); return profile; }
java
protected SocialProfile parseProfile(Map<String, Object> props) { if (!props.containsKey("id")) { throw new IllegalArgumentException("No id in profile"); } SocialProfile profile = SocialProfile.with(props) .displayName("name") .first("first_name") .last("last_name") .id("id") .username("username") .profileUrl("link") .build(); profile.setThumbnailUrl(getBaseUrl() + "/" + profile.getId() + "/picture"); return profile; }
[ "protected", "SocialProfile", "parseProfile", "(", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "if", "(", "!", "props", ".", "containsKey", "(", "\"id\"", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"No id in profile\"", ...
Property names for Facebook - Override to customize @param props @return
[ "Property", "names", "for", "Facebook", "-", "Override", "to", "customize" ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/social/SocialTemplate.java#L94-L108
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javadoc/JavadocTool.java
JavadocTool.parsePackageClasses
private void parsePackageClasses(String name, List<JavaFileObject> files, ListBuffer<JCCompilationUnit> trees, List<String> excludedPackages) throws IOException { if (excludedPackages.contains(name)) { return; } docenv.notice("main.Loading_source_files_for_package", name); if (files == null) { Location location = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH; ListBuffer<JavaFileObject> lb = new ListBuffer<JavaFileObject>(); for (JavaFileObject fo: docenv.fileManager.list( location, name, EnumSet.of(JavaFileObject.Kind.SOURCE), false)) { String binaryName = docenv.fileManager.inferBinaryName(location, fo); String simpleName = getSimpleName(binaryName); if (isValidClassName(simpleName)) { lb.append(fo); } } files = lb.toList(); } if (files.nonEmpty()) { for (JavaFileObject fo : files) { parse(fo, trees, false); } } else { messager.warning(Messager.NOPOS, "main.no_source_files_for_package", name.replace(File.separatorChar, '.')); } }
java
private void parsePackageClasses(String name, List<JavaFileObject> files, ListBuffer<JCCompilationUnit> trees, List<String> excludedPackages) throws IOException { if (excludedPackages.contains(name)) { return; } docenv.notice("main.Loading_source_files_for_package", name); if (files == null) { Location location = docenv.fileManager.hasLocation(StandardLocation.SOURCE_PATH) ? StandardLocation.SOURCE_PATH : StandardLocation.CLASS_PATH; ListBuffer<JavaFileObject> lb = new ListBuffer<JavaFileObject>(); for (JavaFileObject fo: docenv.fileManager.list( location, name, EnumSet.of(JavaFileObject.Kind.SOURCE), false)) { String binaryName = docenv.fileManager.inferBinaryName(location, fo); String simpleName = getSimpleName(binaryName); if (isValidClassName(simpleName)) { lb.append(fo); } } files = lb.toList(); } if (files.nonEmpty()) { for (JavaFileObject fo : files) { parse(fo, trees, false); } } else { messager.warning(Messager.NOPOS, "main.no_source_files_for_package", name.replace(File.separatorChar, '.')); } }
[ "private", "void", "parsePackageClasses", "(", "String", "name", ",", "List", "<", "JavaFileObject", ">", "files", ",", "ListBuffer", "<", "JCCompilationUnit", ">", "trees", ",", "List", "<", "String", ">", "excludedPackages", ")", "throws", "IOException", "{", ...
search all directories in path for subdirectory name. Add all .java files found in such a directory to args.
[ "search", "all", "directories", "in", "path", "for", "subdirectory", "name", ".", "Add", "all", ".", "java", "files", "found", "in", "such", "a", "directory", "to", "args", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/JavadocTool.java#L213-L246
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javadoc/JavadocTool.java
JavadocTool.isValidJavaClassFile
private static boolean isValidJavaClassFile(String file) { if (!file.endsWith(".class")) return false; String clazzName = file.substring(0, file.length() - ".class".length()); return isValidClassName(clazzName); }
java
private static boolean isValidJavaClassFile(String file) { if (!file.endsWith(".class")) return false; String clazzName = file.substring(0, file.length() - ".class".length()); return isValidClassName(clazzName); }
[ "private", "static", "boolean", "isValidJavaClassFile", "(", "String", "file", ")", "{", "if", "(", "!", "file", ".", "endsWith", "(", "\".class\"", ")", ")", "return", "false", ";", "String", "clazzName", "=", "file", ".", "substring", "(", "0", ",", "f...
Return true if given file name is a valid class file name. @param file the name of the file to check. @return true if given file name is a valid class file name and false otherwise.
[ "Return", "true", "if", "given", "file", "name", "is", "a", "valid", "class", "file", "name", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/JavadocTool.java#L371-L375
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Scope.java
Scope.enter
public void enter(Symbol sym, Scope s, Scope origin, boolean staticallyImported) { Assert.check(shared == 0); if (nelems * 3 >= hashMask * 2) dble(); int hash = getIndex(sym.name); Entry old = table[hash]; if (old == null) { old = sentinel; nelems++; } Entry e = makeEntry(sym, old, elems, s, origin, staticallyImported); table[hash] = e; elems = e; //notify listeners for (List<ScopeListener> l = listeners; l.nonEmpty(); l = l.tail) { l.head.symbolAdded(sym, this); } }
java
public void enter(Symbol sym, Scope s, Scope origin, boolean staticallyImported) { Assert.check(shared == 0); if (nelems * 3 >= hashMask * 2) dble(); int hash = getIndex(sym.name); Entry old = table[hash]; if (old == null) { old = sentinel; nelems++; } Entry e = makeEntry(sym, old, elems, s, origin, staticallyImported); table[hash] = e; elems = e; //notify listeners for (List<ScopeListener> l = listeners; l.nonEmpty(); l = l.tail) { l.head.symbolAdded(sym, this); } }
[ "public", "void", "enter", "(", "Symbol", "sym", ",", "Scope", "s", ",", "Scope", "origin", ",", "boolean", "staticallyImported", ")", "{", "Assert", ".", "check", "(", "shared", "==", "0", ")", ";", "if", "(", "nelems", "*", "3", ">=", "hashMask", "...
Enter symbol sym in this scope, but mark that it comes from given scope `s' accessed through `origin'. The last two arguments are only used in import scopes.
[ "Enter", "symbol", "sym", "in", "this", "scope", "but", "mark", "that", "it", "comes", "from", "given", "scope", "s", "accessed", "through", "origin", ".", "The", "last", "two", "arguments", "are", "only", "used", "in", "import", "scopes", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Scope.java#L210-L228
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/comp/ResolveWithDeps.java
ResolveWithDeps.reportDependence
@Override public void reportDependence(Symbol from, Symbol to) { // Capture dependencies between the packages. deps.collect(from.packge().fullname, to.packge().fullname); }
java
@Override public void reportDependence(Symbol from, Symbol to) { // Capture dependencies between the packages. deps.collect(from.packge().fullname, to.packge().fullname); }
[ "@", "Override", "public", "void", "reportDependence", "(", "Symbol", "from", ",", "Symbol", "to", ")", "{", "// Capture dependencies between the packages.", "deps", ".", "collect", "(", "from", ".", "packge", "(", ")", ".", "fullname", ",", "to", ".", "packge...
Collect dependencies in the enclosing class @param from The enclosing class sym @param to The enclosing classes references this sym.
[ "Collect", "dependencies", "in", "the", "enclosing", "class" ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/comp/ResolveWithDeps.java#L62-L66
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/jvm/CRTable.java
CRTable.put
public void put(Object tree, int flags, int startPc, int endPc) { entries.append(new CRTEntry(tree, flags, startPc, endPc)); }
java
public void put(Object tree, int flags, int startPc, int endPc) { entries.append(new CRTEntry(tree, flags, startPc, endPc)); }
[ "public", "void", "put", "(", "Object", "tree", ",", "int", "flags", ",", "int", "startPc", ",", "int", "endPc", ")", "{", "entries", ".", "append", "(", "new", "CRTEntry", "(", "tree", ",", "flags", ",", "startPc", ",", "endPc", ")", ")", ";", "}"...
Create a new CRTEntry and add it to the entries. @param tree The tree or the list of trees for which we are storing the code pointers. @param flags The set of flags designating type of the entry. @param startPc The starting code position. @param endPc The ending code position.
[ "Create", "a", "new", "CRTEntry", "and", "add", "it", "to", "the", "entries", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/jvm/CRTable.java#L81-L83
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/jvm/CRTable.java
CRTable.writeCRT
public int writeCRT(ByteBuffer databuf, Position.LineMap lineMap, Log log) { int crtEntries = 0; // compute source positions for the method new SourceComputer().csp(methodTree); for (List<CRTEntry> l = entries.toList(); l.nonEmpty(); l = l.tail) { CRTEntry entry = l.head; // eliminate entries that do not produce bytecodes: // for example, empty blocks and statements if (entry.startPc == entry.endPc) continue; SourceRange pos = positions.get(entry.tree); Assert.checkNonNull(pos, "CRT: tree source positions are undefined"); if ((pos.startPos == Position.NOPOS) || (pos.endPos == Position.NOPOS)) continue; if (crtDebug) { System.out.println("Tree: " + entry.tree + ", type:" + getTypes(entry.flags)); System.out.print("Start: pos = " + pos.startPos + ", pc = " + entry.startPc); } // encode startPos into line/column representation int startPos = encodePosition(pos.startPos, lineMap, log); if (startPos == Position.NOPOS) continue; if (crtDebug) { System.out.print("End: pos = " + pos.endPos + ", pc = " + (entry.endPc - 1)); } // encode endPos into line/column representation int endPos = encodePosition(pos.endPos, lineMap, log); if (endPos == Position.NOPOS) continue; // write attribute databuf.appendChar(entry.startPc); // 'endPc - 1' because endPc actually points to start of the next command databuf.appendChar(entry.endPc - 1); databuf.appendInt(startPos); databuf.appendInt(endPos); databuf.appendChar(entry.flags); crtEntries++; } return crtEntries; }
java
public int writeCRT(ByteBuffer databuf, Position.LineMap lineMap, Log log) { int crtEntries = 0; // compute source positions for the method new SourceComputer().csp(methodTree); for (List<CRTEntry> l = entries.toList(); l.nonEmpty(); l = l.tail) { CRTEntry entry = l.head; // eliminate entries that do not produce bytecodes: // for example, empty blocks and statements if (entry.startPc == entry.endPc) continue; SourceRange pos = positions.get(entry.tree); Assert.checkNonNull(pos, "CRT: tree source positions are undefined"); if ((pos.startPos == Position.NOPOS) || (pos.endPos == Position.NOPOS)) continue; if (crtDebug) { System.out.println("Tree: " + entry.tree + ", type:" + getTypes(entry.flags)); System.out.print("Start: pos = " + pos.startPos + ", pc = " + entry.startPc); } // encode startPos into line/column representation int startPos = encodePosition(pos.startPos, lineMap, log); if (startPos == Position.NOPOS) continue; if (crtDebug) { System.out.print("End: pos = " + pos.endPos + ", pc = " + (entry.endPc - 1)); } // encode endPos into line/column representation int endPos = encodePosition(pos.endPos, lineMap, log); if (endPos == Position.NOPOS) continue; // write attribute databuf.appendChar(entry.startPc); // 'endPc - 1' because endPc actually points to start of the next command databuf.appendChar(entry.endPc - 1); databuf.appendInt(startPos); databuf.appendInt(endPos); databuf.appendChar(entry.flags); crtEntries++; } return crtEntries; }
[ "public", "int", "writeCRT", "(", "ByteBuffer", "databuf", ",", "Position", ".", "LineMap", "lineMap", ",", "Log", "log", ")", "{", "int", "crtEntries", "=", "0", ";", "// compute source positions for the method", "new", "SourceComputer", "(", ")", ".", "csp", ...
Compute source positions and write CRT to the databuf. @param databuf The buffer to write bytecodes to.
[ "Compute", "source", "positions", "and", "write", "CRT", "to", "the", "databuf", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/jvm/CRTable.java#L88-L140
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/jvm/CRTable.java
CRTable.getTypes
private String getTypes(int flags) { String types = ""; if ((flags & CRT_STATEMENT) != 0) types += " CRT_STATEMENT"; if ((flags & CRT_BLOCK) != 0) types += " CRT_BLOCK"; if ((flags & CRT_ASSIGNMENT) != 0) types += " CRT_ASSIGNMENT"; if ((flags & CRT_FLOW_CONTROLLER) != 0) types += " CRT_FLOW_CONTROLLER"; if ((flags & CRT_FLOW_TARGET) != 0) types += " CRT_FLOW_TARGET"; if ((flags & CRT_INVOKE) != 0) types += " CRT_INVOKE"; if ((flags & CRT_CREATE) != 0) types += " CRT_CREATE"; if ((flags & CRT_BRANCH_TRUE) != 0) types += " CRT_BRANCH_TRUE"; if ((flags & CRT_BRANCH_FALSE) != 0) types += " CRT_BRANCH_FALSE"; return types; }
java
private String getTypes(int flags) { String types = ""; if ((flags & CRT_STATEMENT) != 0) types += " CRT_STATEMENT"; if ((flags & CRT_BLOCK) != 0) types += " CRT_BLOCK"; if ((flags & CRT_ASSIGNMENT) != 0) types += " CRT_ASSIGNMENT"; if ((flags & CRT_FLOW_CONTROLLER) != 0) types += " CRT_FLOW_CONTROLLER"; if ((flags & CRT_FLOW_TARGET) != 0) types += " CRT_FLOW_TARGET"; if ((flags & CRT_INVOKE) != 0) types += " CRT_INVOKE"; if ((flags & CRT_CREATE) != 0) types += " CRT_CREATE"; if ((flags & CRT_BRANCH_TRUE) != 0) types += " CRT_BRANCH_TRUE"; if ((flags & CRT_BRANCH_FALSE) != 0) types += " CRT_BRANCH_FALSE"; return types; }
[ "private", "String", "getTypes", "(", "int", "flags", ")", "{", "String", "types", "=", "\"\"", ";", "if", "(", "(", "flags", "&", "CRT_STATEMENT", ")", "!=", "0", ")", "types", "+=", "\" CRT_STATEMENT\"", ";", "if", "(", "(", "flags", "&", "CRT_BLOCK"...
Return string describing flags enabled.
[ "Return", "string", "describing", "flags", "enabled", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/jvm/CRTable.java#L150-L162
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java
UserResource.read
@GET @Path("{id}") @RolesAllowed({"ROLE_ADMIN"}) public Response read(@PathParam("id") Long id) { checkNotNull(id); return Response.ok(userService.getById(id)).build(); }
java
@GET @Path("{id}") @RolesAllowed({"ROLE_ADMIN"}) public Response read(@PathParam("id") Long id) { checkNotNull(id); return Response.ok(userService.getById(id)).build(); }
[ "@", "GET", "@", "Path", "(", "\"{id}\"", ")", "@", "RolesAllowed", "(", "{", "\"ROLE_ADMIN\"", "}", ")", "public", "Response", "read", "(", "@", "PathParam", "(", "\"id\"", ")", "Long", "id", ")", "{", "checkNotNull", "(", "id", ")", ";", "return", ...
Get details for a single user. @param id unique user id @return user domain object
[ "Get", "details", "for", "a", "single", "user", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L135-L141
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java
UserResource.search
@GET @Path("search") @RolesAllowed({"ROLE_ADMIN"}) public Response search(@QueryParam("email") String email, @QueryParam("username") String username, @QueryParam("pageSize") @DefaultValue("10") int pageSize, @QueryParam("cursorKey") String cursorKey) { final CursorPage<DUser> page; if (null != email) { page = userService.findMatchingUsersByEmail(email, pageSize, cursorKey); } else if (null != username) { page = userService.findMatchingUsersByUserName(username, pageSize, cursorKey); } else { throw new BadRequestRestException("No search key provided"); } return Response.ok(page).build(); }
java
@GET @Path("search") @RolesAllowed({"ROLE_ADMIN"}) public Response search(@QueryParam("email") String email, @QueryParam("username") String username, @QueryParam("pageSize") @DefaultValue("10") int pageSize, @QueryParam("cursorKey") String cursorKey) { final CursorPage<DUser> page; if (null != email) { page = userService.findMatchingUsersByEmail(email, pageSize, cursorKey); } else if (null != username) { page = userService.findMatchingUsersByUserName(username, pageSize, cursorKey); } else { throw new BadRequestRestException("No search key provided"); } return Response.ok(page).build(); }
[ "@", "GET", "@", "Path", "(", "\"search\"", ")", "@", "RolesAllowed", "(", "{", "\"ROLE_ADMIN\"", "}", ")", "public", "Response", "search", "(", "@", "QueryParam", "(", "\"email\"", ")", "String", "email", ",", "@", "QueryParam", "(", "\"username\"", ")", ...
Search for users with matching email or username. @param email a partial email address @param username a partial username @return a page of matching users
[ "Search", "for", "users", "with", "matching", "email", "or", "username", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L165-L183
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java
UserResource.readPage
@GET @RolesAllowed({"ROLE_ADMIN"}) public Response readPage(@QueryParam("pageSize") @DefaultValue("10") int pageSize, @QueryParam("cursorKey") String cursorKey) { CursorPage<DUser> page = userService.readPage(pageSize, cursorKey); return Response.ok(page).build(); }
java
@GET @RolesAllowed({"ROLE_ADMIN"}) public Response readPage(@QueryParam("pageSize") @DefaultValue("10") int pageSize, @QueryParam("cursorKey") String cursorKey) { CursorPage<DUser> page = userService.readPage(pageSize, cursorKey); return Response.ok(page).build(); }
[ "@", "GET", "@", "RolesAllowed", "(", "{", "\"ROLE_ADMIN\"", "}", ")", "public", "Response", "readPage", "(", "@", "QueryParam", "(", "\"pageSize\"", ")", "@", "DefaultValue", "(", "\"10\"", ")", "int", "pageSize", ",", "@", "QueryParam", "(", "\"cursorKey\"...
Get a page of users. @param pageSize Optional. Page size. @param cursorKey Optional. Cursor key @return a page of user domain objects
[ "Get", "a", "page", "of", "users", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L192-L200
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java
UserResource.changeUsername
@POST @Path("{id}/username") @RolesAllowed({"ROLE_ADMIN"}) public Response changeUsername(@PathParam("id") Long id, UsernameRequest usernameRequest) { checkUsernameFormat(usernameRequest.username); userService.changeUsername(id, usernameRequest.getUsername()); return Response.ok(id).build(); }
java
@POST @Path("{id}/username") @RolesAllowed({"ROLE_ADMIN"}) public Response changeUsername(@PathParam("id") Long id, UsernameRequest usernameRequest) { checkUsernameFormat(usernameRequest.username); userService.changeUsername(id, usernameRequest.getUsername()); return Response.ok(id).build(); }
[ "@", "POST", "@", "Path", "(", "\"{id}/username\"", ")", "@", "RolesAllowed", "(", "{", "\"ROLE_ADMIN\"", "}", ")", "public", "Response", "changeUsername", "(", "@", "PathParam", "(", "\"id\"", ")", "Long", "id", ",", "UsernameRequest", "usernameRequest", ")",...
Change a users username. The username must be unique @param usernameRequest new username @return 200 if success 409 if username is not unique
[ "Change", "a", "users", "username", ".", "The", "username", "must", "be", "unique" ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L341-L350
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java
UserResource.changePassword
@POST @Path("{id}/password") @PermitAll public Response changePassword(@PathParam("id") Long userId, PasswordRequest request) { checkNotNull(userId); checkNotNull(request.getToken()); checkPasswordFormat(request.getNewPassword()); boolean isSuccess = userService.confirmResetPasswordUsingToken(userId, request.getNewPassword(), request.getToken()); return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build(); }
java
@POST @Path("{id}/password") @PermitAll public Response changePassword(@PathParam("id") Long userId, PasswordRequest request) { checkNotNull(userId); checkNotNull(request.getToken()); checkPasswordFormat(request.getNewPassword()); boolean isSuccess = userService.confirmResetPasswordUsingToken(userId, request.getNewPassword(), request.getToken()); return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build(); }
[ "@", "POST", "@", "Path", "(", "\"{id}/password\"", ")", "@", "PermitAll", "public", "Response", "changePassword", "(", "@", "PathParam", "(", "\"id\"", ")", "Long", "userId", ",", "PasswordRequest", "request", ")", "{", "checkNotNull", "(", "userId", ")", "...
Change password using a temporary token. Used during password reset flow. @param userId unique user id @param request newPassword and token @return 204 if success, otherwise 403
[ "Change", "password", "using", "a", "temporary", "token", ".", "Used", "during", "password", "reset", "flow", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L380-L390
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java
UserResource.resetPassword
@POST @Path("password/reset") @PermitAll public Response resetPassword(PasswordRequest request) { checkNotNull(request.getEmail()); userService.resetPassword(request.getEmail()); return Response.noContent().build(); }
java
@POST @Path("password/reset") @PermitAll public Response resetPassword(PasswordRequest request) { checkNotNull(request.getEmail()); userService.resetPassword(request.getEmail()); return Response.noContent().build(); }
[ "@", "POST", "@", "Path", "(", "\"password/reset\"", ")", "@", "PermitAll", "public", "Response", "resetPassword", "(", "PasswordRequest", "request", ")", "{", "checkNotNull", "(", "request", ".", "getEmail", "(", ")", ")", ";", "userService", ".", "resetPassw...
Reset user password by sending out a reset email. @param request users unique email @return http 204
[ "Reset", "user", "password", "by", "sending", "out", "a", "reset", "email", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L398-L406
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java
UserResource.confirmAccount
@POST @Path("{id}/account/confirm") @PermitAll public Response confirmAccount(@PathParam("id") Long userId, AccountRequest request) { checkNotNull(userId); checkNotNull(request.getToken()); boolean isSuccess = userService.confirmAccountUsingToken(userId, request.getToken()); return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build(); }
java
@POST @Path("{id}/account/confirm") @PermitAll public Response confirmAccount(@PathParam("id") Long userId, AccountRequest request) { checkNotNull(userId); checkNotNull(request.getToken()); boolean isSuccess = userService.confirmAccountUsingToken(userId, request.getToken()); return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build(); }
[ "@", "POST", "@", "Path", "(", "\"{id}/account/confirm\"", ")", "@", "PermitAll", "public", "Response", "confirmAccount", "(", "@", "PathParam", "(", "\"id\"", ")", "Long", "userId", ",", "AccountRequest", "request", ")", "{", "checkNotNull", "(", "userId", ")...
Confirm a newly create account using a temporary token. @param userId unique user id @param request token @return 204 if success @return 400 if id / token combination is invalid
[ "Confirm", "a", "newly", "create", "account", "using", "a", "temporary", "token", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L416-L425
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java
UserResource.resendVerifyAccountEmail
@POST @Path("{id}/account/resend") @PermitAll public Response resendVerifyAccountEmail(@PathParam("id") Long userId) { checkNotNull(userId); boolean isSuccess = userService.resendVerifyAccountEmail(userId); return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build(); }
java
@POST @Path("{id}/account/resend") @PermitAll public Response resendVerifyAccountEmail(@PathParam("id") Long userId) { checkNotNull(userId); boolean isSuccess = userService.resendVerifyAccountEmail(userId); return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build(); }
[ "@", "POST", "@", "Path", "(", "\"{id}/account/resend\"", ")", "@", "PermitAll", "public", "Response", "resendVerifyAccountEmail", "(", "@", "PathParam", "(", "\"id\"", ")", "Long", "userId", ")", "{", "checkNotNull", "(", "userId", ")", ";", "boolean", "isSuc...
Resend account verification email. @param userId unique user id @return 204 if success
[ "Resend", "account", "verification", "email", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L433-L441
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java
UserResource.changeEmail
@POST @Path("{id}/email") @RolesAllowed({"ROLE_ADMIN"}) public Response changeEmail(@PathParam("id") Long userId, EmailRequest request) { checkNotNull(userId); checkEmailFormat(request.getEmail()); boolean isSuccess = userService.changeEmailAddress(userId, request.getEmail()); return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build(); }
java
@POST @Path("{id}/email") @RolesAllowed({"ROLE_ADMIN"}) public Response changeEmail(@PathParam("id") Long userId, EmailRequest request) { checkNotNull(userId); checkEmailFormat(request.getEmail()); boolean isSuccess = userService.changeEmailAddress(userId, request.getEmail()); return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build(); }
[ "@", "POST", "@", "Path", "(", "\"{id}/email\"", ")", "@", "RolesAllowed", "(", "{", "\"ROLE_ADMIN\"", "}", ")", "public", "Response", "changeEmail", "(", "@", "PathParam", "(", "\"id\"", ")", "Long", "userId", ",", "EmailRequest", "request", ")", "{", "ch...
Admin changing a users email. @param userId unique user id @param request injected @return 204 if success
[ "Admin", "changing", "a", "users", "email", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L465-L474
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java
UserResource.confirmChangeEmail
@POST @Path("{id}/email/confirm") @PermitAll public Response confirmChangeEmail(@PathParam("id") Long userId, EmailRequest request) { checkNotNull(userId); checkNotNull(request.getToken()); boolean isSuccess = userService.confirmEmailAddressChangeUsingToken(userId, request.getToken()); return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build(); }
java
@POST @Path("{id}/email/confirm") @PermitAll public Response confirmChangeEmail(@PathParam("id") Long userId, EmailRequest request) { checkNotNull(userId); checkNotNull(request.getToken()); boolean isSuccess = userService.confirmEmailAddressChangeUsingToken(userId, request.getToken()); return isSuccess ? Response.noContent().build() : Response.status(Response.Status.BAD_REQUEST).build(); }
[ "@", "POST", "@", "Path", "(", "\"{id}/email/confirm\"", ")", "@", "PermitAll", "public", "Response", "confirmChangeEmail", "(", "@", "PathParam", "(", "\"id\"", ")", "Long", "userId", ",", "EmailRequest", "request", ")", "{", "checkNotNull", "(", "userId", ")...
User confirm changing email. The token is verified and the temporary stored email will not be permanently saved as the users email. @param userId unique email @return 204 if success
[ "User", "confirm", "changing", "email", ".", "The", "token", "is", "verified", "and", "the", "temporary", "stored", "email", "will", "not", "be", "permanently", "saved", "as", "the", "users", "email", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L483-L492
train
syphr42/libmythtv-java
protocol/src/main/java/org/syphr/mythtv/protocol/ProtocolFactory.java
ProtocolFactory.createInstance
public static Protocol createInstance(ProtocolVersion version, SocketManager socketManager) { switch (version) { case _63: return new Protocol63(socketManager); case _72: return new Protocol72(socketManager); case _73: return new Protocol73(socketManager); case _74: return new Protocol74(socketManager); default: throw new IllegalArgumentException("Unknown protocol version: " + version); } }
java
public static Protocol createInstance(ProtocolVersion version, SocketManager socketManager) { switch (version) { case _63: return new Protocol63(socketManager); case _72: return new Protocol72(socketManager); case _73: return new Protocol73(socketManager); case _74: return new Protocol74(socketManager); default: throw new IllegalArgumentException("Unknown protocol version: " + version); } }
[ "public", "static", "Protocol", "createInstance", "(", "ProtocolVersion", "version", ",", "SocketManager", "socketManager", ")", "{", "switch", "(", "version", ")", "{", "case", "_63", ":", "return", "new", "Protocol63", "(", "socketManager", ")", ";", "case", ...
Create a new protocol instance. This instance cannot be used until the associated socket manager is connected. @param version the desired protocol version (this must match the backend to which the socket manager is connecting) @param socketManager the socket manager that will control communication between the client and the backend @return a new protocol instance
[ "Create", "a", "new", "protocol", "instance", ".", "This", "instance", "cannot", "be", "used", "until", "the", "associated", "socket", "manager", "is", "connected", "." ]
cc7a2012fbd4a4ba2562dda6b2614fb0548526ea
https://github.com/syphr42/libmythtv-java/blob/cc7a2012fbd4a4ba2562dda6b2614fb0548526ea/protocol/src/main/java/org/syphr/mythtv/protocol/ProtocolFactory.java#L57-L76
train
base2Services/kagura
shared/reporting-core/src/main/java/com/base2/kagura/core/report/configmodel/ReportConfig.java
ReportConfig.prepareParameters
public void prepareParameters(Map<String, Object> extra) { if (paramConfig == null) return; for (ParamConfig param : paramConfig) { param.prepareParameter(extra); } }
java
public void prepareParameters(Map<String, Object> extra) { if (paramConfig == null) return; for (ParamConfig param : paramConfig) { param.prepareParameter(extra); } }
[ "public", "void", "prepareParameters", "(", "Map", "<", "String", ",", "Object", ">", "extra", ")", "{", "if", "(", "paramConfig", "==", "null", ")", "return", ";", "for", "(", "ParamConfig", "param", ":", "paramConfig", ")", "{", "param", ".", "prepareP...
Prepares the parameters for the report. This populates the Combo and ManyCombo box options if there is a groovy or report backing the data. @param extra Extra options from the middleware, this is passed down to the report or groovy execution.
[ "Prepares", "the", "parameters", "for", "the", "report", ".", "This", "populates", "the", "Combo", "and", "ManyCombo", "box", "options", "if", "there", "is", "a", "groovy", "or", "report", "backing", "the", "data", "." ]
5564aa71bfa2cb3baaae2eb098c6c673dd4e82ee
https://github.com/base2Services/kagura/blob/5564aa71bfa2cb3baaae2eb098c6c673dd4e82ee/shared/reporting-core/src/main/java/com/base2/kagura/core/report/configmodel/ReportConfig.java#L143-L149
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java
ValueTaglet.getFieldDoc
private FieldDoc getFieldDoc(Configuration config, Tag tag, String name) { if (name == null || name.length() == 0) { //Base case: no label. if (tag.holder() instanceof FieldDoc) { return (FieldDoc) tag.holder(); } else { // If the value tag does not specify a parameter which is a valid field and // it is not used within the comments of a valid field, return null. return null; } } StringTokenizer st = new StringTokenizer(name, "#"); String memberName = null; ClassDoc cd = null; if (st.countTokens() == 1) { //Case 2: @value in same class. Doc holder = tag.holder(); if (holder instanceof MemberDoc) { cd = ((MemberDoc) holder).containingClass(); } else if (holder instanceof ClassDoc) { cd = (ClassDoc) holder; } memberName = st.nextToken(); } else { //Case 3: @value in different class. cd = config.root.classNamed(st.nextToken()); memberName = st.nextToken(); } if (cd == null) { return null; } FieldDoc[] fields = cd.fields(); for (int i = 0; i < fields.length; i++) { if (fields[i].name().equals(memberName)) { return fields[i]; } } return null; }
java
private FieldDoc getFieldDoc(Configuration config, Tag tag, String name) { if (name == null || name.length() == 0) { //Base case: no label. if (tag.holder() instanceof FieldDoc) { return (FieldDoc) tag.holder(); } else { // If the value tag does not specify a parameter which is a valid field and // it is not used within the comments of a valid field, return null. return null; } } StringTokenizer st = new StringTokenizer(name, "#"); String memberName = null; ClassDoc cd = null; if (st.countTokens() == 1) { //Case 2: @value in same class. Doc holder = tag.holder(); if (holder instanceof MemberDoc) { cd = ((MemberDoc) holder).containingClass(); } else if (holder instanceof ClassDoc) { cd = (ClassDoc) holder; } memberName = st.nextToken(); } else { //Case 3: @value in different class. cd = config.root.classNamed(st.nextToken()); memberName = st.nextToken(); } if (cd == null) { return null; } FieldDoc[] fields = cd.fields(); for (int i = 0; i < fields.length; i++) { if (fields[i].name().equals(memberName)) { return fields[i]; } } return null; }
[ "private", "FieldDoc", "getFieldDoc", "(", "Configuration", "config", ",", "Tag", "tag", ",", "String", "name", ")", "{", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "==", "0", ")", "{", "//Base case: no label.", "if", "(", ...
Given the name of the field, return the corresponding FieldDoc. Return null due to invalid use of value tag if the name is null or empty string and if the value tag is not used on a field. @param config the current configuration of the doclet. @param tag the value tag. @param name the name of the field to search for. The name should be in {@code <qualified class name>#<field name>} format. If the class name is omitted, it is assumed that the field is in the current class. @return the corresponding FieldDoc. If the name is null or empty string, return field that the value tag was used in. Return null if the name is null or empty string and if the value tag is not used on a field.
[ "Given", "the", "name", "of", "the", "field", "return", "the", "corresponding", "FieldDoc", ".", "Return", "null", "due", "to", "invalid", "use", "of", "value", "tag", "if", "the", "name", "is", "null", "or", "empty", "string", "and", "if", "the", "value...
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java#L122-L160
train
eiichiro/gig
gig-core/src/main/java/org/eiichiro/gig/Configuration.java
Configuration.constructed
@Constructed public void constructed() { Context context = factory.enterContext(); try { scope = new ImporterTopLevel(context); } finally { Context.exit(); } Container container = Jaguar.component(Container.class); Object store = container.component(container.contexts().get(Application.class)).store(); if (store instanceof ServletContext) { org.eiichiro.bootleg.Configuration configuration = new DefaultConfiguration(); configuration.init((ServletContext) store); this.configuration = configuration; } }
java
@Constructed public void constructed() { Context context = factory.enterContext(); try { scope = new ImporterTopLevel(context); } finally { Context.exit(); } Container container = Jaguar.component(Container.class); Object store = container.component(container.contexts().get(Application.class)).store(); if (store instanceof ServletContext) { org.eiichiro.bootleg.Configuration configuration = new DefaultConfiguration(); configuration.init((ServletContext) store); this.configuration = configuration; } }
[ "@", "Constructed", "public", "void", "constructed", "(", ")", "{", "Context", "context", "=", "factory", ".", "enterContext", "(", ")", ";", "try", "{", "scope", "=", "new", "ImporterTopLevel", "(", "context", ")", ";", "}", "finally", "{", "Context", "...
Sets up Mozilla Rhino's script scope. If the application is running on a Servlet container, this method instantiates and initializes the Bootleg's default configuration internally.
[ "Sets", "up", "Mozilla", "Rhino", "s", "script", "scope", ".", "If", "the", "application", "is", "running", "on", "a", "Servlet", "container", "this", "method", "instantiates", "and", "initializes", "the", "Bootleg", "s", "default", "configuration", "internally"...
21181fb36a17d2154f989e5e8c6edbb39fc81900
https://github.com/eiichiro/gig/blob/21181fb36a17d2154f989e5e8c6edbb39fc81900/gig-core/src/main/java/org/eiichiro/gig/Configuration.java#L118-L136
train
eiichiro/gig
gig-core/src/main/java/org/eiichiro/gig/Configuration.java
Configuration.activated
@Activated public void activated() { logger.info("Importing core packages ['org.eiichiro.gig', 'org.eiichiro.bootleg', 'org.eiichiro.jaguar', 'org.eiichiro.jaguar.deployment'] into JavaScript context"); Context context = factory.enterContext(); try { context.evaluateString(scope, "importPackage(Packages.org.eiichiro.gig)", Configuration.class.getSimpleName(), 146, null); context.evaluateString(scope, "importPackage(Packages.org.eiichiro.bootleg)", Configuration.class.getSimpleName(), 147, null); context.evaluateString(scope, "importPackage(Packages.org.eiichiro.jaguar)", Configuration.class.getSimpleName(), 148, null); context.evaluateString(scope, "importPackage(Packages.org.eiichiro.jaguar.deployment)", Configuration.class.getSimpleName(), 149, null); } finally { Context.exit(); } load(COMPONENTS_JS); load(ROUTING_JS); load(SETTINGS_JS); }
java
@Activated public void activated() { logger.info("Importing core packages ['org.eiichiro.gig', 'org.eiichiro.bootleg', 'org.eiichiro.jaguar', 'org.eiichiro.jaguar.deployment'] into JavaScript context"); Context context = factory.enterContext(); try { context.evaluateString(scope, "importPackage(Packages.org.eiichiro.gig)", Configuration.class.getSimpleName(), 146, null); context.evaluateString(scope, "importPackage(Packages.org.eiichiro.bootleg)", Configuration.class.getSimpleName(), 147, null); context.evaluateString(scope, "importPackage(Packages.org.eiichiro.jaguar)", Configuration.class.getSimpleName(), 148, null); context.evaluateString(scope, "importPackage(Packages.org.eiichiro.jaguar.deployment)", Configuration.class.getSimpleName(), 149, null); } finally { Context.exit(); } load(COMPONENTS_JS); load(ROUTING_JS); load(SETTINGS_JS); }
[ "@", "Activated", "public", "void", "activated", "(", ")", "{", "logger", ".", "info", "(", "\"Importing core packages ['org.eiichiro.gig', 'org.eiichiro.bootleg', 'org.eiichiro.jaguar', 'org.eiichiro.jaguar.deployment'] into JavaScript context\"", ")", ";", "Context", "context", "...
Attempts to load pre-defined configuration files.
[ "Attempts", "to", "load", "pre", "-", "defined", "configuration", "files", "." ]
21181fb36a17d2154f989e5e8c6edbb39fc81900
https://github.com/eiichiro/gig/blob/21181fb36a17d2154f989e5e8c6edbb39fc81900/gig-core/src/main/java/org/eiichiro/gig/Configuration.java#L141-L158
train
eiichiro/gig
gig-core/src/main/java/org/eiichiro/gig/Configuration.java
Configuration.load
public void load(String file) { Context context = factory.enterContext(); try { URL url = Thread.currentThread().getContextClassLoader().getResource(file); if (url == null) { logger.debug("Configuration [" + file + "] does not exist"); return; } File f = new File(url.getPath()); if (f.exists()) { logger.info("Loading configuration [" + file + "]"); context.evaluateReader(scope, new FileReader(f), file.substring(file.lastIndexOf("/") + 1), 1, null); } } catch (Exception e) { logger.error("Failed to load configuration [" + file + "]", e); throw new UncheckedException(e); } finally { Context.exit(); } }
java
public void load(String file) { Context context = factory.enterContext(); try { URL url = Thread.currentThread().getContextClassLoader().getResource(file); if (url == null) { logger.debug("Configuration [" + file + "] does not exist"); return; } File f = new File(url.getPath()); if (f.exists()) { logger.info("Loading configuration [" + file + "]"); context.evaluateReader(scope, new FileReader(f), file.substring(file.lastIndexOf("/") + 1), 1, null); } } catch (Exception e) { logger.error("Failed to load configuration [" + file + "]", e); throw new UncheckedException(e); } finally { Context.exit(); } }
[ "public", "void", "load", "(", "String", "file", ")", "{", "Context", "context", "=", "factory", ".", "enterContext", "(", ")", ";", "try", "{", "URL", "url", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ".", "...
Loads the specified configuration file written in JavaScript. @param file Configuration file written in JavaScript.
[ "Loads", "the", "specified", "configuration", "file", "written", "in", "JavaScript", "." ]
21181fb36a17d2154f989e5e8c6edbb39fc81900
https://github.com/eiichiro/gig/blob/21181fb36a17d2154f989e5e8c6edbb39fc81900/gig-core/src/main/java/org/eiichiro/gig/Configuration.java#L165-L189
train
eiichiro/gig
gig-core/src/main/java/org/eiichiro/gig/Configuration.java
Configuration.set
public <T> void set(String key, T value) { Preconditions.checkArgument(key != null && !key.isEmpty(), "Parameter 'key' must not be [" + key + "]"); values.put(key, value); scope.put(key, scope, value); }
java
public <T> void set(String key, T value) { Preconditions.checkArgument(key != null && !key.isEmpty(), "Parameter 'key' must not be [" + key + "]"); values.put(key, value); scope.put(key, scope, value); }
[ "public", "<", "T", ">", "void", "set", "(", "String", "key", ",", "T", "value", ")", "{", "Preconditions", ".", "checkArgument", "(", "key", "!=", "null", "&&", "!", "key", ".", "isEmpty", "(", ")", ",", "\"Parameter 'key' must not be [\"", "+", "key", ...
Sets the specified configuration setting with the specified key. @param key The key to the configuration setting. @param value The value of the configuration setting.
[ "Sets", "the", "specified", "configuration", "setting", "with", "the", "specified", "key", "." ]
21181fb36a17d2154f989e5e8c6edbb39fc81900
https://github.com/eiichiro/gig/blob/21181fb36a17d2154f989e5e8c6edbb39fc81900/gig-core/src/main/java/org/eiichiro/gig/Configuration.java#L330-L334
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/ean/AbstractUPCEAN.java
AbstractUPCEAN.calcChecksumChar
protected static char calcChecksumChar (@Nonnull final String sMsg, @Nonnegative final int nLength) { ValueEnforcer.notNull (sMsg, "Msg"); ValueEnforcer.isBetweenInclusive (nLength, "Length", 0, sMsg.length ()); return asChar (calcChecksum (sMsg.toCharArray (), nLength)); }
java
protected static char calcChecksumChar (@Nonnull final String sMsg, @Nonnegative final int nLength) { ValueEnforcer.notNull (sMsg, "Msg"); ValueEnforcer.isBetweenInclusive (nLength, "Length", 0, sMsg.length ()); return asChar (calcChecksum (sMsg.toCharArray (), nLength)); }
[ "protected", "static", "char", "calcChecksumChar", "(", "@", "Nonnull", "final", "String", "sMsg", ",", "@", "Nonnegative", "final", "int", "nLength", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sMsg", ",", "\"Msg\"", ")", ";", "ValueEnforcer", ".", "is...
Calculates the check character for a given message @param sMsg the message @param nLength The number of characters to be checked. Must be &ge; 0 and &lt; message.length @return char the check character
[ "Calculates", "the", "check", "character", "for", "a", "given", "message" ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/ean/AbstractUPCEAN.java#L144-L150
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/parser/UnicodeReader.java
UnicodeReader.scanSurrogates
protected char scanSurrogates() { if (surrogatesSupported && Character.isHighSurrogate(ch)) { char high = ch; scanChar(); if (Character.isLowSurrogate(ch)) { return high; } ch = high; } return 0; }
java
protected char scanSurrogates() { if (surrogatesSupported && Character.isHighSurrogate(ch)) { char high = ch; scanChar(); if (Character.isLowSurrogate(ch)) { return high; } ch = high; } return 0; }
[ "protected", "char", "scanSurrogates", "(", ")", "{", "if", "(", "surrogatesSupported", "&&", "Character", ".", "isHighSurrogate", "(", "ch", ")", ")", "{", "char", "high", "=", "ch", ";", "scanChar", "(", ")", ";", "if", "(", "Character", ".", "isLowSur...
Scan surrogate pairs. If 'ch' is a high surrogate and the next character is a low surrogate, then put the low surrogate in 'ch', and return the high surrogate. otherwise, just return 0.
[ "Scan", "surrogate", "pairs", ".", "If", "ch", "is", "a", "high", "surrogate", "and", "the", "next", "character", "is", "a", "low", "surrogate", "then", "put", "the", "low", "surrogate", "in", "ch", "and", "return", "the", "high", "surrogate", ".", "othe...
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/parser/UnicodeReader.java#L204-L218
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/ean/EAN8.java
EAN8.validateMessage
@Nonnull public static EValidity validateMessage (@Nullable final String sMsg) { final int nLen = StringHelper.getLength (sMsg); if (nLen >= 7 && nLen <= 8) if (AbstractUPCEAN.validateMessage (sMsg).isValid ()) return EValidity.VALID; return EValidity.INVALID; }
java
@Nonnull public static EValidity validateMessage (@Nullable final String sMsg) { final int nLen = StringHelper.getLength (sMsg); if (nLen >= 7 && nLen <= 8) if (AbstractUPCEAN.validateMessage (sMsg).isValid ()) return EValidity.VALID; return EValidity.INVALID; }
[ "@", "Nonnull", "public", "static", "EValidity", "validateMessage", "(", "@", "Nullable", "final", "String", "sMsg", ")", "{", "final", "int", "nLen", "=", "StringHelper", ".", "getLength", "(", "sMsg", ")", ";", "if", "(", "nLen", ">=", "7", "&&", "nLen...
Validates a EAN-8 message. The method throws IllegalArgumentExceptions if an invalid message is passed. @param sMsg the message to validate @return {@link EValidity#VALID} if the msg is valid, {@link EValidity#INVALID} otherwise.
[ "Validates", "a", "EAN", "-", "8", "message", ".", "The", "method", "throws", "IllegalArgumentExceptions", "if", "an", "invalid", "message", "is", "passed", "." ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/ean/EAN8.java#L73-L81
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/comp/PubapiVisitor.java
PubapiVisitor.makeMethodString
protected String makeMethodString(ExecutableElement e) { StringBuilder result = new StringBuilder(); for (Modifier modifier : e.getModifiers()) { result.append(modifier.toString()); result.append(" "); } result.append(e.getReturnType().toString()); result.append(" "); result.append(e.toString()); List<? extends TypeMirror> thrownTypes = e.getThrownTypes(); if (!thrownTypes.isEmpty()) { result.append(" throws "); for (Iterator<? extends TypeMirror> iterator = thrownTypes .iterator(); iterator.hasNext();) { TypeMirror typeMirror = iterator.next(); result.append(typeMirror.toString()); if (iterator.hasNext()) { result.append(", "); } } } return result.toString(); }
java
protected String makeMethodString(ExecutableElement e) { StringBuilder result = new StringBuilder(); for (Modifier modifier : e.getModifiers()) { result.append(modifier.toString()); result.append(" "); } result.append(e.getReturnType().toString()); result.append(" "); result.append(e.toString()); List<? extends TypeMirror> thrownTypes = e.getThrownTypes(); if (!thrownTypes.isEmpty()) { result.append(" throws "); for (Iterator<? extends TypeMirror> iterator = thrownTypes .iterator(); iterator.hasNext();) { TypeMirror typeMirror = iterator.next(); result.append(typeMirror.toString()); if (iterator.hasNext()) { result.append(", "); } } } return result.toString(); }
[ "protected", "String", "makeMethodString", "(", "ExecutableElement", "e", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Modifier", "modifier", ":", "e", ".", "getModifiers", "(", ")", ")", "{", "result", ".", ...
Creates a String representation of a method element with everything necessary to track all public aspects of it in an API. @param e Element to create String for. @return String representation of element.
[ "Creates", "a", "String", "representation", "of", "a", "method", "element", "with", "everything", "necessary", "to", "track", "all", "public", "aspects", "of", "it", "in", "an", "API", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/comp/PubapiVisitor.java#L105-L128
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/comp/PubapiVisitor.java
PubapiVisitor.makeVariableString
protected String makeVariableString(VariableElement e) { StringBuilder result = new StringBuilder(); for (Modifier modifier : e.getModifiers()) { result.append(modifier.toString()); result.append(" "); } result.append(e.asType().toString()); result.append(" "); result.append(e.toString()); Object value = e.getConstantValue(); if (value != null) { result.append(" = "); if (e.asType().toString().equals("char")) { int v = (int)value.toString().charAt(0); result.append("'\\u"+Integer.toString(v,16)+"'"); } else { result.append(value.toString()); } } return result.toString(); }
java
protected String makeVariableString(VariableElement e) { StringBuilder result = new StringBuilder(); for (Modifier modifier : e.getModifiers()) { result.append(modifier.toString()); result.append(" "); } result.append(e.asType().toString()); result.append(" "); result.append(e.toString()); Object value = e.getConstantValue(); if (value != null) { result.append(" = "); if (e.asType().toString().equals("char")) { int v = (int)value.toString().charAt(0); result.append("'\\u"+Integer.toString(v,16)+"'"); } else { result.append(value.toString()); } } return result.toString(); }
[ "protected", "String", "makeVariableString", "(", "VariableElement", "e", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Modifier", "modifier", ":", "e", ".", "getModifiers", "(", ")", ")", "{", "result", ".", ...
Creates a String representation of a variable element with everything necessary to track all public aspects of it in an API. @param e Element to create String for. @return String representation of element.
[ "Creates", "a", "String", "representation", "of", "a", "variable", "element", "with", "everything", "necessary", "to", "track", "all", "public", "aspects", "of", "it", "in", "an", "API", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/comp/PubapiVisitor.java#L136-L156
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/newrelic/DeploymentCache.java
DeploymentCache.add
public void add(Collection<Deployment> deployments) { for(Deployment deployment : deployments) this.deployments.put(deployment.getId(), deployment); }
java
public void add(Collection<Deployment> deployments) { for(Deployment deployment : deployments) this.deployments.put(deployment.getId(), deployment); }
[ "public", "void", "add", "(", "Collection", "<", "Deployment", ">", "deployments", ")", "{", "for", "(", "Deployment", "deployment", ":", "deployments", ")", "this", ".", "deployments", ".", "put", "(", "deployment", ".", "getId", "(", ")", ",", "deploymen...
Adds the deployment list to the deployments for the account. @param deployments The deployments to add
[ "Adds", "the", "deployment", "list", "to", "the", "deployments", "for", "the", "account", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/DeploymentCache.java#L67-L71
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Infer.java
Infer.generateReturnConstraints
Type generateReturnConstraints(JCTree tree, Attr.ResultInfo resultInfo, MethodType mt, InferenceContext inferenceContext) { InferenceContext rsInfoInfContext = resultInfo.checkContext.inferenceContext(); Type from = mt.getReturnType(); if (mt.getReturnType().containsAny(inferenceContext.inferencevars) && rsInfoInfContext != emptyContext) { from = types.capture(from); //add synthetic captured ivars for (Type t : from.getTypeArguments()) { if (t.hasTag(TYPEVAR) && ((TypeVar)t).isCaptured()) { inferenceContext.addVar((TypeVar)t); } } } Type qtype = inferenceContext.asUndetVar(from); Type to = resultInfo.pt; if (qtype.hasTag(VOID)) { to = syms.voidType; } else if (to.hasTag(NONE)) { to = from.isPrimitive() ? from : syms.objectType; } else if (qtype.hasTag(UNDETVAR)) { if (resultInfo.pt.isReference()) { to = generateReturnConstraintsUndetVarToReference( tree, (UndetVar)qtype, to, resultInfo, inferenceContext); } else { if (to.isPrimitive()) { to = generateReturnConstraintsPrimitive(tree, (UndetVar)qtype, to, resultInfo, inferenceContext); } } } Assert.check(allowGraphInference || !rsInfoInfContext.free(to), "legacy inference engine cannot handle constraints on both sides of a subtyping assertion"); //we need to skip capture? Warner retWarn = new Warner(); if (!resultInfo.checkContext.compatible(qtype, rsInfoInfContext.asUndetVar(to), retWarn) || //unchecked conversion is not allowed in source 7 mode (!allowGraphInference && retWarn.hasLint(Lint.LintCategory.UNCHECKED))) { throw inferenceException .setMessage("infer.no.conforming.instance.exists", inferenceContext.restvars(), mt.getReturnType(), to); } return from; }
java
Type generateReturnConstraints(JCTree tree, Attr.ResultInfo resultInfo, MethodType mt, InferenceContext inferenceContext) { InferenceContext rsInfoInfContext = resultInfo.checkContext.inferenceContext(); Type from = mt.getReturnType(); if (mt.getReturnType().containsAny(inferenceContext.inferencevars) && rsInfoInfContext != emptyContext) { from = types.capture(from); //add synthetic captured ivars for (Type t : from.getTypeArguments()) { if (t.hasTag(TYPEVAR) && ((TypeVar)t).isCaptured()) { inferenceContext.addVar((TypeVar)t); } } } Type qtype = inferenceContext.asUndetVar(from); Type to = resultInfo.pt; if (qtype.hasTag(VOID)) { to = syms.voidType; } else if (to.hasTag(NONE)) { to = from.isPrimitive() ? from : syms.objectType; } else if (qtype.hasTag(UNDETVAR)) { if (resultInfo.pt.isReference()) { to = generateReturnConstraintsUndetVarToReference( tree, (UndetVar)qtype, to, resultInfo, inferenceContext); } else { if (to.isPrimitive()) { to = generateReturnConstraintsPrimitive(tree, (UndetVar)qtype, to, resultInfo, inferenceContext); } } } Assert.check(allowGraphInference || !rsInfoInfContext.free(to), "legacy inference engine cannot handle constraints on both sides of a subtyping assertion"); //we need to skip capture? Warner retWarn = new Warner(); if (!resultInfo.checkContext.compatible(qtype, rsInfoInfContext.asUndetVar(to), retWarn) || //unchecked conversion is not allowed in source 7 mode (!allowGraphInference && retWarn.hasLint(Lint.LintCategory.UNCHECKED))) { throw inferenceException .setMessage("infer.no.conforming.instance.exists", inferenceContext.restvars(), mt.getReturnType(), to); } return from; }
[ "Type", "generateReturnConstraints", "(", "JCTree", "tree", ",", "Attr", ".", "ResultInfo", "resultInfo", ",", "MethodType", "mt", ",", "InferenceContext", "inferenceContext", ")", "{", "InferenceContext", "rsInfoInfContext", "=", "resultInfo", ".", "checkContext", "....
Generate constraints from the generic method's return type. If the method call occurs in a context where a type T is expected, use the expected type to derive more constraints on the generic method inference variables.
[ "Generate", "constraints", "from", "the", "generic", "method", "s", "return", "type", ".", "If", "the", "method", "call", "occurs", "in", "a", "context", "where", "a", "type", "T", "is", "expected", "use", "the", "expected", "type", "to", "derive", "more",...
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Infer.java#L228-L272
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Infer.java
Infer.instantiateAsUninferredVars
private void instantiateAsUninferredVars(List<Type> vars, InferenceContext inferenceContext) { ListBuffer<Type> todo = new ListBuffer<>(); //step 1 - create fresh tvars for (Type t : vars) { UndetVar uv = (UndetVar)inferenceContext.asUndetVar(t); List<Type> upperBounds = uv.getBounds(InferenceBound.UPPER); if (Type.containsAny(upperBounds, vars)) { TypeSymbol fresh_tvar = new TypeVariableSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner); fresh_tvar.type = new TypeVar(fresh_tvar, types.makeIntersectionType(uv.getBounds(InferenceBound.UPPER)), null); todo.append(uv); uv.inst = fresh_tvar.type; } else if (upperBounds.nonEmpty()) { uv.inst = types.glb(upperBounds); } else { uv.inst = syms.objectType; } } //step 2 - replace fresh tvars in their bounds List<Type> formals = vars; for (Type t : todo) { UndetVar uv = (UndetVar)t; TypeVar ct = (TypeVar)uv.inst; ct.bound = types.glb(inferenceContext.asInstTypes(types.getBounds(ct))); if (ct.bound.isErroneous()) { //report inference error if glb fails reportBoundError(uv, BoundErrorKind.BAD_UPPER); } formals = formals.tail; } }
java
private void instantiateAsUninferredVars(List<Type> vars, InferenceContext inferenceContext) { ListBuffer<Type> todo = new ListBuffer<>(); //step 1 - create fresh tvars for (Type t : vars) { UndetVar uv = (UndetVar)inferenceContext.asUndetVar(t); List<Type> upperBounds = uv.getBounds(InferenceBound.UPPER); if (Type.containsAny(upperBounds, vars)) { TypeSymbol fresh_tvar = new TypeVariableSymbol(Flags.SYNTHETIC, uv.qtype.tsym.name, null, uv.qtype.tsym.owner); fresh_tvar.type = new TypeVar(fresh_tvar, types.makeIntersectionType(uv.getBounds(InferenceBound.UPPER)), null); todo.append(uv); uv.inst = fresh_tvar.type; } else if (upperBounds.nonEmpty()) { uv.inst = types.glb(upperBounds); } else { uv.inst = syms.objectType; } } //step 2 - replace fresh tvars in their bounds List<Type> formals = vars; for (Type t : todo) { UndetVar uv = (UndetVar)t; TypeVar ct = (TypeVar)uv.inst; ct.bound = types.glb(inferenceContext.asInstTypes(types.getBounds(ct))); if (ct.bound.isErroneous()) { //report inference error if glb fails reportBoundError(uv, BoundErrorKind.BAD_UPPER); } formals = formals.tail; } }
[ "private", "void", "instantiateAsUninferredVars", "(", "List", "<", "Type", ">", "vars", ",", "InferenceContext", "inferenceContext", ")", "{", "ListBuffer", "<", "Type", ">", "todo", "=", "new", "ListBuffer", "<>", "(", ")", ";", "//step 1 - create fresh tvars", ...
Infer cyclic inference variables as described in 15.12.2.8.
[ "Infer", "cyclic", "inference", "variables", "as", "described", "in", "15", ".", "12", ".", "2", ".", "8", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Infer.java#L368-L397
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Infer.java
Infer.instantiatePolymorphicSignatureInstance
Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env, MethodSymbol spMethod, // sig. poly. method or null if none Resolve.MethodResolutionContext resolveContext, List<Type> argtypes) { final Type restype; //The return type for a polymorphic signature call is computed from //the enclosing tree E, as follows: if E is a cast, then use the //target type of the cast expression as a return type; if E is an //expression statement, the return type is 'void' - otherwise the //return type is simply 'Object'. A correctness check ensures that //env.next refers to the lexically enclosing environment in which //the polymorphic signature call environment is nested. switch (env.next.tree.getTag()) { case TYPECAST: JCTypeCast castTree = (JCTypeCast)env.next.tree; restype = (TreeInfo.skipParens(castTree.expr) == env.tree) ? castTree.clazz.type : syms.objectType; break; case EXEC: JCTree.JCExpressionStatement execTree = (JCTree.JCExpressionStatement)env.next.tree; restype = (TreeInfo.skipParens(execTree.expr) == env.tree) ? syms.voidType : syms.objectType; break; default: restype = syms.objectType; } List<Type> paramtypes = Type.map(argtypes, new ImplicitArgType(spMethod, resolveContext.step)); List<Type> exType = spMethod != null ? spMethod.getThrownTypes() : List.of(syms.throwableType); // make it throw all exceptions MethodType mtype = new MethodType(paramtypes, restype, exType, syms.methodClass); return mtype; }
java
Type instantiatePolymorphicSignatureInstance(Env<AttrContext> env, MethodSymbol spMethod, // sig. poly. method or null if none Resolve.MethodResolutionContext resolveContext, List<Type> argtypes) { final Type restype; //The return type for a polymorphic signature call is computed from //the enclosing tree E, as follows: if E is a cast, then use the //target type of the cast expression as a return type; if E is an //expression statement, the return type is 'void' - otherwise the //return type is simply 'Object'. A correctness check ensures that //env.next refers to the lexically enclosing environment in which //the polymorphic signature call environment is nested. switch (env.next.tree.getTag()) { case TYPECAST: JCTypeCast castTree = (JCTypeCast)env.next.tree; restype = (TreeInfo.skipParens(castTree.expr) == env.tree) ? castTree.clazz.type : syms.objectType; break; case EXEC: JCTree.JCExpressionStatement execTree = (JCTree.JCExpressionStatement)env.next.tree; restype = (TreeInfo.skipParens(execTree.expr) == env.tree) ? syms.voidType : syms.objectType; break; default: restype = syms.objectType; } List<Type> paramtypes = Type.map(argtypes, new ImplicitArgType(spMethod, resolveContext.step)); List<Type> exType = spMethod != null ? spMethod.getThrownTypes() : List.of(syms.throwableType); // make it throw all exceptions MethodType mtype = new MethodType(paramtypes, restype, exType, syms.methodClass); return mtype; }
[ "Type", "instantiatePolymorphicSignatureInstance", "(", "Env", "<", "AttrContext", ">", "env", ",", "MethodSymbol", "spMethod", ",", "// sig. poly. method or null if none", "Resolve", ".", "MethodResolutionContext", "resolveContext", ",", "List", "<", "Type", ">", "argtyp...
Compute a synthetic method type corresponding to the requested polymorphic method signature. The target return type is computed from the immediately enclosing scope surrounding the polymorphic-signature call.
[ "Compute", "a", "synthetic", "method", "type", "corresponding", "to", "the", "requested", "polymorphic", "method", "signature", ".", "The", "target", "return", "type", "is", "computed", "from", "the", "immediately", "enclosing", "scope", "surrounding", "the", "pol...
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Infer.java#L404-L446
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Infer.java
Infer.checkWithinBounds
void checkWithinBounds(InferenceContext inferenceContext, Warner warn) throws InferenceException { MultiUndetVarListener mlistener = new MultiUndetVarListener(inferenceContext.undetvars); List<Type> saved_undet = inferenceContext.save(); try { while (true) { mlistener.reset(); if (!allowGraphInference) { //in legacy mode we lack of transitivity, so bound check //cannot be run in parallel with other incoprporation rounds for (Type t : inferenceContext.undetvars) { UndetVar uv = (UndetVar)t; IncorporationStep.CHECK_BOUNDS.apply(uv, inferenceContext, warn); } } for (Type t : inferenceContext.undetvars) { UndetVar uv = (UndetVar)t; //bound incorporation EnumSet<IncorporationStep> incorporationSteps = allowGraphInference ? incorporationStepsGraph : incorporationStepsLegacy; for (IncorporationStep is : incorporationSteps) { if (is.accepts(uv, inferenceContext)) { is.apply(uv, inferenceContext, warn); } } } if (!mlistener.changed || !allowGraphInference) break; } } finally { mlistener.detach(); if (incorporationCache.size() == MAX_INCORPORATION_STEPS) { inferenceContext.rollback(saved_undet); } incorporationCache.clear(); } }
java
void checkWithinBounds(InferenceContext inferenceContext, Warner warn) throws InferenceException { MultiUndetVarListener mlistener = new MultiUndetVarListener(inferenceContext.undetvars); List<Type> saved_undet = inferenceContext.save(); try { while (true) { mlistener.reset(); if (!allowGraphInference) { //in legacy mode we lack of transitivity, so bound check //cannot be run in parallel with other incoprporation rounds for (Type t : inferenceContext.undetvars) { UndetVar uv = (UndetVar)t; IncorporationStep.CHECK_BOUNDS.apply(uv, inferenceContext, warn); } } for (Type t : inferenceContext.undetvars) { UndetVar uv = (UndetVar)t; //bound incorporation EnumSet<IncorporationStep> incorporationSteps = allowGraphInference ? incorporationStepsGraph : incorporationStepsLegacy; for (IncorporationStep is : incorporationSteps) { if (is.accepts(uv, inferenceContext)) { is.apply(uv, inferenceContext, warn); } } } if (!mlistener.changed || !allowGraphInference) break; } } finally { mlistener.detach(); if (incorporationCache.size() == MAX_INCORPORATION_STEPS) { inferenceContext.rollback(saved_undet); } incorporationCache.clear(); } }
[ "void", "checkWithinBounds", "(", "InferenceContext", "inferenceContext", ",", "Warner", "warn", ")", "throws", "InferenceException", "{", "MultiUndetVarListener", "mlistener", "=", "new", "MultiUndetVarListener", "(", "inferenceContext", ".", "undetvars", ")", ";", "Li...
Check bounds and perform incorporation
[ "Check", "bounds", "and", "perform", "incorporation" ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Infer.java#L530-L566
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Infer.java
Infer.checkCompatibleUpperBounds
void checkCompatibleUpperBounds(UndetVar uv, InferenceContext inferenceContext) { List<Type> hibounds = Type.filter(uv.getBounds(InferenceBound.UPPER), new BoundFilter(inferenceContext)); Type hb = null; if (hibounds.isEmpty()) hb = syms.objectType; else if (hibounds.tail.isEmpty()) hb = hibounds.head; else hb = types.glb(hibounds); if (hb == null || hb.isErroneous()) reportBoundError(uv, BoundErrorKind.BAD_UPPER); }
java
void checkCompatibleUpperBounds(UndetVar uv, InferenceContext inferenceContext) { List<Type> hibounds = Type.filter(uv.getBounds(InferenceBound.UPPER), new BoundFilter(inferenceContext)); Type hb = null; if (hibounds.isEmpty()) hb = syms.objectType; else if (hibounds.tail.isEmpty()) hb = hibounds.head; else hb = types.glb(hibounds); if (hb == null || hb.isErroneous()) reportBoundError(uv, BoundErrorKind.BAD_UPPER); }
[ "void", "checkCompatibleUpperBounds", "(", "UndetVar", "uv", ",", "InferenceContext", "inferenceContext", ")", "{", "List", "<", "Type", ">", "hibounds", "=", "Type", ".", "filter", "(", "uv", ".", "getBounds", "(", "InferenceBound", ".", "UPPER", ")", ",", ...
Make sure that the upper bounds we got so far lead to a solvable inference variable by making sure that a glb exists.
[ "Make", "sure", "that", "the", "upper", "bounds", "we", "got", "so", "far", "lead", "to", "a", "solvable", "inference", "variable", "by", "making", "sure", "that", "a", "glb", "exists", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Infer.java#L1071-L1083
train
magik6k/JWWF
src/main/java/net/magik6k/jwwf/core/JwwfServer.java
JwwfServer.bindWebapp
public JwwfServer bindWebapp(final Class<? extends User> user, String url) { if (!url.endsWith("/")) url = url + "/"; context.addServlet(new ServletHolder(new WebClientServelt(clientCreator)), url + ""); context.addServlet(new ServletHolder(new SkinServlet()), url + "__jwwf/skins/*"); ServletHolder fontServletHolder = new ServletHolder(new ResourceServlet()); fontServletHolder.setInitParameter("basePackage", "net/magik6k/jwwf/assets/fonts"); context.addServlet(fontServletHolder, url + "__jwwf/fonts/*"); context.addServlet(new ServletHolder(new APISocketServlet(new UserFactory() { @Override public User createUser() { try { User u = user.getDeclaredConstructor().newInstance(); u.setServer(jwwfServer); return u; } catch (Exception e) { e.printStackTrace(); } return null; } })), url + "__jwwf/socket"); for (JwwfPlugin plugin : plugins) { if (plugin instanceof IPluginWebapp) ((IPluginWebapp) plugin).onWebappBound(this, url); } return this; }
java
public JwwfServer bindWebapp(final Class<? extends User> user, String url) { if (!url.endsWith("/")) url = url + "/"; context.addServlet(new ServletHolder(new WebClientServelt(clientCreator)), url + ""); context.addServlet(new ServletHolder(new SkinServlet()), url + "__jwwf/skins/*"); ServletHolder fontServletHolder = new ServletHolder(new ResourceServlet()); fontServletHolder.setInitParameter("basePackage", "net/magik6k/jwwf/assets/fonts"); context.addServlet(fontServletHolder, url + "__jwwf/fonts/*"); context.addServlet(new ServletHolder(new APISocketServlet(new UserFactory() { @Override public User createUser() { try { User u = user.getDeclaredConstructor().newInstance(); u.setServer(jwwfServer); return u; } catch (Exception e) { e.printStackTrace(); } return null; } })), url + "__jwwf/socket"); for (JwwfPlugin plugin : plugins) { if (plugin instanceof IPluginWebapp) ((IPluginWebapp) plugin).onWebappBound(this, url); } return this; }
[ "public", "JwwfServer", "bindWebapp", "(", "final", "Class", "<", "?", "extends", "User", ">", "user", ",", "String", "url", ")", "{", "if", "(", "!", "url", ".", "endsWith", "(", "\"/\"", ")", ")", "url", "=", "url", "+", "\"/\"", ";", "context", ...
Binds webapp to address @param user User class for the web application @param url Url to bind to, myst begin and end with /, like /foo/bar/ @return This JwwfServer
[ "Binds", "webapp", "to", "address" ]
8ba334501396c3301495da8708733f6014f20665
https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/core/JwwfServer.java#L53-L83
train
magik6k/JWWF
src/main/java/net/magik6k/jwwf/core/JwwfServer.java
JwwfServer.attachPlugin
public JwwfServer attachPlugin(JwwfPlugin plugin) { plugins.add(plugin); if (plugin instanceof IPluginGlobal) ((IPluginGlobal) plugin).onAttach(this); return this; }
java
public JwwfServer attachPlugin(JwwfPlugin plugin) { plugins.add(plugin); if (plugin instanceof IPluginGlobal) ((IPluginGlobal) plugin).onAttach(this); return this; }
[ "public", "JwwfServer", "attachPlugin", "(", "JwwfPlugin", "plugin", ")", "{", "plugins", ".", "add", "(", "plugin", ")", ";", "if", "(", "plugin", "instanceof", "IPluginGlobal", ")", "(", "(", "IPluginGlobal", ")", "plugin", ")", ".", "onAttach", "(", "th...
Attahes new plugin to this server @param plugin Plugin to attach @return This JwwfServer
[ "Attahes", "new", "plugin", "to", "this", "server" ]
8ba334501396c3301495da8708733f6014f20665
https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/core/JwwfServer.java#L129-L134
train
magik6k/JWWF
src/main/java/net/magik6k/jwwf/core/JwwfServer.java
JwwfServer.startAndJoin
public JwwfServer startAndJoin() { try { server.start(); server.join(); } catch (Exception e) { e.printStackTrace(); } return this; }
java
public JwwfServer startAndJoin() { try { server.start(); server.join(); } catch (Exception e) { e.printStackTrace(); } return this; }
[ "public", "JwwfServer", "startAndJoin", "(", ")", "{", "try", "{", "server", ".", "start", "(", ")", ";", "server", ".", "join", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return"...
Starts Jetty server and waits for it @return This JwwfServer
[ "Starts", "Jetty", "server", "and", "waits", "for", "it" ]
8ba334501396c3301495da8708733f6014f20665
https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/core/JwwfServer.java#L164-L172
train
brianwhu/xillium
data/src/main/java/org/xillium/data/xml/XDBCodec.java
XDBCodec.decode
public static InputStream decode(DataBinder binder, InputStream stream) throws ParserConfigurationException, SAXException, IOException { XML.newSAXParser().parse(stream, new XDBHandler(binder)); return stream; }
java
public static InputStream decode(DataBinder binder, InputStream stream) throws ParserConfigurationException, SAXException, IOException { XML.newSAXParser().parse(stream, new XDBHandler(binder)); return stream; }
[ "public", "static", "InputStream", "decode", "(", "DataBinder", "binder", ",", "InputStream", "stream", ")", "throws", "ParserConfigurationException", ",", "SAXException", ",", "IOException", "{", "XML", ".", "newSAXParser", "(", ")", ".", "parse", "(", "stream", ...
Decodes an XML stream. Returns the input stream.
[ "Decodes", "an", "XML", "stream", ".", "Returns", "the", "input", "stream", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/xml/XDBCodec.java#L107-L110
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/TransTypes.java
TransTypes.addBridge
void addBridge(DiagnosticPosition pos, MethodSymbol meth, MethodSymbol impl, ClassSymbol origin, boolean hypothetical, ListBuffer<JCTree> bridges) { make.at(pos); Type origType = types.memberType(origin.type, meth); Type origErasure = erasure(origType); // Create a bridge method symbol and a bridge definition without a body. Type bridgeType = meth.erasure(types); long flags = impl.flags() & AccessFlags | SYNTHETIC | BRIDGE | (origin.isInterface() ? DEFAULT : 0); if (hypothetical) flags |= HYPOTHETICAL; MethodSymbol bridge = new MethodSymbol(flags, meth.name, bridgeType, origin); /* once JDK-6996415 is solved it should be checked if this approach can * be applied to method addOverrideBridgesIfNeeded */ bridge.params = createBridgeParams(impl, bridge, bridgeType); bridge.setAttributes(impl); if (!hypothetical) { JCMethodDecl md = make.MethodDef(bridge, null); // The bridge calls this.impl(..), if we have an implementation // in the current class, super.impl(...) otherwise. JCExpression receiver = (impl.owner == origin) ? make.This(origin.erasure(types)) : make.Super(types.supertype(origin.type).tsym.erasure(types), origin); // The type returned from the original method. Type calltype = erasure(impl.type.getReturnType()); // Construct a call of this.impl(params), or super.impl(params), // casting params and possibly results as needed. JCExpression call = make.Apply( null, make.Select(receiver, impl).setType(calltype), translateArgs(make.Idents(md.params), origErasure.getParameterTypes(), null)) .setType(calltype); JCStatement stat = (origErasure.getReturnType().hasTag(VOID)) ? make.Exec(call) : make.Return(coerce(call, bridgeType.getReturnType())); md.body = make.Block(0, List.of(stat)); // Add bridge to `bridges' buffer bridges.append(md); } // Add bridge to scope of enclosing class and `overridden' table. origin.members().enter(bridge); overridden.put(bridge, meth); }
java
void addBridge(DiagnosticPosition pos, MethodSymbol meth, MethodSymbol impl, ClassSymbol origin, boolean hypothetical, ListBuffer<JCTree> bridges) { make.at(pos); Type origType = types.memberType(origin.type, meth); Type origErasure = erasure(origType); // Create a bridge method symbol and a bridge definition without a body. Type bridgeType = meth.erasure(types); long flags = impl.flags() & AccessFlags | SYNTHETIC | BRIDGE | (origin.isInterface() ? DEFAULT : 0); if (hypothetical) flags |= HYPOTHETICAL; MethodSymbol bridge = new MethodSymbol(flags, meth.name, bridgeType, origin); /* once JDK-6996415 is solved it should be checked if this approach can * be applied to method addOverrideBridgesIfNeeded */ bridge.params = createBridgeParams(impl, bridge, bridgeType); bridge.setAttributes(impl); if (!hypothetical) { JCMethodDecl md = make.MethodDef(bridge, null); // The bridge calls this.impl(..), if we have an implementation // in the current class, super.impl(...) otherwise. JCExpression receiver = (impl.owner == origin) ? make.This(origin.erasure(types)) : make.Super(types.supertype(origin.type).tsym.erasure(types), origin); // The type returned from the original method. Type calltype = erasure(impl.type.getReturnType()); // Construct a call of this.impl(params), or super.impl(params), // casting params and possibly results as needed. JCExpression call = make.Apply( null, make.Select(receiver, impl).setType(calltype), translateArgs(make.Idents(md.params), origErasure.getParameterTypes(), null)) .setType(calltype); JCStatement stat = (origErasure.getReturnType().hasTag(VOID)) ? make.Exec(call) : make.Return(coerce(call, bridgeType.getReturnType())); md.body = make.Block(0, List.of(stat)); // Add bridge to `bridges' buffer bridges.append(md); } // Add bridge to scope of enclosing class and `overridden' table. origin.members().enter(bridge); overridden.put(bridge, meth); }
[ "void", "addBridge", "(", "DiagnosticPosition", "pos", ",", "MethodSymbol", "meth", ",", "MethodSymbol", "impl", ",", "ClassSymbol", "origin", ",", "boolean", "hypothetical", ",", "ListBuffer", "<", "JCTree", ">", "bridges", ")", "{", "make", ".", "at", "(", ...
Add a bridge definition and enter corresponding method symbol in local scope of origin. @param pos The source code position to be used for the definition. @param meth The method for which a bridge needs to be added @param impl That method's implementation (possibly the method itself) @param origin The class to which the bridge will be added @param hypothetical True if the bridge method is not strictly necessary in the binary, but is represented in the symbol table to detect erasure clashes. @param bridges The list buffer to which the bridge will be added
[ "Add", "a", "bridge", "definition", "and", "enter", "corresponding", "method", "symbol", "in", "local", "scope", "of", "origin", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/TransTypes.java#L245-L302
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/TransTypes.java
TransTypes.addBridges
void addBridges(DiagnosticPosition pos, ClassSymbol origin, ListBuffer<JCTree> bridges) { Type st = types.supertype(origin.type); while (st.hasTag(CLASS)) { // if (isSpecialization(st)) addBridges(pos, st.tsym, origin, bridges); st = types.supertype(st); } for (List<Type> l = types.interfaces(origin.type); l.nonEmpty(); l = l.tail) // if (isSpecialization(l.head)) addBridges(pos, l.head.tsym, origin, bridges); }
java
void addBridges(DiagnosticPosition pos, ClassSymbol origin, ListBuffer<JCTree> bridges) { Type st = types.supertype(origin.type); while (st.hasTag(CLASS)) { // if (isSpecialization(st)) addBridges(pos, st.tsym, origin, bridges); st = types.supertype(st); } for (List<Type> l = types.interfaces(origin.type); l.nonEmpty(); l = l.tail) // if (isSpecialization(l.head)) addBridges(pos, l.head.tsym, origin, bridges); }
[ "void", "addBridges", "(", "DiagnosticPosition", "pos", ",", "ClassSymbol", "origin", ",", "ListBuffer", "<", "JCTree", ">", "bridges", ")", "{", "Type", "st", "=", "types", ".", "supertype", "(", "origin", ".", "type", ")", ";", "while", "(", "st", ".",...
Add all necessary bridges to some class appending them to list buffer. @param pos The source code position to be used for the bridges. @param origin The class in which the bridges go. @param bridges The list buffer to which the bridges are added.
[ "Add", "all", "necessary", "bridges", "to", "some", "class", "appending", "them", "to", "list", "buffer", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/TransTypes.java#L464-L474
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/TransTypes.java
TransTypes.visitTypeApply
public void visitTypeApply(JCTypeApply tree) { JCTree clazz = translate(tree.clazz, null); result = clazz; }
java
public void visitTypeApply(JCTypeApply tree) { JCTree clazz = translate(tree.clazz, null); result = clazz; }
[ "public", "void", "visitTypeApply", "(", "JCTypeApply", "tree", ")", "{", "JCTree", "clazz", "=", "translate", "(", "tree", ".", "clazz", ",", "null", ")", ";", "result", "=", "clazz", ";", "}" ]
Visitor method for parameterized types.
[ "Visitor", "method", "for", "parameterized", "types", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/TransTypes.java#L851-L854
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/TransTypes.java
TransTypes.translateTopLevelClass
public JCTree translateTopLevelClass(JCTree cdef, TreeMaker make) { // note that this method does NOT support recursion. this.make = make; pt = null; return translate(cdef, null); }
java
public JCTree translateTopLevelClass(JCTree cdef, TreeMaker make) { // note that this method does NOT support recursion. this.make = make; pt = null; return translate(cdef, null); }
[ "public", "JCTree", "translateTopLevelClass", "(", "JCTree", "cdef", ",", "TreeMaker", "make", ")", "{", "// note that this method does NOT support recursion.", "this", ".", "make", "=", "make", ";", "pt", "=", "null", ";", "return", "translate", "(", "cdef", ",",...
Translate a toplevel class definition. @param cdef The definition to be translated.
[ "Translate", "a", "toplevel", "class", "definition", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/TransTypes.java#L1031-L1036
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
PackageIndexFrameWriter.addAllProfilesLink
protected void addAllProfilesLink(Content div) { Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME, allprofilesLabel, "", "packageListFrame"); Content span = HtmlTree.SPAN(linkContent); div.addContent(span); }
java
protected void addAllProfilesLink(Content div) { Content linkContent = getHyperLink(DocPaths.PROFILE_OVERVIEW_FRAME, allprofilesLabel, "", "packageListFrame"); Content span = HtmlTree.SPAN(linkContent); div.addContent(span); }
[ "protected", "void", "addAllProfilesLink", "(", "Content", "div", ")", "{", "Content", "linkContent", "=", "getHyperLink", "(", "DocPaths", ".", "PROFILE_OVERVIEW_FRAME", ",", "allprofilesLabel", ",", "\"\"", ",", "\"packageListFrame\"", ")", ";", "Content", "span",...
Adds "All Profiles" link for the top of the left-hand frame page to the documentation tree. @param div the Content object to which the all profiles link should be added
[ "Adds", "All", "Profiles", "link", "for", "the", "top", "of", "the", "left", "-", "hand", "frame", "page", "to", "the", "documentation", "tree", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java#L163-L168
train
petrbouda/joyrest
joyrest-core/src/main/java/org/joyrest/stream/BiStream.java
BiStream.throwIfNull
public BiStream<T, U> throwIfNull(BiPredicate<? super T, ? super U> biPredicate, Supplier<? extends RuntimeException> e) { Predicate<T> predicate = (t) -> biPredicate.test(t, object); return nonEmptyStream(stream.filter(predicate), e); }
java
public BiStream<T, U> throwIfNull(BiPredicate<? super T, ? super U> biPredicate, Supplier<? extends RuntimeException> e) { Predicate<T> predicate = (t) -> biPredicate.test(t, object); return nonEmptyStream(stream.filter(predicate), e); }
[ "public", "BiStream", "<", "T", ",", "U", ">", "throwIfNull", "(", "BiPredicate", "<", "?", "super", "T", ",", "?", "super", "U", ">", "biPredicate", ",", "Supplier", "<", "?", "extends", "RuntimeException", ">", "e", ")", "{", "Predicate", "<", "T", ...
Compares the objects from stream to the injected object. If the rest of the stream equals null so exception is thrown. @param biPredicate which compare objects from stream and injected object @param e exception which will be thrown if the stream equals {@code null} @return BiStream object
[ "Compares", "the", "objects", "from", "stream", "to", "the", "injected", "object", ".", "If", "the", "rest", "of", "the", "stream", "equals", "null", "so", "exception", "is", "thrown", "." ]
58903f06fb7f0b8fdf1ef91318fb48a88bf970e0
https://github.com/petrbouda/joyrest/blob/58903f06fb7f0b8fdf1ef91318fb48a88bf970e0/joyrest-core/src/main/java/org/joyrest/stream/BiStream.java#L66-L69
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclint/Env.java
Env.setCurrent
void setCurrent(TreePath path, DocCommentTree comment) { currPath = path; currDocComment = comment; currElement = trees.getElement(currPath); currOverriddenMethods = ((JavacTypes) types).getOverriddenMethods(currElement); AccessKind ak = AccessKind.PUBLIC; for (TreePath p = path; p != null; p = p.getParentPath()) { Element e = trees.getElement(p); if (e != null && e.getKind() != ElementKind.PACKAGE) { ak = min(ak, AccessKind.of(e.getModifiers())); } } currAccess = ak; }
java
void setCurrent(TreePath path, DocCommentTree comment) { currPath = path; currDocComment = comment; currElement = trees.getElement(currPath); currOverriddenMethods = ((JavacTypes) types).getOverriddenMethods(currElement); AccessKind ak = AccessKind.PUBLIC; for (TreePath p = path; p != null; p = p.getParentPath()) { Element e = trees.getElement(p); if (e != null && e.getKind() != ElementKind.PACKAGE) { ak = min(ak, AccessKind.of(e.getModifiers())); } } currAccess = ak; }
[ "void", "setCurrent", "(", "TreePath", "path", ",", "DocCommentTree", "comment", ")", "{", "currPath", "=", "path", ";", "currDocComment", "=", "comment", ";", "currElement", "=", "trees", ".", "getElement", "(", "currPath", ")", ";", "currOverriddenMethods", ...
Set the current declaration and its doc comment.
[ "Set", "the", "current", "declaration", "and", "its", "doc", "comment", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclint/Env.java#L151-L165
train
brianwhu/xillium
base/src/main/java/org/xillium/base/type/Flags.java
Flags.valueOf
public static <E extends Enum<E>> Flags<E> valueOf(Class<E> type, String values) { Flags<E> flags = new Flags<E>(type); for (String text : values.trim().split(MULTI_VALUE_SEPARATOR)) { flags.set(Enum.valueOf(type, text)); } return flags; }
java
public static <E extends Enum<E>> Flags<E> valueOf(Class<E> type, String values) { Flags<E> flags = new Flags<E>(type); for (String text : values.trim().split(MULTI_VALUE_SEPARATOR)) { flags.set(Enum.valueOf(type, text)); } return flags; }
[ "public", "static", "<", "E", "extends", "Enum", "<", "E", ">", ">", "Flags", "<", "E", ">", "valueOf", "(", "Class", "<", "E", ">", "type", ",", "String", "values", ")", "{", "Flags", "<", "E", ">", "flags", "=", "new", "Flags", "<", "E", ">",...
Returns a Flags with a value represented by a string of concatenated enum literal names separated by any combination of a comma, a colon, or a white space. @param <E> the enum type argument associated with the Flags @param type the enum class associated with the Flags @param values a string representation of enum constants @return a Flags object
[ "Returns", "a", "Flags", "with", "a", "value", "represented", "by", "a", "string", "of", "concatenated", "enum", "literal", "names", "separated", "by", "any", "combination", "of", "a", "comma", "a", "colon", "or", "a", "white", "space", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/type/Flags.java#L109-L115
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java
ProfilePackageFrameWriter.generate
public static void generate(ConfigurationImpl configuration, PackageDoc packageDoc, int profileValue) { ProfilePackageFrameWriter profpackgen; try { String profileName = Profile.lookup(profileValue).name; profpackgen = new ProfilePackageFrameWriter(configuration, packageDoc, profileName); StringBuilder winTitle = new StringBuilder(profileName); String sep = " - "; winTitle.append(sep); String pkgName = Util.getPackageName(packageDoc); winTitle.append(pkgName); Content body = profpackgen.getBody(false, profpackgen.getWindowTitle(winTitle.toString())); Content profName = new StringContent(profileName); Content sepContent = new StringContent(sep); Content pkgNameContent = new RawHtml(pkgName); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, profpackgen.getTargetProfileLink("classFrame", profName, profileName)); heading.addContent(sepContent); heading.addContent(profpackgen.getTargetProfilePackageLink(packageDoc, "classFrame", pkgNameContent, profileName)); body.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.indexContainer); profpackgen.addClassListing(div, profileValue); body.addContent(div); profpackgen.printHtmlDocument( configuration.metakeywords.getMetaKeywords(packageDoc), false, body); profpackgen.close(); } catch (IOException exc) { configuration.standardmessage.error( "doclet.exception_encountered", exc.toString(), DocPaths.PACKAGE_FRAME.getPath()); throw new DocletAbortException(exc); } }
java
public static void generate(ConfigurationImpl configuration, PackageDoc packageDoc, int profileValue) { ProfilePackageFrameWriter profpackgen; try { String profileName = Profile.lookup(profileValue).name; profpackgen = new ProfilePackageFrameWriter(configuration, packageDoc, profileName); StringBuilder winTitle = new StringBuilder(profileName); String sep = " - "; winTitle.append(sep); String pkgName = Util.getPackageName(packageDoc); winTitle.append(pkgName); Content body = profpackgen.getBody(false, profpackgen.getWindowTitle(winTitle.toString())); Content profName = new StringContent(profileName); Content sepContent = new StringContent(sep); Content pkgNameContent = new RawHtml(pkgName); Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, profpackgen.getTargetProfileLink("classFrame", profName, profileName)); heading.addContent(sepContent); heading.addContent(profpackgen.getTargetProfilePackageLink(packageDoc, "classFrame", pkgNameContent, profileName)); body.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.addStyle(HtmlStyle.indexContainer); profpackgen.addClassListing(div, profileValue); body.addContent(div); profpackgen.printHtmlDocument( configuration.metakeywords.getMetaKeywords(packageDoc), false, body); profpackgen.close(); } catch (IOException exc) { configuration.standardmessage.error( "doclet.exception_encountered", exc.toString(), DocPaths.PACKAGE_FRAME.getPath()); throw new DocletAbortException(exc); } }
[ "public", "static", "void", "generate", "(", "ConfigurationImpl", "configuration", ",", "PackageDoc", "packageDoc", ",", "int", "profileValue", ")", "{", "ProfilePackageFrameWriter", "profpackgen", ";", "try", "{", "String", "profileName", "=", "Profile", ".", "look...
Generate a profile package summary page for the left-hand bottom frame. Construct the ProfilePackageFrameWriter object and then uses it generate the file. @param configuration the current configuration of the doclet. @param packageDoc The package for which "profilename-package-frame.html" is to be generated. @param profileValue the value of the profile being documented
[ "Generate", "a", "profile", "package", "summary", "page", "for", "the", "left", "-", "hand", "bottom", "frame", ".", "Construct", "the", "ProfilePackageFrameWriter", "object", "and", "then", "uses", "it", "generate", "the", "file", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java#L84-L120
train
scravy/java-pair
src/main/java/de/scravy/pair/Pairs.java
Pairs.from
public static <First, Second> Pair<First, Second> from( final First first, final Second second) { return new ImmutablePair<First, Second>(first, second); }
java
public static <First, Second> Pair<First, Second> from( final First first, final Second second) { return new ImmutablePair<First, Second>(first, second); }
[ "public", "static", "<", "First", ",", "Second", ">", "Pair", "<", "First", ",", "Second", ">", "from", "(", "final", "First", "first", ",", "final", "Second", "second", ")", "{", "return", "new", "ImmutablePair", "<", "First", ",", "Second", ">", "(",...
Create a simple pair from it's first and second component. @since 1.0.0 @param first The first (left) component. @param second The second (right) component. @return A pair consisting of the two components.
[ "Create", "a", "simple", "pair", "from", "it", "s", "first", "and", "second", "component", "." ]
d8792e86c4f8e977826a4ccb940e4416a1119ccb
https://github.com/scravy/java-pair/blob/d8792e86c4f8e977826a4ccb940e4416a1119ccb/src/main/java/de/scravy/pair/Pairs.java#L31-L34
train
scravy/java-pair
src/main/java/de/scravy/pair/Pairs.java
Pairs.toArray
public static <CommonSuperType, First extends CommonSuperType, Second extends CommonSuperType> CommonSuperType[] toArray(final Pair<First, Second> pair, final Class<CommonSuperType> commonSuperType) { @SuppressWarnings("unchecked") final CommonSuperType[] array = (CommonSuperType[]) Array.newInstance( commonSuperType, 2); return toArray(pair, array, 0); }
java
public static <CommonSuperType, First extends CommonSuperType, Second extends CommonSuperType> CommonSuperType[] toArray(final Pair<First, Second> pair, final Class<CommonSuperType> commonSuperType) { @SuppressWarnings("unchecked") final CommonSuperType[] array = (CommonSuperType[]) Array.newInstance( commonSuperType, 2); return toArray(pair, array, 0); }
[ "public", "static", "<", "CommonSuperType", ",", "First", "extends", "CommonSuperType", ",", "Second", "extends", "CommonSuperType", ">", "CommonSuperType", "[", "]", "toArray", "(", "final", "Pair", "<", "First", ",", "Second", ">", "pair", ",", "final", "Cla...
Transform a pair into an array of the common super type of both components. @param pair The pair. @param commonSuperType A common super type that both First and Second inherit from. @return The array of the common super type with length 2.
[ "Transform", "a", "pair", "into", "an", "array", "of", "the", "common", "super", "type", "of", "both", "components", "." ]
d8792e86c4f8e977826a4ccb940e4416a1119ccb
https://github.com/scravy/java-pair/blob/d8792e86c4f8e977826a4ccb940e4416a1119ccb/src/main/java/de/scravy/pair/Pairs.java#L97-L104
train
scravy/java-pair
src/main/java/de/scravy/pair/Pairs.java
Pairs.toArray
public static <CommonSuperType, First extends CommonSuperType, Second extends CommonSuperType> CommonSuperType[] toArray( final Pair<First, Second> pair, final CommonSuperType[] target, final int offset) { target[offset] = pair.getFirst(); target[offset + 1] = pair.getSecond(); return target; }
java
public static <CommonSuperType, First extends CommonSuperType, Second extends CommonSuperType> CommonSuperType[] toArray( final Pair<First, Second> pair, final CommonSuperType[] target, final int offset) { target[offset] = pair.getFirst(); target[offset + 1] = pair.getSecond(); return target; }
[ "public", "static", "<", "CommonSuperType", ",", "First", "extends", "CommonSuperType", ",", "Second", "extends", "CommonSuperType", ">", "CommonSuperType", "[", "]", "toArray", "(", "final", "Pair", "<", "First", ",", "Second", ">", "pair", ",", "final", "Com...
Write a pair into an array of the common super type of both components. @since 1.0.0 @param pair The pair. @return The array of the common super type with length 2.
[ "Write", "a", "pair", "into", "an", "array", "of", "the", "common", "super", "type", "of", "both", "components", "." ]
d8792e86c4f8e977826a4ccb940e4416a1119ccb
https://github.com/scravy/java-pair/blob/d8792e86c4f8e977826a4ccb940e4416a1119ccb/src/main/java/de/scravy/pair/Pairs.java#L115-L122
train
brianwhu/xillium
core/src/main/java/org/xillium/core/ExtendableService.java
ExtendableService.setFilter
@Override public void setFilter(Service.Filter filter) { _filter = _filter == null ? filter : new CompoundServiceFilter(filter, _filter); }
java
@Override public void setFilter(Service.Filter filter) { _filter = _filter == null ? filter : new CompoundServiceFilter(filter, _filter); }
[ "@", "Override", "public", "void", "setFilter", "(", "Service", ".", "Filter", "filter", ")", "{", "_filter", "=", "_filter", "==", "null", "?", "filter", ":", "new", "CompoundServiceFilter", "(", "filter", ",", "_filter", ")", ";", "}" ]
Installs a service filter.
[ "Installs", "a", "service", "filter", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/ExtendableService.java#L20-L23
train
brianwhu/xillium
core/src/main/java/org/xillium/core/ExtendableService.java
ExtendableService.setFilters
public void setFilters(List<Service.Filter> filters) { for (Service.Filter filter: filters) setFilter(filter); }
java
public void setFilters(List<Service.Filter> filters) { for (Service.Filter filter: filters) setFilter(filter); }
[ "public", "void", "setFilters", "(", "List", "<", "Service", ".", "Filter", ">", "filters", ")", "{", "for", "(", "Service", ".", "Filter", "filter", ":", "filters", ")", "setFilter", "(", "filter", ")", ";", "}" ]
Installs a list of service filters. This method is designed to facilitate Spring bean assembly.
[ "Installs", "a", "list", "of", "service", "filters", ".", "This", "method", "is", "designed", "to", "facilitate", "Spring", "bean", "assembly", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/ExtendableService.java#L28-L30
train
mcpat/microjiac-public
extensions/microjiac-interaction/src/newimpl/java/de/jiac/micro/ips/InteractionManager.java
InteractionManager.findContext
private Interaction findContext(String id) { for(int i= _currentInteractions.size() - 1; i >= 0; i--) { Interaction ia= (Interaction) _currentInteractions.get(i); if(ia.id.equals(id)) { return ia; } } return null; }
java
private Interaction findContext(String id) { for(int i= _currentInteractions.size() - 1; i >= 0; i--) { Interaction ia= (Interaction) _currentInteractions.get(i); if(ia.id.equals(id)) { return ia; } } return null; }
[ "private", "Interaction", "findContext", "(", "String", "id", ")", "{", "for", "(", "int", "i", "=", "_currentInteractions", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "Interaction", "ia", "=", "(", "Interaction",...
Caller must hold lock on interactions
[ "Caller", "must", "hold", "lock", "on", "interactions" ]
3c649e44846981a68e84cc4578719532414d8d35
https://github.com/mcpat/microjiac-public/blob/3c649e44846981a68e84cc4578719532414d8d35/extensions/microjiac-interaction/src/newimpl/java/de/jiac/micro/ips/InteractionManager.java#L123-L132
train
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Batch.java
Batch.request
public List<RpcResponse> request(List<RpcRequest> reqList) { for (RpcRequest req : reqList) { this.reqList.add(req); } return null; }
java
public List<RpcResponse> request(List<RpcRequest> reqList) { for (RpcRequest req : reqList) { this.reqList.add(req); } return null; }
[ "public", "List", "<", "RpcResponse", ">", "request", "(", "List", "<", "RpcRequest", ">", "reqList", ")", "{", "for", "(", "RpcRequest", "req", ":", "reqList", ")", "{", "this", ".", "reqList", ".", "add", "(", "req", ")", ";", "}", "return", "null"...
Adds all requests in reqList to internal request list @param reqList Requests to add to call batch @return Always returns null @throws IllegalStateException if batch has already been sent
[ "Adds", "all", "requests", "in", "reqList", "to", "internal", "request", "list" ]
c2b639634c88a25002b66d1fb4a8f5fb51ade6a2
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Batch.java#L56-L62
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Kinds.java
Kinds.kindName
public static KindName kindName(int kind) { switch (kind) { case PCK: return KindName.PACKAGE; case TYP: return KindName.CLASS; case VAR: return KindName.VAR; case VAL: return KindName.VAL; case MTH: return KindName.METHOD; default : throw new AssertionError("Unexpected kind: "+kind); } }
java
public static KindName kindName(int kind) { switch (kind) { case PCK: return KindName.PACKAGE; case TYP: return KindName.CLASS; case VAR: return KindName.VAR; case VAL: return KindName.VAL; case MTH: return KindName.METHOD; default : throw new AssertionError("Unexpected kind: "+kind); } }
[ "public", "static", "KindName", "kindName", "(", "int", "kind", ")", "{", "switch", "(", "kind", ")", "{", "case", "PCK", ":", "return", "KindName", ".", "PACKAGE", ";", "case", "TYP", ":", "return", "KindName", ".", "CLASS", ";", "case", "VAR", ":", ...
A KindName representing a given symbol kind
[ "A", "KindName", "representing", "a", "given", "symbol", "kind" ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Kinds.java#L140-L149
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Kinds.java
Kinds.absentKind
public static KindName absentKind(int kind) { switch (kind) { case ABSENT_VAR: return KindName.VAR; case WRONG_MTHS: case WRONG_MTH: case ABSENT_MTH: case WRONG_STATICNESS: return KindName.METHOD; case ABSENT_TYP: return KindName.CLASS; default: throw new AssertionError("Unexpected kind: "+kind); } }
java
public static KindName absentKind(int kind) { switch (kind) { case ABSENT_VAR: return KindName.VAR; case WRONG_MTHS: case WRONG_MTH: case ABSENT_MTH: case WRONG_STATICNESS: return KindName.METHOD; case ABSENT_TYP: return KindName.CLASS; default: throw new AssertionError("Unexpected kind: "+kind); } }
[ "public", "static", "KindName", "absentKind", "(", "int", "kind", ")", "{", "switch", "(", "kind", ")", "{", "case", "ABSENT_VAR", ":", "return", "KindName", ".", "VAR", ";", "case", "WRONG_MTHS", ":", "case", "WRONG_MTH", ":", "case", "ABSENT_MTH", ":", ...
A KindName representing the kind of a missing symbol, given an error kind.
[ "A", "KindName", "representing", "the", "kind", "of", "a", "missing", "symbol", "given", "an", "error", "kind", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Kinds.java#L238-L249
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANCountryData.java
IBANCountryData.parseToElementValues
@Nonnull @ReturnsMutableCopy public ICommonsList <IBANElementValue> parseToElementValues (@Nonnull final String sIBAN) { ValueEnforcer.notNull (sIBAN, "IBANString"); final String sRealIBAN = IBANManager.unifyIBAN (sIBAN); if (sRealIBAN.length () != m_nExpectedLength) throw new IllegalArgumentException ("Passed IBAN has an invalid length. Expected " + m_nExpectedLength + " but found " + sRealIBAN.length ()); final ICommonsList <IBANElementValue> ret = new CommonsArrayList <> (m_aElements.size ()); int nIndex = 0; for (final IBANElement aElement : m_aElements) { final String sIBANPart = sRealIBAN.substring (nIndex, nIndex + aElement.getLength ()); ret.add (new IBANElementValue (aElement, sIBANPart)); nIndex += aElement.getLength (); } return ret; }
java
@Nonnull @ReturnsMutableCopy public ICommonsList <IBANElementValue> parseToElementValues (@Nonnull final String sIBAN) { ValueEnforcer.notNull (sIBAN, "IBANString"); final String sRealIBAN = IBANManager.unifyIBAN (sIBAN); if (sRealIBAN.length () != m_nExpectedLength) throw new IllegalArgumentException ("Passed IBAN has an invalid length. Expected " + m_nExpectedLength + " but found " + sRealIBAN.length ()); final ICommonsList <IBANElementValue> ret = new CommonsArrayList <> (m_aElements.size ()); int nIndex = 0; for (final IBANElement aElement : m_aElements) { final String sIBANPart = sRealIBAN.substring (nIndex, nIndex + aElement.getLength ()); ret.add (new IBANElementValue (aElement, sIBANPart)); nIndex += aElement.getLength (); } return ret; }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "ICommonsList", "<", "IBANElementValue", ">", "parseToElementValues", "(", "@", "Nonnull", "final", "String", "sIBAN", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sIBAN", ",", "\"IBANString\"", ")", ";", ...
Parse a given IBAN number string and convert it to elements according to this country's definition of IBAN numbers. @param sIBAN The IBAN number string to parse. May not be <code>null</code>. @return The list of parsed elements.
[ "Parse", "a", "given", "IBAN", "number", "string", "and", "convert", "it", "to", "elements", "according", "to", "this", "country", "s", "definition", "of", "IBAN", "numbers", "." ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANCountryData.java#L167-L189
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANCountryData.java
IBANCountryData.createFromString
@Nonnull public static IBANCountryData createFromString (@Nonnull @Nonempty final String sCountryCode, @Nonnegative final int nExpectedLength, @Nullable final String sLayout, @Nullable final String sFixedCheckDigits, @Nullable final LocalDate aValidFrom, @Nullable final LocalDate aValidTo, @Nonnull final String sDesc) { ValueEnforcer.notEmpty (sDesc, "Desc"); if (sDesc.length () < 4) throw new IllegalArgumentException ("Cannot converted passed string because it is too short!"); final ICommonsList <IBANElement> aList = _parseElements (sDesc); final Pattern aPattern = _parseLayout (sCountryCode, nExpectedLength, sFixedCheckDigits, sLayout); // And we're done try { return new IBANCountryData (nExpectedLength, aPattern, sFixedCheckDigits, aValidFrom, aValidTo, aList); } catch (final IllegalArgumentException ex) { throw new IllegalArgumentException ("Failed to parse '" + sDesc + "': " + ex.getMessage ()); } }
java
@Nonnull public static IBANCountryData createFromString (@Nonnull @Nonempty final String sCountryCode, @Nonnegative final int nExpectedLength, @Nullable final String sLayout, @Nullable final String sFixedCheckDigits, @Nullable final LocalDate aValidFrom, @Nullable final LocalDate aValidTo, @Nonnull final String sDesc) { ValueEnforcer.notEmpty (sDesc, "Desc"); if (sDesc.length () < 4) throw new IllegalArgumentException ("Cannot converted passed string because it is too short!"); final ICommonsList <IBANElement> aList = _parseElements (sDesc); final Pattern aPattern = _parseLayout (sCountryCode, nExpectedLength, sFixedCheckDigits, sLayout); // And we're done try { return new IBANCountryData (nExpectedLength, aPattern, sFixedCheckDigits, aValidFrom, aValidTo, aList); } catch (final IllegalArgumentException ex) { throw new IllegalArgumentException ("Failed to parse '" + sDesc + "': " + ex.getMessage ()); } }
[ "@", "Nonnull", "public", "static", "IBANCountryData", "createFromString", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sCountryCode", ",", "@", "Nonnegative", "final", "int", "nExpectedLength", ",", "@", "Nullable", "final", "String", "sLayout", ",",...
This method is used to create an instance of this class from a string representation. @param sCountryCode Country code to use. Neither <code>null</code> nor empty. @param nExpectedLength The expected length having only validation purpose. @param sLayout <code>null</code> or the layout descriptor @param sFixedCheckDigits <code>null</code> or fixed check digits (of length 2) @param aValidFrom Validity start date. May be <code>null</code>. @param aValidTo Validity end date. May be <code>null</code>. @param sDesc The string description of this country data. May not be <code>null</code>. @return The parsed county data.
[ "This", "method", "is", "used", "to", "create", "an", "instance", "of", "this", "class", "from", "a", "string", "representation", "." ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANCountryData.java#L319-L345
train
petrbouda/joyrest
joyrest-core/src/main/java/org/joyrest/routing/AbstractControllerConfiguration.java
AbstractControllerConfiguration.setControllerPath
protected final void setControllerPath(String path) { requireNonNull(path, "Global path cannot be change to 'null'"); if (!"".equals(path) && !"/".equals(path)) { this.controllerPath = pathCorrector.apply(path); } }
java
protected final void setControllerPath(String path) { requireNonNull(path, "Global path cannot be change to 'null'"); if (!"".equals(path) && !"/".equals(path)) { this.controllerPath = pathCorrector.apply(path); } }
[ "protected", "final", "void", "setControllerPath", "(", "String", "path", ")", "{", "requireNonNull", "(", "path", ",", "\"Global path cannot be change to 'null'\"", ")", ";", "if", "(", "!", "\"\"", ".", "equals", "(", "path", ")", "&&", "!", "\"/\"", ".", ...
Creates a resource part of the path unified for all routes defined in the inherited class @param path resource path of all defined class @throws NullPointerException whether {@code path} is {@code null}
[ "Creates", "a", "resource", "part", "of", "the", "path", "unified", "for", "all", "routes", "defined", "in", "the", "inherited", "class" ]
58903f06fb7f0b8fdf1ef91318fb48a88bf970e0
https://github.com/petrbouda/joyrest/blob/58903f06fb7f0b8fdf1ef91318fb48a88bf970e0/joyrest-core/src/main/java/org/joyrest/routing/AbstractControllerConfiguration.java#L95-L101
train
arakelian/more-commons
src/main/java/com/arakelian/core/utils/AbstractClassScanner.java
AbstractClassScanner.scan
public void scan(final String[] packages) { LOGGER.info("Scanning packages {}:", ArrayUtils.toString(packages)); for (final String pkg : packages) { try { final String pkgFile = pkg.replace('.', '/'); final Enumeration<URL> urls = getRootClassloader().getResources(pkgFile); while (urls.hasMoreElements()) { final URL url = urls.nextElement(); try { final URI uri = getURI(url); LOGGER.debug("Scanning {}", uri); scan(uri, pkgFile); } catch (final URISyntaxException e) { LOGGER.debug("URL {} cannot be converted to a URI", url, e); } } } catch (final IOException ex) { throw new RuntimeException("The resources for the package" + pkg + ", could not be obtained", ex); } } LOGGER.info( "Found {} matching classes and {} matching files", matchingClasses.size(), matchingFiles.size()); }
java
public void scan(final String[] packages) { LOGGER.info("Scanning packages {}:", ArrayUtils.toString(packages)); for (final String pkg : packages) { try { final String pkgFile = pkg.replace('.', '/'); final Enumeration<URL> urls = getRootClassloader().getResources(pkgFile); while (urls.hasMoreElements()) { final URL url = urls.nextElement(); try { final URI uri = getURI(url); LOGGER.debug("Scanning {}", uri); scan(uri, pkgFile); } catch (final URISyntaxException e) { LOGGER.debug("URL {} cannot be converted to a URI", url, e); } } } catch (final IOException ex) { throw new RuntimeException("The resources for the package" + pkg + ", could not be obtained", ex); } } LOGGER.info( "Found {} matching classes and {} matching files", matchingClasses.size(), matchingFiles.size()); }
[ "public", "void", "scan", "(", "final", "String", "[", "]", "packages", ")", "{", "LOGGER", ".", "info", "(", "\"Scanning packages {}:\"", ",", "ArrayUtils", ".", "toString", "(", "packages", ")", ")", ";", "for", "(", "final", "String", "pkg", ":", "pac...
Scans packages for matching Java classes. @param packages An array of packages to search.
[ "Scans", "packages", "for", "matching", "Java", "classes", "." ]
83c607044f64a7f6c005a67866c0ef7cb68d6e29
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/AbstractClassScanner.java#L309-L334
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javap/JavapTask.java
JavapTask.run
int run(String[] args) { try { handleOptions(args); // the following gives consistent behavior with javac if (classes == null || classes.size() == 0) { if (options.help || options.version || options.fullVersion) return EXIT_OK; else return EXIT_CMDERR; } try { return run(); } finally { if (defaultFileManager != null) { try { defaultFileManager.close(); defaultFileManager = null; } catch (IOException e) { throw new InternalError(e); } } } } catch (BadArgs e) { reportError(e.key, e.args); if (e.showUsage) { printLines(getMessage("main.usage.summary", progname)); } return EXIT_CMDERR; } catch (InternalError e) { Object[] e_args; if (e.getCause() == null) e_args = e.args; else { e_args = new Object[e.args.length + 1]; e_args[0] = e.getCause(); System.arraycopy(e.args, 0, e_args, 1, e.args.length); } reportError("err.internal.error", e_args); return EXIT_ABNORMAL; } finally { log.flush(); } }
java
int run(String[] args) { try { handleOptions(args); // the following gives consistent behavior with javac if (classes == null || classes.size() == 0) { if (options.help || options.version || options.fullVersion) return EXIT_OK; else return EXIT_CMDERR; } try { return run(); } finally { if (defaultFileManager != null) { try { defaultFileManager.close(); defaultFileManager = null; } catch (IOException e) { throw new InternalError(e); } } } } catch (BadArgs e) { reportError(e.key, e.args); if (e.showUsage) { printLines(getMessage("main.usage.summary", progname)); } return EXIT_CMDERR; } catch (InternalError e) { Object[] e_args; if (e.getCause() == null) e_args = e.args; else { e_args = new Object[e.args.length + 1]; e_args[0] = e.getCause(); System.arraycopy(e.args, 0, e_args, 1, e.args.length); } reportError("err.internal.error", e_args); return EXIT_ABNORMAL; } finally { log.flush(); } }
[ "int", "run", "(", "String", "[", "]", "args", ")", "{", "try", "{", "handleOptions", "(", "args", ")", ";", "// the following gives consistent behavior with javac", "if", "(", "classes", "==", "null", "||", "classes", ".", "size", "(", ")", "==", "0", ")"...
Compiler terminated abnormally
[ "Compiler", "terminated", "abnormally" ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javap/JavapTask.java#L410-L454
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java
MetaKeywords.getMetaKeywords
public String[] getMetaKeywords(Profile profile) { if( configuration.keywords ) { String profileName = profile.name; return new String[] { profileName + " " + "profile" }; } else { return new String[] {}; } }
java
public String[] getMetaKeywords(Profile profile) { if( configuration.keywords ) { String profileName = profile.name; return new String[] { profileName + " " + "profile" }; } else { return new String[] {}; } }
[ "public", "String", "[", "]", "getMetaKeywords", "(", "Profile", "profile", ")", "{", "if", "(", "configuration", ".", "keywords", ")", "{", "String", "profileName", "=", "profile", ".", "name", ";", "return", "new", "String", "[", "]", "{", "profileName",...
Get the profile keywords. @param profile the profile being documented
[ "Get", "the", "profile", "keywords", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java#L113-L120
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/source/util/TreeScanner.java
TreeScanner.scan
public R scan(Tree node, P p) { return (node == null) ? null : node.accept(this, p); }
java
public R scan(Tree node, P p) { return (node == null) ? null : node.accept(this, p); }
[ "public", "R", "scan", "(", "Tree", "node", ",", "P", "p", ")", "{", "return", "(", "node", "==", "null", ")", "?", "null", ":", "node", ".", "accept", "(", "this", ",", "p", ")", ";", "}" ]
Scan a single node.
[ "Scan", "a", "single", "node", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/source/util/TreeScanner.java#L76-L78
train
brianwhu/xillium
gear/src/main/java/org/xillium/gear/auth/ClientAddressAuthorizer.java
ClientAddressAuthorizer.setAuthorizedPatternArray
public void setAuthorizedPatternArray(String[] patterns) { Matcher matcher; patterns: for (String pattern: patterns) { if ((matcher = IPv4_ADDRESS_PATTERN.matcher(pattern)).matches()) { short[] address = new short[4]; for (int i = 0; i < address.length; ++i) { String p = matcher.group(i+1); try { address[i] = Short.parseShort(p); if (address[i] > 255) { _logger.warning("Invalid pattern ignored: " + pattern); continue patterns; } } catch (Exception x) { if ("*".equals(p)) { address[i] = 256; } else { _logger.warning("Invalid pattern ignored: " + pattern); continue patterns; } } } _logger.fine("normalized ipv4 address pattern = " + Strings.join(address, '.')); _ipv4patterns.add(address); } else if ((matcher = IPv6_ADDRESS_PATTERN.matcher(pattern)).matches()) { short[] address = new short[16]; for (int i = 0; i < address.length; i += 2) { String p = matcher.group(i/2+1); try { int v = Integer.parseInt(p, 16); address[i] = (short)(v >> 8); address[i+1] = (short)(v & 0x00ff); } catch (Exception x) { if ("*".equals(p)) { address[i] = 256; address[i+1] = 256; } else { _logger.warning("Invalid pattern ignored: " + pattern); continue patterns; } } } _logger.fine("normalized ipv6 address pattern = " + Strings.join(address, '.')); _ipv6patterns.add(address); } else { _logger.warning("Invalid pattern ignored: " + pattern); } } }
java
public void setAuthorizedPatternArray(String[] patterns) { Matcher matcher; patterns: for (String pattern: patterns) { if ((matcher = IPv4_ADDRESS_PATTERN.matcher(pattern)).matches()) { short[] address = new short[4]; for (int i = 0; i < address.length; ++i) { String p = matcher.group(i+1); try { address[i] = Short.parseShort(p); if (address[i] > 255) { _logger.warning("Invalid pattern ignored: " + pattern); continue patterns; } } catch (Exception x) { if ("*".equals(p)) { address[i] = 256; } else { _logger.warning("Invalid pattern ignored: " + pattern); continue patterns; } } } _logger.fine("normalized ipv4 address pattern = " + Strings.join(address, '.')); _ipv4patterns.add(address); } else if ((matcher = IPv6_ADDRESS_PATTERN.matcher(pattern)).matches()) { short[] address = new short[16]; for (int i = 0; i < address.length; i += 2) { String p = matcher.group(i/2+1); try { int v = Integer.parseInt(p, 16); address[i] = (short)(v >> 8); address[i+1] = (short)(v & 0x00ff); } catch (Exception x) { if ("*".equals(p)) { address[i] = 256; address[i+1] = 256; } else { _logger.warning("Invalid pattern ignored: " + pattern); continue patterns; } } } _logger.fine("normalized ipv6 address pattern = " + Strings.join(address, '.')); _ipv6patterns.add(address); } else { _logger.warning("Invalid pattern ignored: " + pattern); } } }
[ "public", "void", "setAuthorizedPatternArray", "(", "String", "[", "]", "patterns", ")", "{", "Matcher", "matcher", ";", "patterns", ":", "for", "(", "String", "pattern", ":", "patterns", ")", "{", "if", "(", "(", "matcher", "=", "IPv4_ADDRESS_PATTERN", ".",...
Adds authorized address patterns as a String array.
[ "Adds", "authorized", "address", "patterns", "as", "a", "String", "array", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/gear/src/main/java/org/xillium/gear/auth/ClientAddressAuthorizer.java#L81-L130
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.findJavaSourceFiles
private boolean findJavaSourceFiles(String[] args) { String prev = ""; for (String s : args) { if (s.endsWith(".java") && !prev.equals("-xf") && !prev.equals("-if")) { return true; } prev = s; } return false; }
java
private boolean findJavaSourceFiles(String[] args) { String prev = ""; for (String s : args) { if (s.endsWith(".java") && !prev.equals("-xf") && !prev.equals("-if")) { return true; } prev = s; } return false; }
[ "private", "boolean", "findJavaSourceFiles", "(", "String", "[", "]", "args", ")", "{", "String", "prev", "=", "\"\"", ";", "for", "(", "String", "s", ":", "args", ")", "{", "if", "(", "s", ".", "endsWith", "(", "\".java\"", ")", "&&", "!", "prev", ...
Are java source files passed on the command line?
[ "Are", "java", "source", "files", "passed", "on", "the", "command", "line?" ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L357-L366
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.findAtFile
private boolean findAtFile(String[] args) { for (String s : args) { if (s.startsWith("@")) { return true; } } return false; }
java
private boolean findAtFile(String[] args) { for (String s : args) { if (s.startsWith("@")) { return true; } } return false; }
[ "private", "boolean", "findAtFile", "(", "String", "[", "]", "args", ")", "{", "for", "(", "String", "s", ":", "args", ")", "{", "if", "(", "s", ".", "startsWith", "(", "\"@\"", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", "...
Is an at file passed on the command line?
[ "Is", "an", "at", "file", "passed", "on", "the", "command", "line?" ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L371-L378
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.findLogLevel
private String findLogLevel(String[] args) { for (String s : args) { if (s.startsWith("--log=") && s.length()>6) { return s.substring(6); } if (s.equals("-verbose")) { return "info"; } } return "info"; }
java
private String findLogLevel(String[] args) { for (String s : args) { if (s.startsWith("--log=") && s.length()>6) { return s.substring(6); } if (s.equals("-verbose")) { return "info"; } } return "info"; }
[ "private", "String", "findLogLevel", "(", "String", "[", "]", "args", ")", "{", "for", "(", "String", "s", ":", "args", ")", "{", "if", "(", "s", ".", "startsWith", "(", "\"--log=\"", ")", "&&", "s", ".", "length", "(", ")", ">", "6", ")", "{", ...
Find the log level setting.
[ "Find", "the", "log", "level", "setting", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L383-L393
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.makeSureExists
private static boolean makeSureExists(File dir) { // Make sure the dest directories exist. if (!dir.exists()) { if (!dir.mkdirs()) { Log.error("Could not create the directory "+dir.getPath()); return false; } } return true; }
java
private static boolean makeSureExists(File dir) { // Make sure the dest directories exist. if (!dir.exists()) { if (!dir.mkdirs()) { Log.error("Could not create the directory "+dir.getPath()); return false; } } return true; }
[ "private", "static", "boolean", "makeSureExists", "(", "File", "dir", ")", "{", "// Make sure the dest directories exist.", "if", "(", "!", "dir", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "dir", ".", "mkdirs", "(", ")", ")", "{", "Log", ".", ...
Make sure directory exist, create it if not.
[ "Make", "sure", "directory", "exist", "create", "it", "if", "not", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L484-L493
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.checkPattern
private static void checkPattern(String s) throws ProblemException { // Package names like foo.bar.gamma are allowed, and // package names suffixed with .* like foo.bar.* are // also allowed. Pattern p = Pattern.compile("[a-zA-Z_]{1}[a-zA-Z0-9_]*(\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*)*(\\.\\*)?+"); Matcher m = p.matcher(s); if (!m.matches()) { throw new ProblemException("The string \""+s+"\" is not a proper package name pattern."); } }
java
private static void checkPattern(String s) throws ProblemException { // Package names like foo.bar.gamma are allowed, and // package names suffixed with .* like foo.bar.* are // also allowed. Pattern p = Pattern.compile("[a-zA-Z_]{1}[a-zA-Z0-9_]*(\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*)*(\\.\\*)?+"); Matcher m = p.matcher(s); if (!m.matches()) { throw new ProblemException("The string \""+s+"\" is not a proper package name pattern."); } }
[ "private", "static", "void", "checkPattern", "(", "String", "s", ")", "throws", "ProblemException", "{", "// Package names like foo.bar.gamma are allowed, and", "// package names suffixed with .* like foo.bar.* are", "// also allowed.", "Pattern", "p", "=", "Pattern", ".", "com...
Verify that a package pattern is valid.
[ "Verify", "that", "a", "package", "pattern", "is", "valid", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L498-L507
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.checkFilePattern
private static void checkFilePattern(String s) throws ProblemException { // File names like foo/bar/gamma/Bar.java are allowed, // as well as /bar/jndi.properties as well as, // */bar/Foo.java Pattern p = null; if (File.separatorChar == '\\') { p = Pattern.compile("\\*?(.+\\\\)*.+"); } else if (File.separatorChar == '/') { p = Pattern.compile("\\*?(.+/)*.+"); } else { throw new ProblemException("This platform uses the unsupported "+File.separatorChar+ " as file separator character. Please add support for it!"); } Matcher m = p.matcher(s); if (!m.matches()) { throw new ProblemException("The string \""+s+"\" is not a proper file name."); } }
java
private static void checkFilePattern(String s) throws ProblemException { // File names like foo/bar/gamma/Bar.java are allowed, // as well as /bar/jndi.properties as well as, // */bar/Foo.java Pattern p = null; if (File.separatorChar == '\\') { p = Pattern.compile("\\*?(.+\\\\)*.+"); } else if (File.separatorChar == '/') { p = Pattern.compile("\\*?(.+/)*.+"); } else { throw new ProblemException("This platform uses the unsupported "+File.separatorChar+ " as file separator character. Please add support for it!"); } Matcher m = p.matcher(s); if (!m.matches()) { throw new ProblemException("The string \""+s+"\" is not a proper file name."); } }
[ "private", "static", "void", "checkFilePattern", "(", "String", "s", ")", "throws", "ProblemException", "{", "// File names like foo/bar/gamma/Bar.java are allowed,", "// as well as /bar/jndi.properties as well as,", "// */bar/Foo.java", "Pattern", "p", "=", "null", ";", "if", ...
Verify that a source file name is valid.
[ "Verify", "that", "a", "source", "file", "name", "is", "valid", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L542-L560
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.hasOption
private static boolean hasOption(String[] args, String option) { for (String a : args) { if (a.equals(option)) return true; } return false; }
java
private static boolean hasOption(String[] args, String option) { for (String a : args) { if (a.equals(option)) return true; } return false; }
[ "private", "static", "boolean", "hasOption", "(", "String", "[", "]", "args", ",", "String", "option", ")", "{", "for", "(", "String", "a", ":", "args", ")", "{", "if", "(", "a", ".", "equals", "(", "option", ")", ")", "return", "true", ";", "}", ...
Scan the arguments to find an option is used.
[ "Scan", "the", "arguments", "to", "find", "an", "option", "is", "used", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L565-L570
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.rewriteOptions
private static void rewriteOptions(String[] args, String option, String new_option) { for (int i=0; i<args.length; ++i) { if (args[i].equals(option)) { args[i] = new_option; } } }
java
private static void rewriteOptions(String[] args, String option, String new_option) { for (int i=0; i<args.length; ++i) { if (args[i].equals(option)) { args[i] = new_option; } } }
[ "private", "static", "void", "rewriteOptions", "(", "String", "[", "]", "args", ",", "String", "option", ",", "String", "new_option", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "++", "i", ")", "{", "if", ...
Rewrite a single option into something else.
[ "Rewrite", "a", "single", "option", "into", "something", "else", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L603-L609
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.findDirectoryOption
private static File findDirectoryOption(String[] args, String option, String name, boolean needed, boolean allow_dups, boolean create) throws ProblemException, ProblemException { File dir = null; for (int i = 0; i<args.length; ++i) { if (args[i].equals(option)) { if (dir != null) { throw new ProblemException("You have already specified the "+name+" dir!"); } if (i+1 >= args.length) { throw new ProblemException("You have to specify a directory following "+option+"."); } if (args[i+1].indexOf(File.pathSeparatorChar) != -1) { throw new ProblemException("You must only specify a single directory for "+option+"."); } dir = new File(args[i+1]); if (!dir.exists()) { if (!create) { throw new ProblemException("This directory does not exist: "+dir.getPath()); } else if (!makeSureExists(dir)) { throw new ProblemException("Cannot create directory "+dir.getPath()); } } if (!dir.isDirectory()) { throw new ProblemException("\""+args[i+1]+"\" is not a directory."); } } } if (dir == null && needed) { throw new ProblemException("You have to specify "+option); } try { if (dir != null) return dir.getCanonicalFile(); } catch (IOException e) { throw new ProblemException(""+e); } return null; }
java
private static File findDirectoryOption(String[] args, String option, String name, boolean needed, boolean allow_dups, boolean create) throws ProblemException, ProblemException { File dir = null; for (int i = 0; i<args.length; ++i) { if (args[i].equals(option)) { if (dir != null) { throw new ProblemException("You have already specified the "+name+" dir!"); } if (i+1 >= args.length) { throw new ProblemException("You have to specify a directory following "+option+"."); } if (args[i+1].indexOf(File.pathSeparatorChar) != -1) { throw new ProblemException("You must only specify a single directory for "+option+"."); } dir = new File(args[i+1]); if (!dir.exists()) { if (!create) { throw new ProblemException("This directory does not exist: "+dir.getPath()); } else if (!makeSureExists(dir)) { throw new ProblemException("Cannot create directory "+dir.getPath()); } } if (!dir.isDirectory()) { throw new ProblemException("\""+args[i+1]+"\" is not a directory."); } } } if (dir == null && needed) { throw new ProblemException("You have to specify "+option); } try { if (dir != null) return dir.getCanonicalFile(); } catch (IOException e) { throw new ProblemException(""+e); } return null; }
[ "private", "static", "File", "findDirectoryOption", "(", "String", "[", "]", "args", ",", "String", "option", ",", "String", "name", ",", "boolean", "needed", ",", "boolean", "allow_dups", ",", "boolean", "create", ")", "throws", "ProblemException", ",", "Prob...
Scan the arguments to find an option that specifies a directory. Create the directory if necessary.
[ "Scan", "the", "arguments", "to", "find", "an", "option", "that", "specifies", "a", "directory", ".", "Create", "the", "directory", "if", "necessary", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L615-L653
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.shouldBeFollowedByPath
private static boolean shouldBeFollowedByPath(String o) { return o.equals("-s") || o.equals("-h") || o.equals("-d") || o.equals("-sourcepath") || o.equals("-classpath") || o.equals("-cp") || o.equals("-bootclasspath") || o.equals("-src"); }
java
private static boolean shouldBeFollowedByPath(String o) { return o.equals("-s") || o.equals("-h") || o.equals("-d") || o.equals("-sourcepath") || o.equals("-classpath") || o.equals("-cp") || o.equals("-bootclasspath") || o.equals("-src"); }
[ "private", "static", "boolean", "shouldBeFollowedByPath", "(", "String", "o", ")", "{", "return", "o", ".", "equals", "(", "\"-s\"", ")", "||", "o", ".", "equals", "(", "\"-h\"", ")", "||", "o", ".", "equals", "(", "\"-d\"", ")", "||", "o", ".", "equ...
Option is followed by path.
[ "Option", "is", "followed", "by", "path", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L658-L667
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.addSrcBeforeDirectories
private static String[] addSrcBeforeDirectories(String[] args) { List<String> newargs = new ArrayList<String>(); for (int i = 0; i<args.length; ++i) { File dir = new File(args[i]); if (dir.exists() && dir.isDirectory()) { if (i == 0 || !shouldBeFollowedByPath(args[i-1])) { newargs.add("-src"); } } newargs.add(args[i]); } return newargs.toArray(new String[0]); }
java
private static String[] addSrcBeforeDirectories(String[] args) { List<String> newargs = new ArrayList<String>(); for (int i = 0; i<args.length; ++i) { File dir = new File(args[i]); if (dir.exists() && dir.isDirectory()) { if (i == 0 || !shouldBeFollowedByPath(args[i-1])) { newargs.add("-src"); } } newargs.add(args[i]); } return newargs.toArray(new String[0]); }
[ "private", "static", "String", "[", "]", "addSrcBeforeDirectories", "(", "String", "[", "]", "args", ")", "{", "List", "<", "String", ">", "newargs", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", ...
Add -src before source root directories if not already there.
[ "Add", "-", "src", "before", "source", "root", "directories", "if", "not", "already", "there", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L672-L684
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.checkSrcOption
private static void checkSrcOption(String[] args) throws ProblemException { Set<File> dirs = new HashSet<File>(); for (int i = 0; i<args.length; ++i) { if (args[i].equals("-src")) { if (i+1 >= args.length) { throw new ProblemException("You have to specify a directory following -src."); } StringTokenizer st = new StringTokenizer(args[i+1], File.pathSeparator); while (st.hasMoreElements()) { File dir = new File(st.nextToken()); if (!dir.exists()) { throw new ProblemException("This directory does not exist: "+dir.getPath()); } if (!dir.isDirectory()) { throw new ProblemException("\""+dir.getPath()+"\" is not a directory."); } if (dirs.contains(dir)) { throw new ProblemException("The src directory \""+dir.getPath()+"\" is specified more than once!"); } dirs.add(dir); } } } if (dirs.isEmpty()) { throw new ProblemException("You have to specify -src."); } }
java
private static void checkSrcOption(String[] args) throws ProblemException { Set<File> dirs = new HashSet<File>(); for (int i = 0; i<args.length; ++i) { if (args[i].equals("-src")) { if (i+1 >= args.length) { throw new ProblemException("You have to specify a directory following -src."); } StringTokenizer st = new StringTokenizer(args[i+1], File.pathSeparator); while (st.hasMoreElements()) { File dir = new File(st.nextToken()); if (!dir.exists()) { throw new ProblemException("This directory does not exist: "+dir.getPath()); } if (!dir.isDirectory()) { throw new ProblemException("\""+dir.getPath()+"\" is not a directory."); } if (dirs.contains(dir)) { throw new ProblemException("The src directory \""+dir.getPath()+"\" is specified more than once!"); } dirs.add(dir); } } } if (dirs.isEmpty()) { throw new ProblemException("You have to specify -src."); } }
[ "private", "static", "void", "checkSrcOption", "(", "String", "[", "]", "args", ")", "throws", "ProblemException", "{", "Set", "<", "File", ">", "dirs", "=", "new", "HashSet", "<", "File", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", ...
Check the -src options.
[ "Check", "the", "-", "src", "options", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L689-L716
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.findFileOption
private static File findFileOption(String[] args, String option, String name, boolean needed) throws ProblemException, ProblemException { File file = null; for (int i = 0; i<args.length; ++i) { if (args[i].equals(option)) { if (file != null) { throw new ProblemException("You have already specified the "+name+" file!"); } if (i+1 >= args.length) { throw new ProblemException("You have to specify a file following "+option+"."); } file = new File(args[i+1]); if (file.isDirectory()) { throw new ProblemException("\""+args[i+1]+"\" is not a file."); } if (!file.exists() && needed) { throw new ProblemException("The file \""+args[i+1]+"\" does not exist."); } } } if (file == null && needed) { throw new ProblemException("You have to specify "+option); } return file; }
java
private static File findFileOption(String[] args, String option, String name, boolean needed) throws ProblemException, ProblemException { File file = null; for (int i = 0; i<args.length; ++i) { if (args[i].equals(option)) { if (file != null) { throw new ProblemException("You have already specified the "+name+" file!"); } if (i+1 >= args.length) { throw new ProblemException("You have to specify a file following "+option+"."); } file = new File(args[i+1]); if (file.isDirectory()) { throw new ProblemException("\""+args[i+1]+"\" is not a file."); } if (!file.exists() && needed) { throw new ProblemException("The file \""+args[i+1]+"\" does not exist."); } } } if (file == null && needed) { throw new ProblemException("You have to specify "+option); } return file; }
[ "private", "static", "File", "findFileOption", "(", "String", "[", "]", "args", ",", "String", "option", ",", "String", "name", ",", "boolean", "needed", ")", "throws", "ProblemException", ",", "ProblemException", "{", "File", "file", "=", "null", ";", "for"...
Scan the arguments to find an option that specifies a file.
[ "Scan", "the", "arguments", "to", "find", "an", "option", "that", "specifies", "a", "file", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L721-L746
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.findBooleanOption
public static boolean findBooleanOption(String[] args, String option) { for (int i = 0; i<args.length; ++i) { if (args[i].equals(option)) return true; } return false; }
java
public static boolean findBooleanOption(String[] args, String option) { for (int i = 0; i<args.length; ++i) { if (args[i].equals(option)) return true; } return false; }
[ "public", "static", "boolean", "findBooleanOption", "(", "String", "[", "]", "args", ",", "String", "option", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "++", "i", ")", "{", "if", "(", "args", "[", "i",...
Look for a specific switch, return true if found.
[ "Look", "for", "a", "specific", "switch", "return", "true", "if", "found", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L751-L756
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/sjavac/Main.java
Main.findNumberOption
public static int findNumberOption(String[] args, String option) { int rc = 0; for (int i = 0; i<args.length; ++i) { if (args[i].equals(option)) { if (args.length > i+1) { rc = Integer.parseInt(args[i+1]); } } } return rc; }
java
public static int findNumberOption(String[] args, String option) { int rc = 0; for (int i = 0; i<args.length; ++i) { if (args[i].equals(option)) { if (args.length > i+1) { rc = Integer.parseInt(args[i+1]); } } } return rc; }
[ "public", "static", "int", "findNumberOption", "(", "String", "[", "]", "args", ",", "String", "option", ")", "{", "int", "rc", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "++", "i", ")", "{", "if...
Scan the arguments to find an option that specifies a number.
[ "Scan", "the", "arguments", "to", "find", "an", "option", "that", "specifies", "a", "number", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/Main.java#L761-L771
train