id int32 0 165k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
32,800 | alexa/alexa-skills-kit-sdk-for-java | ask-sdk-core/src/com/amazon/ask/CustomSkill.java | CustomSkill.invoke | protected ResponseEnvelope invoke(UnmarshalledRequest<RequestEnvelope> unmarshalledRequest, Object context) {
RequestEnvelope requestEnvelope = unmarshalledRequest.getUnmarshalledRequest();
JsonNode requestEnvelopeJson = unmarshalledRequest.getRequestJson();
if (skillId != null && !requestEnvelope.getContext().getSystem().getApplication().getApplicationId().equals(skillId)) {
throw new AskSdkException("AlexaSkill ID verification failed.");
}
ServiceClientFactory serviceClientFactory = apiClient != null ? ServiceClientFactory.builder()
.withDefaultApiConfiguration(getApiConfiguration(requestEnvelope))
.build() : null;
HandlerInput handlerInput = HandlerInput.builder()
.withRequestEnvelope(requestEnvelope)
.withPersistenceAdapter(persistenceAdapter)
.withContext(context)
.withRequestEnvelopeJson(requestEnvelopeJson)
.withServiceClientFactory(serviceClientFactory)
.withTemplateFactory(templateFactory)
.build();
Optional<Response> response = requestDispatcher.dispatch(handlerInput);
return ResponseEnvelope.builder()
.withResponse(response != null ? response.orElse(null) : null)
.withSessionAttributes
(requestEnvelope.getSession() != null ? handlerInput.getAttributesManager().getSessionAttributes() : null)
.withVersion(SdkConstants.FORMAT_VERSION)
.withUserAgent(UserAgentUtils.getUserAgent(customUserAgent))
.build();
} | java | protected ResponseEnvelope invoke(UnmarshalledRequest<RequestEnvelope> unmarshalledRequest, Object context) {
RequestEnvelope requestEnvelope = unmarshalledRequest.getUnmarshalledRequest();
JsonNode requestEnvelopeJson = unmarshalledRequest.getRequestJson();
if (skillId != null && !requestEnvelope.getContext().getSystem().getApplication().getApplicationId().equals(skillId)) {
throw new AskSdkException("AlexaSkill ID verification failed.");
}
ServiceClientFactory serviceClientFactory = apiClient != null ? ServiceClientFactory.builder()
.withDefaultApiConfiguration(getApiConfiguration(requestEnvelope))
.build() : null;
HandlerInput handlerInput = HandlerInput.builder()
.withRequestEnvelope(requestEnvelope)
.withPersistenceAdapter(persistenceAdapter)
.withContext(context)
.withRequestEnvelopeJson(requestEnvelopeJson)
.withServiceClientFactory(serviceClientFactory)
.withTemplateFactory(templateFactory)
.build();
Optional<Response> response = requestDispatcher.dispatch(handlerInput);
return ResponseEnvelope.builder()
.withResponse(response != null ? response.orElse(null) : null)
.withSessionAttributes
(requestEnvelope.getSession() != null ? handlerInput.getAttributesManager().getSessionAttributes() : null)
.withVersion(SdkConstants.FORMAT_VERSION)
.withUserAgent(UserAgentUtils.getUserAgent(customUserAgent))
.build();
} | [
"protected",
"ResponseEnvelope",
"invoke",
"(",
"UnmarshalledRequest",
"<",
"RequestEnvelope",
">",
"unmarshalledRequest",
",",
"Object",
"context",
")",
"{",
"RequestEnvelope",
"requestEnvelope",
"=",
"unmarshalledRequest",
".",
"getUnmarshalledRequest",
"(",
")",
";",
... | Invokes the dispatcher to handler the request envelope and construct the handler input
@param unmarshalledRequest unmarshalled output from {@link JacksonJsonUnmarshaller}, containing a
{@link RequestEnvelope} and a JSON representation of the request.
@param context context
@return optional request envelope | [
"Invokes",
"the",
"dispatcher",
"to",
"handler",
"the",
"request",
"envelope",
"and",
"construct",
"the",
"handler",
"input"
] | c49194da0693898c70f3f2c4a372f5a12da04e3e | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/CustomSkill.java#L80-L109 |
32,801 | alexa/alexa-skills-kit-sdk-for-java | ask-sdk-servlet-support/src/com/amazon/ask/servlet/verifiers/SkillRequestSignatureVerifier.java | SkillRequestSignatureVerifier.retrieveAndVerifyCertificateChain | private X509Certificate retrieveAndVerifyCertificateChain(
final String signingCertificateChainUrl) throws CertificateException {
try (InputStream in =
proxy != null ? getAndVerifySigningCertificateChainUrl(signingCertificateChainUrl).openConnection(proxy).getInputStream()
: getAndVerifySigningCertificateChainUrl(signingCertificateChainUrl).openConnection().getInputStream()) {
CertificateFactory certificateFactory =
CertificateFactory.getInstance(ServletConstants.SIGNATURE_CERTIFICATE_TYPE);
@SuppressWarnings("unchecked")
Collection<X509Certificate> certificateChain =
(Collection<X509Certificate>) certificateFactory.generateCertificates(in);
/*
* check the before/after dates on the certificate date to confirm that it is valid on
* the current date
*/
X509Certificate signingCertificate = certificateChain.iterator().next();
signingCertificate.checkValidity();
// check the certificate chain
TrustManagerFactory trustManagerFactory =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init((KeyStore) null);
X509TrustManager x509TrustManager = null;
for (TrustManager trustManager : trustManagerFactory.getTrustManagers()) {
if (trustManager instanceof X509TrustManager) {
x509TrustManager = (X509TrustManager) trustManager;
}
}
if (x509TrustManager == null) {
throw new IllegalStateException(
"No X509 TrustManager available. Unable to check certificate chain");
} else {
x509TrustManager.checkServerTrusted(
certificateChain.toArray(new X509Certificate[certificateChain.size()]),
ServletConstants.SIGNATURE_TYPE);
}
/*
* verify Echo API's hostname is specified as one of subject alternative names on the
* signing certificate
*/
if (!subjectAlernativeNameListContainsEchoSdkDomainName(signingCertificate
.getSubjectAlternativeNames())) {
throw new CertificateException(
"The provided certificate is not valid for the Echo SDK");
}
return signingCertificate;
} catch (KeyStoreException | IOException | NoSuchAlgorithmException ex) {
throw new CertificateException("Unable to verify certificate at URL: "
+ signingCertificateChainUrl, ex);
}
} | java | private X509Certificate retrieveAndVerifyCertificateChain(
final String signingCertificateChainUrl) throws CertificateException {
try (InputStream in =
proxy != null ? getAndVerifySigningCertificateChainUrl(signingCertificateChainUrl).openConnection(proxy).getInputStream()
: getAndVerifySigningCertificateChainUrl(signingCertificateChainUrl).openConnection().getInputStream()) {
CertificateFactory certificateFactory =
CertificateFactory.getInstance(ServletConstants.SIGNATURE_CERTIFICATE_TYPE);
@SuppressWarnings("unchecked")
Collection<X509Certificate> certificateChain =
(Collection<X509Certificate>) certificateFactory.generateCertificates(in);
/*
* check the before/after dates on the certificate date to confirm that it is valid on
* the current date
*/
X509Certificate signingCertificate = certificateChain.iterator().next();
signingCertificate.checkValidity();
// check the certificate chain
TrustManagerFactory trustManagerFactory =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init((KeyStore) null);
X509TrustManager x509TrustManager = null;
for (TrustManager trustManager : trustManagerFactory.getTrustManagers()) {
if (trustManager instanceof X509TrustManager) {
x509TrustManager = (X509TrustManager) trustManager;
}
}
if (x509TrustManager == null) {
throw new IllegalStateException(
"No X509 TrustManager available. Unable to check certificate chain");
} else {
x509TrustManager.checkServerTrusted(
certificateChain.toArray(new X509Certificate[certificateChain.size()]),
ServletConstants.SIGNATURE_TYPE);
}
/*
* verify Echo API's hostname is specified as one of subject alternative names on the
* signing certificate
*/
if (!subjectAlernativeNameListContainsEchoSdkDomainName(signingCertificate
.getSubjectAlternativeNames())) {
throw new CertificateException(
"The provided certificate is not valid for the Echo SDK");
}
return signingCertificate;
} catch (KeyStoreException | IOException | NoSuchAlgorithmException ex) {
throw new CertificateException("Unable to verify certificate at URL: "
+ signingCertificateChainUrl, ex);
}
} | [
"private",
"X509Certificate",
"retrieveAndVerifyCertificateChain",
"(",
"final",
"String",
"signingCertificateChainUrl",
")",
"throws",
"CertificateException",
"{",
"try",
"(",
"InputStream",
"in",
"=",
"proxy",
"!=",
"null",
"?",
"getAndVerifySigningCertificateChainUrl",
"... | Retrieves the certificate from the specified URL and confirms that the certificate is valid.
@param signingCertificateChainUrl
the URL to retrieve the certificate chain from
@return the certificate at the specified URL, if the certificate is valid
@throws CertificateException
if the certificate cannot be retrieve or is invalid | [
"Retrieves",
"the",
"certificate",
"from",
"the",
"specified",
"URL",
"and",
"confirms",
"that",
"the",
"certificate",
"is",
"valid",
"."
] | c49194da0693898c70f3f2c4a372f5a12da04e3e | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-servlet-support/src/com/amazon/ask/servlet/verifiers/SkillRequestSignatureVerifier.java#L124-L177 |
32,802 | alexa/alexa-skills-kit-sdk-for-java | ask-sdk-core/src/com/amazon/ask/request/Predicates.java | Predicates.requestType | public static <T extends Request> Predicate<HandlerInput> requestType(Class<T> requestType) {
return i -> requestType.isInstance(i.getRequestEnvelope().getRequest());
} | java | public static <T extends Request> Predicate<HandlerInput> requestType(Class<T> requestType) {
return i -> requestType.isInstance(i.getRequestEnvelope().getRequest());
} | [
"public",
"static",
"<",
"T",
"extends",
"Request",
">",
"Predicate",
"<",
"HandlerInput",
">",
"requestType",
"(",
"Class",
"<",
"T",
">",
"requestType",
")",
"{",
"return",
"i",
"->",
"requestType",
".",
"isInstance",
"(",
"i",
".",
"getRequestEnvelope",
... | Returns a predicate that returns to true if the incoming request is an instance
of the given request class.
@param <T> class of the request to evaluate against
@param requestType request type to evaluate against
@return true if the incoming request is an instance of the given request class | [
"Returns",
"a",
"predicate",
"that",
"returns",
"to",
"true",
"if",
"the",
"incoming",
"request",
"is",
"an",
"instance",
"of",
"the",
"given",
"request",
"class",
"."
] | c49194da0693898c70f3f2c4a372f5a12da04e3e | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/request/Predicates.java#L41-L43 |
32,803 | alexa/alexa-skills-kit-sdk-for-java | ask-sdk-core/src/com/amazon/ask/response/template/loader/impl/LocaleTemplateEnumerator.java | LocaleTemplateEnumerator.next | @Override
public String next() {
if (hasNext()) {
if (enumerationSize == NULL_LOCALE_ENUMERATION_SIZE) {
cursor++;
return templateName;
}
final String language = matcher.group(1);
final String country = matcher.group(2);
switch (cursor) {
case 0: cursor++; return templateName + FILE_SEPARATOR + language + FILE_SEPARATOR + country;
case 1: cursor++; return templateName + FILE_SEPARATOR + language + UNDERSCORE + country;
case 2: cursor++; return templateName + FILE_SEPARATOR + language;
case 3: cursor++; return templateName + UNDERSCORE + language + UNDERSCORE + country;
case 4: cursor++; return templateName + UNDERSCORE + language;
case 5: cursor++; return templateName;
}
}
String message = "No next available template name combination.";
LOGGER.error(message);
throw new IllegalStateException(message);
} | java | @Override
public String next() {
if (hasNext()) {
if (enumerationSize == NULL_LOCALE_ENUMERATION_SIZE) {
cursor++;
return templateName;
}
final String language = matcher.group(1);
final String country = matcher.group(2);
switch (cursor) {
case 0: cursor++; return templateName + FILE_SEPARATOR + language + FILE_SEPARATOR + country;
case 1: cursor++; return templateName + FILE_SEPARATOR + language + UNDERSCORE + country;
case 2: cursor++; return templateName + FILE_SEPARATOR + language;
case 3: cursor++; return templateName + UNDERSCORE + language + UNDERSCORE + country;
case 4: cursor++; return templateName + UNDERSCORE + language;
case 5: cursor++; return templateName;
}
}
String message = "No next available template name combination.";
LOGGER.error(message);
throw new IllegalStateException(message);
} | [
"@",
"Override",
"public",
"String",
"next",
"(",
")",
"{",
"if",
"(",
"hasNext",
"(",
")",
")",
"{",
"if",
"(",
"enumerationSize",
"==",
"NULL_LOCALE_ENUMERATION_SIZE",
")",
"{",
"cursor",
"++",
";",
"return",
"templateName",
";",
"}",
"final",
"String",
... | Generate the next combination of template name and return.
@return the next combination of template name | [
"Generate",
"the",
"next",
"combination",
"of",
"template",
"name",
"and",
"return",
"."
] | c49194da0693898c70f3f2c4a372f5a12da04e3e | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/response/template/loader/impl/LocaleTemplateEnumerator.java#L79-L100 |
32,804 | alexa/alexa-skills-kit-sdk-for-java | ask-sdk-core/src/com/amazon/ask/attributes/AttributesManager.java | AttributesManager.setSessionAttributes | public void setSessionAttributes(Map<String, Object> sessionAttributes) {
if (requestEnvelope.getSession() == null) {
throw new IllegalStateException("Attempting to set session attributes for out of session request");
}
this.sessionAttributes = sessionAttributes;
} | java | public void setSessionAttributes(Map<String, Object> sessionAttributes) {
if (requestEnvelope.getSession() == null) {
throw new IllegalStateException("Attempting to set session attributes for out of session request");
}
this.sessionAttributes = sessionAttributes;
} | [
"public",
"void",
"setSessionAttributes",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"sessionAttributes",
")",
"{",
"if",
"(",
"requestEnvelope",
".",
"getSession",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Attempti... | Sets session attributes, replacing any existing attributes already present in the session. An exception is thrown
if this method is called while processing an out of session request. Use this method when bulk replacing attributes
is desired.
@param sessionAttributes session attributes to set
@throws IllegalStateException if attempting to retrieve session attributes from an out of session request | [
"Sets",
"session",
"attributes",
"replacing",
"any",
"existing",
"attributes",
"already",
"present",
"in",
"the",
"session",
".",
"An",
"exception",
"is",
"thrown",
"if",
"this",
"method",
"is",
"called",
"while",
"processing",
"an",
"out",
"of",
"session",
"r... | c49194da0693898c70f3f2c4a372f5a12da04e3e | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/attributes/AttributesManager.java#L105-L110 |
32,805 | alexa/alexa-skills-kit-sdk-for-java | ask-sdk-dynamodb-persistence-adapter/src/com/amazon/ask/attributes/persistence/impl/PartitionKeyGenerators.java | PartitionKeyGenerators.userId | public static Function<RequestEnvelope, String> userId() {
return r -> Optional.ofNullable(r).map(RequestEnvelope::getContext)
.map(Context::getSystem)
.map(SystemState::getUser)
.map(User::getUserId)
.orElseThrow(() -> new PersistenceException("Could not retrieve user ID from request envelope to generate persistence ID"));
} | java | public static Function<RequestEnvelope, String> userId() {
return r -> Optional.ofNullable(r).map(RequestEnvelope::getContext)
.map(Context::getSystem)
.map(SystemState::getUser)
.map(User::getUserId)
.orElseThrow(() -> new PersistenceException("Could not retrieve user ID from request envelope to generate persistence ID"));
} | [
"public",
"static",
"Function",
"<",
"RequestEnvelope",
",",
"String",
">",
"userId",
"(",
")",
"{",
"return",
"r",
"->",
"Optional",
".",
"ofNullable",
"(",
"r",
")",
".",
"map",
"(",
"RequestEnvelope",
"::",
"getContext",
")",
".",
"map",
"(",
"Context... | Produces a partition key from the user ID contained in an incoming request.
@return partition key derived from user ID
@throws PersistenceException if user ID cannot be retrieved | [
"Produces",
"a",
"partition",
"key",
"from",
"the",
"user",
"ID",
"contained",
"in",
"an",
"incoming",
"request",
"."
] | c49194da0693898c70f3f2c4a372f5a12da04e3e | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-dynamodb-persistence-adapter/src/com/amazon/ask/attributes/persistence/impl/PartitionKeyGenerators.java#L36-L42 |
32,806 | alexa/alexa-skills-kit-sdk-for-java | ask-sdk-dynamodb-persistence-adapter/src/com/amazon/ask/attributes/persistence/impl/PartitionKeyGenerators.java | PartitionKeyGenerators.deviceId | public static Function<RequestEnvelope, String> deviceId() {
return r -> Optional.ofNullable(r).map(RequestEnvelope::getContext)
.map(Context::getSystem)
.map(SystemState::getDevice)
.map(Device::getDeviceId)
.orElseThrow(() -> new PersistenceException("Could not retrieve device ID from request envelope to generate persistence ID"));
} | java | public static Function<RequestEnvelope, String> deviceId() {
return r -> Optional.ofNullable(r).map(RequestEnvelope::getContext)
.map(Context::getSystem)
.map(SystemState::getDevice)
.map(Device::getDeviceId)
.orElseThrow(() -> new PersistenceException("Could not retrieve device ID from request envelope to generate persistence ID"));
} | [
"public",
"static",
"Function",
"<",
"RequestEnvelope",
",",
"String",
">",
"deviceId",
"(",
")",
"{",
"return",
"r",
"->",
"Optional",
".",
"ofNullable",
"(",
"r",
")",
".",
"map",
"(",
"RequestEnvelope",
"::",
"getContext",
")",
".",
"map",
"(",
"Conte... | Produces a partition key from the device ID contained in an incoming request.
@return partition key derived from device ID
@throws PersistenceException if device ID cannot be retrieved | [
"Produces",
"a",
"partition",
"key",
"from",
"the",
"device",
"ID",
"contained",
"in",
"an",
"incoming",
"request",
"."
] | c49194da0693898c70f3f2c4a372f5a12da04e3e | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-dynamodb-persistence-adapter/src/com/amazon/ask/attributes/persistence/impl/PartitionKeyGenerators.java#L49-L55 |
32,807 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/DefaultPluginFactory.java | DefaultPluginFactory.create | @Override
public Plugin create(final PluginWrapper pluginWrapper) {
String pluginClassName = pluginWrapper.getDescriptor().getPluginClass();
log.debug("Create instance for plugin '{}'", pluginClassName);
Class<?> pluginClass;
try {
pluginClass = pluginWrapper.getPluginClassLoader().loadClass(pluginClassName);
} catch (ClassNotFoundException e) {
log.error(e.getMessage(), e);
return null;
}
// once we have the class, we can do some checks on it to ensure
// that it is a valid implementation of a plugin.
int modifiers = pluginClass.getModifiers();
if (Modifier.isAbstract(modifiers) || Modifier.isInterface(modifiers)
|| (!Plugin.class.isAssignableFrom(pluginClass))) {
log.error("The plugin class '{}' is not valid", pluginClassName);
return null;
}
// create the plugin instance
try {
Constructor<?> constructor = pluginClass.getConstructor(PluginWrapper.class);
return (Plugin) constructor.newInstance(pluginWrapper);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return null;
} | java | @Override
public Plugin create(final PluginWrapper pluginWrapper) {
String pluginClassName = pluginWrapper.getDescriptor().getPluginClass();
log.debug("Create instance for plugin '{}'", pluginClassName);
Class<?> pluginClass;
try {
pluginClass = pluginWrapper.getPluginClassLoader().loadClass(pluginClassName);
} catch (ClassNotFoundException e) {
log.error(e.getMessage(), e);
return null;
}
// once we have the class, we can do some checks on it to ensure
// that it is a valid implementation of a plugin.
int modifiers = pluginClass.getModifiers();
if (Modifier.isAbstract(modifiers) || Modifier.isInterface(modifiers)
|| (!Plugin.class.isAssignableFrom(pluginClass))) {
log.error("The plugin class '{}' is not valid", pluginClassName);
return null;
}
// create the plugin instance
try {
Constructor<?> constructor = pluginClass.getConstructor(PluginWrapper.class);
return (Plugin) constructor.newInstance(pluginWrapper);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return null;
} | [
"@",
"Override",
"public",
"Plugin",
"create",
"(",
"final",
"PluginWrapper",
"pluginWrapper",
")",
"{",
"String",
"pluginClassName",
"=",
"pluginWrapper",
".",
"getDescriptor",
"(",
")",
".",
"getPluginClass",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"Creat... | Creates a plugin instance. If an error occurs than that error is logged and the method returns null.
@param pluginWrapper
@return | [
"Creates",
"a",
"plugin",
"instance",
".",
"If",
"an",
"error",
"occurs",
"than",
"that",
"error",
"is",
"logged",
"and",
"the",
"method",
"returns",
"null",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/DefaultPluginFactory.java#L39-L70 |
32,808 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/util/DirectedGraph.java | DirectedGraph.addVertex | public void addVertex(V vertex) {
if (containsVertex(vertex)) {
return;
}
neighbors.put(vertex, new ArrayList<V>());
} | java | public void addVertex(V vertex) {
if (containsVertex(vertex)) {
return;
}
neighbors.put(vertex, new ArrayList<V>());
} | [
"public",
"void",
"addVertex",
"(",
"V",
"vertex",
")",
"{",
"if",
"(",
"containsVertex",
"(",
"vertex",
")",
")",
"{",
"return",
";",
"}",
"neighbors",
".",
"put",
"(",
"vertex",
",",
"new",
"ArrayList",
"<",
"V",
">",
"(",
")",
")",
";",
"}"
] | Add a vertex to the graph. Nothing happens if vertex is already in graph. | [
"Add",
"a",
"vertex",
"to",
"the",
"graph",
".",
"Nothing",
"happens",
"if",
"vertex",
"is",
"already",
"in",
"graph",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java#L42-L48 |
32,809 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/util/DirectedGraph.java | DirectedGraph.addEdge | public void addEdge(V from, V to) {
addVertex(from);
addVertex(to);
neighbors.get(from).add(to);
} | java | public void addEdge(V from, V to) {
addVertex(from);
addVertex(to);
neighbors.get(from).add(to);
} | [
"public",
"void",
"addEdge",
"(",
"V",
"from",
",",
"V",
"to",
")",
"{",
"addVertex",
"(",
"from",
")",
";",
"addVertex",
"(",
"to",
")",
";",
"neighbors",
".",
"get",
"(",
"from",
")",
".",
"add",
"(",
"to",
")",
";",
"}"
] | Add an edge to the graph; if either vertex does not exist, it's added.
This implementation allows the creation of multi-edges and self-loops. | [
"Add",
"an",
"edge",
"to",
"the",
"graph",
";",
"if",
"either",
"vertex",
"does",
"not",
"exist",
"it",
"s",
"added",
".",
"This",
"implementation",
"allows",
"the",
"creation",
"of",
"multi",
"-",
"edges",
"and",
"self",
"-",
"loops",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java#L65-L69 |
32,810 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/util/DirectedGraph.java | DirectedGraph.removeEdge | public void removeEdge(V from, V to) {
if (!containsVertex(from)) {
throw new IllegalArgumentException("Nonexistent vertex " + from);
}
if (!containsVertex(to)) {
throw new IllegalArgumentException("Nonexistent vertex " + to);
}
neighbors.get(from).remove(to);
} | java | public void removeEdge(V from, V to) {
if (!containsVertex(from)) {
throw new IllegalArgumentException("Nonexistent vertex " + from);
}
if (!containsVertex(to)) {
throw new IllegalArgumentException("Nonexistent vertex " + to);
}
neighbors.get(from).remove(to);
} | [
"public",
"void",
"removeEdge",
"(",
"V",
"from",
",",
"V",
"to",
")",
"{",
"if",
"(",
"!",
"containsVertex",
"(",
"from",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Nonexistent vertex \"",
"+",
"from",
")",
";",
"}",
"if",
"(",
... | Remove an edge from the graph. Nothing happens if no such edge.
@throws {@link IllegalArgumentException} if either vertex doesn't exist. | [
"Remove",
"an",
"edge",
"from",
"the",
"graph",
".",
"Nothing",
"happens",
"if",
"no",
"such",
"edge",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/util/DirectedGraph.java#L75-L85 |
32,811 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | AbstractPluginManager.getPlugins | @Override
public List<PluginWrapper> getPlugins(PluginState pluginState) {
List<PluginWrapper> plugins = new ArrayList<>();
for (PluginWrapper plugin : getPlugins()) {
if (pluginState.equals(plugin.getPluginState())) {
plugins.add(plugin);
}
}
return plugins;
} | java | @Override
public List<PluginWrapper> getPlugins(PluginState pluginState) {
List<PluginWrapper> plugins = new ArrayList<>();
for (PluginWrapper plugin : getPlugins()) {
if (pluginState.equals(plugin.getPluginState())) {
plugins.add(plugin);
}
}
return plugins;
} | [
"@",
"Override",
"public",
"List",
"<",
"PluginWrapper",
">",
"getPlugins",
"(",
"PluginState",
"pluginState",
")",
"{",
"List",
"<",
"PluginWrapper",
">",
"plugins",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"PluginWrapper",
"plugin",
":",
... | Returns a copy of plugins with that state. | [
"Returns",
"a",
"copy",
"of",
"plugins",
"with",
"that",
"state",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java#L143-L153 |
32,812 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | AbstractPluginManager.loadPlugins | @Override
public void loadPlugins() {
log.debug("Lookup plugins in '{}'", pluginsRoot);
// check for plugins root
if (Files.notExists(pluginsRoot) || !Files.isDirectory(pluginsRoot)) {
log.warn("No '{}' root", pluginsRoot);
return;
}
// get all plugin paths from repository
List<Path> pluginPaths = pluginRepository.getPluginPaths();
// check for no plugins
if (pluginPaths.isEmpty()) {
log.info("No plugins");
return;
}
log.debug("Found {} possible plugins: {}", pluginPaths.size(), pluginPaths);
// load plugins from plugin paths
for (Path pluginPath : pluginPaths) {
try {
loadPluginFromPath(pluginPath);
} catch (PluginException e) {
log.error(e.getMessage(), e);
}
}
// resolve plugins
try {
resolvePlugins();
} catch (PluginException e) {
log.error(e.getMessage(), e);
}
} | java | @Override
public void loadPlugins() {
log.debug("Lookup plugins in '{}'", pluginsRoot);
// check for plugins root
if (Files.notExists(pluginsRoot) || !Files.isDirectory(pluginsRoot)) {
log.warn("No '{}' root", pluginsRoot);
return;
}
// get all plugin paths from repository
List<Path> pluginPaths = pluginRepository.getPluginPaths();
// check for no plugins
if (pluginPaths.isEmpty()) {
log.info("No plugins");
return;
}
log.debug("Found {} possible plugins: {}", pluginPaths.size(), pluginPaths);
// load plugins from plugin paths
for (Path pluginPath : pluginPaths) {
try {
loadPluginFromPath(pluginPath);
} catch (PluginException e) {
log.error(e.getMessage(), e);
}
}
// resolve plugins
try {
resolvePlugins();
} catch (PluginException e) {
log.error(e.getMessage(), e);
}
} | [
"@",
"Override",
"public",
"void",
"loadPlugins",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"Lookup plugins in '{}'\"",
",",
"pluginsRoot",
")",
";",
"// check for plugins root",
"if",
"(",
"Files",
".",
"notExists",
"(",
"pluginsRoot",
")",
"||",
"!",
"Files... | Load plugins. | [
"Load",
"plugins",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java#L200-L235 |
32,813 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | AbstractPluginManager.startPlugins | @Override
public void startPlugins() {
for (PluginWrapper pluginWrapper : resolvedPlugins) {
PluginState pluginState = pluginWrapper.getPluginState();
if ((PluginState.DISABLED != pluginState) && (PluginState.STARTED != pluginState)) {
try {
log.info("Start plugin '{}'", getPluginLabel(pluginWrapper.getDescriptor()));
pluginWrapper.getPlugin().start();
pluginWrapper.setPluginState(PluginState.STARTED);
startedPlugins.add(pluginWrapper);
firePluginStateEvent(new PluginStateEvent(this, pluginWrapper, pluginState));
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
} | java | @Override
public void startPlugins() {
for (PluginWrapper pluginWrapper : resolvedPlugins) {
PluginState pluginState = pluginWrapper.getPluginState();
if ((PluginState.DISABLED != pluginState) && (PluginState.STARTED != pluginState)) {
try {
log.info("Start plugin '{}'", getPluginLabel(pluginWrapper.getDescriptor()));
pluginWrapper.getPlugin().start();
pluginWrapper.setPluginState(PluginState.STARTED);
startedPlugins.add(pluginWrapper);
firePluginStateEvent(new PluginStateEvent(this, pluginWrapper, pluginState));
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"startPlugins",
"(",
")",
"{",
"for",
"(",
"PluginWrapper",
"pluginWrapper",
":",
"resolvedPlugins",
")",
"{",
"PluginState",
"pluginState",
"=",
"pluginWrapper",
".",
"getPluginState",
"(",
")",
";",
"if",
"(",
"(",
"PluginS... | Start all active plugins. | [
"Start",
"all",
"active",
"plugins",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java#L322-L339 |
32,814 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | AbstractPluginManager.startPlugin | @Override
public PluginState startPlugin(String pluginId) {
checkPluginId(pluginId);
PluginWrapper pluginWrapper = getPlugin(pluginId);
PluginDescriptor pluginDescriptor = pluginWrapper.getDescriptor();
PluginState pluginState = pluginWrapper.getPluginState();
if (PluginState.STARTED == pluginState) {
log.debug("Already started plugin '{}'", getPluginLabel(pluginDescriptor));
return PluginState.STARTED;
}
if (!resolvedPlugins.contains(pluginWrapper)) {
log.warn("Cannot start an unresolved plugin '{}'", getPluginLabel(pluginDescriptor));
return pluginState;
}
if (PluginState.DISABLED == pluginState) {
// automatically enable plugin on manual plugin start
if (!enablePlugin(pluginId)) {
return pluginState;
}
}
for (PluginDependency dependency : pluginDescriptor.getDependencies()) {
startPlugin(dependency.getPluginId());
}
try {
log.info("Start plugin '{}'", getPluginLabel(pluginDescriptor));
pluginWrapper.getPlugin().start();
pluginWrapper.setPluginState(PluginState.STARTED);
startedPlugins.add(pluginWrapper);
firePluginStateEvent(new PluginStateEvent(this, pluginWrapper, pluginState));
} catch (PluginException e) {
log.error(e.getMessage(), e);
}
return pluginWrapper.getPluginState();
} | java | @Override
public PluginState startPlugin(String pluginId) {
checkPluginId(pluginId);
PluginWrapper pluginWrapper = getPlugin(pluginId);
PluginDescriptor pluginDescriptor = pluginWrapper.getDescriptor();
PluginState pluginState = pluginWrapper.getPluginState();
if (PluginState.STARTED == pluginState) {
log.debug("Already started plugin '{}'", getPluginLabel(pluginDescriptor));
return PluginState.STARTED;
}
if (!resolvedPlugins.contains(pluginWrapper)) {
log.warn("Cannot start an unresolved plugin '{}'", getPluginLabel(pluginDescriptor));
return pluginState;
}
if (PluginState.DISABLED == pluginState) {
// automatically enable plugin on manual plugin start
if (!enablePlugin(pluginId)) {
return pluginState;
}
}
for (PluginDependency dependency : pluginDescriptor.getDependencies()) {
startPlugin(dependency.getPluginId());
}
try {
log.info("Start plugin '{}'", getPluginLabel(pluginDescriptor));
pluginWrapper.getPlugin().start();
pluginWrapper.setPluginState(PluginState.STARTED);
startedPlugins.add(pluginWrapper);
firePluginStateEvent(new PluginStateEvent(this, pluginWrapper, pluginState));
} catch (PluginException e) {
log.error(e.getMessage(), e);
}
return pluginWrapper.getPluginState();
} | [
"@",
"Override",
"public",
"PluginState",
"startPlugin",
"(",
"String",
"pluginId",
")",
"{",
"checkPluginId",
"(",
"pluginId",
")",
";",
"PluginWrapper",
"pluginWrapper",
"=",
"getPlugin",
"(",
"pluginId",
")",
";",
"PluginDescriptor",
"pluginDescriptor",
"=",
"p... | Start the specified plugin and its dependencies. | [
"Start",
"the",
"specified",
"plugin",
"and",
"its",
"dependencies",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java#L344-L384 |
32,815 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | AbstractPluginManager.stopPlugins | @Override
public void stopPlugins() {
// stop started plugins in reverse order
Collections.reverse(startedPlugins);
Iterator<PluginWrapper> itr = startedPlugins.iterator();
while (itr.hasNext()) {
PluginWrapper pluginWrapper = itr.next();
PluginState pluginState = pluginWrapper.getPluginState();
if (PluginState.STARTED == pluginState) {
try {
log.info("Stop plugin '{}'", getPluginLabel(pluginWrapper.getDescriptor()));
pluginWrapper.getPlugin().stop();
pluginWrapper.setPluginState(PluginState.STOPPED);
itr.remove();
firePluginStateEvent(new PluginStateEvent(this, pluginWrapper, pluginState));
} catch (PluginException e) {
log.error(e.getMessage(), e);
}
}
}
} | java | @Override
public void stopPlugins() {
// stop started plugins in reverse order
Collections.reverse(startedPlugins);
Iterator<PluginWrapper> itr = startedPlugins.iterator();
while (itr.hasNext()) {
PluginWrapper pluginWrapper = itr.next();
PluginState pluginState = pluginWrapper.getPluginState();
if (PluginState.STARTED == pluginState) {
try {
log.info("Stop plugin '{}'", getPluginLabel(pluginWrapper.getDescriptor()));
pluginWrapper.getPlugin().stop();
pluginWrapper.setPluginState(PluginState.STOPPED);
itr.remove();
firePluginStateEvent(new PluginStateEvent(this, pluginWrapper, pluginState));
} catch (PluginException e) {
log.error(e.getMessage(), e);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"stopPlugins",
"(",
")",
"{",
"// stop started plugins in reverse order",
"Collections",
".",
"reverse",
"(",
"startedPlugins",
")",
";",
"Iterator",
"<",
"PluginWrapper",
">",
"itr",
"=",
"startedPlugins",
".",
"iterator",
"(",
... | Stop all active plugins. | [
"Stop",
"all",
"active",
"plugins",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java#L389-L410 |
32,816 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | AbstractPluginManager.idForPath | protected String idForPath(Path pluginPath) {
for (PluginWrapper plugin : plugins.values()) {
if (plugin.getPluginPath().equals(pluginPath)) {
return plugin.getPluginId();
}
}
return null;
} | java | protected String idForPath(Path pluginPath) {
for (PluginWrapper plugin : plugins.values()) {
if (plugin.getPluginPath().equals(pluginPath)) {
return plugin.getPluginId();
}
}
return null;
} | [
"protected",
"String",
"idForPath",
"(",
"Path",
"pluginPath",
")",
"{",
"for",
"(",
"PluginWrapper",
"plugin",
":",
"plugins",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"plugin",
".",
"getPluginPath",
"(",
")",
".",
"equals",
"(",
"pluginPath",
")",... | Tests for already loaded plugins on given path.
@param pluginPath the path to investigate
@return id of plugin or null if not loaded | [
"Tests",
"for",
"already",
"loaded",
"plugins",
"on",
"given",
"path",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java#L896-L904 |
32,817 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | AbstractPluginManager.validatePluginDescriptor | protected void validatePluginDescriptor(PluginDescriptor descriptor) throws PluginException {
if (StringUtils.isNullOrEmpty(descriptor.getPluginId())) {
throw new PluginException("Field 'id' cannot be empty");
}
if (descriptor.getVersion() == null) {
throw new PluginException("Field 'version' cannot be empty");
}
} | java | protected void validatePluginDescriptor(PluginDescriptor descriptor) throws PluginException {
if (StringUtils.isNullOrEmpty(descriptor.getPluginId())) {
throw new PluginException("Field 'id' cannot be empty");
}
if (descriptor.getVersion() == null) {
throw new PluginException("Field 'version' cannot be empty");
}
} | [
"protected",
"void",
"validatePluginDescriptor",
"(",
"PluginDescriptor",
"descriptor",
")",
"throws",
"PluginException",
"{",
"if",
"(",
"StringUtils",
".",
"isNullOrEmpty",
"(",
"descriptor",
".",
"getPluginId",
"(",
")",
")",
")",
"{",
"throw",
"new",
"PluginEx... | Override this to change the validation criteria.
@param descriptor the plugin descriptor to validate
@throws PluginException if validation fails | [
"Override",
"this",
"to",
"change",
"the",
"validation",
"criteria",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java#L912-L920 |
32,818 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/util/FileUtils.java | FileUtils.findWithEnding | public static Path findWithEnding(Path basePath, String... endings) {
for (String ending : endings) {
Path newPath = basePath.resolveSibling(basePath.getFileName() + ending);
if (Files.exists(newPath)) {
return newPath;
}
}
return null;
} | java | public static Path findWithEnding(Path basePath, String... endings) {
for (String ending : endings) {
Path newPath = basePath.resolveSibling(basePath.getFileName() + ending);
if (Files.exists(newPath)) {
return newPath;
}
}
return null;
} | [
"public",
"static",
"Path",
"findWithEnding",
"(",
"Path",
"basePath",
",",
"String",
"...",
"endings",
")",
"{",
"for",
"(",
"String",
"ending",
":",
"endings",
")",
"{",
"Path",
"newPath",
"=",
"basePath",
".",
"resolveSibling",
"(",
"basePath",
".",
"ge... | Finds a path with various endings or null if not found.
@param basePath the base name
@param endings a list of endings to search for
@return new path or null if not found | [
"Finds",
"a",
"path",
"with",
"various",
"endings",
"or",
"null",
"if",
"not",
"found",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/util/FileUtils.java#L133-L142 |
32,819 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/util/FileUtils.java | FileUtils.isZipFile | public static boolean isZipFile(Path path) {
return Files.isRegularFile(path) && path.toString().toLowerCase().endsWith(".zip");
} | java | public static boolean isZipFile(Path path) {
return Files.isRegularFile(path) && path.toString().toLowerCase().endsWith(".zip");
} | [
"public",
"static",
"boolean",
"isZipFile",
"(",
"Path",
"path",
")",
"{",
"return",
"Files",
".",
"isRegularFile",
"(",
"path",
")",
"&&",
"path",
".",
"toString",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"\".zip\"",
")",
";",
"}"... | Return true only if path is a zip file.
@param path to a file/dir
@return true if file with {@code .zip} ending | [
"Return",
"true",
"only",
"if",
"path",
"is",
"a",
"zip",
"file",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/util/FileUtils.java#L203-L205 |
32,820 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/util/FileUtils.java | FileUtils.isJarFile | public static boolean isJarFile(Path path) {
return Files.isRegularFile(path) && path.toString().toLowerCase().endsWith(".jar");
} | java | public static boolean isJarFile(Path path) {
return Files.isRegularFile(path) && path.toString().toLowerCase().endsWith(".jar");
} | [
"public",
"static",
"boolean",
"isJarFile",
"(",
"Path",
"path",
")",
"{",
"return",
"Files",
".",
"isRegularFile",
"(",
"path",
")",
"&&",
"path",
".",
"toString",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"\".jar\"",
")",
";",
"}"... | Return true only if path is a jar file.
@param path to a file/dir
@return true if file with {@code .jar} ending | [
"Return",
"true",
"only",
"if",
"path",
"is",
"a",
"jar",
"file",
"."
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/util/FileUtils.java#L213-L215 |
32,821 | pf4j/pf4j | pf4j/src/main/java/org/pf4j/DefaultPluginManager.java | DefaultPluginManager.loadPluginFromPath | @Override
protected PluginWrapper loadPluginFromPath(Path pluginPath) throws PluginException {
// First unzip any ZIP files
try {
pluginPath = FileUtils.expandIfZip(pluginPath);
} catch (Exception e) {
log.warn("Failed to unzip " + pluginPath, e);
return null;
}
return super.loadPluginFromPath(pluginPath);
} | java | @Override
protected PluginWrapper loadPluginFromPath(Path pluginPath) throws PluginException {
// First unzip any ZIP files
try {
pluginPath = FileUtils.expandIfZip(pluginPath);
} catch (Exception e) {
log.warn("Failed to unzip " + pluginPath, e);
return null;
}
return super.loadPluginFromPath(pluginPath);
} | [
"@",
"Override",
"protected",
"PluginWrapper",
"loadPluginFromPath",
"(",
"Path",
"pluginPath",
")",
"throws",
"PluginException",
"{",
"// First unzip any ZIP files",
"try",
"{",
"pluginPath",
"=",
"FileUtils",
".",
"expandIfZip",
"(",
"pluginPath",
")",
";",
"}",
"... | Load a plugin from disk. If the path is a zip file, first unpack
@param pluginPath plugin location on disk
@return PluginWrapper for the loaded plugin or null if not loaded
@throws PluginException if problems during load | [
"Load",
"a",
"plugin",
"from",
"disk",
".",
"If",
"the",
"path",
"is",
"a",
"zip",
"file",
"first",
"unpack"
] | 6dd7a6069f0e2fbd842c81e2c8c388918b88ea81 | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/DefaultPluginManager.java#L136-L147 |
32,822 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLContextSpi.java | SSLContextSpi.engineGetSupportedSSLParameters | protected SSLParameters engineGetSupportedSSLParameters() {
SSLSocket socket = getDefaultSocket();
SSLParameters params = new SSLParameters();
params.setCipherSuites(socket.getSupportedCipherSuites());
params.setProtocols(socket.getSupportedProtocols());
return params;
} | java | protected SSLParameters engineGetSupportedSSLParameters() {
SSLSocket socket = getDefaultSocket();
SSLParameters params = new SSLParameters();
params.setCipherSuites(socket.getSupportedCipherSuites());
params.setProtocols(socket.getSupportedProtocols());
return params;
} | [
"protected",
"SSLParameters",
"engineGetSupportedSSLParameters",
"(",
")",
"{",
"SSLSocket",
"socket",
"=",
"getDefaultSocket",
"(",
")",
";",
"SSLParameters",
"params",
"=",
"new",
"SSLParameters",
"(",
")",
";",
"params",
".",
"setCipherSuites",
"(",
"socket",
"... | Returns a copy of the SSLParameters indicating the maximum supported
settings for this SSL context.
<p>The parameters will always have the ciphersuite and protocols
arrays set to non-null values.
<p>The default implementation obtains the parameters from an
SSLSocket created by calling the
{@linkplain javax.net.SocketFactory#createSocket
SocketFactory.createSocket()} method of this context's SocketFactory.
@return a copy of the SSLParameters object with the maximum supported
settings
@throws UnsupportedOperationException if the supported SSL parameters
could not be obtained.
@since 1.6 | [
"Returns",
"a",
"copy",
"of",
"the",
"SSLParameters",
"indicating",
"the",
"maximum",
"supported",
"settings",
"for",
"this",
"SSL",
"context",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLContextSpi.java#L191-L197 |
32,823 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeTextProvider.java | DateTimeTextProvider.createEntry | private static <A, B> Entry<A, B> createEntry(A text, B field) {
return new SimpleImmutableEntry<>(text, field);
} | java | private static <A, B> Entry<A, B> createEntry(A text, B field) {
return new SimpleImmutableEntry<>(text, field);
} | [
"private",
"static",
"<",
"A",
",",
"B",
">",
"Entry",
"<",
"A",
",",
"B",
">",
"createEntry",
"(",
"A",
"text",
",",
"B",
"field",
")",
"{",
"return",
"new",
"SimpleImmutableEntry",
"<>",
"(",
"text",
",",
"field",
")",
";",
"}"
] | Helper method to create an immutable entry.
@param text the text, not null
@param field the field, not null
@return the entry, not null | [
"Helper",
"method",
"to",
"create",
"an",
"immutable",
"entry",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeTextProvider.java#L471-L473 |
32,824 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateVersion.java | CertificateVersion.construct | private void construct(DerValue derVal) throws IOException {
if (derVal.isConstructed() && derVal.isContextSpecific()) {
derVal = derVal.data.getDerValue();
version = derVal.getInteger();
if (derVal.data.available() != 0) {
throw new IOException("X.509 version, bad format");
}
}
} | java | private void construct(DerValue derVal) throws IOException {
if (derVal.isConstructed() && derVal.isContextSpecific()) {
derVal = derVal.data.getDerValue();
version = derVal.getInteger();
if (derVal.data.available() != 0) {
throw new IOException("X.509 version, bad format");
}
}
} | [
"private",
"void",
"construct",
"(",
"DerValue",
"derVal",
")",
"throws",
"IOException",
"{",
"if",
"(",
"derVal",
".",
"isConstructed",
"(",
")",
"&&",
"derVal",
".",
"isContextSpecific",
"(",
")",
")",
"{",
"derVal",
"=",
"derVal",
".",
"data",
".",
"g... | Construct the class from the passed DerValue | [
"Construct",
"the",
"class",
"from",
"the",
"passed",
"DerValue"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateVersion.java#L75-L83 |
32,825 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateVersion.java | CertificateVersion.encode | public void encode(OutputStream out) throws IOException {
// Nothing for default
if (version == V1) {
return;
}
DerOutputStream tmp = new DerOutputStream();
tmp.putInteger(version);
DerOutputStream seq = new DerOutputStream();
seq.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0),
tmp);
out.write(seq.toByteArray());
} | java | public void encode(OutputStream out) throws IOException {
// Nothing for default
if (version == V1) {
return;
}
DerOutputStream tmp = new DerOutputStream();
tmp.putInteger(version);
DerOutputStream seq = new DerOutputStream();
seq.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, (byte)0),
tmp);
out.write(seq.toByteArray());
} | [
"public",
"void",
"encode",
"(",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"// Nothing for default",
"if",
"(",
"version",
"==",
"V1",
")",
"{",
"return",
";",
"}",
"DerOutputStream",
"tmp",
"=",
"new",
"DerOutputStream",
"(",
")",
";",
"tmp"... | Encode the CertificateVersion period in DER form to the stream.
@param out the OutputStream to marshal the contents to.
@exception IOException on errors. | [
"Encode",
"the",
"CertificateVersion",
"period",
"in",
"DER",
"form",
"to",
"the",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/CertificateVersion.java#L161-L174 |
32,826 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.getIndex | public int getIndex (String uri, String localName)
{
int max = length * 5;
for (int i = 0; i < max; i += 5) {
if (data[i].equals(uri) && data[i+1].equals(localName)) {
return i / 5;
}
}
return -1;
} | java | public int getIndex (String uri, String localName)
{
int max = length * 5;
for (int i = 0; i < max; i += 5) {
if (data[i].equals(uri) && data[i+1].equals(localName)) {
return i / 5;
}
}
return -1;
} | [
"public",
"int",
"getIndex",
"(",
"String",
"uri",
",",
"String",
"localName",
")",
"{",
"int",
"max",
"=",
"length",
"*",
"5",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"+=",
"5",
")",
"{",
"if",
"(",
"data",
"["... | Look up an attribute's index by Namespace name.
<p>In many cases, it will be more efficient to look up the name once and
use the index query methods rather than using the name query methods
repeatedly.</p>
@param uri The attribute's Namespace URI, or the empty
string if none is available.
@param localName The attribute's local name.
@return The attribute's index, or -1 if none matches.
@see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String) | [
"Look",
"up",
"an",
"attribute",
"s",
"index",
"by",
"Namespace",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L199-L208 |
32,827 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.getType | public String getType (String uri, String localName)
{
int max = length * 5;
for (int i = 0; i < max; i += 5) {
if (data[i].equals(uri) && data[i+1].equals(localName)) {
return data[i+3];
}
}
return null;
} | java | public String getType (String uri, String localName)
{
int max = length * 5;
for (int i = 0; i < max; i += 5) {
if (data[i].equals(uri) && data[i+1].equals(localName)) {
return data[i+3];
}
}
return null;
} | [
"public",
"String",
"getType",
"(",
"String",
"uri",
",",
"String",
"localName",
")",
"{",
"int",
"max",
"=",
"length",
"*",
"5",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"+=",
"5",
")",
"{",
"if",
"(",
"data",
"... | Look up an attribute's type by Namespace-qualified name.
@param uri The Namespace URI, or the empty string for a name
with no explicit Namespace URI.
@param localName The local name.
@return The attribute's type, or null if there is no
matching attribute.
@see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String) | [
"Look",
"up",
"an",
"attribute",
"s",
"type",
"by",
"Namespace",
"-",
"qualified",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L240-L249 |
32,828 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.clear | public void clear ()
{
if (data != null) {
for (int i = 0; i < (length * 5); i++)
data [i] = null;
}
length = 0;
} | java | public void clear ()
{
if (data != null) {
for (int i = 0; i < (length * 5); i++)
data [i] = null;
}
length = 0;
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"(",
"length",
"*",
"5",
")",
";",
"i",
"++",
")",
"data",
"[",
"i",
"]",
"=",
"null",
";",
"}",
"length... | Clear the attribute list for reuse.
<p>Note that little memory is freed by this call:
the current array is kept so it can be
reused.</p> | [
"Clear",
"the",
"attribute",
"list",
"for",
"reuse",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L327-L334 |
32,829 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.setAttributes | public void setAttributes (Attributes atts)
{
clear();
length = atts.getLength();
if (length > 0) {
data = new String[length*5];
for (int i = 0; i < length; i++) {
data[i*5] = atts.getURI(i);
data[i*5+1] = atts.getLocalName(i);
data[i*5+2] = atts.getQName(i);
data[i*5+3] = atts.getType(i);
data[i*5+4] = atts.getValue(i);
}
}
} | java | public void setAttributes (Attributes atts)
{
clear();
length = atts.getLength();
if (length > 0) {
data = new String[length*5];
for (int i = 0; i < length; i++) {
data[i*5] = atts.getURI(i);
data[i*5+1] = atts.getLocalName(i);
data[i*5+2] = atts.getQName(i);
data[i*5+3] = atts.getType(i);
data[i*5+4] = atts.getValue(i);
}
}
} | [
"public",
"void",
"setAttributes",
"(",
"Attributes",
"atts",
")",
"{",
"clear",
"(",
")",
";",
"length",
"=",
"atts",
".",
"getLength",
"(",
")",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"data",
"=",
"new",
"String",
"[",
"length",
"*",
"5",
... | Copy an entire Attributes object.
<p>It may be more efficient to reuse an existing object
rather than constantly allocating new ones.</p>
@param atts The attributes to copy. | [
"Copy",
"an",
"entire",
"Attributes",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L345-L359 |
32,830 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.addAttribute | public void addAttribute (String uri, String localName, String qName,
String type, String value)
{
ensureCapacity(length+1);
data[length*5] = uri;
data[length*5+1] = localName;
data[length*5+2] = qName;
data[length*5+3] = type;
data[length*5+4] = value;
length++;
} | java | public void addAttribute (String uri, String localName, String qName,
String type, String value)
{
ensureCapacity(length+1);
data[length*5] = uri;
data[length*5+1] = localName;
data[length*5+2] = qName;
data[length*5+3] = type;
data[length*5+4] = value;
length++;
} | [
"public",
"void",
"addAttribute",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"String",
"type",
",",
"String",
"value",
")",
"{",
"ensureCapacity",
"(",
"length",
"+",
"1",
")",
";",
"data",
"[",
"length",
"*",
"5",
"... | Add an attribute to the end of the list.
<p>For the sake of speed, this method does no checking
to see if the attribute is already in the list: that is
the responsibility of the application.</p>
@param uri The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed.
@param localName The local name, or the empty string if
Namespace processing is not being performed.
@param qName The qualified (prefixed) name, or the empty string
if qualified names are not available.
@param type The attribute type as a string.
@param value The attribute value. | [
"Add",
"an",
"attribute",
"to",
"the",
"end",
"of",
"the",
"list",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L379-L389 |
32,831 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.setAttribute | public void setAttribute (int index, String uri, String localName,
String qName, String type, String value)
{
if (index >= 0 && index < length) {
data[index*5] = uri;
data[index*5+1] = localName;
data[index*5+2] = qName;
data[index*5+3] = type;
data[index*5+4] = value;
} else {
badIndex(index);
}
} | java | public void setAttribute (int index, String uri, String localName,
String qName, String type, String value)
{
if (index >= 0 && index < length) {
data[index*5] = uri;
data[index*5+1] = localName;
data[index*5+2] = qName;
data[index*5+3] = type;
data[index*5+4] = value;
} else {
badIndex(index);
}
} | [
"public",
"void",
"setAttribute",
"(",
"int",
"index",
",",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"String",
"type",
",",
"String",
"value",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"length",
")",
... | Set an attribute in the list.
<p>For the sake of speed, this method does no checking
for name conflicts or well-formedness: such checks are the
responsibility of the application.</p>
@param index The index of the attribute (zero-based).
@param uri The Namespace URI, or the empty string if
none is available or Namespace processing is not
being performed.
@param localName The local name, or the empty string if
Namespace processing is not being performed.
@param qName The qualified name, or the empty string
if qualified names are not available.
@param type The attribute type as a string.
@param value The attribute value.
@exception java.lang.ArrayIndexOutOfBoundsException When the
supplied index does not point to an attribute
in the list. | [
"Set",
"an",
"attribute",
"in",
"the",
"list",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L413-L425 |
32,832 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.setURI | public void setURI (int index, String uri)
{
if (index >= 0 && index < length) {
data[index*5] = uri;
} else {
badIndex(index);
}
} | java | public void setURI (int index, String uri)
{
if (index >= 0 && index < length) {
data[index*5] = uri;
} else {
badIndex(index);
}
} | [
"public",
"void",
"setURI",
"(",
"int",
"index",
",",
"String",
"uri",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"length",
")",
"{",
"data",
"[",
"index",
"*",
"5",
"]",
"=",
"uri",
";",
"}",
"else",
"{",
"badIndex",
"(",
"in... | Set the Namespace URI of a specific attribute.
@param index The index of the attribute (zero-based).
@param uri The attribute's Namespace URI, or the empty
string for none.
@exception java.lang.ArrayIndexOutOfBoundsException When the
supplied index does not point to an attribute
in the list. | [
"Set",
"the",
"Namespace",
"URI",
"of",
"a",
"specific",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L466-L473 |
32,833 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.setLocalName | public void setLocalName (int index, String localName)
{
if (index >= 0 && index < length) {
data[index*5+1] = localName;
} else {
badIndex(index);
}
} | java | public void setLocalName (int index, String localName)
{
if (index >= 0 && index < length) {
data[index*5+1] = localName;
} else {
badIndex(index);
}
} | [
"public",
"void",
"setLocalName",
"(",
"int",
"index",
",",
"String",
"localName",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"length",
")",
"{",
"data",
"[",
"index",
"*",
"5",
"+",
"1",
"]",
"=",
"localName",
";",
"}",
"else",
... | Set the local name of a specific attribute.
@param index The index of the attribute (zero-based).
@param localName The attribute's local name, or the empty
string for none.
@exception java.lang.ArrayIndexOutOfBoundsException When the
supplied index does not point to an attribute
in the list. | [
"Set",
"the",
"local",
"name",
"of",
"a",
"specific",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L486-L493 |
32,834 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.setQName | public void setQName (int index, String qName)
{
if (index >= 0 && index < length) {
data[index*5+2] = qName;
} else {
badIndex(index);
}
} | java | public void setQName (int index, String qName)
{
if (index >= 0 && index < length) {
data[index*5+2] = qName;
} else {
badIndex(index);
}
} | [
"public",
"void",
"setQName",
"(",
"int",
"index",
",",
"String",
"qName",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"length",
")",
"{",
"data",
"[",
"index",
"*",
"5",
"+",
"2",
"]",
"=",
"qName",
";",
"}",
"else",
"{",
"bad... | Set the qualified name of a specific attribute.
@param index The index of the attribute (zero-based).
@param qName The attribute's qualified name, or the empty
string for none.
@exception java.lang.ArrayIndexOutOfBoundsException When the
supplied index does not point to an attribute
in the list. | [
"Set",
"the",
"qualified",
"name",
"of",
"a",
"specific",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L506-L513 |
32,835 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.setType | public void setType (int index, String type)
{
if (index >= 0 && index < length) {
data[index*5+3] = type;
} else {
badIndex(index);
}
} | java | public void setType (int index, String type)
{
if (index >= 0 && index < length) {
data[index*5+3] = type;
} else {
badIndex(index);
}
} | [
"public",
"void",
"setType",
"(",
"int",
"index",
",",
"String",
"type",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"length",
")",
"{",
"data",
"[",
"index",
"*",
"5",
"+",
"3",
"]",
"=",
"type",
";",
"}",
"else",
"{",
"badInd... | Set the type of a specific attribute.
@param index The index of the attribute (zero-based).
@param type The attribute's type.
@exception java.lang.ArrayIndexOutOfBoundsException When the
supplied index does not point to an attribute
in the list. | [
"Set",
"the",
"type",
"of",
"a",
"specific",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L525-L532 |
32,836 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.setValue | public void setValue (int index, String value)
{
if (index >= 0 && index < length) {
data[index*5+4] = value;
} else {
badIndex(index);
}
} | java | public void setValue (int index, String value)
{
if (index >= 0 && index < length) {
data[index*5+4] = value;
} else {
badIndex(index);
}
} | [
"public",
"void",
"setValue",
"(",
"int",
"index",
",",
"String",
"value",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"length",
")",
"{",
"data",
"[",
"index",
"*",
"5",
"+",
"4",
"]",
"=",
"value",
";",
"}",
"else",
"{",
"bad... | Set the value of a specific attribute.
@param index The index of the attribute (zero-based).
@param value The attribute's value.
@exception java.lang.ArrayIndexOutOfBoundsException When the
supplied index does not point to an attribute
in the list. | [
"Set",
"the",
"value",
"of",
"a",
"specific",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L544-L551 |
32,837 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java | AttributesImpl.ensureCapacity | private void ensureCapacity (int n) {
if (n <= 0) {
return;
}
int max;
if (data == null || data.length == 0) {
max = 25;
}
else if (data.length >= n * 5) {
return;
}
else {
max = data.length;
}
while (max < n * 5) {
max *= 2;
}
String newData[] = new String[max];
if (length > 0) {
System.arraycopy(data, 0, newData, 0, length*5);
}
data = newData;
} | java | private void ensureCapacity (int n) {
if (n <= 0) {
return;
}
int max;
if (data == null || data.length == 0) {
max = 25;
}
else if (data.length >= n * 5) {
return;
}
else {
max = data.length;
}
while (max < n * 5) {
max *= 2;
}
String newData[] = new String[max];
if (length > 0) {
System.arraycopy(data, 0, newData, 0, length*5);
}
data = newData;
} | [
"private",
"void",
"ensureCapacity",
"(",
"int",
"n",
")",
"{",
"if",
"(",
"n",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"int",
"max",
";",
"if",
"(",
"data",
"==",
"null",
"||",
"data",
".",
"length",
"==",
"0",
")",
"{",
"max",
"=",
"25",
"... | Ensure the internal array's capacity.
@param n The minimum number of attributes that the array must
be able to hold. | [
"Ensure",
"the",
"internal",
"array",
"s",
"capacity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L566-L589 |
32,838 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterNameReader.java | UCharacterNameReader.read | protected void read(UCharacterName data) throws IOException
{
// reading index
m_tokenstringindex_ = m_byteBuffer_.getInt();
m_groupindex_ = m_byteBuffer_.getInt();
m_groupstringindex_ = m_byteBuffer_.getInt();
m_algnamesindex_ = m_byteBuffer_.getInt();
// reading tokens
int count = m_byteBuffer_.getChar();
char token[] = ICUBinary.getChars(m_byteBuffer_, count, 0);
int size = m_groupindex_ - m_tokenstringindex_;
byte tokenstr[] = new byte[size];
m_byteBuffer_.get(tokenstr);
data.setToken(token, tokenstr);
// reading the group information records
count = m_byteBuffer_.getChar();
data.setGroupCountSize(count, GROUP_INFO_SIZE_);
count *= GROUP_INFO_SIZE_;
char group[] = ICUBinary.getChars(m_byteBuffer_, count, 0);
size = m_algnamesindex_ - m_groupstringindex_;
byte groupstring[] = new byte[size];
m_byteBuffer_.get(groupstring);
data.setGroup(group, groupstring);
count = m_byteBuffer_.getInt();
UCharacterName.AlgorithmName alg[] =
new UCharacterName.AlgorithmName[count];
for (int i = 0; i < count; i ++)
{
UCharacterName.AlgorithmName an = readAlg();
if (an == null) {
throw new IOException("unames.icu read error: Algorithmic names creation error");
}
alg[i] = an;
}
data.setAlgorithm(alg);
} | java | protected void read(UCharacterName data) throws IOException
{
// reading index
m_tokenstringindex_ = m_byteBuffer_.getInt();
m_groupindex_ = m_byteBuffer_.getInt();
m_groupstringindex_ = m_byteBuffer_.getInt();
m_algnamesindex_ = m_byteBuffer_.getInt();
// reading tokens
int count = m_byteBuffer_.getChar();
char token[] = ICUBinary.getChars(m_byteBuffer_, count, 0);
int size = m_groupindex_ - m_tokenstringindex_;
byte tokenstr[] = new byte[size];
m_byteBuffer_.get(tokenstr);
data.setToken(token, tokenstr);
// reading the group information records
count = m_byteBuffer_.getChar();
data.setGroupCountSize(count, GROUP_INFO_SIZE_);
count *= GROUP_INFO_SIZE_;
char group[] = ICUBinary.getChars(m_byteBuffer_, count, 0);
size = m_algnamesindex_ - m_groupstringindex_;
byte groupstring[] = new byte[size];
m_byteBuffer_.get(groupstring);
data.setGroup(group, groupstring);
count = m_byteBuffer_.getInt();
UCharacterName.AlgorithmName alg[] =
new UCharacterName.AlgorithmName[count];
for (int i = 0; i < count; i ++)
{
UCharacterName.AlgorithmName an = readAlg();
if (an == null) {
throw new IOException("unames.icu read error: Algorithmic names creation error");
}
alg[i] = an;
}
data.setAlgorithm(alg);
} | [
"protected",
"void",
"read",
"(",
"UCharacterName",
"data",
")",
"throws",
"IOException",
"{",
"// reading index",
"m_tokenstringindex_",
"=",
"m_byteBuffer_",
".",
"getInt",
"(",
")",
";",
"m_groupindex_",
"=",
"m_byteBuffer_",
".",
"getInt",
"(",
")",
";",
"m_... | Read and break up the stream of data passed in as arguments
and fills up UCharacterName.
If unsuccessful false will be returned.
@param data instance of datablock
@exception IOException thrown when there's a data error. | [
"Read",
"and",
"break",
"up",
"the",
"stream",
"of",
"data",
"passed",
"in",
"as",
"arguments",
"and",
"fills",
"up",
"UCharacterName",
".",
"If",
"unsuccessful",
"false",
"will",
"be",
"returned",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterNameReader.java#L61-L102 |
32,839 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterNameReader.java | UCharacterNameReader.readAlg | private UCharacterName.AlgorithmName readAlg() throws IOException
{
UCharacterName.AlgorithmName result =
new UCharacterName.AlgorithmName();
int rangestart = m_byteBuffer_.getInt();
int rangeend = m_byteBuffer_.getInt();
byte type = m_byteBuffer_.get();
byte variant = m_byteBuffer_.get();
if (!result.setInfo(rangestart, rangeend, type, variant)) {
return null;
}
int size = m_byteBuffer_.getChar();
if (type == UCharacterName.AlgorithmName.TYPE_1_)
{
char factor[] = ICUBinary.getChars(m_byteBuffer_, variant, 0);
result.setFactor(factor);
size -= (variant << 1);
}
StringBuilder prefix = new StringBuilder();
char c = (char)(m_byteBuffer_.get() & 0x00FF);
while (c != 0)
{
prefix.append(c);
c = (char)(m_byteBuffer_.get() & 0x00FF);
}
result.setPrefix(prefix.toString());
size -= (ALG_INFO_SIZE_ + prefix.length() + 1);
if (size > 0)
{
byte string[] = new byte[size];
m_byteBuffer_.get(string);
result.setFactorString(string);
}
return result;
} | java | private UCharacterName.AlgorithmName readAlg() throws IOException
{
UCharacterName.AlgorithmName result =
new UCharacterName.AlgorithmName();
int rangestart = m_byteBuffer_.getInt();
int rangeend = m_byteBuffer_.getInt();
byte type = m_byteBuffer_.get();
byte variant = m_byteBuffer_.get();
if (!result.setInfo(rangestart, rangeend, type, variant)) {
return null;
}
int size = m_byteBuffer_.getChar();
if (type == UCharacterName.AlgorithmName.TYPE_1_)
{
char factor[] = ICUBinary.getChars(m_byteBuffer_, variant, 0);
result.setFactor(factor);
size -= (variant << 1);
}
StringBuilder prefix = new StringBuilder();
char c = (char)(m_byteBuffer_.get() & 0x00FF);
while (c != 0)
{
prefix.append(c);
c = (char)(m_byteBuffer_.get() & 0x00FF);
}
result.setPrefix(prefix.toString());
size -= (ALG_INFO_SIZE_ + prefix.length() + 1);
if (size > 0)
{
byte string[] = new byte[size];
m_byteBuffer_.get(string);
result.setFactorString(string);
}
return result;
} | [
"private",
"UCharacterName",
".",
"AlgorithmName",
"readAlg",
"(",
")",
"throws",
"IOException",
"{",
"UCharacterName",
".",
"AlgorithmName",
"result",
"=",
"new",
"UCharacterName",
".",
"AlgorithmName",
"(",
")",
";",
"int",
"rangestart",
"=",
"m_byteBuffer_",
".... | Reads an individual record of AlgorithmNames
@return an instance of AlgorithNames if read is successful otherwise null
@exception IOException thrown when file read error occurs or data is corrupted | [
"Reads",
"an",
"individual",
"record",
"of",
"AlgorithmNames"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterNameReader.java#L159-L199 |
32,840 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/gen/TypeGenerator.java | TypeGenerator.getMethodSignature | protected String getMethodSignature(MethodDeclaration m) {
StringBuilder sb = new StringBuilder();
ExecutableElement element = m.getExecutableElement();
char prefix = Modifier.isStatic(m.getModifiers()) ? '+' : '-';
String returnType = nameTable.getObjCType(element.getReturnType());
String selector = nameTable.getMethodSelector(element);
if (m.isConstructor()) {
returnType = "instancetype";
} else if (selector.equals("hash")) {
// Explicitly test hashCode() because of NSObject's hash return value.
returnType = "NSUInteger";
}
sb.append(UnicodeUtils.format("%c (%s%s)", prefix, returnType, nullability(element)));
List<SingleVariableDeclaration> params = m.getParameters();
String[] selParts = selector.split(":");
if (params.isEmpty()) {
assert selParts.length == 1 && !selector.endsWith(":");
sb.append(selParts[0]);
} else {
assert params.size() == selParts.length;
int baseLength = sb.length() + selParts[0].length();
for (int i = 0; i < params.size(); i++) {
if (i != 0) {
sb.append('\n');
sb.append(pad(baseLength - selParts[i].length()));
}
VariableElement var = params.get(i).getVariableElement();
String typeName = nameTable.getObjCType(var.asType());
sb.append(
UnicodeUtils.format(
"%s:(%s%s)%s",
selParts[i], typeName, nullability(var), nameTable.getVariableShortName(var)));
}
}
return sb.toString();
} | java | protected String getMethodSignature(MethodDeclaration m) {
StringBuilder sb = new StringBuilder();
ExecutableElement element = m.getExecutableElement();
char prefix = Modifier.isStatic(m.getModifiers()) ? '+' : '-';
String returnType = nameTable.getObjCType(element.getReturnType());
String selector = nameTable.getMethodSelector(element);
if (m.isConstructor()) {
returnType = "instancetype";
} else if (selector.equals("hash")) {
// Explicitly test hashCode() because of NSObject's hash return value.
returnType = "NSUInteger";
}
sb.append(UnicodeUtils.format("%c (%s%s)", prefix, returnType, nullability(element)));
List<SingleVariableDeclaration> params = m.getParameters();
String[] selParts = selector.split(":");
if (params.isEmpty()) {
assert selParts.length == 1 && !selector.endsWith(":");
sb.append(selParts[0]);
} else {
assert params.size() == selParts.length;
int baseLength = sb.length() + selParts[0].length();
for (int i = 0; i < params.size(); i++) {
if (i != 0) {
sb.append('\n');
sb.append(pad(baseLength - selParts[i].length()));
}
VariableElement var = params.get(i).getVariableElement();
String typeName = nameTable.getObjCType(var.asType());
sb.append(
UnicodeUtils.format(
"%s:(%s%s)%s",
selParts[i], typeName, nullability(var), nameTable.getVariableShortName(var)));
}
}
return sb.toString();
} | [
"protected",
"String",
"getMethodSignature",
"(",
"MethodDeclaration",
"m",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"ExecutableElement",
"element",
"=",
"m",
".",
"getExecutableElement",
"(",
")",
";",
"char",
"prefix",
"=",
... | Create an Objective-C method signature string. | [
"Create",
"an",
"Objective",
"-",
"C",
"method",
"signature",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/gen/TypeGenerator.java#L279-L317 |
32,841 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java | Cache.newSoftMemoryCache | public static <K,V> Cache<K,V> newSoftMemoryCache(int size) {
return new MemoryCache<>(true, size);
} | java | public static <K,V> Cache<K,V> newSoftMemoryCache(int size) {
return new MemoryCache<>(true, size);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Cache",
"<",
"K",
",",
"V",
">",
"newSoftMemoryCache",
"(",
"int",
"size",
")",
"{",
"return",
"new",
"MemoryCache",
"<>",
"(",
"true",
",",
"size",
")",
";",
"}"
] | Return a new memory cache with the specified maximum size, unlimited
lifetime for entries, with the values held by SoftReferences. | [
"Return",
"a",
"new",
"memory",
"cache",
"with",
"the",
"specified",
"maximum",
"size",
"unlimited",
"lifetime",
"for",
"entries",
"with",
"the",
"values",
"held",
"by",
"SoftReferences",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java#L122-L124 |
32,842 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java | Cache.newHardMemoryCache | public static <K,V> Cache<K,V> newHardMemoryCache(int size) {
return new MemoryCache<>(false, size);
} | java | public static <K,V> Cache<K,V> newHardMemoryCache(int size) {
return new MemoryCache<>(false, size);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Cache",
"<",
"K",
",",
"V",
">",
"newHardMemoryCache",
"(",
"int",
"size",
")",
"{",
"return",
"new",
"MemoryCache",
"<>",
"(",
"false",
",",
"size",
")",
";",
"}"
] | Return a new memory cache with the specified maximum size, unlimited
lifetime for entries, with the values held by standard references. | [
"Return",
"a",
"new",
"memory",
"cache",
"with",
"the",
"specified",
"maximum",
"size",
"unlimited",
"lifetime",
"for",
"entries",
"with",
"the",
"values",
"held",
"by",
"standard",
"references",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java#L139-L141 |
32,843 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java | Cache.newNullCache | @SuppressWarnings("unchecked")
public static <K,V> Cache<K,V> newNullCache() {
return (Cache<K,V>) NullCache.INSTANCE;
} | java | @SuppressWarnings("unchecked")
public static <K,V> Cache<K,V> newNullCache() {
return (Cache<K,V>) NullCache.INSTANCE;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Cache",
"<",
"K",
",",
"V",
">",
"newNullCache",
"(",
")",
"{",
"return",
"(",
"Cache",
"<",
"K",
",",
"V",
">",
")",
"NullCache",
".",
"INSTANCE",
";... | Return a dummy cache that does nothing. | [
"Return",
"a",
"dummy",
"cache",
"that",
"does",
"nothing",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java#L146-L149 |
32,844 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java | MemoryCache.emptyQueue | private void emptyQueue() {
if (queue == null) {
return;
}
int startSize = cacheMap.size();
while (true) {
@SuppressWarnings("unchecked")
CacheEntry<K,V> entry = (CacheEntry<K,V>)queue.poll();
if (entry == null) {
break;
}
K key = entry.getKey();
if (key == null) {
// key is null, entry has already been removed
continue;
}
CacheEntry<K,V> currentEntry = cacheMap.remove(key);
// check if the entry in the map corresponds to the expired
// entry. If not, readd the entry
if ((currentEntry != null) && (entry != currentEntry)) {
cacheMap.put(key, currentEntry);
}
}
if (DEBUG) {
int endSize = cacheMap.size();
if (startSize != endSize) {
System.out.println("*** Expunged " + (startSize - endSize)
+ " entries, " + endSize + " entries left");
}
}
} | java | private void emptyQueue() {
if (queue == null) {
return;
}
int startSize = cacheMap.size();
while (true) {
@SuppressWarnings("unchecked")
CacheEntry<K,V> entry = (CacheEntry<K,V>)queue.poll();
if (entry == null) {
break;
}
K key = entry.getKey();
if (key == null) {
// key is null, entry has already been removed
continue;
}
CacheEntry<K,V> currentEntry = cacheMap.remove(key);
// check if the entry in the map corresponds to the expired
// entry. If not, readd the entry
if ((currentEntry != null) && (entry != currentEntry)) {
cacheMap.put(key, currentEntry);
}
}
if (DEBUG) {
int endSize = cacheMap.size();
if (startSize != endSize) {
System.out.println("*** Expunged " + (startSize - endSize)
+ " entries, " + endSize + " entries left");
}
}
} | [
"private",
"void",
"emptyQueue",
"(",
")",
"{",
"if",
"(",
"queue",
"==",
"null",
")",
"{",
"return",
";",
"}",
"int",
"startSize",
"=",
"cacheMap",
".",
"size",
"(",
")",
";",
"while",
"(",
"true",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecke... | Empty the reference queue and remove all corresponding entries
from the cache.
This method should be called at the beginning of each public
method. | [
"Empty",
"the",
"reference",
"queue",
"and",
"remove",
"all",
"corresponding",
"entries",
"from",
"the",
"cache",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java#L283-L313 |
32,845 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java | MemoryCache.expungeExpiredEntries | private void expungeExpiredEntries() {
emptyQueue();
if (lifetime == 0) {
return;
}
int cnt = 0;
long time = System.currentTimeMillis();
for (Iterator<CacheEntry<K,V>> t = cacheMap.values().iterator();
t.hasNext(); ) {
CacheEntry<K,V> entry = t.next();
if (entry.isValid(time) == false) {
t.remove();
cnt++;
}
}
if (DEBUG) {
if (cnt != 0) {
System.out.println("Removed " + cnt
+ " expired entries, remaining " + cacheMap.size());
}
}
} | java | private void expungeExpiredEntries() {
emptyQueue();
if (lifetime == 0) {
return;
}
int cnt = 0;
long time = System.currentTimeMillis();
for (Iterator<CacheEntry<K,V>> t = cacheMap.values().iterator();
t.hasNext(); ) {
CacheEntry<K,V> entry = t.next();
if (entry.isValid(time) == false) {
t.remove();
cnt++;
}
}
if (DEBUG) {
if (cnt != 0) {
System.out.println("Removed " + cnt
+ " expired entries, remaining " + cacheMap.size());
}
}
} | [
"private",
"void",
"expungeExpiredEntries",
"(",
")",
"{",
"emptyQueue",
"(",
")",
";",
"if",
"(",
"lifetime",
"==",
"0",
")",
"{",
"return",
";",
"}",
"int",
"cnt",
"=",
"0",
";",
"long",
"time",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";... | Scan all entries and remove all expired ones. | [
"Scan",
"all",
"entries",
"and",
"remove",
"all",
"expired",
"ones",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java#L318-L339 |
32,846 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java | MemoryCache.accept | public synchronized void accept(CacheVisitor<K,V> visitor) {
expungeExpiredEntries();
Map<K,V> cached = getCachedEntries();
visitor.visit(cached);
} | java | public synchronized void accept(CacheVisitor<K,V> visitor) {
expungeExpiredEntries();
Map<K,V> cached = getCachedEntries();
visitor.visit(cached);
} | [
"public",
"synchronized",
"void",
"accept",
"(",
"CacheVisitor",
"<",
"K",
",",
"V",
">",
"visitor",
")",
"{",
"expungeExpiredEntries",
"(",
")",
";",
"Map",
"<",
"K",
",",
"V",
">",
"cached",
"=",
"getCachedEntries",
"(",
")",
";",
"visitor",
".",
"vi... | it is a heavyweight method. | [
"it",
"is",
"a",
"heavyweight",
"method",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/Cache.java#L442-L447 |
32,847 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UCharacterIterator.java | UCharacterIterator.currentCodePoint | public int currentCodePoint() {
int ch = current();
if (UTF16.isLeadSurrogate((char) ch)) {
// advance the index to get the
// next code point
next();
// due to post increment semantics
// current() after next() actually
// returns the char we want
int ch2 = current();
// current should never change
// the current index so back off
previous();
if (UTF16.isTrailSurrogate((char) ch2)) {
// we found a surrogate pair
// return the codepoint
return Character.toCodePoint((char) ch, (char) ch2);
}
}
return ch;
} | java | public int currentCodePoint() {
int ch = current();
if (UTF16.isLeadSurrogate((char) ch)) {
// advance the index to get the
// next code point
next();
// due to post increment semantics
// current() after next() actually
// returns the char we want
int ch2 = current();
// current should never change
// the current index so back off
previous();
if (UTF16.isTrailSurrogate((char) ch2)) {
// we found a surrogate pair
// return the codepoint
return Character.toCodePoint((char) ch, (char) ch2);
}
}
return ch;
} | [
"public",
"int",
"currentCodePoint",
"(",
")",
"{",
"int",
"ch",
"=",
"current",
"(",
")",
";",
"if",
"(",
"UTF16",
".",
"isLeadSurrogate",
"(",
"(",
"char",
")",
"ch",
")",
")",
"{",
"// advance the index to get the",
"// next code point",
"next",
"(",
")... | Returns the codepoint at the current index. If the current index is invalid, DONE is returned. If the current
index points to a lead surrogate, and there is a following trail surrogate, then the code point is returned.
Otherwise, the code unit at index is returned. Index is not changed.
@return current codepoint | [
"Returns",
"the",
"codepoint",
"at",
"the",
"current",
"index",
".",
"If",
"the",
"current",
"index",
"is",
"invalid",
"DONE",
"is",
"returned",
".",
"If",
"the",
"current",
"index",
"points",
"to",
"a",
"lead",
"surrogate",
"and",
"there",
"is",
"a",
"f... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UCharacterIterator.java#L143-L164 |
32,848 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CharTrie.java | CharTrie.getSurrogateOffset | @Override
protected final int getSurrogateOffset(char lead, char trail)
{
if (m_dataManipulate_ == null) {
throw new NullPointerException(
"The field DataManipulate in this Trie is null");
}
// get fold position for the next trail surrogate
int offset = m_dataManipulate_.getFoldingOffset(getLeadValue(lead));
// get the real data from the folded lead/trail units
if (offset > 0) {
return getRawOffset(offset, (char)(trail & SURROGATE_MASK_));
}
// return -1 if there is an error, in this case we return the default
// value: m_initialValue_
return -1;
} | java | @Override
protected final int getSurrogateOffset(char lead, char trail)
{
if (m_dataManipulate_ == null) {
throw new NullPointerException(
"The field DataManipulate in this Trie is null");
}
// get fold position for the next trail surrogate
int offset = m_dataManipulate_.getFoldingOffset(getLeadValue(lead));
// get the real data from the folded lead/trail units
if (offset > 0) {
return getRawOffset(offset, (char)(trail & SURROGATE_MASK_));
}
// return -1 if there is an error, in this case we return the default
// value: m_initialValue_
return -1;
} | [
"@",
"Override",
"protected",
"final",
"int",
"getSurrogateOffset",
"(",
"char",
"lead",
",",
"char",
"trail",
")",
"{",
"if",
"(",
"m_dataManipulate_",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"The field DataManipulate in this Trie is ... | Gets the offset to the data which the surrogate pair points to.
@param lead lead surrogate
@param trail trailing surrogate
@return offset to data | [
"Gets",
"the",
"offset",
"to",
"the",
"data",
"which",
"the",
"surrogate",
"pair",
"points",
"to",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CharTrie.java#L257-L276 |
32,849 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/CheckedOutputStream.java | CheckedOutputStream.write | public void write(byte[] b, int off, int len) throws IOException {
out.write(b, off, len);
cksum.update(b, off, len);
} | java | public void write(byte[] b, int off, int len) throws IOException {
out.write(b, off, len);
cksum.update(b, off, len);
} | [
"public",
"void",
"write",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"b",
",",
"off",
",",
"len",
")",
";",
"cksum",
".",
"update",
"(",
"b",
",",
"off",
",",
... | Writes an array of bytes. Will block until the bytes are
actually written.
@param b the data to be written
@param off the start offset of the data
@param len the number of bytes to be written
@exception IOException if an I/O error has occurred | [
"Writes",
"an",
"array",
"of",
"bytes",
".",
"Will",
"block",
"until",
"the",
"bytes",
"are",
"actually",
"written",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/CheckedOutputStream.java#L72-L75 |
32,850 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/PollArrayWrapper.java | PollArrayWrapper.addEntry | void addEntry(SelChImpl sc) {
putDescriptor(totalChannels, IOUtil.fdVal(sc.getFD()));
putEventOps(totalChannels, 0);
putReventOps(totalChannels, 0);
totalChannels++;
} | java | void addEntry(SelChImpl sc) {
putDescriptor(totalChannels, IOUtil.fdVal(sc.getFD()));
putEventOps(totalChannels, 0);
putReventOps(totalChannels, 0);
totalChannels++;
} | [
"void",
"addEntry",
"(",
"SelChImpl",
"sc",
")",
"{",
"putDescriptor",
"(",
"totalChannels",
",",
"IOUtil",
".",
"fdVal",
"(",
"sc",
".",
"getFD",
"(",
")",
")",
")",
";",
"putEventOps",
"(",
"totalChannels",
",",
"0",
")",
";",
"putReventOps",
"(",
"t... | Prepare another pollfd struct for use. | [
"Prepare",
"another",
"pollfd",
"struct",
"for",
"use",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/PollArrayWrapper.java#L76-L81 |
32,851 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/PollArrayWrapper.java | PollArrayWrapper.replaceEntry | static void replaceEntry(PollArrayWrapper source, int sindex,
PollArrayWrapper target, int tindex) {
target.putDescriptor(tindex, source.getDescriptor(sindex));
target.putEventOps(tindex, source.getEventOps(sindex));
target.putReventOps(tindex, source.getReventOps(sindex));
} | java | static void replaceEntry(PollArrayWrapper source, int sindex,
PollArrayWrapper target, int tindex) {
target.putDescriptor(tindex, source.getDescriptor(sindex));
target.putEventOps(tindex, source.getEventOps(sindex));
target.putReventOps(tindex, source.getReventOps(sindex));
} | [
"static",
"void",
"replaceEntry",
"(",
"PollArrayWrapper",
"source",
",",
"int",
"sindex",
",",
"PollArrayWrapper",
"target",
",",
"int",
"tindex",
")",
"{",
"target",
".",
"putDescriptor",
"(",
"tindex",
",",
"source",
".",
"getDescriptor",
"(",
"sindex",
")"... | Writes the pollfd entry from the source wrapper at the source index
over the entry in the target wrapper at the target index. The source
array remains unchanged unless the source array and the target are
the same array. | [
"Writes",
"the",
"pollfd",
"entry",
"from",
"the",
"source",
"wrapper",
"at",
"the",
"source",
"index",
"over",
"the",
"entry",
"in",
"the",
"target",
"wrapper",
"at",
"the",
"target",
"index",
".",
"The",
"source",
"array",
"remains",
"unchanged",
"unless",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/PollArrayWrapper.java#L89-L94 |
32,852 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFilteredSentenceBreakIterator.java | SimpleFilteredSentenceBreakIterator.breakExceptionAt | private final boolean breakExceptionAt(int n) {
// Note: the C++ version of this function is SimpleFilteredSentenceBreakIterator::breakExceptionAt()
int bestPosn = -1;
int bestValue = -1;
// loops while 'n' points to an exception
text.setIndex(n);
backwardsTrie.reset();
int uch;
// Assume a space is following the '.' (so we handle the case: "Mr. /Brown")
if ((uch = text.previousCodePoint()) == ' ') { // TODO: skip a class of chars here??
// TODO only do this the 1st time?
} else {
uch = text.nextCodePoint();
}
BytesTrie.Result r = BytesTrie.Result.INTERMEDIATE_VALUE;
while ((uch = text.previousCodePoint()) != UCharacterIterator.DONE && // more to consume backwards and..
((r = backwardsTrie.nextForCodePoint(uch)).hasNext())) {// more in the trie
if (r.hasValue()) { // remember the best match so far
bestPosn = text.getIndex();
bestValue = backwardsTrie.getValue();
}
}
if (r.matches()) { // exact match?
bestValue = backwardsTrie.getValue();
bestPosn = text.getIndex();
}
if (bestPosn >= 0) {
if (bestValue == Builder.MATCH) { // exact match!
return true; // Exception here.
} else if (bestValue == Builder.PARTIAL && forwardsPartialTrie != null) {
// make sure there's a forward trie
// We matched the "Ph." in "Ph.D." - now we need to run everything through the forwards trie
// to see if it matches something going forward.
forwardsPartialTrie.reset();
BytesTrie.Result rfwd = BytesTrie.Result.INTERMEDIATE_VALUE;
text.setIndex(bestPosn); // hope that's close ..
while ((uch = text.nextCodePoint()) != BreakIterator.DONE
&& ((rfwd = forwardsPartialTrie.nextForCodePoint(uch)).hasNext())) {
}
if (rfwd.matches()) {
// Exception here
return true;
} // else fall through
} // else fall through
} // else fall through
return false; // No exception here.
} | java | private final boolean breakExceptionAt(int n) {
// Note: the C++ version of this function is SimpleFilteredSentenceBreakIterator::breakExceptionAt()
int bestPosn = -1;
int bestValue = -1;
// loops while 'n' points to an exception
text.setIndex(n);
backwardsTrie.reset();
int uch;
// Assume a space is following the '.' (so we handle the case: "Mr. /Brown")
if ((uch = text.previousCodePoint()) == ' ') { // TODO: skip a class of chars here??
// TODO only do this the 1st time?
} else {
uch = text.nextCodePoint();
}
BytesTrie.Result r = BytesTrie.Result.INTERMEDIATE_VALUE;
while ((uch = text.previousCodePoint()) != UCharacterIterator.DONE && // more to consume backwards and..
((r = backwardsTrie.nextForCodePoint(uch)).hasNext())) {// more in the trie
if (r.hasValue()) { // remember the best match so far
bestPosn = text.getIndex();
bestValue = backwardsTrie.getValue();
}
}
if (r.matches()) { // exact match?
bestValue = backwardsTrie.getValue();
bestPosn = text.getIndex();
}
if (bestPosn >= 0) {
if (bestValue == Builder.MATCH) { // exact match!
return true; // Exception here.
} else if (bestValue == Builder.PARTIAL && forwardsPartialTrie != null) {
// make sure there's a forward trie
// We matched the "Ph." in "Ph.D." - now we need to run everything through the forwards trie
// to see if it matches something going forward.
forwardsPartialTrie.reset();
BytesTrie.Result rfwd = BytesTrie.Result.INTERMEDIATE_VALUE;
text.setIndex(bestPosn); // hope that's close ..
while ((uch = text.nextCodePoint()) != BreakIterator.DONE
&& ((rfwd = forwardsPartialTrie.nextForCodePoint(uch)).hasNext())) {
}
if (rfwd.matches()) {
// Exception here
return true;
} // else fall through
} // else fall through
} // else fall through
return false; // No exception here.
} | [
"private",
"final",
"boolean",
"breakExceptionAt",
"(",
"int",
"n",
")",
"{",
"// Note: the C++ version of this function is SimpleFilteredSentenceBreakIterator::breakExceptionAt()",
"int",
"bestPosn",
"=",
"-",
"1",
";",
"int",
"bestValue",
"=",
"-",
"1",
";",
"// loops w... | Is there an exception at this point?
@param n
@return | [
"Is",
"there",
"an",
"exception",
"at",
"this",
"point?"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFilteredSentenceBreakIterator.java#L65-L119 |
32,853 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/Log.java | Log.setWtfHandler | public static TerribleFailureHandler setWtfHandler(TerribleFailureHandler handler) {
if (handler == null) {
throw new NullPointerException("handler == null");
}
TerribleFailureHandler oldHandler = sWtfHandler;
sWtfHandler = handler;
return oldHandler;
} | java | public static TerribleFailureHandler setWtfHandler(TerribleFailureHandler handler) {
if (handler == null) {
throw new NullPointerException("handler == null");
}
TerribleFailureHandler oldHandler = sWtfHandler;
sWtfHandler = handler;
return oldHandler;
} | [
"public",
"static",
"TerribleFailureHandler",
"setWtfHandler",
"(",
"TerribleFailureHandler",
"handler",
")",
"{",
"if",
"(",
"handler",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"handler == null\"",
")",
";",
"}",
"TerribleFailureHandler"... | Sets the terrible failure handler, for testing.
@return the old handler
@hide | [
"Sets",
"the",
"terrible",
"failure",
"handler",
"for",
"testing",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/Log.java#L352-L359 |
32,854 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyGenerator.java | KeyGenerator.init | public final void init(AlgorithmParameterSpec params, SecureRandom random)
throws InvalidAlgorithmParameterException
{
if (serviceIterator == null) {
spi.engineInit(params, random);
return;
}
Exception failure = null;
KeyGeneratorSpi mySpi = spi;
do {
try {
mySpi.engineInit(params, random);
initType = I_PARAMS;
initKeySize = 0;
initParams = params;
initRandom = random;
return;
} catch (Exception e) {
if (failure == null) {
failure = e;
}
mySpi = nextSpi(mySpi, false);
}
} while (mySpi != null);
if (failure instanceof InvalidAlgorithmParameterException) {
throw (InvalidAlgorithmParameterException)failure;
}
if (failure instanceof RuntimeException) {
throw (RuntimeException)failure;
}
throw new InvalidAlgorithmParameterException("init() failed", failure);
} | java | public final void init(AlgorithmParameterSpec params, SecureRandom random)
throws InvalidAlgorithmParameterException
{
if (serviceIterator == null) {
spi.engineInit(params, random);
return;
}
Exception failure = null;
KeyGeneratorSpi mySpi = spi;
do {
try {
mySpi.engineInit(params, random);
initType = I_PARAMS;
initKeySize = 0;
initParams = params;
initRandom = random;
return;
} catch (Exception e) {
if (failure == null) {
failure = e;
}
mySpi = nextSpi(mySpi, false);
}
} while (mySpi != null);
if (failure instanceof InvalidAlgorithmParameterException) {
throw (InvalidAlgorithmParameterException)failure;
}
if (failure instanceof RuntimeException) {
throw (RuntimeException)failure;
}
throw new InvalidAlgorithmParameterException("init() failed", failure);
} | [
"public",
"final",
"void",
"init",
"(",
"AlgorithmParameterSpec",
"params",
",",
"SecureRandom",
"random",
")",
"throws",
"InvalidAlgorithmParameterException",
"{",
"if",
"(",
"serviceIterator",
"==",
"null",
")",
"{",
"spi",
".",
"engineInit",
"(",
"params",
",",... | Initializes this key generator with the specified parameter
set and a user-provided source of randomness.
@param params the key generation parameters
@param random the source of randomness for this key generator
@exception InvalidAlgorithmParameterException if <code>params</code> is
inappropriate for this key generator | [
"Initializes",
"this",
"key",
"generator",
"with",
"the",
"specified",
"parameter",
"set",
"and",
"a",
"user",
"-",
"provided",
"source",
"of",
"randomness",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyGenerator.java#L507-L538 |
32,855 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyGenerator.java | KeyGenerator.init | public final void init(int keysize, SecureRandom random) {
if (serviceIterator == null) {
spi.engineInit(keysize, random);
return;
}
RuntimeException failure = null;
KeyGeneratorSpi mySpi = spi;
do {
try {
mySpi.engineInit(keysize, random);
initType = I_SIZE;
initKeySize = keysize;
initParams = null;
initRandom = random;
return;
} catch (RuntimeException e) {
if (failure == null) {
failure = e;
}
mySpi = nextSpi(mySpi, false);
}
} while (mySpi != null);
throw failure;
} | java | public final void init(int keysize, SecureRandom random) {
if (serviceIterator == null) {
spi.engineInit(keysize, random);
return;
}
RuntimeException failure = null;
KeyGeneratorSpi mySpi = spi;
do {
try {
mySpi.engineInit(keysize, random);
initType = I_SIZE;
initKeySize = keysize;
initParams = null;
initRandom = random;
return;
} catch (RuntimeException e) {
if (failure == null) {
failure = e;
}
mySpi = nextSpi(mySpi, false);
}
} while (mySpi != null);
throw failure;
} | [
"public",
"final",
"void",
"init",
"(",
"int",
"keysize",
",",
"SecureRandom",
"random",
")",
"{",
"if",
"(",
"serviceIterator",
"==",
"null",
")",
"{",
"spi",
".",
"engineInit",
"(",
"keysize",
",",
"random",
")",
";",
"return",
";",
"}",
"RuntimeExcept... | Initializes this key generator for a certain keysize, using a
user-provided source of randomness.
@param keysize the keysize. This is an algorithm-specific metric,
specified in number of bits.
@param random the source of randomness for this key generator
@exception InvalidParameterException if the keysize is wrong or not
supported. | [
"Initializes",
"this",
"key",
"generator",
"for",
"a",
"certain",
"keysize",
"using",
"a",
"user",
"-",
"provided",
"source",
"of",
"randomness",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyGenerator.java#L572-L595 |
32,856 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/NamespaceSupport.java | NamespaceSupport.reset | public void reset ()
{
contexts = new Context[32];
namespaceDeclUris = false;
contextPos = 0;
contexts[contextPos] = currentContext = new Context();
currentContext.declarePrefix("xml", XMLNS);
} | java | public void reset ()
{
contexts = new Context[32];
namespaceDeclUris = false;
contextPos = 0;
contexts[contextPos] = currentContext = new Context();
currentContext.declarePrefix("xml", XMLNS);
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"contexts",
"=",
"new",
"Context",
"[",
"32",
"]",
";",
"namespaceDeclUris",
"=",
"false",
";",
"contextPos",
"=",
"0",
";",
"contexts",
"[",
"contextPos",
"]",
"=",
"currentContext",
"=",
"new",
"Context",
"(",
... | Reset this Namespace support object for reuse.
<p>It is necessary to invoke this method before reusing the
Namespace support object for a new session. If namespace
declaration URIs are to be supported, that flag must also
be set to a non-default value.
</p>
@see #setNamespaceDeclUris | [
"Reset",
"this",
"Namespace",
"support",
"object",
"for",
"reuse",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/NamespaceSupport.java#L151-L158 |
32,857 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/NamespaceSupport.java | NamespaceSupport.pushContext | public void pushContext ()
{
int max = contexts.length;
contexts [contextPos].declsOK = false;
contextPos++;
// Extend the array if necessary
if (contextPos >= max) {
Context newContexts[] = new Context[max*2];
System.arraycopy(contexts, 0, newContexts, 0, max);
max *= 2;
contexts = newContexts;
}
// Allocate the context if necessary.
currentContext = contexts[contextPos];
if (currentContext == null) {
contexts[contextPos] = currentContext = new Context();
}
// Set the parent, if any.
if (contextPos > 0) {
currentContext.setParent(contexts[contextPos - 1]);
}
} | java | public void pushContext ()
{
int max = contexts.length;
contexts [contextPos].declsOK = false;
contextPos++;
// Extend the array if necessary
if (contextPos >= max) {
Context newContexts[] = new Context[max*2];
System.arraycopy(contexts, 0, newContexts, 0, max);
max *= 2;
contexts = newContexts;
}
// Allocate the context if necessary.
currentContext = contexts[contextPos];
if (currentContext == null) {
contexts[contextPos] = currentContext = new Context();
}
// Set the parent, if any.
if (contextPos > 0) {
currentContext.setParent(contexts[contextPos - 1]);
}
} | [
"public",
"void",
"pushContext",
"(",
")",
"{",
"int",
"max",
"=",
"contexts",
".",
"length",
";",
"contexts",
"[",
"contextPos",
"]",
".",
"declsOK",
"=",
"false",
";",
"contextPos",
"++",
";",
"// Extend the array if necessary",
"if",
"(",
"contextPos",
">... | Start a new Namespace context.
The new context will automatically inherit
the declarations of its parent context, but it will also keep
track of which declarations were made within this context.
<p>Event callback code should start a new context once per element.
This means being ready to call this in either of two places.
For elements that don't include namespace declarations, the
<em>ContentHandler.startElement()</em> callback is the right place.
For elements with such a declaration, it'd done in the first
<em>ContentHandler.startPrefixMapping()</em> callback.
A boolean flag can be used to
track whether a context has been started yet. When either of
those methods is called, it checks the flag to see if a new context
needs to be started. If so, it starts the context and sets the
flag. After <em>ContentHandler.startElement()</em>
does that, it always clears the flag.
<p>Normally, SAX drivers would push a new context at the beginning
of each XML element. Then they perform a first pass over the
attributes to process all namespace declarations, making
<em>ContentHandler.startPrefixMapping()</em> callbacks.
Then a second pass is made, to determine the namespace-qualified
names for all attributes and for the element name.
Finally all the information for the
<em>ContentHandler.startElement()</em> callback is available,
so it can then be made.
<p>The Namespace support object always starts with a base context
already in force: in this context, only the "xml" prefix is
declared.</p>
@see org.xml.sax.ContentHandler
@see #popContext | [
"Start",
"a",
"new",
"Namespace",
"context",
".",
"The",
"new",
"context",
"will",
"automatically",
"inherit",
"the",
"declarations",
"of",
"its",
"parent",
"context",
"but",
"it",
"will",
"also",
"keep",
"track",
"of",
"which",
"declarations",
"were",
"made",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/NamespaceSupport.java#L197-L222 |
32,858 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/NamespaceSupport.java | NamespaceSupport.getPrefixes | public Enumeration getPrefixes(String uri) {
ArrayList<String> prefixes = new ArrayList<String>();
Enumeration allPrefixes = getPrefixes();
while (allPrefixes.hasMoreElements()) {
String prefix = (String) allPrefixes.nextElement();
if (uri.equals(getURI(prefix))) {
prefixes.add(prefix);
}
}
return Collections.enumeration(prefixes);
} | java | public Enumeration getPrefixes(String uri) {
ArrayList<String> prefixes = new ArrayList<String>();
Enumeration allPrefixes = getPrefixes();
while (allPrefixes.hasMoreElements()) {
String prefix = (String) allPrefixes.nextElement();
if (uri.equals(getURI(prefix))) {
prefixes.add(prefix);
}
}
return Collections.enumeration(prefixes);
} | [
"public",
"Enumeration",
"getPrefixes",
"(",
"String",
"uri",
")",
"{",
"ArrayList",
"<",
"String",
">",
"prefixes",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Enumeration",
"allPrefixes",
"=",
"getPrefixes",
"(",
")",
";",
"while",
"(",
... | Return an enumeration of all prefixes for a given URI whose
declarations are active in the current context.
This includes declarations from parent contexts that have
not been overridden.
<p>This method returns prefixes mapped to a specific Namespace
URI. The xml: prefix will be included. If you want only one
prefix that's mapped to the Namespace URI, and you don't care
which one you get, use the {@link #getPrefix getPrefix}
method instead.</p>
<p><strong>Note:</strong> the empty (default) prefix is <em>never</em> included
in this enumeration; to check for the presence of a default
Namespace, use the {@link #getURI getURI} method with an
argument of "".</p>
@param uri The Namespace URI.
@return An enumeration of prefixes (never empty).
@see #getPrefix
@see #getDeclaredPrefixes
@see #getURI | [
"Return",
"an",
"enumeration",
"of",
"all",
"prefixes",
"for",
"a",
"given",
"URI",
"whose",
"declarations",
"are",
"active",
"in",
"the",
"current",
"context",
".",
"This",
"includes",
"declarations",
"from",
"parent",
"contexts",
"that",
"have",
"not",
"been... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/NamespaceSupport.java#L445-L455 |
32,859 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/MeasureUnit.java | MeasureUnit.getAvailable | public synchronized static Set<MeasureUnit> getAvailable(String type) {
populateCache();
Map<String, MeasureUnit> units = cache.get(type);
// Train users not to modify returned set from the start giving us more
// flexibility for implementation.
return units == null ? Collections.<MeasureUnit>emptySet()
: Collections.unmodifiableSet(new HashSet<MeasureUnit>(units.values()));
} | java | public synchronized static Set<MeasureUnit> getAvailable(String type) {
populateCache();
Map<String, MeasureUnit> units = cache.get(type);
// Train users not to modify returned set from the start giving us more
// flexibility for implementation.
return units == null ? Collections.<MeasureUnit>emptySet()
: Collections.unmodifiableSet(new HashSet<MeasureUnit>(units.values()));
} | [
"public",
"synchronized",
"static",
"Set",
"<",
"MeasureUnit",
">",
"getAvailable",
"(",
"String",
"type",
")",
"{",
"populateCache",
"(",
")",
";",
"Map",
"<",
"String",
",",
"MeasureUnit",
">",
"units",
"=",
"cache",
".",
"get",
"(",
"type",
")",
";",
... | For the given type, return the available units.
@param type the type
@return the available units for type. Returned set is unmodifiable. | [
"For",
"the",
"given",
"type",
"return",
"the",
"available",
"units",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/MeasureUnit.java#L137-L144 |
32,860 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/MeasureUnit.java | MeasureUnit.getAvailable | public synchronized static Set<MeasureUnit> getAvailable() {
Set<MeasureUnit> result = new HashSet<MeasureUnit>();
for (String type : new HashSet<String>(MeasureUnit.getAvailableTypes())) {
for (MeasureUnit unit : MeasureUnit.getAvailable(type)) {
result.add(unit);
}
}
// Train users not to modify returned set from the start giving us more
// flexibility for implementation.
return Collections.unmodifiableSet(result);
} | java | public synchronized static Set<MeasureUnit> getAvailable() {
Set<MeasureUnit> result = new HashSet<MeasureUnit>();
for (String type : new HashSet<String>(MeasureUnit.getAvailableTypes())) {
for (MeasureUnit unit : MeasureUnit.getAvailable(type)) {
result.add(unit);
}
}
// Train users not to modify returned set from the start giving us more
// flexibility for implementation.
return Collections.unmodifiableSet(result);
} | [
"public",
"synchronized",
"static",
"Set",
"<",
"MeasureUnit",
">",
"getAvailable",
"(",
")",
"{",
"Set",
"<",
"MeasureUnit",
">",
"result",
"=",
"new",
"HashSet",
"<",
"MeasureUnit",
">",
"(",
")",
";",
"for",
"(",
"String",
"type",
":",
"new",
"HashSet... | Get all of the available units. Returned set is unmodifiable. | [
"Get",
"all",
"of",
"the",
"available",
"units",
".",
"Returned",
"set",
"is",
"unmodifiable",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/MeasureUnit.java#L149-L159 |
32,861 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/MeasureUnit.java | MeasureUnit.resolveUnitPerUnit | @Deprecated
public static MeasureUnit resolveUnitPerUnit(MeasureUnit unit, MeasureUnit perUnit) {
return unitPerUnitToSingleUnit.get(Pair.of(unit, perUnit));
} | java | @Deprecated
public static MeasureUnit resolveUnitPerUnit(MeasureUnit unit, MeasureUnit perUnit) {
return unitPerUnitToSingleUnit.get(Pair.of(unit, perUnit));
} | [
"@",
"Deprecated",
"public",
"static",
"MeasureUnit",
"resolveUnitPerUnit",
"(",
"MeasureUnit",
"unit",
",",
"MeasureUnit",
"perUnit",
")",
"{",
"return",
"unitPerUnitToSingleUnit",
".",
"get",
"(",
"Pair",
".",
"of",
"(",
"unit",
",",
"perUnit",
")",
")",
";"... | For ICU use only.
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"For",
"ICU",
"use",
"only",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/MeasureUnit.java#L199-L202 |
32,862 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/MatchOps.java | MatchOps.makeRef | public static <T> TerminalOp<T, Boolean> makeRef(Predicate<? super T> predicate,
MatchKind matchKind) {
Objects.requireNonNull(predicate);
Objects.requireNonNull(matchKind);
class MatchSink extends BooleanTerminalSink<T> {
MatchSink() {
super(matchKind);
}
@Override
public void accept(T t) {
if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
stop = true;
value = matchKind.shortCircuitResult;
}
}
}
return new MatchOp<>(StreamShape.REFERENCE, matchKind, MatchSink::new);
} | java | public static <T> TerminalOp<T, Boolean> makeRef(Predicate<? super T> predicate,
MatchKind matchKind) {
Objects.requireNonNull(predicate);
Objects.requireNonNull(matchKind);
class MatchSink extends BooleanTerminalSink<T> {
MatchSink() {
super(matchKind);
}
@Override
public void accept(T t) {
if (!stop && predicate.test(t) == matchKind.stopOnPredicateMatches) {
stop = true;
value = matchKind.shortCircuitResult;
}
}
}
return new MatchOp<>(StreamShape.REFERENCE, matchKind, MatchSink::new);
} | [
"public",
"static",
"<",
"T",
">",
"TerminalOp",
"<",
"T",
",",
"Boolean",
">",
"makeRef",
"(",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
",",
"MatchKind",
"matchKind",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"predicate",
")",
";",
... | Constructs a quantified predicate matcher for a Stream.
@param <T> the type of stream elements
@param predicate the {@code Predicate} to apply to stream elements
@param matchKind the kind of quantified match (all, any, none)
@return a {@code TerminalOp} implementing the desired quantified match
criteria | [
"Constructs",
"a",
"quantified",
"predicate",
"matcher",
"for",
"a",
"Stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/MatchOps.java#L79-L98 |
32,863 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/StrictMath.java | StrictMath.floorOrCeil | private static double floorOrCeil(double a,
double negativeBoundary,
double positiveBoundary,
double sign) {
int exponent = Math.getExponent(a);
if (exponent < 0) {
/*
* Absolute value of argument is less than 1.
* floorOrceil(-0.0) => -0.0
* floorOrceil(+0.0) => +0.0
*/
return ((a == 0.0) ? a :
( (a < 0.0) ? negativeBoundary : positiveBoundary) );
} else if (exponent >= 52) {
/*
* Infinity, NaN, or a value so large it must be integral.
*/
return a;
}
// Else the argument is either an integral value already XOR it
// has to be rounded to one.
assert exponent >= 0 && exponent <= 51;
long doppel = Double.doubleToRawLongBits(a);
long mask = DoubleConsts.SIGNIF_BIT_MASK >> exponent;
if ( (mask & doppel) == 0L )
return a; // integral value
else {
double result = Double.longBitsToDouble(doppel & (~mask));
if (sign*a > 0.0)
result = result + sign;
return result;
}
} | java | private static double floorOrCeil(double a,
double negativeBoundary,
double positiveBoundary,
double sign) {
int exponent = Math.getExponent(a);
if (exponent < 0) {
/*
* Absolute value of argument is less than 1.
* floorOrceil(-0.0) => -0.0
* floorOrceil(+0.0) => +0.0
*/
return ((a == 0.0) ? a :
( (a < 0.0) ? negativeBoundary : positiveBoundary) );
} else if (exponent >= 52) {
/*
* Infinity, NaN, or a value so large it must be integral.
*/
return a;
}
// Else the argument is either an integral value already XOR it
// has to be rounded to one.
assert exponent >= 0 && exponent <= 51;
long doppel = Double.doubleToRawLongBits(a);
long mask = DoubleConsts.SIGNIF_BIT_MASK >> exponent;
if ( (mask & doppel) == 0L )
return a; // integral value
else {
double result = Double.longBitsToDouble(doppel & (~mask));
if (sign*a > 0.0)
result = result + sign;
return result;
}
} | [
"private",
"static",
"double",
"floorOrCeil",
"(",
"double",
"a",
",",
"double",
"negativeBoundary",
",",
"double",
"positiveBoundary",
",",
"double",
"sign",
")",
"{",
"int",
"exponent",
"=",
"Math",
".",
"getExponent",
"(",
"a",
")",
";",
"if",
"(",
"exp... | Internal method to share logic between floor and ceil.
@param a the value to be floored or ceiled
@param negativeBoundary result for values in (-1, 0)
@param positiveBoundary result for values in (0, 1)
@param increment value to add when the argument is non-integral | [
"Internal",
"method",
"to",
"share",
"logic",
"between",
"floor",
"and",
"ceil",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/StrictMath.java#L370-L405 |
32,864 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java | TemplateList.dumpAssociationTables | void dumpAssociationTables()
{
Enumeration associations = m_patternTable.elements();
while (associations.hasMoreElements())
{
TemplateSubPatternAssociation head =
(TemplateSubPatternAssociation) associations.nextElement();
while (null != head)
{
System.out.print("(" + head.getTargetString() + ", "
+ head.getPattern() + ")");
head = head.getNext();
}
System.out.println("\n.....");
}
TemplateSubPatternAssociation head = m_wildCardPatterns;
System.out.print("wild card list: ");
while (null != head)
{
System.out.print("(" + head.getTargetString() + ", "
+ head.getPattern() + ")");
head = head.getNext();
}
System.out.println("\n.....");
} | java | void dumpAssociationTables()
{
Enumeration associations = m_patternTable.elements();
while (associations.hasMoreElements())
{
TemplateSubPatternAssociation head =
(TemplateSubPatternAssociation) associations.nextElement();
while (null != head)
{
System.out.print("(" + head.getTargetString() + ", "
+ head.getPattern() + ")");
head = head.getNext();
}
System.out.println("\n.....");
}
TemplateSubPatternAssociation head = m_wildCardPatterns;
System.out.print("wild card list: ");
while (null != head)
{
System.out.print("(" + head.getTargetString() + ", "
+ head.getPattern() + ")");
head = head.getNext();
}
System.out.println("\n.....");
} | [
"void",
"dumpAssociationTables",
"(",
")",
"{",
"Enumeration",
"associations",
"=",
"m_patternTable",
".",
"elements",
"(",
")",
";",
"while",
"(",
"associations",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"TemplateSubPatternAssociation",
"head",
"=",
"(",
"Te... | Dump all patterns and elements that match those patterns | [
"Dump",
"all",
"patterns",
"and",
"elements",
"that",
"match",
"those",
"patterns"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L133-L167 |
32,865 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java | TemplateList.compose | public void compose(StylesheetRoot sroot)
{
if (DEBUG)
{
System.out.println("Before wildcard insert...");
dumpAssociationTables();
}
if (null != m_wildCardPatterns)
{
Enumeration associations = m_patternTable.elements();
while (associations.hasMoreElements())
{
TemplateSubPatternAssociation head =
(TemplateSubPatternAssociation) associations.nextElement();
TemplateSubPatternAssociation wild = m_wildCardPatterns;
while (null != wild)
{
try
{
head = insertAssociationIntoList(
head, (TemplateSubPatternAssociation) wild.clone(), true);
}
catch (CloneNotSupportedException cnse){}
wild = wild.getNext();
}
}
}
if (DEBUG)
{
System.out.println("After wildcard insert...");
dumpAssociationTables();
}
} | java | public void compose(StylesheetRoot sroot)
{
if (DEBUG)
{
System.out.println("Before wildcard insert...");
dumpAssociationTables();
}
if (null != m_wildCardPatterns)
{
Enumeration associations = m_patternTable.elements();
while (associations.hasMoreElements())
{
TemplateSubPatternAssociation head =
(TemplateSubPatternAssociation) associations.nextElement();
TemplateSubPatternAssociation wild = m_wildCardPatterns;
while (null != wild)
{
try
{
head = insertAssociationIntoList(
head, (TemplateSubPatternAssociation) wild.clone(), true);
}
catch (CloneNotSupportedException cnse){}
wild = wild.getNext();
}
}
}
if (DEBUG)
{
System.out.println("After wildcard insert...");
dumpAssociationTables();
}
} | [
"public",
"void",
"compose",
"(",
"StylesheetRoot",
"sroot",
")",
"{",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Before wildcard insert...\"",
")",
";",
"dumpAssociationTables",
"(",
")",
";",
"}",
"if",
"(",
"null",
"!=",... | After all templates have been added, this function
should be called. | [
"After",
"all",
"templates",
"have",
"been",
"added",
"this",
"function",
"should",
"be",
"called",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L173-L211 |
32,866 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java | TemplateList.insertAssociationIntoList | private TemplateSubPatternAssociation
insertAssociationIntoList(TemplateSubPatternAssociation head,
TemplateSubPatternAssociation item,
boolean isWildCardInsert)
{
// Sort first by import level (higher level is at front),
// then by priority (highest priority is at front),
// then by document order (later in document is at front).
double priority = getPriorityOrScore(item);
double workPriority;
int importLevel = item.getImportLevel();
int docOrder = item.getDocOrderPos();
TemplateSubPatternAssociation insertPoint = head;
TemplateSubPatternAssociation next;
boolean insertBefore; // true means insert before insertPoint; otherwise after
// This can only be true if insertPoint is pointing to
// the first or last template.
// Spin down so that insertPoint points to:
// (a) the template immediately _before_ the first template on the chain with
// a precedence that is either (i) less than ours or (ii) the same as ours but
// the template document position is less than ours
// -or-
// (b) the last template on the chain if no such template described in (a) exists.
// If we are pointing to the first template or the last template (that is, case b),
// we need to determine whether to insert before or after the template. Otherwise,
// we always insert after the insertPoint.
while (true)
{
next = insertPoint.getNext();
if (null == next)
break;
else
{
workPriority = getPriorityOrScore(next);
if (importLevel > next.getImportLevel())
break;
else if (importLevel < next.getImportLevel())
insertPoint = next;
else if (priority > workPriority) // import precedence is equal
break;
else if (priority < workPriority)
insertPoint = next;
else if (docOrder >= next.getDocOrderPos()) // priorities, import are equal
break;
else
insertPoint = next;
}
}
if ( (null == next) || (insertPoint == head) ) // insert point is first or last
{
workPriority = getPriorityOrScore(insertPoint);
if (importLevel > insertPoint.getImportLevel())
insertBefore = true;
else if (importLevel < insertPoint.getImportLevel())
insertBefore = false;
else if (priority > workPriority)
insertBefore = true;
else if (priority < workPriority)
insertBefore = false;
else if (docOrder >= insertPoint.getDocOrderPos())
insertBefore = true;
else
insertBefore = false;
}
else
insertBefore = false;
// System.out.println("appending: "+target+" to "+matchPat.getPattern());
if (isWildCardInsert)
{
if (insertBefore)
{
item.setNext(insertPoint);
String key = insertPoint.getTargetString();
item.setTargetString(key);
putHead(key, item);
return item;
}
else
{
item.setNext(next);
insertPoint.setNext(item);
return head;
}
}
else
{
if (insertBefore)
{
item.setNext(insertPoint);
if (insertPoint.isWild() || item.isWild())
m_wildCardPatterns = item;
else
putHead(item.getTargetString(), item);
return item;
}
else
{
item.setNext(next);
insertPoint.setNext(item);
return head;
}
}
} | java | private TemplateSubPatternAssociation
insertAssociationIntoList(TemplateSubPatternAssociation head,
TemplateSubPatternAssociation item,
boolean isWildCardInsert)
{
// Sort first by import level (higher level is at front),
// then by priority (highest priority is at front),
// then by document order (later in document is at front).
double priority = getPriorityOrScore(item);
double workPriority;
int importLevel = item.getImportLevel();
int docOrder = item.getDocOrderPos();
TemplateSubPatternAssociation insertPoint = head;
TemplateSubPatternAssociation next;
boolean insertBefore; // true means insert before insertPoint; otherwise after
// This can only be true if insertPoint is pointing to
// the first or last template.
// Spin down so that insertPoint points to:
// (a) the template immediately _before_ the first template on the chain with
// a precedence that is either (i) less than ours or (ii) the same as ours but
// the template document position is less than ours
// -or-
// (b) the last template on the chain if no such template described in (a) exists.
// If we are pointing to the first template or the last template (that is, case b),
// we need to determine whether to insert before or after the template. Otherwise,
// we always insert after the insertPoint.
while (true)
{
next = insertPoint.getNext();
if (null == next)
break;
else
{
workPriority = getPriorityOrScore(next);
if (importLevel > next.getImportLevel())
break;
else if (importLevel < next.getImportLevel())
insertPoint = next;
else if (priority > workPriority) // import precedence is equal
break;
else if (priority < workPriority)
insertPoint = next;
else if (docOrder >= next.getDocOrderPos()) // priorities, import are equal
break;
else
insertPoint = next;
}
}
if ( (null == next) || (insertPoint == head) ) // insert point is first or last
{
workPriority = getPriorityOrScore(insertPoint);
if (importLevel > insertPoint.getImportLevel())
insertBefore = true;
else if (importLevel < insertPoint.getImportLevel())
insertBefore = false;
else if (priority > workPriority)
insertBefore = true;
else if (priority < workPriority)
insertBefore = false;
else if (docOrder >= insertPoint.getDocOrderPos())
insertBefore = true;
else
insertBefore = false;
}
else
insertBefore = false;
// System.out.println("appending: "+target+" to "+matchPat.getPattern());
if (isWildCardInsert)
{
if (insertBefore)
{
item.setNext(insertPoint);
String key = insertPoint.getTargetString();
item.setTargetString(key);
putHead(key, item);
return item;
}
else
{
item.setNext(next);
insertPoint.setNext(item);
return head;
}
}
else
{
if (insertBefore)
{
item.setNext(insertPoint);
if (insertPoint.isWild() || item.isWild())
m_wildCardPatterns = item;
else
putHead(item.getTargetString(), item);
return item;
}
else
{
item.setNext(next);
insertPoint.setNext(item);
return head;
}
}
} | [
"private",
"TemplateSubPatternAssociation",
"insertAssociationIntoList",
"(",
"TemplateSubPatternAssociation",
"head",
",",
"TemplateSubPatternAssociation",
"item",
",",
"boolean",
"isWildCardInsert",
")",
"{",
"// Sort first by import level (higher level is at front),",
"// then by pr... | Insert the given TemplateSubPatternAssociation into the the linked
list. Sort by import precedence, then priority, then by document order.
@param head The first TemplateSubPatternAssociation in the linked list.
@param item The item that we want to insert into the proper place.
@param isWildCardInsert <code>true</code> if we are inserting a wild card
template onto this list.
@return the new head of the list. | [
"Insert",
"the",
"given",
"TemplateSubPatternAssociation",
"into",
"the",
"the",
"linked",
"list",
".",
"Sort",
"by",
"import",
"precedence",
"then",
"priority",
"then",
"by",
"document",
"order",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L223-L335 |
32,867 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java | TemplateList.insertPatternInTable | private void insertPatternInTable(StepPattern pattern, ElemTemplate template)
{
String target = pattern.getTargetString();
if (null != target)
{
String pstring = template.getMatch().getPatternString();
TemplateSubPatternAssociation association =
new TemplateSubPatternAssociation(template, pattern, pstring);
// See if there's already one there
boolean isWildCard = association.isWild();
TemplateSubPatternAssociation head = isWildCard
? m_wildCardPatterns
: getHead(target);
if (null == head)
{
if (isWildCard)
m_wildCardPatterns = association;
else
putHead(target, association);
}
else
{
insertAssociationIntoList(head, association, false);
}
}
} | java | private void insertPatternInTable(StepPattern pattern, ElemTemplate template)
{
String target = pattern.getTargetString();
if (null != target)
{
String pstring = template.getMatch().getPatternString();
TemplateSubPatternAssociation association =
new TemplateSubPatternAssociation(template, pattern, pstring);
// See if there's already one there
boolean isWildCard = association.isWild();
TemplateSubPatternAssociation head = isWildCard
? m_wildCardPatterns
: getHead(target);
if (null == head)
{
if (isWildCard)
m_wildCardPatterns = association;
else
putHead(target, association);
}
else
{
insertAssociationIntoList(head, association, false);
}
}
} | [
"private",
"void",
"insertPatternInTable",
"(",
"StepPattern",
"pattern",
",",
"ElemTemplate",
"template",
")",
"{",
"String",
"target",
"=",
"pattern",
".",
"getTargetString",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"target",
")",
"{",
"String",
"pstring",
... | Add a template to the template list.
@param pattern
@param template | [
"Add",
"a",
"template",
"to",
"the",
"template",
"list",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L343-L372 |
32,868 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java | TemplateList.getPriorityOrScore | private double getPriorityOrScore(TemplateSubPatternAssociation matchPat)
{
double priority = matchPat.getTemplate().getPriority();
if (priority == XPath.MATCH_SCORE_NONE)
{
Expression ex = matchPat.getStepPattern();
if (ex instanceof NodeTest)
{
return ((NodeTest) ex).getDefaultScore();
}
}
return priority;
} | java | private double getPriorityOrScore(TemplateSubPatternAssociation matchPat)
{
double priority = matchPat.getTemplate().getPriority();
if (priority == XPath.MATCH_SCORE_NONE)
{
Expression ex = matchPat.getStepPattern();
if (ex instanceof NodeTest)
{
return ((NodeTest) ex).getDefaultScore();
}
}
return priority;
} | [
"private",
"double",
"getPriorityOrScore",
"(",
"TemplateSubPatternAssociation",
"matchPat",
")",
"{",
"double",
"priority",
"=",
"matchPat",
".",
"getTemplate",
"(",
")",
".",
"getPriority",
"(",
")",
";",
"if",
"(",
"priority",
"==",
"XPath",
".",
"MATCH_SCORE... | Given a match pattern and template association, return the
score of that match. This score or priority can always be
statically calculated.
@param matchPat The match pattern to template association.
@return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST},
{@link org.apache.xpath.patterns.NodeTest#SCORE_NONE},
{@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD},
{@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or
{@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}, or
the value defined by the priority attribute of the template. | [
"Given",
"a",
"match",
"pattern",
"and",
"template",
"association",
"return",
"the",
"score",
"of",
"that",
"match",
".",
"This",
"score",
"or",
"priority",
"can",
"always",
"be",
"statically",
"calculated",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L389-L405 |
32,869 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java | TemplateList.getHead | public TemplateSubPatternAssociation getHead(XPathContext xctxt,
int targetNode, DTM dtm)
{
short targetNodeType = dtm.getNodeType(targetNode);
TemplateSubPatternAssociation head;
switch (targetNodeType)
{
case DTM.ELEMENT_NODE :
case DTM.ATTRIBUTE_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getLocalName(targetNode));
break;
case DTM.TEXT_NODE :
case DTM.CDATA_SECTION_NODE :
head = m_textPatterns;
break;
case DTM.ENTITY_REFERENCE_NODE :
case DTM.ENTITY_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
break;
case DTM.PROCESSING_INSTRUCTION_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getLocalName(targetNode));
break;
case DTM.COMMENT_NODE :
head = m_commentPatterns;
break;
case DTM.DOCUMENT_NODE :
case DTM.DOCUMENT_FRAGMENT_NODE :
head = m_docPatterns;
break;
case DTM.NOTATION_NODE :
default :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
}
return (null == head) ? m_wildCardPatterns : head;
} | java | public TemplateSubPatternAssociation getHead(XPathContext xctxt,
int targetNode, DTM dtm)
{
short targetNodeType = dtm.getNodeType(targetNode);
TemplateSubPatternAssociation head;
switch (targetNodeType)
{
case DTM.ELEMENT_NODE :
case DTM.ATTRIBUTE_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getLocalName(targetNode));
break;
case DTM.TEXT_NODE :
case DTM.CDATA_SECTION_NODE :
head = m_textPatterns;
break;
case DTM.ENTITY_REFERENCE_NODE :
case DTM.ENTITY_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
break;
case DTM.PROCESSING_INSTRUCTION_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getLocalName(targetNode));
break;
case DTM.COMMENT_NODE :
head = m_commentPatterns;
break;
case DTM.DOCUMENT_NODE :
case DTM.DOCUMENT_FRAGMENT_NODE :
head = m_docPatterns;
break;
case DTM.NOTATION_NODE :
default :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
}
return (null == head) ? m_wildCardPatterns : head;
} | [
"public",
"TemplateSubPatternAssociation",
"getHead",
"(",
"XPathContext",
"xctxt",
",",
"int",
"targetNode",
",",
"DTM",
"dtm",
")",
"{",
"short",
"targetNodeType",
"=",
"dtm",
".",
"getNodeType",
"(",
"targetNode",
")",
";",
"TemplateSubPatternAssociation",
"head"... | Get the head of the most likely list of associations to check, based on
the name and type of the targetNode argument.
@param xctxt The XPath runtime context.
@param targetNode The target node that will be checked for a match.
@param dtm The dtm owner for the target node.
@return The head of a linked list that contains all possible match pattern to
template associations. | [
"Get",
"the",
"head",
"of",
"the",
"most",
"likely",
"list",
"of",
"associations",
"to",
"check",
"based",
"on",
"the",
"name",
"and",
"type",
"of",
"the",
"targetNode",
"argument",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L430-L470 |
32,870 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java | TemplateList.getTemplateFast | public ElemTemplate getTemplateFast(XPathContext xctxt,
int targetNode,
int expTypeID,
QName mode,
int maxImportLevel,
boolean quietConflictWarnings,
DTM dtm)
throws TransformerException
{
TemplateSubPatternAssociation head;
switch (dtm.getNodeType(targetNode))
{
case DTM.ELEMENT_NODE :
case DTM.ATTRIBUTE_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getLocalNameFromExpandedNameID(expTypeID));
break;
case DTM.TEXT_NODE :
case DTM.CDATA_SECTION_NODE :
head = m_textPatterns;
break;
case DTM.ENTITY_REFERENCE_NODE :
case DTM.ENTITY_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
break;
case DTM.PROCESSING_INSTRUCTION_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getLocalName(targetNode));
break;
case DTM.COMMENT_NODE :
head = m_commentPatterns;
break;
case DTM.DOCUMENT_NODE :
case DTM.DOCUMENT_FRAGMENT_NODE :
head = m_docPatterns;
break;
case DTM.NOTATION_NODE :
default :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
}
if(null == head)
{
head = m_wildCardPatterns;
if(null == head)
return null;
}
// XSLT functions, such as xsl:key, need to be able to get to
// current ElemTemplateElement via a cast to the prefix resolver.
// Setting this fixes bug idkey03.
xctxt.pushNamespaceContextNull();
try
{
do
{
if ( (maxImportLevel > -1) && (head.getImportLevel() > maxImportLevel) )
{
continue;
}
ElemTemplate template = head.getTemplate();
xctxt.setNamespaceContext(template);
if ((head.m_stepPattern.execute(xctxt, targetNode, dtm, expTypeID) != NodeTest.SCORE_NONE)
&& head.matchMode(mode))
{
if (quietConflictWarnings)
checkConflicts(head, xctxt, targetNode, mode);
return template;
}
}
while (null != (head = head.getNext()));
}
finally
{
xctxt.popNamespaceContext();
}
return null;
} | java | public ElemTemplate getTemplateFast(XPathContext xctxt,
int targetNode,
int expTypeID,
QName mode,
int maxImportLevel,
boolean quietConflictWarnings,
DTM dtm)
throws TransformerException
{
TemplateSubPatternAssociation head;
switch (dtm.getNodeType(targetNode))
{
case DTM.ELEMENT_NODE :
case DTM.ATTRIBUTE_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getLocalNameFromExpandedNameID(expTypeID));
break;
case DTM.TEXT_NODE :
case DTM.CDATA_SECTION_NODE :
head = m_textPatterns;
break;
case DTM.ENTITY_REFERENCE_NODE :
case DTM.ENTITY_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
break;
case DTM.PROCESSING_INSTRUCTION_NODE :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getLocalName(targetNode));
break;
case DTM.COMMENT_NODE :
head = m_commentPatterns;
break;
case DTM.DOCUMENT_NODE :
case DTM.DOCUMENT_FRAGMENT_NODE :
head = m_docPatterns;
break;
case DTM.NOTATION_NODE :
default :
head = (TemplateSubPatternAssociation) m_patternTable.get(
dtm.getNodeName(targetNode)); // %REVIEW% I think this is right
}
if(null == head)
{
head = m_wildCardPatterns;
if(null == head)
return null;
}
// XSLT functions, such as xsl:key, need to be able to get to
// current ElemTemplateElement via a cast to the prefix resolver.
// Setting this fixes bug idkey03.
xctxt.pushNamespaceContextNull();
try
{
do
{
if ( (maxImportLevel > -1) && (head.getImportLevel() > maxImportLevel) )
{
continue;
}
ElemTemplate template = head.getTemplate();
xctxt.setNamespaceContext(template);
if ((head.m_stepPattern.execute(xctxt, targetNode, dtm, expTypeID) != NodeTest.SCORE_NONE)
&& head.matchMode(mode))
{
if (quietConflictWarnings)
checkConflicts(head, xctxt, targetNode, mode);
return template;
}
}
while (null != (head = head.getNext()));
}
finally
{
xctxt.popNamespaceContext();
}
return null;
} | [
"public",
"ElemTemplate",
"getTemplateFast",
"(",
"XPathContext",
"xctxt",
",",
"int",
"targetNode",
",",
"int",
"expTypeID",
",",
"QName",
"mode",
",",
"int",
"maxImportLevel",
",",
"boolean",
"quietConflictWarnings",
",",
"DTM",
"dtm",
")",
"throws",
"Transforme... | Given a target element, find the template that best
matches in the given XSL document, according
to the rules specified in the xsl draft. This variation of getTemplate
assumes the current node and current expression node have already been
pushed.
@param xctxt
@param targetNode
@param mode A string indicating the display mode.
@param maxImportLevel The maximum importCountComposed that we should consider or -1
if we should consider all import levels. This is used by apply-imports to
access templates that have been overridden.
@param quietConflictWarnings
@return Rule that best matches targetElem.
@throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
the error condition is severe enough to halt processing.
@throws TransformerException | [
"Given",
"a",
"target",
"element",
"find",
"the",
"template",
"that",
"best",
"matches",
"in",
"the",
"given",
"XSL",
"document",
"according",
"to",
"the",
"rules",
"specified",
"in",
"the",
"xsl",
"draft",
".",
"This",
"variation",
"of",
"getTemplate",
"ass... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L492-L576 |
32,871 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java | TemplateList.getTemplate | public ElemTemplate getTemplate(XPathContext xctxt,
int targetNode,
QName mode,
boolean quietConflictWarnings,
DTM dtm)
throws TransformerException
{
TemplateSubPatternAssociation head = getHead(xctxt, targetNode, dtm);
if (null != head)
{
// XSLT functions, such as xsl:key, need to be able to get to
// current ElemTemplateElement via a cast to the prefix resolver.
// Setting this fixes bug idkey03.
xctxt.pushNamespaceContextNull();
xctxt.pushCurrentNodeAndExpression(targetNode, targetNode);
try
{
do
{
ElemTemplate template = head.getTemplate();
xctxt.setNamespaceContext(template);
if ((head.m_stepPattern.execute(xctxt, targetNode) != NodeTest.SCORE_NONE)
&& head.matchMode(mode))
{
if (quietConflictWarnings)
checkConflicts(head, xctxt, targetNode, mode);
return template;
}
}
while (null != (head = head.getNext()));
}
finally
{
xctxt.popCurrentNodeAndExpression();
xctxt.popNamespaceContext();
}
}
return null;
} | java | public ElemTemplate getTemplate(XPathContext xctxt,
int targetNode,
QName mode,
boolean quietConflictWarnings,
DTM dtm)
throws TransformerException
{
TemplateSubPatternAssociation head = getHead(xctxt, targetNode, dtm);
if (null != head)
{
// XSLT functions, such as xsl:key, need to be able to get to
// current ElemTemplateElement via a cast to the prefix resolver.
// Setting this fixes bug idkey03.
xctxt.pushNamespaceContextNull();
xctxt.pushCurrentNodeAndExpression(targetNode, targetNode);
try
{
do
{
ElemTemplate template = head.getTemplate();
xctxt.setNamespaceContext(template);
if ((head.m_stepPattern.execute(xctxt, targetNode) != NodeTest.SCORE_NONE)
&& head.matchMode(mode))
{
if (quietConflictWarnings)
checkConflicts(head, xctxt, targetNode, mode);
return template;
}
}
while (null != (head = head.getNext()));
}
finally
{
xctxt.popCurrentNodeAndExpression();
xctxt.popNamespaceContext();
}
}
return null;
} | [
"public",
"ElemTemplate",
"getTemplate",
"(",
"XPathContext",
"xctxt",
",",
"int",
"targetNode",
",",
"QName",
"mode",
",",
"boolean",
"quietConflictWarnings",
",",
"DTM",
"dtm",
")",
"throws",
"TransformerException",
"{",
"TemplateSubPatternAssociation",
"head",
"=",... | Given a target element, find the template that best
matches in the given XSL document, according
to the rules specified in the xsl draft.
@param xctxt
@param targetNode
@param mode A string indicating the display mode.
@param quietConflictWarnings
@return Rule that best matches targetElem.
@throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
the error condition is severe enough to halt processing.
@throws TransformerException | [
"Given",
"a",
"target",
"element",
"find",
"the",
"template",
"that",
"best",
"matches",
"in",
"the",
"given",
"XSL",
"document",
"according",
"to",
"the",
"rules",
"specified",
"in",
"the",
"xsl",
"draft",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L593-L636 |
32,872 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java | TemplateList.addObjectIfNotFound | private void addObjectIfNotFound(Object obj, Vector v)
{
int n = v.size();
boolean addIt = true;
for (int i = 0; i < n; i++)
{
if (v.elementAt(i) == obj)
{
addIt = false;
break;
}
}
if (addIt)
{
v.addElement(obj);
}
} | java | private void addObjectIfNotFound(Object obj, Vector v)
{
int n = v.size();
boolean addIt = true;
for (int i = 0; i < n; i++)
{
if (v.elementAt(i) == obj)
{
addIt = false;
break;
}
}
if (addIt)
{
v.addElement(obj);
}
} | [
"private",
"void",
"addObjectIfNotFound",
"(",
"Object",
"obj",
",",
"Vector",
"v",
")",
"{",
"int",
"n",
"=",
"v",
".",
"size",
"(",
")",
";",
"boolean",
"addIt",
"=",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i"... | Add object to vector if not already there.
@param obj
@param v | [
"Add",
"object",
"to",
"vector",
"if",
"not",
"already",
"there",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L739-L759 |
32,873 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java | TemplateList.putHead | private void putHead(String key, TemplateSubPatternAssociation assoc)
{
if (key.equals(PsuedoNames.PSEUDONAME_TEXT))
m_textPatterns = assoc;
else if (key.equals(PsuedoNames.PSEUDONAME_ROOT))
m_docPatterns = assoc;
else if (key.equals(PsuedoNames.PSEUDONAME_COMMENT))
m_commentPatterns = assoc;
m_patternTable.put(key, assoc);
} | java | private void putHead(String key, TemplateSubPatternAssociation assoc)
{
if (key.equals(PsuedoNames.PSEUDONAME_TEXT))
m_textPatterns = assoc;
else if (key.equals(PsuedoNames.PSEUDONAME_ROOT))
m_docPatterns = assoc;
else if (key.equals(PsuedoNames.PSEUDONAME_COMMENT))
m_commentPatterns = assoc;
m_patternTable.put(key, assoc);
} | [
"private",
"void",
"putHead",
"(",
"String",
"key",
",",
"TemplateSubPatternAssociation",
"assoc",
")",
"{",
"if",
"(",
"key",
".",
"equals",
"(",
"PsuedoNames",
".",
"PSEUDONAME_TEXT",
")",
")",
"m_textPatterns",
"=",
"assoc",
";",
"else",
"if",
"(",
"key",... | Get the head of the assocation list that is keyed by target.
@param key
@param assoc | [
"Get",
"the",
"head",
"of",
"the",
"assocation",
"list",
"that",
"is",
"keyed",
"by",
"target",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/TemplateList.java#L842-L853 |
32,874 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Holiday.java | Holiday.firstBetween | @Override
public Date firstBetween(Date start, Date end) {
return rule.firstBetween(start, end);
} | java | @Override
public Date firstBetween(Date start, Date end) {
return rule.firstBetween(start, end);
} | [
"@",
"Override",
"public",
"Date",
"firstBetween",
"(",
"Date",
"start",
",",
"Date",
"end",
")",
"{",
"return",
"rule",
".",
"firstBetween",
"(",
"start",
",",
"end",
")",
";",
"}"
] | Return the first occurrence of this holiday that is on or after
the given start date and before the given end date.
@param start Only occurrences on or after this date are returned.
@param end Only occurrences before this date are returned.
@return The date on which this event occurs, or null if it
does not occur between the start and end dates.
@see #firstAfter
@hide draft / provisional / internal are hidden on Android | [
"Return",
"the",
"first",
"occurrence",
"of",
"this",
"holiday",
"that",
"is",
"on",
"or",
"after",
"the",
"given",
"start",
"date",
"and",
"before",
"the",
"given",
"end",
"date",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Holiday.java#L92-L95 |
32,875 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Holiday.java | Holiday.isBetween | @Override
public boolean isBetween(Date start, Date end) {
return rule.isBetween(start, end);
} | java | @Override
public boolean isBetween(Date start, Date end) {
return rule.isBetween(start, end);
} | [
"@",
"Override",
"public",
"boolean",
"isBetween",
"(",
"Date",
"start",
",",
"Date",
"end",
")",
"{",
"return",
"rule",
".",
"isBetween",
"(",
"start",
",",
"end",
")",
";",
"}"
] | Check whether this holiday occurs at least once between the two
dates given.
@hide draft / provisional / internal are hidden on Android | [
"Check",
"whether",
"this",
"holiday",
"occurs",
"at",
"least",
"once",
"between",
"the",
"two",
"dates",
"given",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Holiday.java#L117-L120 |
32,876 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java | XMLReaderAdapter.setup | private void setup (XMLReader xmlReader)
{
if (xmlReader == null) {
throw new NullPointerException("XMLReader must not be null");
}
this.xmlReader = xmlReader;
qAtts = new AttributesAdapter();
} | java | private void setup (XMLReader xmlReader)
{
if (xmlReader == null) {
throw new NullPointerException("XMLReader must not be null");
}
this.xmlReader = xmlReader;
qAtts = new AttributesAdapter();
} | [
"private",
"void",
"setup",
"(",
"XMLReader",
"xmlReader",
")",
"{",
"if",
"(",
"xmlReader",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"XMLReader must not be null\"",
")",
";",
"}",
"this",
".",
"xmlReader",
"=",
"xmlReader",
";",
... | Internal setup.
@param xmlReader The embedded XMLReader. | [
"Internal",
"setup",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java#L98-L105 |
32,877 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java | XMLReaderAdapter.setupXMLReader | private void setupXMLReader ()
throws SAXException
{
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
try {
xmlReader.setFeature("http://xml.org/sax/features/namespaces",
false);
} catch (SAXException e) {
// NO OP: it's just extra information, and we can ignore it
}
xmlReader.setContentHandler(this);
} | java | private void setupXMLReader ()
throws SAXException
{
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
try {
xmlReader.setFeature("http://xml.org/sax/features/namespaces",
false);
} catch (SAXException e) {
// NO OP: it's just extra information, and we can ignore it
}
xmlReader.setContentHandler(this);
} | [
"private",
"void",
"setupXMLReader",
"(",
")",
"throws",
"SAXException",
"{",
"xmlReader",
".",
"setFeature",
"(",
"\"http://xml.org/sax/features/namespace-prefixes\"",
",",
"true",
")",
";",
"try",
"{",
"xmlReader",
".",
"setFeature",
"(",
"\"http://xml.org/sax/feature... | Set up the XML reader. | [
"Set",
"up",
"the",
"XML",
"reader",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java#L230-L241 |
32,878 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java | XMLReaderAdapter.startElement | public void startElement (String uri, String localName,
String qName, Attributes atts)
throws SAXException
{
if (documentHandler != null) {
qAtts.setAttributes(atts);
documentHandler.startElement(qName, qAtts);
}
} | java | public void startElement (String uri, String localName,
String qName, Attributes atts)
throws SAXException
{
if (documentHandler != null) {
qAtts.setAttributes(atts);
documentHandler.startElement(qName, qAtts);
}
} | [
"public",
"void",
"startElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"atts",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"documentHandler",
"!=",
"null",
")",
"{",
"qAtts",
".",
"setAttributes",
"(... | Adapt a SAX2 start element event.
@param uri The Namespace URI.
@param localName The Namespace local name.
@param qName The qualified (prefixed) name.
@param atts The SAX2 attributes.
@exception org.xml.sax.SAXException The client may raise a
processing exception.
@see org.xml.sax.ContentHandler#endDocument | [
"Adapt",
"a",
"SAX2",
"start",
"element",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java#L327-L335 |
32,879 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java | XMLReaderAdapter.endElement | public void endElement (String uri, String localName,
String qName)
throws SAXException
{
if (documentHandler != null)
documentHandler.endElement(qName);
} | java | public void endElement (String uri, String localName,
String qName)
throws SAXException
{
if (documentHandler != null)
documentHandler.endElement(qName);
} | [
"public",
"void",
"endElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"documentHandler",
"!=",
"null",
")",
"documentHandler",
".",
"endElement",
"(",
"qName",
")",
";",
"}"
] | Adapt a SAX2 end element event.
@param uri The Namespace URI.
@param localName The Namespace local name.
@param qName The qualified (prefixed) name.
@exception org.xml.sax.SAXException The client may raise a
processing exception.
@see org.xml.sax.ContentHandler#endElement | [
"Adapt",
"a",
"SAX2",
"end",
"element",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java#L348-L354 |
32,880 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java | XMLReaderAdapter.processingInstruction | public void processingInstruction (String target, String data)
throws SAXException
{
if (documentHandler != null)
documentHandler.processingInstruction(target, data);
} | java | public void processingInstruction (String target, String data)
throws SAXException
{
if (documentHandler != null)
documentHandler.processingInstruction(target, data);
} | [
"public",
"void",
"processingInstruction",
"(",
"String",
"target",
",",
"String",
"data",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"documentHandler",
"!=",
"null",
")",
"documentHandler",
".",
"processingInstruction",
"(",
"target",
",",
"data",
")",
";",... | Adapt a SAX2 processing instruction event.
@param target The processing instruction target.
@param data The remainder of the processing instruction
@exception org.xml.sax.SAXException The client may raise a
processing exception.
@see org.xml.sax.ContentHandler#processingInstruction | [
"Adapt",
"a",
"SAX2",
"processing",
"instruction",
"event",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLReaderAdapter.java#L402-L407 |
32,881 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Pair.java | Pair.of | public static <F, S> Pair<F, S> of(F first, S second) {
if (first == null || second == null) {
throw new IllegalArgumentException("Pair.of requires non null values.");
}
return new Pair<F, S>(first, second);
} | java | public static <F, S> Pair<F, S> of(F first, S second) {
if (first == null || second == null) {
throw new IllegalArgumentException("Pair.of requires non null values.");
}
return new Pair<F, S>(first, second);
} | [
"public",
"static",
"<",
"F",
",",
"S",
">",
"Pair",
"<",
"F",
",",
"S",
">",
"of",
"(",
"F",
"first",
",",
"S",
"second",
")",
"{",
"if",
"(",
"first",
"==",
"null",
"||",
"second",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentExcepti... | Creates a pair object
@param first must be non-null
@param second must be non-null
@return The pair object. | [
"Creates",
"a",
"pair",
"object"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Pair.java#L34-L39 |
32,882 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLStreamHandler.java | URLStreamHandler.sameFile | protected boolean sameFile(URL u1, URL u2) {
// Compare the protocols.
if (!((u1.getProtocol() == u2.getProtocol()) ||
(u1.getProtocol() != null &&
u1.getProtocol().equalsIgnoreCase(u2.getProtocol()))))
return false;
// Compare the files.
if (!(u1.getFile() == u2.getFile() ||
(u1.getFile() != null && u1.getFile().equals(u2.getFile()))))
return false;
// Compare the ports.
int port1, port2;
try {
port1 = (u1.getPort() != -1)
? u1.getPort() : ((URLStreamHandler) u1.getHandler()).getDefaultPort();
port2 = (u2.getPort() != -1)
? u2.getPort() : ((URLStreamHandler) u2.getHandler()).getDefaultPort();
if (port1 != port2)
return false;
} catch (MalformedURLException e) {
return false;
}
// Compare the hosts.
if (!hostsEqual(u1, u2))
return false;
return true;
} | java | protected boolean sameFile(URL u1, URL u2) {
// Compare the protocols.
if (!((u1.getProtocol() == u2.getProtocol()) ||
(u1.getProtocol() != null &&
u1.getProtocol().equalsIgnoreCase(u2.getProtocol()))))
return false;
// Compare the files.
if (!(u1.getFile() == u2.getFile() ||
(u1.getFile() != null && u1.getFile().equals(u2.getFile()))))
return false;
// Compare the ports.
int port1, port2;
try {
port1 = (u1.getPort() != -1)
? u1.getPort() : ((URLStreamHandler) u1.getHandler()).getDefaultPort();
port2 = (u2.getPort() != -1)
? u2.getPort() : ((URLStreamHandler) u2.getHandler()).getDefaultPort();
if (port1 != port2)
return false;
} catch (MalformedURLException e) {
return false;
}
// Compare the hosts.
if (!hostsEqual(u1, u2))
return false;
return true;
} | [
"protected",
"boolean",
"sameFile",
"(",
"URL",
"u1",
",",
"URL",
"u2",
")",
"{",
"// Compare the protocols.",
"if",
"(",
"!",
"(",
"(",
"u1",
".",
"getProtocol",
"(",
")",
"==",
"u2",
".",
"getProtocol",
"(",
")",
")",
"||",
"(",
"u1",
".",
"getProt... | Compare two urls to see whether they refer to the same file,
i.e., having the same protocol, host, port, and path.
This method requires that none of its arguments is null. This is
guaranteed by the fact that it is only called indirectly
by java.net.URL class.
@param u1 a URL object
@param u2 a URL object
@return true if u1 and u2 refer to the same file
@since 1.3 | [
"Compare",
"two",
"urls",
"to",
"see",
"whether",
"they",
"refer",
"to",
"the",
"same",
"file",
"i",
".",
"e",
".",
"having",
"the",
"same",
"protocol",
"host",
"port",
"and",
"path",
".",
"This",
"method",
"requires",
"that",
"none",
"of",
"its",
"arg... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLStreamHandler.java#L414-L444 |
32,883 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLStreamHandler.java | URLStreamHandler.getHostAddress | protected synchronized InetAddress getHostAddress(URL u) {
if (u.hostAddress != null)
return (InetAddress) u.hostAddress;
String host = u.getHost();
if (host == null || host.equals("")) {
return null;
} else {
try {
u.hostAddress = InetAddress.getByName(host);
} catch (UnknownHostException ex) {
return null;
} catch (SecurityException se) {
return null;
}
}
return (InetAddress) u.hostAddress;
} | java | protected synchronized InetAddress getHostAddress(URL u) {
if (u.hostAddress != null)
return (InetAddress) u.hostAddress;
String host = u.getHost();
if (host == null || host.equals("")) {
return null;
} else {
try {
u.hostAddress = InetAddress.getByName(host);
} catch (UnknownHostException ex) {
return null;
} catch (SecurityException se) {
return null;
}
}
return (InetAddress) u.hostAddress;
} | [
"protected",
"synchronized",
"InetAddress",
"getHostAddress",
"(",
"URL",
"u",
")",
"{",
"if",
"(",
"u",
".",
"hostAddress",
"!=",
"null",
")",
"return",
"(",
"InetAddress",
")",
"u",
".",
"hostAddress",
";",
"String",
"host",
"=",
"u",
".",
"getHost",
"... | Get the IP address of our host. An empty host field or a DNS failure
will result in a null return.
@param u a URL object
@return an {@code InetAddress} representing the host
IP address.
@since 1.3 | [
"Get",
"the",
"IP",
"address",
"of",
"our",
"host",
".",
"An",
"empty",
"host",
"field",
"or",
"a",
"DNS",
"failure",
"will",
"result",
"in",
"a",
"null",
"return",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLStreamHandler.java#L455-L472 |
32,884 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompoundTransliterator.java | CompoundTransliterator._smartAppend | private static void _smartAppend(StringBuilder buf, char c) {
if (buf.length() != 0 &&
buf.charAt(buf.length() - 1) != c) {
buf.append(c);
}
} | java | private static void _smartAppend(StringBuilder buf, char c) {
if (buf.length() != 0 &&
buf.charAt(buf.length() - 1) != c) {
buf.append(c);
}
} | [
"private",
"static",
"void",
"_smartAppend",
"(",
"StringBuilder",
"buf",
",",
"char",
"c",
")",
"{",
"if",
"(",
"buf",
".",
"length",
"(",
")",
"!=",
"0",
"&&",
"buf",
".",
"charAt",
"(",
"buf",
".",
"length",
"(",
")",
"-",
"1",
")",
"!=",
"c",... | Append c to buf, unless buf is empty or buf already ends in c. | [
"Append",
"c",
"to",
"buf",
"unless",
"buf",
"is",
"empty",
"or",
"buf",
"already",
"ends",
"in",
"c",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompoundTransliterator.java#L250-L255 |
32,885 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/CachedXPathAPI.java | CachedXPathAPI.selectSingleNode | public Node selectSingleNode(
Node contextNode, String str, Node namespaceNode)
throws TransformerException
{
// Have the XObject return its result as a NodeSetDTM.
NodeIterator nl = selectNodeIterator(contextNode, str, namespaceNode);
// Return the first node, or null
return nl.nextNode();
} | java | public Node selectSingleNode(
Node contextNode, String str, Node namespaceNode)
throws TransformerException
{
// Have the XObject return its result as a NodeSetDTM.
NodeIterator nl = selectNodeIterator(contextNode, str, namespaceNode);
// Return the first node, or null
return nl.nextNode();
} | [
"public",
"Node",
"selectSingleNode",
"(",
"Node",
"contextNode",
",",
"String",
"str",
",",
"Node",
"namespaceNode",
")",
"throws",
"TransformerException",
"{",
"// Have the XObject return its result as a NodeSetDTM.",
"NodeIterator",
"nl",
"=",
"selectNodeIterator",
"(",
... | Use an XPath string to select a single node.
XPath namespace prefixes are resolved from the namespaceNode.
@param contextNode The node to start searching from.
@param str A valid XPath string.
@param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
@return The first node found that matches the XPath, or null.
@throws TransformerException | [
"Use",
"an",
"XPath",
"string",
"to",
"select",
"a",
"single",
"node",
".",
"XPath",
"namespace",
"prefixes",
"are",
"resolved",
"from",
"the",
"namespaceNode",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/CachedXPathAPI.java#L138-L148 |
32,886 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLServerSocket.java | SSLServerSocket.getSSLParameters | public SSLParameters getSSLParameters() {
SSLParameters parameters = new SSLParameters();
parameters.setCipherSuites(getEnabledCipherSuites());
parameters.setProtocols(getEnabledProtocols());
if (getNeedClientAuth()) {
parameters.setNeedClientAuth(true);
} else if (getWantClientAuth()) {
parameters.setWantClientAuth(true);
}
return parameters;
} | java | public SSLParameters getSSLParameters() {
SSLParameters parameters = new SSLParameters();
parameters.setCipherSuites(getEnabledCipherSuites());
parameters.setProtocols(getEnabledProtocols());
if (getNeedClientAuth()) {
parameters.setNeedClientAuth(true);
} else if (getWantClientAuth()) {
parameters.setWantClientAuth(true);
}
return parameters;
} | [
"public",
"SSLParameters",
"getSSLParameters",
"(",
")",
"{",
"SSLParameters",
"parameters",
"=",
"new",
"SSLParameters",
"(",
")",
";",
"parameters",
".",
"setCipherSuites",
"(",
"getEnabledCipherSuites",
"(",
")",
")",
";",
"parameters",
".",
"setProtocols",
"("... | Returns the SSLParameters in effect for newly accepted connections.
The ciphersuites and protocols of the returned SSLParameters
are always non-null.
@return the SSLParameters in effect for newly accepted connections
@see #setSSLParameters(SSLParameters)
@since 1.7 | [
"Returns",
"the",
"SSLParameters",
"in",
"effect",
"for",
"newly",
"accepted",
"connections",
".",
"The",
"ciphersuites",
"and",
"protocols",
"of",
"the",
"returned",
"SSLParameters",
"are",
"always",
"non",
"-",
"null",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLServerSocket.java#L468-L480 |
32,887 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLServerSocket.java | SSLServerSocket.setSSLParameters | public void setSSLParameters(SSLParameters params) {
String[] s;
s = params.getCipherSuites();
if (s != null) {
setEnabledCipherSuites(s);
}
s = params.getProtocols();
if (s != null) {
setEnabledProtocols(s);
}
if (params.getNeedClientAuth()) {
setNeedClientAuth(true);
} else if (params.getWantClientAuth()) {
setWantClientAuth(true);
} else {
setWantClientAuth(false);
}
} | java | public void setSSLParameters(SSLParameters params) {
String[] s;
s = params.getCipherSuites();
if (s != null) {
setEnabledCipherSuites(s);
}
s = params.getProtocols();
if (s != null) {
setEnabledProtocols(s);
}
if (params.getNeedClientAuth()) {
setNeedClientAuth(true);
} else if (params.getWantClientAuth()) {
setWantClientAuth(true);
} else {
setWantClientAuth(false);
}
} | [
"public",
"void",
"setSSLParameters",
"(",
"SSLParameters",
"params",
")",
"{",
"String",
"[",
"]",
"s",
";",
"s",
"=",
"params",
".",
"getCipherSuites",
"(",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"setEnabledCipherSuites",
"(",
"s",
")",
";... | Applies SSLParameters to newly accepted connections.
<p>This means:
<ul>
<li>If {@code params.getCipherSuites()} is non-null,
{@code setEnabledCipherSuites()} is called with that value.</li>
<li>If {@code params.getProtocols()} is non-null,
{@code setEnabledProtocols()} is called with that value.</li>
<li>If {@code params.getNeedClientAuth()} or
{@code params.getWantClientAuth()} return {@code true},
{@code setNeedClientAuth(true)} and
{@code setWantClientAuth(true)} are called, respectively;
otherwise {@code setWantClientAuth(false)} is called.</li>
<li>If {@code params.getServerNames()} is non-null, the socket will
configure its server names with that value.</li>
<li>If {@code params.getSNIMatchers()} is non-null, the socket will
configure its SNI matchers with that value.</li>
</ul>
@param params the parameters
@throws IllegalArgumentException if the setEnabledCipherSuites() or
the setEnabledProtocols() call fails
@see #getSSLParameters()
@since 1.7 | [
"Applies",
"SSLParameters",
"to",
"newly",
"accepted",
"connections",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLServerSocket.java#L510-L529 |
32,888 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/CertId.java | CertId.encode | public void encode(DerOutputStream out) throws IOException {
DerOutputStream tmp = new DerOutputStream();
hashAlgId.encode(tmp);
tmp.putOctetString(issuerNameHash);
tmp.putOctetString(issuerKeyHash);
certSerialNumber.encode(tmp);
out.write(DerValue.tag_Sequence, tmp);
if (debug) {
HexDumpEncoder encoder = new HexDumpEncoder();
System.out.println("Encoded certId is " +
encoder.encode(out.toByteArray()));
}
} | java | public void encode(DerOutputStream out) throws IOException {
DerOutputStream tmp = new DerOutputStream();
hashAlgId.encode(tmp);
tmp.putOctetString(issuerNameHash);
tmp.putOctetString(issuerKeyHash);
certSerialNumber.encode(tmp);
out.write(DerValue.tag_Sequence, tmp);
if (debug) {
HexDumpEncoder encoder = new HexDumpEncoder();
System.out.println("Encoded certId is " +
encoder.encode(out.toByteArray()));
}
} | [
"public",
"void",
"encode",
"(",
"DerOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"DerOutputStream",
"tmp",
"=",
"new",
"DerOutputStream",
"(",
")",
";",
"hashAlgId",
".",
"encode",
"(",
"tmp",
")",
";",
"tmp",
".",
"putOctetString",
"(",
"issuer... | Encode the CertId using ASN.1 DER.
The hash algorithm used is SHA-1. | [
"Encode",
"the",
"CertId",
"using",
"ASN",
".",
"1",
"DER",
".",
"The",
"hash",
"algorithm",
"used",
"is",
"SHA",
"-",
"1",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/CertId.java#L157-L171 |
32,889 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java | KeyAgreement.init | public final void init(Key key, SecureRandom random)
throws InvalidKeyException {
if (spi != null && (key == null || lock == null)) {
spi.engineInit(key, random);
} else {
try {
chooseProvider(I_NO_PARAMS, key, null, random);
} catch (InvalidAlgorithmParameterException e) {
// should never occur
throw new InvalidKeyException(e);
}
}
/* Android-removed: this debugging mechanism is not used in Android.
if (!skipDebug && pdebug != null) {
pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
this.provider.getName());
}
*/
} | java | public final void init(Key key, SecureRandom random)
throws InvalidKeyException {
if (spi != null && (key == null || lock == null)) {
spi.engineInit(key, random);
} else {
try {
chooseProvider(I_NO_PARAMS, key, null, random);
} catch (InvalidAlgorithmParameterException e) {
// should never occur
throw new InvalidKeyException(e);
}
}
/* Android-removed: this debugging mechanism is not used in Android.
if (!skipDebug && pdebug != null) {
pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
this.provider.getName());
}
*/
} | [
"public",
"final",
"void",
"init",
"(",
"Key",
"key",
",",
"SecureRandom",
"random",
")",
"throws",
"InvalidKeyException",
"{",
"if",
"(",
"spi",
"!=",
"null",
"&&",
"(",
"key",
"==",
"null",
"||",
"lock",
"==",
"null",
")",
")",
"{",
"spi",
".",
"en... | Initializes this key agreement with the given key and source of
randomness. The given key is required to contain all the algorithm
parameters required for this key agreement.
<p> If the key agreement algorithm requires random bytes, it gets them
from the given source of randomness, <code>random</code>.
However, if the underlying
algorithm implementation does not require any random bytes,
<code>random</code> is ignored.
@param key the party's private information. For example, in the case
of the Diffie-Hellman key agreement, this would be the party's own
Diffie-Hellman private key.
@param random the source of randomness
@exception InvalidKeyException if the given key is
inappropriate for this key agreement, e.g., is of the wrong type or
has an incompatible algorithm type. | [
"Initializes",
"this",
"key",
"agreement",
"with",
"the",
"given",
"key",
"and",
"source",
"of",
"randomness",
".",
"The",
"given",
"key",
"is",
"required",
"to",
"contain",
"all",
"the",
"algorithm",
"parameters",
"required",
"for",
"this",
"key",
"agreement"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java#L453-L472 |
32,890 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java | KeyAgreement.init | public final void init(Key key, AlgorithmParameterSpec params)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
init(key, params, JceSecurity.RANDOM);
} | java | public final void init(Key key, AlgorithmParameterSpec params)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
init(key, params, JceSecurity.RANDOM);
} | [
"public",
"final",
"void",
"init",
"(",
"Key",
"key",
",",
"AlgorithmParameterSpec",
"params",
")",
"throws",
"InvalidKeyException",
",",
"InvalidAlgorithmParameterException",
"{",
"init",
"(",
"key",
",",
"params",
",",
"JceSecurity",
".",
"RANDOM",
")",
";",
"... | Initializes this key agreement with the given key and set of
algorithm parameters.
<p> If this key agreement requires any random bytes, it will get
them using the
{@link java.security.SecureRandom}
implementation of the highest-priority
installed provider as the source of randomness.
(If none of the installed providers supply an implementation of
SecureRandom, a system-provided source of randomness will be used.)
@param key the party's private information. For example, in the case
of the Diffie-Hellman key agreement, this would be the party's own
Diffie-Hellman private key.
@param params the key agreement parameters
@exception InvalidKeyException if the given key is
inappropriate for this key agreement, e.g., is of the wrong type or
has an incompatible algorithm type.
@exception InvalidAlgorithmParameterException if the given parameters
are inappropriate for this key agreement. | [
"Initializes",
"this",
"key",
"agreement",
"with",
"the",
"given",
"key",
"and",
"set",
"of",
"algorithm",
"parameters",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java#L497-L501 |
32,891 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java | KeyAgreement.init | public final void init(Key key, AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
if (spi != null) {
spi.engineInit(key, params, random);
} else {
chooseProvider(I_PARAMS, key, params, random);
}
/* Android-removed: this debugging mechanism is not used in Android.
if (!skipDebug && pdebug != null) {
pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
this.provider.getName());
}
*/
} | java | public final void init(Key key, AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
if (spi != null) {
spi.engineInit(key, params, random);
} else {
chooseProvider(I_PARAMS, key, params, random);
}
/* Android-removed: this debugging mechanism is not used in Android.
if (!skipDebug && pdebug != null) {
pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
this.provider.getName());
}
*/
} | [
"public",
"final",
"void",
"init",
"(",
"Key",
"key",
",",
"AlgorithmParameterSpec",
"params",
",",
"SecureRandom",
"random",
")",
"throws",
"InvalidKeyException",
",",
"InvalidAlgorithmParameterException",
"{",
"if",
"(",
"spi",
"!=",
"null",
")",
"{",
"spi",
"... | Initializes this key agreement with the given key, set of
algorithm parameters, and source of randomness.
@param key the party's private information. For example, in the case
of the Diffie-Hellman key agreement, this would be the party's own
Diffie-Hellman private key.
@param params the key agreement parameters
@param random the source of randomness
@exception InvalidKeyException if the given key is
inappropriate for this key agreement, e.g., is of the wrong type or
has an incompatible algorithm type.
@exception InvalidAlgorithmParameterException if the given parameters
are inappropriate for this key agreement. | [
"Initializes",
"this",
"key",
"agreement",
"with",
"the",
"given",
"key",
"set",
"of",
"algorithm",
"parameters",
"and",
"source",
"of",
"randomness",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java#L519-L535 |
32,892 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java | KeyAgreement.doPhase | public final Key doPhase(Key key, boolean lastPhase)
throws InvalidKeyException, IllegalStateException
{
chooseFirstProvider();
return spi.engineDoPhase(key, lastPhase);
} | java | public final Key doPhase(Key key, boolean lastPhase)
throws InvalidKeyException, IllegalStateException
{
chooseFirstProvider();
return spi.engineDoPhase(key, lastPhase);
} | [
"public",
"final",
"Key",
"doPhase",
"(",
"Key",
"key",
",",
"boolean",
"lastPhase",
")",
"throws",
"InvalidKeyException",
",",
"IllegalStateException",
"{",
"chooseFirstProvider",
"(",
")",
";",
"return",
"spi",
".",
"engineDoPhase",
"(",
"key",
",",
"lastPhase... | Executes the next phase of this key agreement with the given
key that was received from one of the other parties involved in this key
agreement.
@param key the key for this phase. For example, in the case of
Diffie-Hellman between 2 parties, this would be the other party's
Diffie-Hellman public key.
@param lastPhase flag which indicates whether or not this is the last
phase of this key agreement.
@return the (intermediate) key resulting from this phase, or null
if this phase does not yield a key
@exception InvalidKeyException if the given key is inappropriate for
this phase.
@exception IllegalStateException if this key agreement has not been
initialized. | [
"Executes",
"the",
"next",
"phase",
"of",
"this",
"key",
"agreement",
"with",
"the",
"given",
"key",
"that",
"was",
"received",
"from",
"one",
"of",
"the",
"other",
"parties",
"involved",
"in",
"this",
"key",
"agreement",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/KeyAgreement.java#L556-L561 |
32,893 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java | WalkerFactory.newDTMIterator | public static DTMIterator newDTMIterator(
Compiler compiler, int opPos,
boolean isTopLevel)
throws javax.xml.transform.TransformerException
{
int firstStepPos = OpMap.getFirstChildPos(opPos);
int analysis = analyze(compiler, firstStepPos, 0);
boolean isOneStep = isOneStep(analysis);
DTMIterator iter;
// Is the iteration a one-step attribute pattern (i.e. select="@foo")?
if (isOneStep && walksSelfOnly(analysis) &&
isWild(analysis) && !hasPredicate(analysis))
{
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("SelfIteratorNoPredicate", analysis, compiler);
// Then use a simple iteration of the attributes, with node test
// and predicate testing.
iter = new SelfIteratorNoPredicate(compiler, opPos, analysis);
}
// Is the iteration exactly one child step?
else if (walksChildrenOnly(analysis) && isOneStep)
{
// Does the pattern specify *any* child with no predicate? (i.e. select="child::node()".
if (isWild(analysis) && !hasPredicate(analysis))
{
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("ChildIterator", analysis, compiler);
// Use simple child iteration without any test.
iter = new ChildIterator(compiler, opPos, analysis);
}
else
{
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("ChildTestIterator", analysis, compiler);
// Else use simple node test iteration with predicate test.
iter = new ChildTestIterator(compiler, opPos, analysis);
}
}
// Is the iteration a one-step attribute pattern (i.e. select="@foo")?
else if (isOneStep && walksAttributes(analysis))
{
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("AttributeIterator", analysis, compiler);
// Then use a simple iteration of the attributes, with node test
// and predicate testing.
iter = new AttributeIterator(compiler, opPos, analysis);
}
else if(isOneStep && !walksFilteredList(analysis))
{
if( !walksNamespaces(analysis)
&& (walksInDocOrder(analysis) || isSet(analysis, BIT_PARENT)))
{
if (false || DEBUG_ITERATOR_CREATION)
diagnoseIterator("OneStepIteratorForward", analysis, compiler);
// Then use a simple iteration of the attributes, with node test
// and predicate testing.
iter = new OneStepIteratorForward(compiler, opPos, analysis);
}
else
{
if (false || DEBUG_ITERATOR_CREATION)
diagnoseIterator("OneStepIterator", analysis, compiler);
// Then use a simple iteration of the attributes, with node test
// and predicate testing.
iter = new OneStepIterator(compiler, opPos, analysis);
}
}
// Analysis of "//center":
// bits: 1001000000001010000000000000011
// count: 3
// root
// child:node()
// BIT_DESCENDANT_OR_SELF
// It's highly possible that we should have a seperate bit set for
// "//foo" patterns.
// For at least the time being, we can't optimize patterns like
// "//table[3]", because this has to be analyzed as
// "/descendant-or-self::node()/table[3]" in order for the indexes
// to work right.
else if (isOptimizableForDescendantIterator(compiler, firstStepPos, 0)
// && getStepCount(analysis) <= 3
// && walksDescendants(analysis)
// && walksSubtreeOnlyFromRootOrContext(analysis)
)
{
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("DescendantIterator", analysis, compiler);
iter = new DescendantIterator(compiler, opPos, analysis);
}
else
{
if(isNaturalDocOrder(compiler, firstStepPos, 0, analysis))
{
if (false || DEBUG_ITERATOR_CREATION)
{
diagnoseIterator("WalkingIterator", analysis, compiler);
}
iter = new WalkingIterator(compiler, opPos, analysis, true);
}
else
{
// if (DEBUG_ITERATOR_CREATION)
// diagnoseIterator("MatchPatternIterator", analysis, compiler);
//
// return new MatchPatternIterator(compiler, opPos, analysis);
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("WalkingIteratorSorted", analysis, compiler);
iter = new WalkingIteratorSorted(compiler, opPos, analysis, true);
}
}
if(iter instanceof LocPathIterator)
((LocPathIterator)iter).setIsTopLevel(isTopLevel);
return iter;
} | java | public static DTMIterator newDTMIterator(
Compiler compiler, int opPos,
boolean isTopLevel)
throws javax.xml.transform.TransformerException
{
int firstStepPos = OpMap.getFirstChildPos(opPos);
int analysis = analyze(compiler, firstStepPos, 0);
boolean isOneStep = isOneStep(analysis);
DTMIterator iter;
// Is the iteration a one-step attribute pattern (i.e. select="@foo")?
if (isOneStep && walksSelfOnly(analysis) &&
isWild(analysis) && !hasPredicate(analysis))
{
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("SelfIteratorNoPredicate", analysis, compiler);
// Then use a simple iteration of the attributes, with node test
// and predicate testing.
iter = new SelfIteratorNoPredicate(compiler, opPos, analysis);
}
// Is the iteration exactly one child step?
else if (walksChildrenOnly(analysis) && isOneStep)
{
// Does the pattern specify *any* child with no predicate? (i.e. select="child::node()".
if (isWild(analysis) && !hasPredicate(analysis))
{
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("ChildIterator", analysis, compiler);
// Use simple child iteration without any test.
iter = new ChildIterator(compiler, opPos, analysis);
}
else
{
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("ChildTestIterator", analysis, compiler);
// Else use simple node test iteration with predicate test.
iter = new ChildTestIterator(compiler, opPos, analysis);
}
}
// Is the iteration a one-step attribute pattern (i.e. select="@foo")?
else if (isOneStep && walksAttributes(analysis))
{
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("AttributeIterator", analysis, compiler);
// Then use a simple iteration of the attributes, with node test
// and predicate testing.
iter = new AttributeIterator(compiler, opPos, analysis);
}
else if(isOneStep && !walksFilteredList(analysis))
{
if( !walksNamespaces(analysis)
&& (walksInDocOrder(analysis) || isSet(analysis, BIT_PARENT)))
{
if (false || DEBUG_ITERATOR_CREATION)
diagnoseIterator("OneStepIteratorForward", analysis, compiler);
// Then use a simple iteration of the attributes, with node test
// and predicate testing.
iter = new OneStepIteratorForward(compiler, opPos, analysis);
}
else
{
if (false || DEBUG_ITERATOR_CREATION)
diagnoseIterator("OneStepIterator", analysis, compiler);
// Then use a simple iteration of the attributes, with node test
// and predicate testing.
iter = new OneStepIterator(compiler, opPos, analysis);
}
}
// Analysis of "//center":
// bits: 1001000000001010000000000000011
// count: 3
// root
// child:node()
// BIT_DESCENDANT_OR_SELF
// It's highly possible that we should have a seperate bit set for
// "//foo" patterns.
// For at least the time being, we can't optimize patterns like
// "//table[3]", because this has to be analyzed as
// "/descendant-or-self::node()/table[3]" in order for the indexes
// to work right.
else if (isOptimizableForDescendantIterator(compiler, firstStepPos, 0)
// && getStepCount(analysis) <= 3
// && walksDescendants(analysis)
// && walksSubtreeOnlyFromRootOrContext(analysis)
)
{
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("DescendantIterator", analysis, compiler);
iter = new DescendantIterator(compiler, opPos, analysis);
}
else
{
if(isNaturalDocOrder(compiler, firstStepPos, 0, analysis))
{
if (false || DEBUG_ITERATOR_CREATION)
{
diagnoseIterator("WalkingIterator", analysis, compiler);
}
iter = new WalkingIterator(compiler, opPos, analysis, true);
}
else
{
// if (DEBUG_ITERATOR_CREATION)
// diagnoseIterator("MatchPatternIterator", analysis, compiler);
//
// return new MatchPatternIterator(compiler, opPos, analysis);
if (DEBUG_ITERATOR_CREATION)
diagnoseIterator("WalkingIteratorSorted", analysis, compiler);
iter = new WalkingIteratorSorted(compiler, opPos, analysis, true);
}
}
if(iter instanceof LocPathIterator)
((LocPathIterator)iter).setIsTopLevel(isTopLevel);
return iter;
} | [
"public",
"static",
"DTMIterator",
"newDTMIterator",
"(",
"Compiler",
"compiler",
",",
"int",
"opPos",
",",
"boolean",
"isTopLevel",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"int",
"firstStepPos",
"=",
"OpMap",
".",... | Create a new LocPathIterator iterator. The exact type of iterator
returned is based on an analysis of the XPath operations.
@param compiler non-null reference to compiler object that has processed
the XPath operations into an opcode map.
@param opPos The position of the operation code for this itterator.
@return non-null reference to a LocPathIterator or derivative.
@throws javax.xml.transform.TransformerException | [
"Create",
"a",
"new",
"LocPathIterator",
"iterator",
".",
"The",
"exact",
"type",
"of",
"iterator",
"returned",
"is",
"based",
"on",
"an",
"analysis",
"of",
"the",
"XPath",
"operations",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java#L158-L285 |
32,894 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java | WalkerFactory.getAnalysisBitFromAxes | static public int getAnalysisBitFromAxes(int axis)
{
switch (axis) // Generate new traverser
{
case Axis.ANCESTOR :
return BIT_ANCESTOR;
case Axis.ANCESTORORSELF :
return BIT_ANCESTOR_OR_SELF;
case Axis.ATTRIBUTE :
return BIT_ATTRIBUTE;
case Axis.CHILD :
return BIT_CHILD;
case Axis.DESCENDANT :
return BIT_DESCENDANT;
case Axis.DESCENDANTORSELF :
return BIT_DESCENDANT_OR_SELF;
case Axis.FOLLOWING :
return BIT_FOLLOWING;
case Axis.FOLLOWINGSIBLING :
return BIT_FOLLOWING_SIBLING;
case Axis.NAMESPACE :
case Axis.NAMESPACEDECLS :
return BIT_NAMESPACE;
case Axis.PARENT :
return BIT_PARENT;
case Axis.PRECEDING :
return BIT_PRECEDING;
case Axis.PRECEDINGSIBLING :
return BIT_PRECEDING_SIBLING;
case Axis.SELF :
return BIT_SELF;
case Axis.ALLFROMNODE :
return BIT_DESCENDANT_OR_SELF;
// case Axis.PRECEDINGANDANCESTOR :
case Axis.DESCENDANTSFROMROOT :
case Axis.ALL :
case Axis.DESCENDANTSORSELFFROMROOT :
return BIT_ANY_DESCENDANT_FROM_ROOT;
case Axis.ROOT :
return BIT_ROOT;
case Axis.FILTEREDLIST :
return BIT_FILTER;
default :
return BIT_FILTER;
}
} | java | static public int getAnalysisBitFromAxes(int axis)
{
switch (axis) // Generate new traverser
{
case Axis.ANCESTOR :
return BIT_ANCESTOR;
case Axis.ANCESTORORSELF :
return BIT_ANCESTOR_OR_SELF;
case Axis.ATTRIBUTE :
return BIT_ATTRIBUTE;
case Axis.CHILD :
return BIT_CHILD;
case Axis.DESCENDANT :
return BIT_DESCENDANT;
case Axis.DESCENDANTORSELF :
return BIT_DESCENDANT_OR_SELF;
case Axis.FOLLOWING :
return BIT_FOLLOWING;
case Axis.FOLLOWINGSIBLING :
return BIT_FOLLOWING_SIBLING;
case Axis.NAMESPACE :
case Axis.NAMESPACEDECLS :
return BIT_NAMESPACE;
case Axis.PARENT :
return BIT_PARENT;
case Axis.PRECEDING :
return BIT_PRECEDING;
case Axis.PRECEDINGSIBLING :
return BIT_PRECEDING_SIBLING;
case Axis.SELF :
return BIT_SELF;
case Axis.ALLFROMNODE :
return BIT_DESCENDANT_OR_SELF;
// case Axis.PRECEDINGANDANCESTOR :
case Axis.DESCENDANTSFROMROOT :
case Axis.ALL :
case Axis.DESCENDANTSORSELFFROMROOT :
return BIT_ANY_DESCENDANT_FROM_ROOT;
case Axis.ROOT :
return BIT_ROOT;
case Axis.FILTEREDLIST :
return BIT_FILTER;
default :
return BIT_FILTER;
}
} | [
"static",
"public",
"int",
"getAnalysisBitFromAxes",
"(",
"int",
"axis",
")",
"{",
"switch",
"(",
"axis",
")",
"// Generate new traverser",
"{",
"case",
"Axis",
".",
"ANCESTOR",
":",
"return",
"BIT_ANCESTOR",
";",
"case",
"Axis",
".",
"ANCESTORORSELF",
":",
"r... | Get a corresponding BIT_XXX from an axis.
@param axis One of Axis.ANCESTOR, etc.
@return One of BIT_ANCESTOR, etc. | [
"Get",
"a",
"corresponding",
"BIT_XXX",
"from",
"an",
"axis",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java#L353-L398 |
32,895 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java | WalkerFactory.mightBeProximate | public static boolean mightBeProximate(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
boolean mightBeProximate = false;
int argLen;
switch (stepType)
{
case OpCodes.OP_VARIABLE :
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
argLen = compiler.getArgLength(opPos);
break;
default :
argLen = compiler.getArgLengthOfStep(opPos);
}
int predPos = compiler.getFirstPredicateOpPos(opPos);
int count = 0;
while (OpCodes.OP_PREDICATE == compiler.getOp(predPos))
{
count++;
int innerExprOpPos = predPos+2;
int predOp = compiler.getOp(innerExprOpPos);
switch(predOp)
{
case OpCodes.OP_VARIABLE:
return true; // Would need more smarts to tell if this could be a number or not!
case OpCodes.OP_LOCATIONPATH:
// OK.
break;
case OpCodes.OP_NUMBER:
case OpCodes.OP_NUMBERLIT:
return true; // that's all she wrote!
case OpCodes.OP_FUNCTION:
boolean isProx
= functionProximateOrContainsProximate(compiler, innerExprOpPos);
if(isProx)
return true;
break;
case OpCodes.OP_GT:
case OpCodes.OP_GTE:
case OpCodes.OP_LT:
case OpCodes.OP_LTE:
case OpCodes.OP_EQUALS:
int leftPos = OpMap.getFirstChildPos(innerExprOpPos);
int rightPos = compiler.getNextOpPos(leftPos);
isProx = isProximateInnerExpr(compiler, leftPos);
if(isProx)
return true;
isProx = isProximateInnerExpr(compiler, rightPos);
if(isProx)
return true;
break;
default:
return true; // be conservative...
}
predPos = compiler.getNextOpPos(predPos);
}
return mightBeProximate;
} | java | public static boolean mightBeProximate(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
boolean mightBeProximate = false;
int argLen;
switch (stepType)
{
case OpCodes.OP_VARIABLE :
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
argLen = compiler.getArgLength(opPos);
break;
default :
argLen = compiler.getArgLengthOfStep(opPos);
}
int predPos = compiler.getFirstPredicateOpPos(opPos);
int count = 0;
while (OpCodes.OP_PREDICATE == compiler.getOp(predPos))
{
count++;
int innerExprOpPos = predPos+2;
int predOp = compiler.getOp(innerExprOpPos);
switch(predOp)
{
case OpCodes.OP_VARIABLE:
return true; // Would need more smarts to tell if this could be a number or not!
case OpCodes.OP_LOCATIONPATH:
// OK.
break;
case OpCodes.OP_NUMBER:
case OpCodes.OP_NUMBERLIT:
return true; // that's all she wrote!
case OpCodes.OP_FUNCTION:
boolean isProx
= functionProximateOrContainsProximate(compiler, innerExprOpPos);
if(isProx)
return true;
break;
case OpCodes.OP_GT:
case OpCodes.OP_GTE:
case OpCodes.OP_LT:
case OpCodes.OP_LTE:
case OpCodes.OP_EQUALS:
int leftPos = OpMap.getFirstChildPos(innerExprOpPos);
int rightPos = compiler.getNextOpPos(leftPos);
isProx = isProximateInnerExpr(compiler, leftPos);
if(isProx)
return true;
isProx = isProximateInnerExpr(compiler, rightPos);
if(isProx)
return true;
break;
default:
return true; // be conservative...
}
predPos = compiler.getNextOpPos(predPos);
}
return mightBeProximate;
} | [
"public",
"static",
"boolean",
"mightBeProximate",
"(",
"Compiler",
"compiler",
",",
"int",
"opPos",
",",
"int",
"stepType",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"boolean",
"mightBeProximate",
"=",
"false",
";",... | Tell if the predicates need to have proximity knowledge. | [
"Tell",
"if",
"the",
"predicates",
"need",
"to",
"have",
"proximity",
"knowledge",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java#L473-L540 |
32,896 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java | WalkerFactory.analyze | private static int analyze(
Compiler compiler, int stepOpCodePos, int stepIndex)
throws javax.xml.transform.TransformerException
{
int stepType;
int stepCount = 0;
int analysisResult = 0x00000000; // 32 bits of analysis
while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos)))
{
stepCount++;
// String namespace = compiler.getStepNS(stepOpCodePos);
// boolean isNSWild = (null != namespace)
// ? namespace.equals(NodeTest.WILD) : false;
// String localname = compiler.getStepLocalName(stepOpCodePos);
// boolean isWild = (null != localname) ? localname.equals(NodeTest.WILD) : false;
boolean predAnalysis = analyzePredicate(compiler, stepOpCodePos,
stepType);
if (predAnalysis)
analysisResult |= BIT_PREDICATE;
switch (stepType)
{
case OpCodes.OP_VARIABLE :
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
analysisResult |= BIT_FILTER;
break;
case OpCodes.FROM_ROOT :
analysisResult |= BIT_ROOT;
break;
case OpCodes.FROM_ANCESTORS :
analysisResult |= BIT_ANCESTOR;
break;
case OpCodes.FROM_ANCESTORS_OR_SELF :
analysisResult |= BIT_ANCESTOR_OR_SELF;
break;
case OpCodes.FROM_ATTRIBUTES :
analysisResult |= BIT_ATTRIBUTE;
break;
case OpCodes.FROM_NAMESPACE :
analysisResult |= BIT_NAMESPACE;
break;
case OpCodes.FROM_CHILDREN :
analysisResult |= BIT_CHILD;
break;
case OpCodes.FROM_DESCENDANTS :
analysisResult |= BIT_DESCENDANT;
break;
case OpCodes.FROM_DESCENDANTS_OR_SELF :
// Use a special bit to to make sure we get the right analysis of "//foo".
if (2 == stepCount && BIT_ROOT == analysisResult)
{
analysisResult |= BIT_ANY_DESCENDANT_FROM_ROOT;
}
analysisResult |= BIT_DESCENDANT_OR_SELF;
break;
case OpCodes.FROM_FOLLOWING :
analysisResult |= BIT_FOLLOWING;
break;
case OpCodes.FROM_FOLLOWING_SIBLINGS :
analysisResult |= BIT_FOLLOWING_SIBLING;
break;
case OpCodes.FROM_PRECEDING :
analysisResult |= BIT_PRECEDING;
break;
case OpCodes.FROM_PRECEDING_SIBLINGS :
analysisResult |= BIT_PRECEDING_SIBLING;
break;
case OpCodes.FROM_PARENT :
analysisResult |= BIT_PARENT;
break;
case OpCodes.FROM_SELF :
analysisResult |= BIT_SELF;
break;
case OpCodes.MATCH_ATTRIBUTE :
analysisResult |= (BIT_MATCH_PATTERN | BIT_ATTRIBUTE);
break;
case OpCodes.MATCH_ANY_ANCESTOR :
analysisResult |= (BIT_MATCH_PATTERN | BIT_ANCESTOR);
break;
case OpCodes.MATCH_IMMEDIATE_ANCESTOR :
analysisResult |= (BIT_MATCH_PATTERN | BIT_PARENT);
break;
default :
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: "
//+ stepType);
}
if (OpCodes.NODETYPE_NODE == compiler.getOp(stepOpCodePos + 3)) // child::node()
{
analysisResult |= BIT_NODETEST_ANY;
}
stepOpCodePos = compiler.getNextStepPos(stepOpCodePos);
if (stepOpCodePos < 0)
break;
}
analysisResult |= (stepCount & BITS_COUNT);
return analysisResult;
} | java | private static int analyze(
Compiler compiler, int stepOpCodePos, int stepIndex)
throws javax.xml.transform.TransformerException
{
int stepType;
int stepCount = 0;
int analysisResult = 0x00000000; // 32 bits of analysis
while (OpCodes.ENDOP != (stepType = compiler.getOp(stepOpCodePos)))
{
stepCount++;
// String namespace = compiler.getStepNS(stepOpCodePos);
// boolean isNSWild = (null != namespace)
// ? namespace.equals(NodeTest.WILD) : false;
// String localname = compiler.getStepLocalName(stepOpCodePos);
// boolean isWild = (null != localname) ? localname.equals(NodeTest.WILD) : false;
boolean predAnalysis = analyzePredicate(compiler, stepOpCodePos,
stepType);
if (predAnalysis)
analysisResult |= BIT_PREDICATE;
switch (stepType)
{
case OpCodes.OP_VARIABLE :
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
analysisResult |= BIT_FILTER;
break;
case OpCodes.FROM_ROOT :
analysisResult |= BIT_ROOT;
break;
case OpCodes.FROM_ANCESTORS :
analysisResult |= BIT_ANCESTOR;
break;
case OpCodes.FROM_ANCESTORS_OR_SELF :
analysisResult |= BIT_ANCESTOR_OR_SELF;
break;
case OpCodes.FROM_ATTRIBUTES :
analysisResult |= BIT_ATTRIBUTE;
break;
case OpCodes.FROM_NAMESPACE :
analysisResult |= BIT_NAMESPACE;
break;
case OpCodes.FROM_CHILDREN :
analysisResult |= BIT_CHILD;
break;
case OpCodes.FROM_DESCENDANTS :
analysisResult |= BIT_DESCENDANT;
break;
case OpCodes.FROM_DESCENDANTS_OR_SELF :
// Use a special bit to to make sure we get the right analysis of "//foo".
if (2 == stepCount && BIT_ROOT == analysisResult)
{
analysisResult |= BIT_ANY_DESCENDANT_FROM_ROOT;
}
analysisResult |= BIT_DESCENDANT_OR_SELF;
break;
case OpCodes.FROM_FOLLOWING :
analysisResult |= BIT_FOLLOWING;
break;
case OpCodes.FROM_FOLLOWING_SIBLINGS :
analysisResult |= BIT_FOLLOWING_SIBLING;
break;
case OpCodes.FROM_PRECEDING :
analysisResult |= BIT_PRECEDING;
break;
case OpCodes.FROM_PRECEDING_SIBLINGS :
analysisResult |= BIT_PRECEDING_SIBLING;
break;
case OpCodes.FROM_PARENT :
analysisResult |= BIT_PARENT;
break;
case OpCodes.FROM_SELF :
analysisResult |= BIT_SELF;
break;
case OpCodes.MATCH_ATTRIBUTE :
analysisResult |= (BIT_MATCH_PATTERN | BIT_ATTRIBUTE);
break;
case OpCodes.MATCH_ANY_ANCESTOR :
analysisResult |= (BIT_MATCH_PATTERN | BIT_ANCESTOR);
break;
case OpCodes.MATCH_IMMEDIATE_ANCESTOR :
analysisResult |= (BIT_MATCH_PATTERN | BIT_PARENT);
break;
default :
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: "
//+ stepType);
}
if (OpCodes.NODETYPE_NODE == compiler.getOp(stepOpCodePos + 3)) // child::node()
{
analysisResult |= BIT_NODETEST_ANY;
}
stepOpCodePos = compiler.getNextStepPos(stepOpCodePos);
if (stepOpCodePos < 0)
break;
}
analysisResult |= (stepCount & BITS_COUNT);
return analysisResult;
} | [
"private",
"static",
"int",
"analyze",
"(",
"Compiler",
"compiler",
",",
"int",
"stepOpCodePos",
",",
"int",
"stepIndex",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"int",
"stepType",
";",
"int",
"stepCount",
"=",
... | Analyze the location path and return 32 bits that give information about
the location path as a whole. See the BIT_XXX constants for meaning about
each of the bits.
@param compiler non-null reference to compiler object that has processed
the XPath operations into an opcode map.
@param stepOpCodePos The opcode position for the step.
@param stepIndex The top-level step index withing the iterator.
@return 32 bits as an integer that give information about the location
path as a whole.
@throws javax.xml.transform.TransformerException | [
"Analyze",
"the",
"location",
"path",
"and",
"return",
"32",
"bits",
"that",
"give",
"information",
"about",
"the",
"location",
"path",
"as",
"a",
"whole",
".",
"See",
"the",
"BIT_XXX",
"constants",
"for",
"meaning",
"about",
"each",
"of",
"the",
"bits",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java#L664-L773 |
32,897 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java | WalkerFactory.isDownwardAxisOfMany | public static boolean isDownwardAxisOfMany(int axis)
{
return ((Axis.DESCENDANTORSELF == axis) ||
(Axis.DESCENDANT == axis)
|| (Axis.FOLLOWING == axis)
// || (Axis.FOLLOWINGSIBLING == axis)
|| (Axis.PRECEDING == axis)
// || (Axis.PRECEDINGSIBLING == axis)
);
} | java | public static boolean isDownwardAxisOfMany(int axis)
{
return ((Axis.DESCENDANTORSELF == axis) ||
(Axis.DESCENDANT == axis)
|| (Axis.FOLLOWING == axis)
// || (Axis.FOLLOWINGSIBLING == axis)
|| (Axis.PRECEDING == axis)
// || (Axis.PRECEDINGSIBLING == axis)
);
} | [
"public",
"static",
"boolean",
"isDownwardAxisOfMany",
"(",
"int",
"axis",
")",
"{",
"return",
"(",
"(",
"Axis",
".",
"DESCENDANTORSELF",
"==",
"axis",
")",
"||",
"(",
"Axis",
".",
"DESCENDANT",
"==",
"axis",
")",
"||",
"(",
"Axis",
".",
"FOLLOWING",
"==... | Tell if the given axis goes downword. Bogus name, if you can think of
a better one, please do tell. This really has to do with inverting
attribute axis.
@param axis One of Axis.XXX.
@return true if the axis is not a child axis and does not go up from
the axis root. | [
"Tell",
"if",
"the",
"given",
"axis",
"goes",
"downword",
".",
"Bogus",
"name",
"if",
"you",
"can",
"think",
"of",
"a",
"better",
"one",
"please",
"do",
"tell",
".",
"This",
"really",
"has",
"to",
"do",
"with",
"inverting",
"attribute",
"axis",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java#L783-L792 |
32,898 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java | WalkerFactory.analyzePredicate | static boolean analyzePredicate(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
int argLen;
switch (stepType)
{
case OpCodes.OP_VARIABLE :
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
argLen = compiler.getArgLength(opPos);
break;
default :
argLen = compiler.getArgLengthOfStep(opPos);
}
int pos = compiler.getFirstPredicateOpPos(opPos);
int nPredicates = compiler.countPredicates(pos);
return (nPredicates > 0) ? true : false;
} | java | static boolean analyzePredicate(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
int argLen;
switch (stepType)
{
case OpCodes.OP_VARIABLE :
case OpCodes.OP_EXTFUNCTION :
case OpCodes.OP_FUNCTION :
case OpCodes.OP_GROUP :
argLen = compiler.getArgLength(opPos);
break;
default :
argLen = compiler.getArgLengthOfStep(opPos);
}
int pos = compiler.getFirstPredicateOpPos(opPos);
int nPredicates = compiler.countPredicates(pos);
return (nPredicates > 0) ? true : false;
} | [
"static",
"boolean",
"analyzePredicate",
"(",
"Compiler",
"compiler",
",",
"int",
"opPos",
",",
"int",
"stepType",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"int",
"argLen",
";",
"switch",
"(",
"stepType",
")",
"... | Analyze a step and give information about it's predicates. Right now this
just returns true or false if the step has a predicate.
@param compiler non-null reference to compiler object that has processed
the XPath operations into an opcode map.
@param opPos The opcode position for the step.
@param stepType The type of step, one of OP_GROUP, etc.
@return true if step has a predicate.
@throws javax.xml.transform.TransformerException | [
"Analyze",
"a",
"step",
"and",
"give",
"information",
"about",
"it",
"s",
"predicates",
".",
"Right",
"now",
"this",
"just",
"returns",
"true",
"or",
"false",
"if",
"the",
"step",
"has",
"a",
"predicate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java#L1127-L1149 |
32,899 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DecimalFormatSymbols.java | DecimalFormatSymbols.setCurrency | public void setCurrency(Currency currency) {
if (currency == null) {
throw new NullPointerException();
}
this.currency = currency;
intlCurrencySymbol = currency.getCurrencyCode();
currencySymbol = currency.getSymbol(locale);
//cachedIcuDFS = null;
} | java | public void setCurrency(Currency currency) {
if (currency == null) {
throw new NullPointerException();
}
this.currency = currency;
intlCurrencySymbol = currency.getCurrencyCode();
currencySymbol = currency.getSymbol(locale);
//cachedIcuDFS = null;
} | [
"public",
"void",
"setCurrency",
"(",
"Currency",
"currency",
")",
"{",
"if",
"(",
"currency",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"this",
".",
"currency",
"=",
"currency",
";",
"intlCurrencySymbol",
"=",
"cu... | Sets the currency of these DecimalFormatSymbols.
This also sets the currency symbol attribute to the currency's symbol
in the DecimalFormatSymbols' locale, and the international currency
symbol attribute to the currency's ISO 4217 currency code.
@param currency the new currency to be used
@exception NullPointerException if <code>currency</code> is null
@since 1.4
@see #setCurrencySymbol
@see #setInternationalCurrencySymbol | [
"Sets",
"the",
"currency",
"of",
"these",
"DecimalFormatSymbols",
".",
"This",
"also",
"sets",
"the",
"currency",
"symbol",
"attribute",
"to",
"the",
"currency",
"s",
"symbol",
"in",
"the",
"DecimalFormatSymbols",
"locale",
"and",
"the",
"international",
"currency... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DecimalFormatSymbols.java#L474-L482 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.