repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
kiegroup/jbpm | jbpm-services/jbpm-services-cdi/src/main/java/org/jbpm/services/cdi/impl/manager/InjectableRegisterableItemsFactory.java | InjectableRegisterableItemsFactory.getFactory | public static RegisterableItemsFactory getFactory(BeanManager beanManager, AuditEventBuilder eventBuilder, KieContainer kieContainer, String ksessionName) {
InjectableRegisterableItemsFactory instance = getInstanceByType(beanManager, InjectableRegisterableItemsFactory.class, new Annotation[]{});
instance.setAuditBuilder(eventBuilder);
instance.setKieContainer(kieContainer);
instance.setKsessionName(ksessionName);
return instance;
} | java | public static RegisterableItemsFactory getFactory(BeanManager beanManager, AuditEventBuilder eventBuilder, KieContainer kieContainer, String ksessionName) {
InjectableRegisterableItemsFactory instance = getInstanceByType(beanManager, InjectableRegisterableItemsFactory.class, new Annotation[]{});
instance.setAuditBuilder(eventBuilder);
instance.setKieContainer(kieContainer);
instance.setKsessionName(ksessionName);
return instance;
} | [
"public",
"static",
"RegisterableItemsFactory",
"getFactory",
"(",
"BeanManager",
"beanManager",
",",
"AuditEventBuilder",
"eventBuilder",
",",
"KieContainer",
"kieContainer",
",",
"String",
"ksessionName",
")",
"{",
"InjectableRegisterableItemsFactory",
"instance",
"=",
"g... | Allows to create instance of this class dynamically via <code>BeanManager</code>. This is useful in case multiple
independent instances are required on runtime and that need cannot be satisfied with regular CDI practices.
@param beanManager - bean manager instance of the container
@param eventBuilder - <code>AbstractAuditLogger</code> logger builder instance to be used, might be null
@param kieContainer - <code>KieContainer</code> that the factory is built for
@param ksessionName - name of the ksession defined in kmodule to be used,
if not given default ksession from kmodule will be used.
@return | [
"Allows",
"to",
"create",
"instance",
"of",
"this",
"class",
"dynamically",
"via",
"<code",
">",
"BeanManager<",
"/",
"code",
">",
".",
"This",
"is",
"useful",
"in",
"case",
"multiple",
"independent",
"instances",
"are",
"required",
"on",
"runtime",
"and",
"... | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-services-cdi/src/main/java/org/jbpm/services/cdi/impl/manager/InjectableRegisterableItemsFactory.java#L337-L343 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.getPushBackReader | public static PushbackReader getPushBackReader(Reader reader, int pushBackSize) {
return (reader instanceof PushbackReader) ? (PushbackReader) reader : new PushbackReader(reader, pushBackSize);
} | java | public static PushbackReader getPushBackReader(Reader reader, int pushBackSize) {
return (reader instanceof PushbackReader) ? (PushbackReader) reader : new PushbackReader(reader, pushBackSize);
} | [
"public",
"static",
"PushbackReader",
"getPushBackReader",
"(",
"Reader",
"reader",
",",
"int",
"pushBackSize",
")",
"{",
"return",
"(",
"reader",
"instanceof",
"PushbackReader",
")",
"?",
"(",
"PushbackReader",
")",
"reader",
":",
"new",
"PushbackReader",
"(",
... | 获得{@link PushbackReader}<br>
如果是{@link PushbackReader}强转返回,否则新建
@param reader 普通Reader
@param pushBackSize 推后的byte数
@return {@link PushbackReader}
@since 3.1.0 | [
"获得",
"{",
"@link",
"PushbackReader",
"}",
"<br",
">",
"如果是",
"{",
"@link",
"PushbackReader",
"}",
"强转返回,否则新建"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L352-L354 |
attribyte/acp | src/main/java/org/attribyte/sql/pool/TypesafeConfig.java | TypesafeConfig.createConnection | static JDBConnection createConnection(final String connectionName,
final Config baseConfig,
final Config globalPropertyConfig) throws InitializationException {
Config connectionRef = ConfigFactory.load().getObject("acp.defaults.connection").toConfig();
Config config = baseConfig.withFallback(connectionRef);
final String user = getString(config, "user");
final String password = getString(config, "password");
final String testSQL = getString(config, "testSQL", "");
String connectionString = getString(config, "connectionString");
final boolean debug = getString(config, "debug", "false").equalsIgnoreCase("true");
final long createTimeoutMillis = getMilliseconds(config, "createTimeout");
final long testIntervalMillis = getMilliseconds(config, "testInterval");
String propsRef = getString(config, "properties", "");
Config propsConfig;
if(propsRef.length() > 0) {
if(globalPropertyConfig.hasPath(propsRef)) {
propsConfig = globalPropertyConfig.getObject(propsRef).toConfig();
} else {
throw new InitializationException("The referenced global properties, '" + propsRef + "' is not defined");
}
connectionString = buildConnectionString(connectionString, propsConfig);
}
return new JDBConnection(connectionName, user, password, connectionString,
createTimeoutMillis,
testSQL.length() > 0 ? testSQL : null,
testIntervalMillis, debug);
} | java | static JDBConnection createConnection(final String connectionName,
final Config baseConfig,
final Config globalPropertyConfig) throws InitializationException {
Config connectionRef = ConfigFactory.load().getObject("acp.defaults.connection").toConfig();
Config config = baseConfig.withFallback(connectionRef);
final String user = getString(config, "user");
final String password = getString(config, "password");
final String testSQL = getString(config, "testSQL", "");
String connectionString = getString(config, "connectionString");
final boolean debug = getString(config, "debug", "false").equalsIgnoreCase("true");
final long createTimeoutMillis = getMilliseconds(config, "createTimeout");
final long testIntervalMillis = getMilliseconds(config, "testInterval");
String propsRef = getString(config, "properties", "");
Config propsConfig;
if(propsRef.length() > 0) {
if(globalPropertyConfig.hasPath(propsRef)) {
propsConfig = globalPropertyConfig.getObject(propsRef).toConfig();
} else {
throw new InitializationException("The referenced global properties, '" + propsRef + "' is not defined");
}
connectionString = buildConnectionString(connectionString, propsConfig);
}
return new JDBConnection(connectionName, user, password, connectionString,
createTimeoutMillis,
testSQL.length() > 0 ? testSQL : null,
testIntervalMillis, debug);
} | [
"static",
"JDBConnection",
"createConnection",
"(",
"final",
"String",
"connectionName",
",",
"final",
"Config",
"baseConfig",
",",
"final",
"Config",
"globalPropertyConfig",
")",
"throws",
"InitializationException",
"{",
"Config",
"connectionRef",
"=",
"ConfigFactory",
... | Creates a connection from properties.
@throws InitializationException if required parameters are unspecified. | [
"Creates",
"a",
"connection",
"from",
"properties",
"."
] | train | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/TypesafeConfig.java#L344-L378 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java | ControlContainerContext.addResourceContext | protected synchronized void addResourceContext(ResourceContext resourceContext, ControlBean bean)
{
if (!resourceContext.hasResources())
_resourceContexts.push(resourceContext);
} | java | protected synchronized void addResourceContext(ResourceContext resourceContext, ControlBean bean)
{
if (!resourceContext.hasResources())
_resourceContexts.push(resourceContext);
} | [
"protected",
"synchronized",
"void",
"addResourceContext",
"(",
"ResourceContext",
"resourceContext",
",",
"ControlBean",
"bean",
")",
"{",
"if",
"(",
"!",
"resourceContext",
".",
"hasResources",
"(",
")",
")",
"_resourceContexts",
".",
"push",
"(",
"resourceContext... | Adds a new managed ResourceContext to the ControlContainerContext. This method
is used to register a resource context that has just acquired resources
@param resourceContext the ResourceContext service that has acquired resources
@param bean the acquiring ControlBean. Unused by the base implementation, but
available so subclassed containers can have access to the bean. | [
"Adds",
"a",
"new",
"managed",
"ResourceContext",
"to",
"the",
"ControlContainerContext",
".",
"This",
"method",
"is",
"used",
"to",
"register",
"a",
"resource",
"context",
"that",
"has",
"just",
"acquired",
"resources"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlContainerContext.java#L99-L103 |
mnlipp/jgrapes | org.jgrapes.http/src/org/jgrapes/http/HttpServer.java | HttpServer.onClose | @Handler
public void onClose(Close event, WebAppMsgChannel appChannel)
throws InterruptedException {
appChannel.handleClose(event);
} | java | @Handler
public void onClose(Close event, WebAppMsgChannel appChannel)
throws InterruptedException {
appChannel.handleClose(event);
} | [
"@",
"Handler",
"public",
"void",
"onClose",
"(",
"Close",
"event",
",",
"WebAppMsgChannel",
"appChannel",
")",
"throws",
"InterruptedException",
"{",
"appChannel",
".",
"handleClose",
"(",
"event",
")",
";",
"}"
] | Handles a close event from downstream by closing the upstream
connections.
@param event
the close event
@throws InterruptedException if the execution was interrupted | [
"Handles",
"a",
"close",
"event",
"from",
"downstream",
"by",
"closing",
"the",
"upstream",
"connections",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/HttpServer.java#L333-L337 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataCloneVisitor.java | ItemDataCloneVisitor.itemInItemStateList | private boolean itemInItemStateList(List<ItemState> list, String itemId, int state)
{
boolean retval = false;
for (ItemState itemState : list)
{
if (itemState.getState() == state && itemState.getData().getIdentifier().equals(itemId))
{
retval = true;
break;
}
}
return retval;
} | java | private boolean itemInItemStateList(List<ItemState> list, String itemId, int state)
{
boolean retval = false;
for (ItemState itemState : list)
{
if (itemState.getState() == state && itemState.getData().getIdentifier().equals(itemId))
{
retval = true;
break;
}
}
return retval;
} | [
"private",
"boolean",
"itemInItemStateList",
"(",
"List",
"<",
"ItemState",
">",
"list",
",",
"String",
"itemId",
",",
"int",
"state",
")",
"{",
"boolean",
"retval",
"=",
"false",
";",
"for",
"(",
"ItemState",
"itemState",
":",
"list",
")",
"{",
"if",
"(... | Return true if the itemstate for item with <code>itemId</code> UUId exist in
<code>List<ItemState></code> list.
@param list
@param itemId
@param state
@return | [
"Return",
"true",
"if",
"the",
"itemstate",
"for",
"item",
"with",
"<code",
">",
"itemId<",
"/",
"code",
">",
"UUId",
"exist",
"in",
"<code",
">",
"List<",
";",
"ItemState>",
";",
"<",
"/",
"code",
">",
"list",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/ItemDataCloneVisitor.java#L240-L253 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/StormSubmitter.java | StormSubmitter.submitTopology | public static void submitTopology(String name, Map stormConf, StormTopology topology)
throws AlreadyAliveException, InvalidTopologyException {
submitTopology(name, stormConf, topology, null);
} | java | public static void submitTopology(String name, Map stormConf, StormTopology topology)
throws AlreadyAliveException, InvalidTopologyException {
submitTopology(name, stormConf, topology, null);
} | [
"public",
"static",
"void",
"submitTopology",
"(",
"String",
"name",
",",
"Map",
"stormConf",
",",
"StormTopology",
"topology",
")",
"throws",
"AlreadyAliveException",
",",
"InvalidTopologyException",
"{",
"submitTopology",
"(",
"name",
",",
"stormConf",
",",
"topol... | Submits a topology to run on the cluster. A topology runs forever or until explicitly killed.
@param name the name of the storm.
@param stormConf the topology-specific configuration. See {@link Config}.
@param topology the processing to execute.
@throws AlreadyAliveException if a topology with this name is already running
@throws InvalidTopologyException if an invalid topology was submitted | [
"Submits",
"a",
"topology",
"to",
"run",
"on",
"the",
"cluster",
".",
"A",
"topology",
"runs",
"forever",
"or",
"until",
"explicitly",
"killed",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/StormSubmitter.java#L63-L66 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.api_credential_GET | public ArrayList<Long> api_credential_GET(Long applicationId, OvhCredentialStateEnum status) throws IOException {
String qPath = "/me/api/credential";
StringBuilder sb = path(qPath);
query(sb, "applicationId", applicationId);
query(sb, "status", status);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> api_credential_GET(Long applicationId, OvhCredentialStateEnum status) throws IOException {
String qPath = "/me/api/credential";
StringBuilder sb = path(qPath);
query(sb, "applicationId", applicationId);
query(sb, "status", status);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"api_credential_GET",
"(",
"Long",
"applicationId",
",",
"OvhCredentialStateEnum",
"status",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/api/credential\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
... | List of your Api Credentials
REST: GET /me/api/credential
@param status [required] Filter the value of status property (=)
@param applicationId [required] Filter the value of applicationId property (like) | [
"List",
"of",
"your",
"Api",
"Credentials"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L514-L521 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/GuiUtils.java | GuiUtils.setDeepEnabled | public static void setDeepEnabled(Component component, boolean enabled)
{
component.setEnabled(enabled);
if (component instanceof Container)
{
Container container = (Container)component;
for (Component c : container.getComponents())
{
setDeepEnabled(c, enabled);
}
}
} | java | public static void setDeepEnabled(Component component, boolean enabled)
{
component.setEnabled(enabled);
if (component instanceof Container)
{
Container container = (Container)component;
for (Component c : container.getComponents())
{
setDeepEnabled(c, enabled);
}
}
} | [
"public",
"static",
"void",
"setDeepEnabled",
"(",
"Component",
"component",
",",
"boolean",
"enabled",
")",
"{",
"component",
".",
"setEnabled",
"(",
"enabled",
")",
";",
"if",
"(",
"component",
"instanceof",
"Container",
")",
"{",
"Container",
"container",
"... | Enables or disables the given component and all its children
recursively
@param component The component
@param enabled Whether the component tree should be enabled | [
"Enables",
"or",
"disables",
"the",
"given",
"component",
"and",
"all",
"its",
"children",
"recursively"
] | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/GuiUtils.java#L100-L111 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java | RegistriesInner.beginImportImage | public void beginImportImage(String resourceGroupName, String registryName, ImportImageParameters parameters) {
beginImportImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).toBlocking().single().body();
} | java | public void beginImportImage(String resourceGroupName, String registryName, ImportImageParameters parameters) {
beginImportImageWithServiceResponseAsync(resourceGroupName, registryName, parameters).toBlocking().single().body();
} | [
"public",
"void",
"beginImportImage",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"ImportImageParameters",
"parameters",
")",
"{",
"beginImportImageWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"parameters",
")",
... | Copies an image to this container registry from the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param parameters The parameters specifying the image to copy and the source container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Copies",
"an",
"image",
"to",
"this",
"container",
"registry",
"from",
"the",
"specified",
"container",
"registry",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L242-L244 |
aws/aws-sdk-java | aws-java-sdk-route53/src/main/java/com/amazonaws/services/route53/model/ListQueryLoggingConfigsResult.java | ListQueryLoggingConfigsResult.getQueryLoggingConfigs | public java.util.List<QueryLoggingConfig> getQueryLoggingConfigs() {
if (queryLoggingConfigs == null) {
queryLoggingConfigs = new com.amazonaws.internal.SdkInternalList<QueryLoggingConfig>();
}
return queryLoggingConfigs;
} | java | public java.util.List<QueryLoggingConfig> getQueryLoggingConfigs() {
if (queryLoggingConfigs == null) {
queryLoggingConfigs = new com.amazonaws.internal.SdkInternalList<QueryLoggingConfig>();
}
return queryLoggingConfigs;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"QueryLoggingConfig",
">",
"getQueryLoggingConfigs",
"(",
")",
"{",
"if",
"(",
"queryLoggingConfigs",
"==",
"null",
")",
"{",
"queryLoggingConfigs",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal",
".",
"... | <p>
An array that contains one <a
href="https://docs.aws.amazon.com/Route53/latest/APIReference/API_QueryLoggingConfig.html">QueryLoggingConfig</a>
element for each configuration for DNS query logging that is associated with the current AWS account.
</p>
@return An array that contains one <a
href="https://docs.aws.amazon.com/Route53/latest/APIReference/API_QueryLoggingConfig.html"
>QueryLoggingConfig</a> element for each configuration for DNS query logging that is associated with the
current AWS account. | [
"<p",
">",
"An",
"array",
"that",
"contains",
"one",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"Route53",
"/",
"latest",
"/",
"APIReference",
"/",
"API_QueryLoggingConfig",
".",
"html",
">",
"QueryLoggingC... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-route53/src/main/java/com/amazonaws/services/route53/model/ListQueryLoggingConfigsResult.java#L61-L66 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Image.java | Image.drawFlash | public void drawFlash(float x,float y,float width,float height) {
drawFlash(x,y,width,height,Color.white);
} | java | public void drawFlash(float x,float y,float width,float height) {
drawFlash(x,y,width,height,Color.white);
} | [
"public",
"void",
"drawFlash",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"width",
",",
"float",
"height",
")",
"{",
"drawFlash",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
",",
"Color",
".",
"white",
")",
";",
"}"
] | Draw this image at a specified location and size as a silohette
@param x The x location to draw the image at
@param y The y location to draw the image at
@param width The width to render the image at
@param height The height to render the image at | [
"Draw",
"this",
"image",
"at",
"a",
"specified",
"location",
"and",
"size",
"as",
"a",
"silohette"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L805-L807 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/OverlapResolver.java | OverlapResolver.getAtomOverlapScore | public double getAtomOverlapScore(IAtomContainer ac, Vector overlappingAtoms) {
overlappingAtoms.removeAllElements();
IAtom atom1 = null;
IAtom atom2 = null;
Point2d p1 = null;
Point2d p2 = null;
double distance = 0;
double overlapScore = 0;
double bondLength = GeometryUtil.getBondLengthAverage(ac);
double overlapCutoff = bondLength / 4;
logger.debug("Bond length is set to " + bondLength);
logger.debug("Now cyling through all pairs of atoms");
for (int f = 0; f < ac.getAtomCount(); f++) {
atom1 = ac.getAtom(f);
p1 = atom1.getPoint2d();
for (int g = f + 1; g < ac.getAtomCount(); g++) {
atom2 = ac.getAtom(g);
p2 = atom2.getPoint2d();
distance = p1.distance(p2);
if (distance < overlapCutoff) {
logger.debug("Detected atom clash with distance: " + distance
+ ", which is smaller than overlapCutoff " + overlapCutoff);
overlapScore += overlapCutoff;
overlappingAtoms.addElement(new OverlapPair(atom1, atom2));
}
}
}
return overlapScore;
} | java | public double getAtomOverlapScore(IAtomContainer ac, Vector overlappingAtoms) {
overlappingAtoms.removeAllElements();
IAtom atom1 = null;
IAtom atom2 = null;
Point2d p1 = null;
Point2d p2 = null;
double distance = 0;
double overlapScore = 0;
double bondLength = GeometryUtil.getBondLengthAverage(ac);
double overlapCutoff = bondLength / 4;
logger.debug("Bond length is set to " + bondLength);
logger.debug("Now cyling through all pairs of atoms");
for (int f = 0; f < ac.getAtomCount(); f++) {
atom1 = ac.getAtom(f);
p1 = atom1.getPoint2d();
for (int g = f + 1; g < ac.getAtomCount(); g++) {
atom2 = ac.getAtom(g);
p2 = atom2.getPoint2d();
distance = p1.distance(p2);
if (distance < overlapCutoff) {
logger.debug("Detected atom clash with distance: " + distance
+ ", which is smaller than overlapCutoff " + overlapCutoff);
overlapScore += overlapCutoff;
overlappingAtoms.addElement(new OverlapPair(atom1, atom2));
}
}
}
return overlapScore;
} | [
"public",
"double",
"getAtomOverlapScore",
"(",
"IAtomContainer",
"ac",
",",
"Vector",
"overlappingAtoms",
")",
"{",
"overlappingAtoms",
".",
"removeAllElements",
"(",
")",
";",
"IAtom",
"atom1",
"=",
"null",
";",
"IAtom",
"atom2",
"=",
"null",
";",
"Point2d",
... | Calculates a score based on the overlap of atoms.
The overlap is calculated by summing up the distances between all pairs of
atoms, if they are less than half the standard bondlength apart.
@param ac The Atomcontainer to work on
@param overlappingAtoms Description of the Parameter
@return The overlapScore value | [
"Calculates",
"a",
"score",
"based",
"on",
"the",
"overlap",
"of",
"atoms",
".",
"The",
"overlap",
"is",
"calculated",
"by",
"summing",
"up",
"the",
"distances",
"between",
"all",
"pairs",
"of",
"atoms",
"if",
"they",
"are",
"less",
"than",
"half",
"the",
... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/OverlapResolver.java#L178-L206 |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/ops/MatrixIO.java | MatrixIO.loadCSV | public static DMatrixRMaj loadCSV(String fileName , int numRows , int numCols )
throws IOException
{
FileInputStream fileStream = new FileInputStream(fileName);
ReadMatrixCsv csv = new ReadMatrixCsv(fileStream);
DMatrixRMaj ret = csv.readDDRM(numRows, numCols);
fileStream.close();
return ret;
} | java | public static DMatrixRMaj loadCSV(String fileName , int numRows , int numCols )
throws IOException
{
FileInputStream fileStream = new FileInputStream(fileName);
ReadMatrixCsv csv = new ReadMatrixCsv(fileStream);
DMatrixRMaj ret = csv.readDDRM(numRows, numCols);
fileStream.close();
return ret;
} | [
"public",
"static",
"DMatrixRMaj",
"loadCSV",
"(",
"String",
"fileName",
",",
"int",
"numRows",
",",
"int",
"numCols",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"fileStream",
"=",
"new",
"FileInputStream",
"(",
"fileName",
")",
";",
"ReadMatrixCsv",
... | Reads a matrix in which has been encoded using a Column Space Value (CSV)
file format. For a description of the format see {@link MatrixIO#loadCSV(String,boolean)}.
@param fileName The file being loaded.
@param numRows number of rows in the matrix.
@param numCols number of columns in the matrix.
@return DMatrixRMaj
@throws IOException | [
"Reads",
"a",
"matrix",
"in",
"which",
"has",
"been",
"encoded",
"using",
"a",
"Column",
"Space",
"Value",
"(",
"CSV",
")",
"file",
"format",
".",
"For",
"a",
"description",
"of",
"the",
"format",
"see",
"{",
"@link",
"MatrixIO#loadCSV",
"(",
"String",
"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/MatrixIO.java#L205-L216 |
google/closure-compiler | src/com/google/javascript/jscomp/gwt/client/Es6ClassConverterJsDocHelper.java | Es6ClassConverterJsDocHelper.getClassJsDoc | @JsMethod(name = "getClassJsDoc", namespace = "jscomp")
public static String getClassJsDoc(String jsDoc) {
if (Strings.isNullOrEmpty(jsDoc)) {
return null;
}
Config config =
Config.builder()
.setLanguageMode(LanguageMode.ECMASCRIPT3)
.setStrictMode(Config.StrictMode.SLOPPY)
.setJsDocParsingMode(JsDocParsing.INCLUDE_DESCRIPTIONS_WITH_WHITESPACE)
.build();
JsDocInfoParser parser =
new JsDocInfoParser(
// Stream expects us to remove the leading /**
new JsDocTokenStream(jsDoc.substring(3)),
jsDoc,
0,
null,
config,
ErrorReporter.NULL_INSTANCE);
parser.parse();
JSDocInfo parsed = parser.retrieveAndResetParsedJSDocInfo();
JSDocInfo classComments = parsed.cloneClassDoc();
JSDocInfoPrinter printer =
new JSDocInfoPrinter(/* useOriginalName= */ true, /* printDesc= */ true);
String comment = printer.print(classComments);
// Don't return empty comments, return null instead.
if (comment == null || RegExp.compile("\\s*/\\*\\*\\s*\\*/\\s*").test(comment)) {
return null;
}
return comment.trim();
} | java | @JsMethod(name = "getClassJsDoc", namespace = "jscomp")
public static String getClassJsDoc(String jsDoc) {
if (Strings.isNullOrEmpty(jsDoc)) {
return null;
}
Config config =
Config.builder()
.setLanguageMode(LanguageMode.ECMASCRIPT3)
.setStrictMode(Config.StrictMode.SLOPPY)
.setJsDocParsingMode(JsDocParsing.INCLUDE_DESCRIPTIONS_WITH_WHITESPACE)
.build();
JsDocInfoParser parser =
new JsDocInfoParser(
// Stream expects us to remove the leading /**
new JsDocTokenStream(jsDoc.substring(3)),
jsDoc,
0,
null,
config,
ErrorReporter.NULL_INSTANCE);
parser.parse();
JSDocInfo parsed = parser.retrieveAndResetParsedJSDocInfo();
JSDocInfo classComments = parsed.cloneClassDoc();
JSDocInfoPrinter printer =
new JSDocInfoPrinter(/* useOriginalName= */ true, /* printDesc= */ true);
String comment = printer.print(classComments);
// Don't return empty comments, return null instead.
if (comment == null || RegExp.compile("\\s*/\\*\\*\\s*\\*/\\s*").test(comment)) {
return null;
}
return comment.trim();
} | [
"@",
"JsMethod",
"(",
"name",
"=",
"\"getClassJsDoc\"",
",",
"namespace",
"=",
"\"jscomp\"",
")",
"public",
"static",
"String",
"getClassJsDoc",
"(",
"String",
"jsDoc",
")",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"jsDoc",
")",
")",
"{",
"ret... | Gets JS Doc that should be retained on a class. Used to upgrade ES5 to ES6 classes and separate
class from constructor comments. | [
"Gets",
"JS",
"Doc",
"that",
"should",
"be",
"retained",
"on",
"a",
"class",
".",
"Used",
"to",
"upgrade",
"ES5",
"to",
"ES6",
"classes",
"and",
"separate",
"class",
"from",
"constructor",
"comments",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/gwt/client/Es6ClassConverterJsDocHelper.java#L57-L88 |
landawn/AbacusUtil | src/com/landawn/abacus/util/AnyDelete.java | AnyDelete.addFamilyVersion | public AnyDelete addFamilyVersion(String family, final long timestamp) {
delete.addFamilyVersion(toFamilyQualifierBytes(family), timestamp);
return this;
} | java | public AnyDelete addFamilyVersion(String family, final long timestamp) {
delete.addFamilyVersion(toFamilyQualifierBytes(family), timestamp);
return this;
} | [
"public",
"AnyDelete",
"addFamilyVersion",
"(",
"String",
"family",
",",
"final",
"long",
"timestamp",
")",
"{",
"delete",
".",
"addFamilyVersion",
"(",
"toFamilyQualifierBytes",
"(",
"family",
")",
",",
"timestamp",
")",
";",
"return",
"this",
";",
"}"
] | Delete all columns of the specified family with a timestamp equal to the specified timestamp.
@param family
@param timestamp
@return | [
"Delete",
"all",
"columns",
"of",
"the",
"specified",
"family",
"with",
"a",
"timestamp",
"equal",
"to",
"the",
"specified",
"timestamp",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/AnyDelete.java#L120-L124 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/shared/core/types/Color.java | Color.fromHSL | public static final Color fromHSL(double h, double s, double l)
{
h = (((h % 360) + 360) % 360) / 360;
s = convertPercents(s);
l = convertPercents(l);
return fromNormalizedHSL(h, s, l);
} | java | public static final Color fromHSL(double h, double s, double l)
{
h = (((h % 360) + 360) % 360) / 360;
s = convertPercents(s);
l = convertPercents(l);
return fromNormalizedHSL(h, s, l);
} | [
"public",
"static",
"final",
"Color",
"fromHSL",
"(",
"double",
"h",
",",
"double",
"s",
",",
"double",
"l",
")",
"{",
"h",
"=",
"(",
"(",
"(",
"h",
"%",
"360",
")",
"+",
"360",
")",
"%",
"360",
")",
"/",
"360",
";",
"s",
"=",
"convertPercents"... | Converts HSL (hue, saturation, lightness) to RGB Color.
HSL values are not normalized yet.
@param h in [0,360] degrees
@param s in [0,100] percent
@param l in [0,100] percent
@return Color with RGB values | [
"Converts",
"HSL",
"(",
"hue",
"saturation",
"lightness",
")",
"to",
"RGB",
"Color",
".",
"HSL",
"values",
"are",
"not",
"normalized",
"yet",
"."
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/shared/core/types/Color.java#L221-L230 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/accounts/A_CmsUserDataImexportDialog.java | A_CmsUserDataImexportDialog.getSelectRoles | protected List<CmsSelectWidgetOption> getSelectRoles() {
List<CmsSelectWidgetOption> retVal = new ArrayList<CmsSelectWidgetOption>();
try {
boolean inRootOu = CmsStringUtil.isEmptyOrWhitespaceOnly(getParamOufqn())
|| CmsOrganizationalUnit.SEPARATOR.equals(getParamOufqn());
List<CmsRole> roles = OpenCms.getRoleManager().getRolesOfUser(
getCms(),
getCms().getRequestContext().getCurrentUser().getName(),
getParamOufqn(),
false,
false,
false);
Iterator<CmsRole> itRoles = roles.iterator();
while (itRoles.hasNext()) {
CmsRole role = itRoles.next();
if (role.isOrganizationalUnitIndependent() && !inRootOu) {
continue;
}
retVal.add(new CmsSelectWidgetOption(role.getGroupName(), false, role.getName(getLocale())));
}
} catch (CmsException e) {
// noop
}
Collections.sort(retVal, new Comparator<CmsSelectWidgetOption>() {
public int compare(CmsSelectWidgetOption arg0, CmsSelectWidgetOption arg1) {
return arg0.getOption().compareTo(arg1.getOption());
}
});
return retVal;
} | java | protected List<CmsSelectWidgetOption> getSelectRoles() {
List<CmsSelectWidgetOption> retVal = new ArrayList<CmsSelectWidgetOption>();
try {
boolean inRootOu = CmsStringUtil.isEmptyOrWhitespaceOnly(getParamOufqn())
|| CmsOrganizationalUnit.SEPARATOR.equals(getParamOufqn());
List<CmsRole> roles = OpenCms.getRoleManager().getRolesOfUser(
getCms(),
getCms().getRequestContext().getCurrentUser().getName(),
getParamOufqn(),
false,
false,
false);
Iterator<CmsRole> itRoles = roles.iterator();
while (itRoles.hasNext()) {
CmsRole role = itRoles.next();
if (role.isOrganizationalUnitIndependent() && !inRootOu) {
continue;
}
retVal.add(new CmsSelectWidgetOption(role.getGroupName(), false, role.getName(getLocale())));
}
} catch (CmsException e) {
// noop
}
Collections.sort(retVal, new Comparator<CmsSelectWidgetOption>() {
public int compare(CmsSelectWidgetOption arg0, CmsSelectWidgetOption arg1) {
return arg0.getOption().compareTo(arg1.getOption());
}
});
return retVal;
} | [
"protected",
"List",
"<",
"CmsSelectWidgetOption",
">",
"getSelectRoles",
"(",
")",
"{",
"List",
"<",
"CmsSelectWidgetOption",
">",
"retVal",
"=",
"new",
"ArrayList",
"<",
"CmsSelectWidgetOption",
">",
"(",
")",
";",
"try",
"{",
"boolean",
"inRootOu",
"=",
"Cm... | Returns the role names to show in the select box.<p>
@return the role names to show in the select box | [
"Returns",
"the",
"role",
"names",
"to",
"show",
"in",
"the",
"select",
"box",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/accounts/A_CmsUserDataImexportDialog.java#L182-L216 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java | TmdbMovies.getMovieCredits | public MediaCreditList getMovieCredits(int movieId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.CREDITS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, MediaCreditList.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credits", url, ex);
}
} | java | public MediaCreditList getMovieCredits(int movieId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.CREDITS).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, MediaCreditList.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credits", url, ex);
}
} | [
"public",
"MediaCreditList",
"getMovieCredits",
"(",
"int",
"movieId",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"ID",
",",
"movieId",
")",
... | Get the cast and crew information for a specific movie id.
@param movieId
@return
@throws MovieDbException | [
"Get",
"the",
"cast",
"and",
"crew",
"information",
"for",
"a",
"specific",
"movie",
"id",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L200-L211 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java | DatabasesInner.getByRecommendedElasticPoolAsync | public Observable<DatabaseInner> getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) {
return getByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() {
@Override
public DatabaseInner call(ServiceResponse<DatabaseInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseInner> getByRecommendedElasticPoolAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) {
return getByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() {
@Override
public DatabaseInner call(ServiceResponse<DatabaseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseInner",
">",
"getByRecommendedElasticPoolAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"recommendedElasticPoolName",
",",
"String",
"databaseName",
")",
"{",
"return",
"getByRecommendedElasticPo... | Gets a database inside of a recommented elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param recommendedElasticPoolName The name of the elastic pool to be retrieved.
@param databaseName The name of the database to be retrieved.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseInner object | [
"Gets",
"a",
"database",
"inside",
"of",
"a",
"recommented",
"elastic",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L1569-L1576 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/system/exec/SudoFeature.java | SudoFeature.hasSudo | public synchronized static boolean hasSudo()
{
if (!sudoTested)
{
String[] cmdArr = new String[]{"which", "sudo"};
List<String> cmd = new ArrayList<String>(cmdArr.length);
Collections.addAll(cmd, cmdArr);
ProcessBuilder whichsudo = new ProcessBuilder(cmd);
try
{
Process p = whichsudo.start();
try
{
Execed e = new Execed(cmd, p, false);
// Let it run
int returnCode = e.waitForExit(new Deadline(3, TimeUnit.SECONDS));
sudoSupported = (returnCode == 0);
sudoTested = true;
}
finally
{
p.destroy();
}
}
catch (Throwable t)
{
sudoSupported = false;
sudoTested = true;
}
}
return sudoSupported;
} | java | public synchronized static boolean hasSudo()
{
if (!sudoTested)
{
String[] cmdArr = new String[]{"which", "sudo"};
List<String> cmd = new ArrayList<String>(cmdArr.length);
Collections.addAll(cmd, cmdArr);
ProcessBuilder whichsudo = new ProcessBuilder(cmd);
try
{
Process p = whichsudo.start();
try
{
Execed e = new Execed(cmd, p, false);
// Let it run
int returnCode = e.waitForExit(new Deadline(3, TimeUnit.SECONDS));
sudoSupported = (returnCode == 0);
sudoTested = true;
}
finally
{
p.destroy();
}
}
catch (Throwable t)
{
sudoSupported = false;
sudoTested = true;
}
}
return sudoSupported;
} | [
"public",
"synchronized",
"static",
"boolean",
"hasSudo",
"(",
")",
"{",
"if",
"(",
"!",
"sudoTested",
")",
"{",
"String",
"[",
"]",
"cmdArr",
"=",
"new",
"String",
"[",
"]",
"{",
"\"which\"",
",",
"\"sudo\"",
"}",
";",
"List",
"<",
"String",
">",
"c... | Determines whether sudo is supported on the local machine
@return | [
"Determines",
"whether",
"sudo",
"is",
"supported",
"on",
"the",
"local",
"machine"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/system/exec/SudoFeature.java#L52-L88 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Transformation2D.java | Transformation2D.setShear | public void setShear(double proportionX, double proportionY) {
xx = 1;
xy = proportionX;
xd = 0;
yx = proportionY;
yy = 1;
yd = 0;
} | java | public void setShear(double proportionX, double proportionY) {
xx = 1;
xy = proportionX;
xd = 0;
yx = proportionY;
yy = 1;
yd = 0;
} | [
"public",
"void",
"setShear",
"(",
"double",
"proportionX",
",",
"double",
"proportionY",
")",
"{",
"xx",
"=",
"1",
";",
"xy",
"=",
"proportionX",
";",
"xd",
"=",
"0",
";",
"yx",
"=",
"proportionY",
";",
"yy",
"=",
"1",
";",
"yd",
"=",
"0",
";",
... | Set transformation to a shear.
@param proportionX
The proportion of shearing in x direction.
@param proportionY
The proportion of shearing in y direction. | [
"Set",
"transformation",
"to",
"a",
"shear",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L658-L665 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/linsol/chol/LinearSolverChol_DDRM.java | LinearSolverChol_DDRM.solve | @Override
public void solve(DMatrixRMaj B , DMatrixRMaj X ) {
if( B.numRows != n ) {
throw new IllegalArgumentException("Unexpected matrix size");
}
X.reshape(n,B.numCols);
if(decomposer.isLower()) {
solveLower(A,B,X,vv);
} else {
throw new RuntimeException("Implement");
}
} | java | @Override
public void solve(DMatrixRMaj B , DMatrixRMaj X ) {
if( B.numRows != n ) {
throw new IllegalArgumentException("Unexpected matrix size");
}
X.reshape(n,B.numCols);
if(decomposer.isLower()) {
solveLower(A,B,X,vv);
} else {
throw new RuntimeException("Implement");
}
} | [
"@",
"Override",
"public",
"void",
"solve",
"(",
"DMatrixRMaj",
"B",
",",
"DMatrixRMaj",
"X",
")",
"{",
"if",
"(",
"B",
".",
"numRows",
"!=",
"n",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unexpected matrix size\"",
")",
";",
"}",
"X",
... | <p>
Using the decomposition, finds the value of 'X' in the linear equation below:<br>
A*x = b<br>
where A has dimension of n by n, x and b are n by m dimension.
</p>
<p>
*Note* that 'b' and 'x' can be the same matrix instance.
</p>
@param B A matrix that is n by m. Not modified.
@param X An n by m matrix where the solution is writen to. Modified. | [
"<p",
">",
"Using",
"the",
"decomposition",
"finds",
"the",
"value",
"of",
"X",
"in",
"the",
"linear",
"equation",
"below",
":",
"<br",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/linsol/chol/LinearSolverChol_DDRM.java#L80-L92 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java | FastDatePrinter.appendDigits | private static void appendDigits(final Appendable buffer, final int value) throws IOException {
buffer.append((char) (value / 10 + '0'));
buffer.append((char) (value % 10 + '0'));
} | java | private static void appendDigits(final Appendable buffer, final int value) throws IOException {
buffer.append((char) (value / 10 + '0'));
buffer.append((char) (value % 10 + '0'));
} | [
"private",
"static",
"void",
"appendDigits",
"(",
"final",
"Appendable",
"buffer",
",",
"final",
"int",
"value",
")",
"throws",
"IOException",
"{",
"buffer",
".",
"append",
"(",
"(",
"char",
")",
"(",
"value",
"/",
"10",
"+",
"'",
"'",
")",
")",
";",
... | Appends two digits to the given buffer.
@param buffer the buffer to append to.
@param value the value to append digits from. | [
"Appends",
"two",
"digits",
"to",
"the",
"given",
"buffer",
"."
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDatePrinter.java#L413-L416 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java | HTTPBatchClientConnectionInterceptor.setResponseElements | private void setResponseElements(IntuitMessage intuitMessage, HttpResponse httpResponse) throws FMSException {
ResponseElements responseElements = intuitMessage.getResponseElements();
if(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_ENCODING) != null)
{
responseElements.setEncodingHeader(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_ENCODING).getValue());
}
else
{
responseElements.setEncodingHeader(null);
}
if(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_TYPE) !=null)
{
responseElements.setContentTypeHeader(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_TYPE).getValue());
}
else
{
responseElements.setContentTypeHeader(null);
}
responseElements.setStatusLine(httpResponse.getStatusLine());
responseElements.setStatusCode(httpResponse.getStatusLine().getStatusCode());
try {
responseElements.setResponseContent(getCopyOfResponseContent(httpResponse.getEntity().getContent()));
} catch (IllegalStateException e) {
LOG.error("IllegalStateException while get the content from HttpRespose.", e);
throw new FMSException(e);
} catch (Exception e) {
LOG.error("IOException in HTTPClientConnectionInterceptor while reading the entity from HttpResponse.", e);
throw new FMSException(e);
}
} | java | private void setResponseElements(IntuitMessage intuitMessage, HttpResponse httpResponse) throws FMSException {
ResponseElements responseElements = intuitMessage.getResponseElements();
if(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_ENCODING) != null)
{
responseElements.setEncodingHeader(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_ENCODING).getValue());
}
else
{
responseElements.setEncodingHeader(null);
}
if(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_TYPE) !=null)
{
responseElements.setContentTypeHeader(httpResponse.getLastHeader(RequestElements.HEADER_PARAM_CONTENT_TYPE).getValue());
}
else
{
responseElements.setContentTypeHeader(null);
}
responseElements.setStatusLine(httpResponse.getStatusLine());
responseElements.setStatusCode(httpResponse.getStatusLine().getStatusCode());
try {
responseElements.setResponseContent(getCopyOfResponseContent(httpResponse.getEntity().getContent()));
} catch (IllegalStateException e) {
LOG.error("IllegalStateException while get the content from HttpRespose.", e);
throw new FMSException(e);
} catch (Exception e) {
LOG.error("IOException in HTTPClientConnectionInterceptor while reading the entity from HttpResponse.", e);
throw new FMSException(e);
}
} | [
"private",
"void",
"setResponseElements",
"(",
"IntuitMessage",
"intuitMessage",
",",
"HttpResponse",
"httpResponse",
")",
"throws",
"FMSException",
"{",
"ResponseElements",
"responseElements",
"=",
"intuitMessage",
".",
"getResponseElements",
"(",
")",
";",
"if",
"(",
... | Method to set the response elements by reading the values from HttpResponse
@param intuitMessage the intuit message object
@param httpResponse the http response object
@throws com.intuit.ipp.exception.FMSException the FMSException | [
"Method",
"to",
"set",
"the",
"response",
"elements",
"by",
"reading",
"the",
"values",
"from",
"HttpResponse"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPBatchClientConnectionInterceptor.java#L443-L472 |
google/closure-compiler | src/com/google/javascript/jscomp/modules/ClosureRequireProcessor.java | ClosureRequireProcessor.getAllRequires | static ImmutableList<Require> getAllRequires(Node nameDeclaration) {
Node rhs =
nameDeclaration.getFirstChild().isDestructuringLhs()
? nameDeclaration.getFirstChild().getSecondChild()
: nameDeclaration.getFirstFirstChild();
// This may be a require, requireType, or forwardDeclare.
Binding.CreatedBy requireKind = getModuleDependencyTypeFromRhs(rhs);
if (requireKind == null) {
return ImmutableList.of();
}
return new ClosureRequireProcessor(nameDeclaration, requireKind).getAllRequiresInDeclaration();
} | java | static ImmutableList<Require> getAllRequires(Node nameDeclaration) {
Node rhs =
nameDeclaration.getFirstChild().isDestructuringLhs()
? nameDeclaration.getFirstChild().getSecondChild()
: nameDeclaration.getFirstFirstChild();
// This may be a require, requireType, or forwardDeclare.
Binding.CreatedBy requireKind = getModuleDependencyTypeFromRhs(rhs);
if (requireKind == null) {
return ImmutableList.of();
}
return new ClosureRequireProcessor(nameDeclaration, requireKind).getAllRequiresInDeclaration();
} | [
"static",
"ImmutableList",
"<",
"Require",
">",
"getAllRequires",
"(",
"Node",
"nameDeclaration",
")",
"{",
"Node",
"rhs",
"=",
"nameDeclaration",
".",
"getFirstChild",
"(",
")",
".",
"isDestructuringLhs",
"(",
")",
"?",
"nameDeclaration",
".",
"getFirstChild",
... | Returns all Require built from the given statement, or null if it is not a require
@param nameDeclaration a VAR, LET, or CONST
@return all Requires contained in this declaration | [
"Returns",
"all",
"Require",
"built",
"from",
"the",
"given",
"statement",
"or",
"null",
"if",
"it",
"is",
"not",
"a",
"require"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/modules/ClosureRequireProcessor.java#L66-L78 |
osglworks/java-tool-ext | src/main/java/org/osgl/util/Token.java | Token.generateToken | @Deprecated
public static String generateToken(String secret, long seconds, String oid, String... payload) {
return generateToken(secret.getBytes(Charsets.UTF_8), seconds, oid, payload);
} | java | @Deprecated
public static String generateToken(String secret, long seconds, String oid, String... payload) {
return generateToken(secret.getBytes(Charsets.UTF_8), seconds, oid, payload);
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"generateToken",
"(",
"String",
"secret",
",",
"long",
"seconds",
",",
"String",
"oid",
",",
"String",
"...",
"payload",
")",
"{",
"return",
"generateToken",
"(",
"secret",
".",
"getBytes",
"(",
"Charsets",
".... | This method is deprecated. please use {@link #generateToken(byte[], long, String, String...)} instead
Generate a token string with secret key, ID and optionally payloads
@param secret the secret to encrypt to token string
@param seconds the expiration of the token in seconds
@param oid the ID of the token (could be customer ID etc)
@param payload the payload optionally indicate more information
@return an encrypted token string that is expiring in {@link Life#SHORT} time period | [
"This",
"method",
"is",
"deprecated",
".",
"please",
"use",
"{",
"@link",
"#generateToken",
"(",
"byte",
"[]",
"long",
"String",
"String",
"...",
")",
"}",
"instead"
] | train | https://github.com/osglworks/java-tool-ext/blob/43f034bd0a42e571e437f44aa20487d45248a30b/src/main/java/org/osgl/util/Token.java#L323-L326 |
StanKocken/EfficientAdapter | efficientadapter/src/main/java/com/skocken/efficientadapter/lib/adapter/AdapterHelper.java | AdapterHelper.updateWith | void updateWith(EfficientAdapter<T> efficientAdapter, List<T> list) {
new AdapterUpdater<>(efficientAdapter).update(list);
} | java | void updateWith(EfficientAdapter<T> efficientAdapter, List<T> list) {
new AdapterUpdater<>(efficientAdapter).update(list);
} | [
"void",
"updateWith",
"(",
"EfficientAdapter",
"<",
"T",
">",
"efficientAdapter",
",",
"List",
"<",
"T",
">",
"list",
")",
"{",
"new",
"AdapterUpdater",
"<>",
"(",
"efficientAdapter",
")",
".",
"update",
"(",
"list",
")",
";",
"}"
] | Update the adapter list with this new list.
Using this method, instead of clear/addAll will allow the implementation to compute the best way to update the
elements.
For example, if you have only one item which was in the previous list and which is not on the new, the
Updater has an opportunity to just call `remove` on this item.
@param efficientAdapter the adapter to update.
@param list the new list of item to be into this adapter. | [
"Update",
"the",
"adapter",
"list",
"with",
"this",
"new",
"list",
".",
"Using",
"this",
"method",
"instead",
"of",
"clear",
"/",
"addAll",
"will",
"allow",
"the",
"implementation",
"to",
"compute",
"the",
"best",
"way",
"to",
"update",
"the",
"elements",
... | train | https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/adapter/AdapterHelper.java#L249-L251 |
Whiley/WhileyCompiler | src/main/java/wyil/check/DefiniteAssignmentCheck.java | DefiniteAssignmentCheck.visitBlock | @Override
public ControlFlow visitBlock(Stmt.Block block, DefinitelyAssignedSet environment) {
DefinitelyAssignedSet nextEnvironment = environment;
DefinitelyAssignedSet breakEnvironment = null;
for(int i=0;i!=block.size();++i) {
Stmt s = block.get(i);
ControlFlow nf = visitStatement(s, nextEnvironment);
nextEnvironment = nf.nextEnvironment;
breakEnvironment = join(breakEnvironment,nf.breakEnvironment);
// NOTE: following can arise when block contains unreachable code.
if(nextEnvironment == null) {
break;
}
}
return new ControlFlow(nextEnvironment,breakEnvironment);
} | java | @Override
public ControlFlow visitBlock(Stmt.Block block, DefinitelyAssignedSet environment) {
DefinitelyAssignedSet nextEnvironment = environment;
DefinitelyAssignedSet breakEnvironment = null;
for(int i=0;i!=block.size();++i) {
Stmt s = block.get(i);
ControlFlow nf = visitStatement(s, nextEnvironment);
nextEnvironment = nf.nextEnvironment;
breakEnvironment = join(breakEnvironment,nf.breakEnvironment);
// NOTE: following can arise when block contains unreachable code.
if(nextEnvironment == null) {
break;
}
}
return new ControlFlow(nextEnvironment,breakEnvironment);
} | [
"@",
"Override",
"public",
"ControlFlow",
"visitBlock",
"(",
"Stmt",
".",
"Block",
"block",
",",
"DefinitelyAssignedSet",
"environment",
")",
"{",
"DefinitelyAssignedSet",
"nextEnvironment",
"=",
"environment",
";",
"DefinitelyAssignedSet",
"breakEnvironment",
"=",
"nul... | Check that all variables used in a given list of statements are
definitely assigned. Furthermore, update the set of definitely assigned
variables to include any which are definitely assigned at the end of
these statements.
@param block
The list of statements to visit.
@param environment
The set of variables which are definitely assigned. | [
"Check",
"that",
"all",
"variables",
"used",
"in",
"a",
"given",
"list",
"of",
"statements",
"are",
"definitely",
"assigned",
".",
"Furthermore",
"update",
"the",
"set",
"of",
"definitely",
"assigned",
"variables",
"to",
"include",
"any",
"which",
"are",
"defi... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/DefiniteAssignmentCheck.java#L149-L164 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java | AbstractTreeMap.tailMap | public SortedMap tailMap(Object startKey) {
// Check for errors
if (comparator == null)
((Comparable) startKey).compareTo(startKey);
else
comparator.compare(startKey, startKey);
return makeSubMap(startKey, null);
} | java | public SortedMap tailMap(Object startKey) {
// Check for errors
if (comparator == null)
((Comparable) startKey).compareTo(startKey);
else
comparator.compare(startKey, startKey);
return makeSubMap(startKey, null);
} | [
"public",
"SortedMap",
"tailMap",
"(",
"Object",
"startKey",
")",
"{",
"// Check for errors",
"if",
"(",
"comparator",
"==",
"null",
")",
"(",
"(",
"Comparable",
")",
"startKey",
")",
".",
"compareTo",
"(",
"startKey",
")",
";",
"else",
"comparator",
".",
... | Answers a SortedMap of the specified portion of this TreeMap which
contains keys greater or equal to the start key. The returned SortedMap
is backed by this TreeMap so changes to one are reflected by the other.
@param startKey the start key
@return a submap where the keys are greater or equal to
<code>startKey</code>
@exception ClassCastException
when the start key cannot be compared with the keys in
this TreeMap
@exception NullPointerException
when the start key is null and the comparator cannot
handle null | [
"Answers",
"a",
"SortedMap",
"of",
"the",
"specified",
"portion",
"of",
"this",
"TreeMap",
"which",
"contains",
"keys",
"greater",
"or",
"equal",
"to",
"the",
"start",
"key",
".",
"The",
"returned",
"SortedMap",
"is",
"backed",
"by",
"this",
"TreeMap",
"so",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L1142-L1149 |
xcesco/kripton | kripton/src/main/java/com/abubusoft/kripton/map/BindMapVisitor.java | BindMapVisitor.visitList | @SuppressWarnings("unchecked")
static VisitorStatusType visitList(String name, List<Object> list, BindMapListener listener, VisitorStatusType status) {
int i = 0;
for (Object item : list) {
if (item == null || item instanceof String) {
visit(name + "." + i, (String) item, listener, status);
} else if (item instanceof List) {
visitList(name + "." + i, (List<Object>) item, listener, status);
} else if (item instanceof Map) {
visitMap(name + "." + i, (Map<String, Object>) item, listener, status);
}
i++;
if (status == VisitorStatusType.STOP)
return status;
}
return status;
} | java | @SuppressWarnings("unchecked")
static VisitorStatusType visitList(String name, List<Object> list, BindMapListener listener, VisitorStatusType status) {
int i = 0;
for (Object item : list) {
if (item == null || item instanceof String) {
visit(name + "." + i, (String) item, listener, status);
} else if (item instanceof List) {
visitList(name + "." + i, (List<Object>) item, listener, status);
} else if (item instanceof Map) {
visitMap(name + "." + i, (Map<String, Object>) item, listener, status);
}
i++;
if (status == VisitorStatusType.STOP)
return status;
}
return status;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"VisitorStatusType",
"visitList",
"(",
"String",
"name",
",",
"List",
"<",
"Object",
">",
"list",
",",
"BindMapListener",
"listener",
",",
"VisitorStatusType",
"status",
")",
"{",
"int",
"i",
"=",
"... | Visit list.
@param name the name
@param list the list
@param listener the listener
@param status the status
@return the visitor status type | [
"Visit",
"list",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/map/BindMapVisitor.java#L82-L100 |
wdtinc/mapbox-vector-tile-java | src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java | JtsAdapter.ptsToGeomCmds | private static List<Integer> ptsToGeomCmds(final Geometry geom, final Vec2d cursor) {
// Guard: empty geometry coordinates
final Coordinate[] geomCoords = geom.getCoordinates();
if(geomCoords.length <= 0) {
return Collections.emptyList();
}
/** Tile commands and parameters */
final List<Integer> geomCmds = new ArrayList<>(geomCmdBuffLenPts(geomCoords.length));
/** Holds next MVT coordinate */
final Vec2d mvtPos = new Vec2d();
/** Length of 'MoveTo' draw command */
int moveCmdLen = 0;
// Insert placeholder for 'MoveTo' command header
geomCmds.add(0);
Coordinate nextCoord;
for(int i = 0; i < geomCoords.length; ++i) {
nextCoord = geomCoords[i];
mvtPos.set(nextCoord.x, nextCoord.y);
// Ignore duplicate MVT points
if(i == 0 || !equalAsInts(cursor, mvtPos)) {
++moveCmdLen;
moveCursor(cursor, geomCmds, mvtPos);
}
}
if(moveCmdLen <= GeomCmdHdr.CMD_HDR_LEN_MAX) {
// Write 'MoveTo' command header to first index
geomCmds.set(0, GeomCmdHdr.cmdHdr(GeomCmd.MoveTo, moveCmdLen));
return geomCmds;
} else {
// Invalid geometry, need at least 1 'MoveTo' value to make points
return Collections.emptyList();
}
} | java | private static List<Integer> ptsToGeomCmds(final Geometry geom, final Vec2d cursor) {
// Guard: empty geometry coordinates
final Coordinate[] geomCoords = geom.getCoordinates();
if(geomCoords.length <= 0) {
return Collections.emptyList();
}
/** Tile commands and parameters */
final List<Integer> geomCmds = new ArrayList<>(geomCmdBuffLenPts(geomCoords.length));
/** Holds next MVT coordinate */
final Vec2d mvtPos = new Vec2d();
/** Length of 'MoveTo' draw command */
int moveCmdLen = 0;
// Insert placeholder for 'MoveTo' command header
geomCmds.add(0);
Coordinate nextCoord;
for(int i = 0; i < geomCoords.length; ++i) {
nextCoord = geomCoords[i];
mvtPos.set(nextCoord.x, nextCoord.y);
// Ignore duplicate MVT points
if(i == 0 || !equalAsInts(cursor, mvtPos)) {
++moveCmdLen;
moveCursor(cursor, geomCmds, mvtPos);
}
}
if(moveCmdLen <= GeomCmdHdr.CMD_HDR_LEN_MAX) {
// Write 'MoveTo' command header to first index
geomCmds.set(0, GeomCmdHdr.cmdHdr(GeomCmd.MoveTo, moveCmdLen));
return geomCmds;
} else {
// Invalid geometry, need at least 1 'MoveTo' value to make points
return Collections.emptyList();
}
} | [
"private",
"static",
"List",
"<",
"Integer",
">",
"ptsToGeomCmds",
"(",
"final",
"Geometry",
"geom",
",",
"final",
"Vec2d",
"cursor",
")",
"{",
"// Guard: empty geometry coordinates",
"final",
"Coordinate",
"[",
"]",
"geomCoords",
"=",
"geom",
".",
"getCoordinates... | <p>Convert a {@link Point} or {@link MultiPoint} geometry to a list of MVT geometry drawing commands. See
<a href="https://github.com/mapbox/vector-tile-spec">vector-tile-spec</a>
for details.</p>
<p>WARNING: The value of the {@code cursor} parameter is modified as a result of calling this method.</p>
@param geom input of type {@link Point} or {@link MultiPoint}. Type is NOT checked and expected to be correct.
@param cursor modified during processing to contain next MVT cursor position
@return list of commands | [
"<p",
">",
"Convert",
"a",
"{",
"@link",
"Point",
"}",
"or",
"{",
"@link",
"MultiPoint",
"}",
"geometry",
"to",
"a",
"list",
"of",
"MVT",
"geometry",
"drawing",
"commands",
".",
"See",
"<a",
"href",
"=",
"https",
":",
"//",
"github",
".",
"com",
"/",... | train | https://github.com/wdtinc/mapbox-vector-tile-java/blob/e5e3df3fc2260709e289f972a1348c0a1ea30339/src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java#L430-L476 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/media/MediaClient.java | MediaClient.createThumbnailJob | public CreateThumbnailJobResponse createThumbnailJob(String pipelineName, String sourceKey) {
ThumbnailSource source = new ThumbnailSource();
source.setKey(sourceKey);
CreateThumbnailJobRequest request =
new CreateThumbnailJobRequest().withPipelineName(pipelineName).withSource(source);
return createThumbnailJob(request);
} | java | public CreateThumbnailJobResponse createThumbnailJob(String pipelineName, String sourceKey) {
ThumbnailSource source = new ThumbnailSource();
source.setKey(sourceKey);
CreateThumbnailJobRequest request =
new CreateThumbnailJobRequest().withPipelineName(pipelineName).withSource(source);
return createThumbnailJob(request);
} | [
"public",
"CreateThumbnailJobResponse",
"createThumbnailJob",
"(",
"String",
"pipelineName",
",",
"String",
"sourceKey",
")",
"{",
"ThumbnailSource",
"source",
"=",
"new",
"ThumbnailSource",
"(",
")",
";",
"source",
".",
"setKey",
"(",
"sourceKey",
")",
";",
"Crea... | Creates a thumbnail job and return job ID.
@param pipelineName The name of a pipeline.
@param sourceKey The key of source object.
@return the unique ID of the new thumbnail job. | [
"Creates",
"a",
"thumbnail",
"job",
"and",
"return",
"job",
"ID",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L1238-L1246 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/component/UISelectMany.java | UISelectMany.countElementOccurrence | private static int countElementOccurrence(Object element, Object[] array) {
int count = 0;
for ( int i= 0; i < array.length; ++i ) {
Object arrayElement = array[i];
if (arrayElement != null && element != null) {
if (arrayElement.equals(element)) {
count ++;
}
}
}
return count;
} | java | private static int countElementOccurrence(Object element, Object[] array) {
int count = 0;
for ( int i= 0; i < array.length; ++i ) {
Object arrayElement = array[i];
if (arrayElement != null && element != null) {
if (arrayElement.equals(element)) {
count ++;
}
}
}
return count;
} | [
"private",
"static",
"int",
"countElementOccurrence",
"(",
"Object",
"element",
",",
"Object",
"[",
"]",
"array",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"++",
"i",
")",... | <p>Return the number of occurrances of a particular element in the
array.</p>
@param element object whose occurrance is to be counted in the array.
@param array object representing the old value of this component. | [
"<p",
">",
"Return",
"the",
"number",
"of",
"occurrances",
"of",
"a",
"particular",
"element",
"in",
"the",
"array",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UISelectMany.java#L495-L508 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java | DecimalStyle.withDecimalSeparator | public DecimalStyle withDecimalSeparator(char decimalSeparator) {
if (decimalSeparator == this.decimalSeparator) {
return this;
}
return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator);
} | java | public DecimalStyle withDecimalSeparator(char decimalSeparator) {
if (decimalSeparator == this.decimalSeparator) {
return this;
}
return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator);
} | [
"public",
"DecimalStyle",
"withDecimalSeparator",
"(",
"char",
"decimalSeparator",
")",
"{",
"if",
"(",
"decimalSeparator",
"==",
"this",
".",
"decimalSeparator",
")",
"{",
"return",
"this",
";",
"}",
"return",
"new",
"DecimalStyle",
"(",
"zeroDigit",
",",
"posi... | Returns a copy of the info with a new character that represents the decimal point.
<p>
The character used to represent a decimal point may vary by culture.
This method specifies the character to use.
@param decimalSeparator the character for the decimal point
@return a copy with a new character that represents the decimal point, not null | [
"Returns",
"a",
"copy",
"of",
"the",
"info",
"with",
"a",
"new",
"character",
"that",
"represents",
"the",
"decimal",
"point",
".",
"<p",
">",
"The",
"character",
"used",
"to",
"represent",
"a",
"decimal",
"point",
"may",
"vary",
"by",
"culture",
".",
"T... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java#L303-L308 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/FileUtils.java | FileUtils.isSubPath | public static boolean isSubPath(File parent, File child) throws IOException {
String childStr = child.getCanonicalPath();
String parentStr = parent.getCanonicalPath();
return childStr.startsWith(parentStr);
} | java | public static boolean isSubPath(File parent, File child) throws IOException {
String childStr = child.getCanonicalPath();
String parentStr = parent.getCanonicalPath();
return childStr.startsWith(parentStr);
} | [
"public",
"static",
"boolean",
"isSubPath",
"(",
"File",
"parent",
",",
"File",
"child",
")",
"throws",
"IOException",
"{",
"String",
"childStr",
"=",
"child",
".",
"getCanonicalPath",
"(",
")",
";",
"String",
"parentStr",
"=",
"parent",
".",
"getCanonicalPath... | *
Check if child path is child of parent path.
@param parent Expected parent path.
@param child Expected child path.
@return If child path is child of parent path.
@throws IOException | [
"*",
"Check",
"if",
"child",
"path",
"is",
"child",
"of",
"parent",
"path",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/FileUtils.java#L45-L50 |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/Util.java | Util.setBlob | private static void setBlob(PreparedStatement ps, int i, Object o, Class<?> cls)
throws SQLException {
final InputStream is;
if (o instanceof byte[]) {
is = new ByteArrayInputStream((byte[]) o);
} | java | private static void setBlob(PreparedStatement ps, int i, Object o, Class<?> cls)
throws SQLException {
final InputStream is;
if (o instanceof byte[]) {
is = new ByteArrayInputStream((byte[]) o);
} | [
"private",
"static",
"void",
"setBlob",
"(",
"PreparedStatement",
"ps",
",",
"int",
"i",
",",
"Object",
"o",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"throws",
"SQLException",
"{",
"final",
"InputStream",
"is",
";",
"if",
"(",
"o",
"instanceof",
"byte",
... | Sets a blob parameter for the prepared statement.
@param ps
@param i
@param o
@param cls
@throws SQLException | [
"Sets",
"a",
"blob",
"parameter",
"for",
"the",
"prepared",
"statement",
"."
] | train | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/Util.java#L808-L813 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/graph/Cycles.java | Cycles.markRingAtomsAndBonds | public static int markRingAtomsAndBonds(IAtomContainer mol) {
EdgeToBondMap bonds = EdgeToBondMap.withSpaceFor(mol);
return markRingAtomsAndBonds(mol, GraphUtil.toAdjList(mol, bonds), bonds);
} | java | public static int markRingAtomsAndBonds(IAtomContainer mol) {
EdgeToBondMap bonds = EdgeToBondMap.withSpaceFor(mol);
return markRingAtomsAndBonds(mol, GraphUtil.toAdjList(mol, bonds), bonds);
} | [
"public",
"static",
"int",
"markRingAtomsAndBonds",
"(",
"IAtomContainer",
"mol",
")",
"{",
"EdgeToBondMap",
"bonds",
"=",
"EdgeToBondMap",
".",
"withSpaceFor",
"(",
"mol",
")",
";",
"return",
"markRingAtomsAndBonds",
"(",
"mol",
",",
"GraphUtil",
".",
"toAdjList"... | Find and mark all cyclic atoms and bonds in the provided molecule.
@param mol molecule
@see IBond#isInRing()
@see IAtom#isInRing()
@return Number of rings found (circuit rank)
@see <a href="https://en.wikipedia.org/wiki/Circuit_rank">Circuit Rank</a> | [
"Find",
"and",
"mark",
"all",
"cyclic",
"atoms",
"and",
"bonds",
"in",
"the",
"provided",
"molecule",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/graph/Cycles.java#L423-L426 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/util/ValidationFileUtil.java | ValidationFileUtil.writeStringToFile | public static void writeStringToFile(File file, String content) throws IOException {
OutputStream outputStream = getOutputStream(file);
outputStream.write(content.getBytes());
} | java | public static void writeStringToFile(File file, String content) throws IOException {
OutputStream outputStream = getOutputStream(file);
outputStream.write(content.getBytes());
} | [
"public",
"static",
"void",
"writeStringToFile",
"(",
"File",
"file",
",",
"String",
"content",
")",
"throws",
"IOException",
"{",
"OutputStream",
"outputStream",
"=",
"getOutputStream",
"(",
"file",
")",
";",
"outputStream",
".",
"write",
"(",
"content",
".",
... | Write string to file.
@param file the file
@param content the content
@throws IOException the io exception | [
"Write",
"string",
"to",
"file",
"."
] | train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationFileUtil.java#L63-L66 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.transferAgent | public ApiSuccessResponse transferAgent(String mediatype, String id, TransferData transferData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = transferAgentWithHttpInfo(mediatype, id, transferData);
return resp.getData();
} | java | public ApiSuccessResponse transferAgent(String mediatype, String id, TransferData transferData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = transferAgentWithHttpInfo(mediatype, id, transferData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"transferAgent",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"TransferData",
"transferData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"transferAgentWithHttpInfo",
"(",
"me... | Transfer an interaction
Transfer the interaction to the specified agent.
@param mediatype The media channel. (required)
@param id The ID of the interaction. (required)
@param transferData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Transfer",
"an",
"interaction",
"Transfer",
"the",
"interaction",
"to",
"the",
"specified",
"agent",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L4341-L4344 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/ftp/FTPFileSystem.java | FTPFileSystem.rename | @Override
public boolean rename(Path src, Path dst) throws IOException {
FTPClient client = connect();
try {
boolean success = rename(client, src, dst);
return success;
} finally {
disconnect(client);
}
} | java | @Override
public boolean rename(Path src, Path dst) throws IOException {
FTPClient client = connect();
try {
boolean success = rename(client, src, dst);
return success;
} finally {
disconnect(client);
}
} | [
"@",
"Override",
"public",
"boolean",
"rename",
"(",
"Path",
"src",
",",
"Path",
"dst",
")",
"throws",
"IOException",
"{",
"FTPClient",
"client",
"=",
"connect",
"(",
")",
";",
"try",
"{",
"boolean",
"success",
"=",
"rename",
"(",
"client",
",",
"src",
... | /*
Assuming that parent of both source and destination is the same. Is the
assumption correct or it is suppose to work like 'move' ? | [
"/",
"*",
"Assuming",
"that",
"parent",
"of",
"both",
"source",
"and",
"destination",
"is",
"the",
"same",
".",
"Is",
"the",
"assumption",
"correct",
"or",
"it",
"is",
"suppose",
"to",
"work",
"like",
"move",
"?"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/ftp/FTPFileSystem.java#L508-L517 |
apache/incubator-gobblin | gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryTopology.java | InMemoryTopology.getImportedByRecursively | @Override
public Collection<ConfigKeyPath> getImportedByRecursively(ConfigKeyPath configKey) {
return getImportedByRecursively(configKey, Optional.<Config>absent());
} | java | @Override
public Collection<ConfigKeyPath> getImportedByRecursively(ConfigKeyPath configKey) {
return getImportedByRecursively(configKey, Optional.<Config>absent());
} | [
"@",
"Override",
"public",
"Collection",
"<",
"ConfigKeyPath",
">",
"getImportedByRecursively",
"(",
"ConfigKeyPath",
"configKey",
")",
"{",
"return",
"getImportedByRecursively",
"(",
"configKey",
",",
"Optional",
".",
"<",
"Config",
">",
"absent",
"(",
")",
")",
... | {@inheritDoc}.
<p>
If the result is already in cache, return the result.
Otherwise, delegate the functionality to the fallback object.
If the fallback did not support this operation, will build the entire topology of the {@link org.apache.gobblin.config.store.api.ConfigStore}
using default breath first search.
</p> | [
"{",
"@inheritDoc",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryTopology.java#L215-L218 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractPathElement3D.java | AbstractPathElement3D.newInstance | @Pure
public static AbstractPathElement3D newInstance(PathElementType type, double lastX, double lastY, double lastZ, double[] coords) {
switch(type) {
case MOVE_TO:
return new MovePathElement3d(coords[0], coords[1], coords[2]);
case LINE_TO:
return new LinePathElement3d(lastX, lastY, lastZ, coords[0], coords[1], coords[2]);
case QUAD_TO:
return new QuadPathElement3d(lastX, lastY, lastZ, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
case CURVE_TO:
return new CurvePathElement3d(lastX, lastY, lastZ, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7], coords[8]);
case CLOSE:
return new ClosePathElement3d(lastX, lastY, lastZ, coords[0], coords[1], coords[2]);
default:
}
throw new IllegalArgumentException();
} | java | @Pure
public static AbstractPathElement3D newInstance(PathElementType type, double lastX, double lastY, double lastZ, double[] coords) {
switch(type) {
case MOVE_TO:
return new MovePathElement3d(coords[0], coords[1], coords[2]);
case LINE_TO:
return new LinePathElement3d(lastX, lastY, lastZ, coords[0], coords[1], coords[2]);
case QUAD_TO:
return new QuadPathElement3d(lastX, lastY, lastZ, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
case CURVE_TO:
return new CurvePathElement3d(lastX, lastY, lastZ, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7], coords[8]);
case CLOSE:
return new ClosePathElement3d(lastX, lastY, lastZ, coords[0], coords[1], coords[2]);
default:
}
throw new IllegalArgumentException();
} | [
"@",
"Pure",
"public",
"static",
"AbstractPathElement3D",
"newInstance",
"(",
"PathElementType",
"type",
",",
"double",
"lastX",
",",
"double",
"lastY",
",",
"double",
"lastZ",
",",
"double",
"[",
"]",
"coords",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"... | Create an instance of path element.
@param type is the type of the new element.
@param lastX is the coordinate of the last point.
@param lastY is the coordinate of the last point.
@param lastZ is the coordinate of the last point.
@param coords are the coordinates.
@return the instance of path element. | [
"Create",
"an",
"instance",
"of",
"path",
"element",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractPathElement3D.java#L49-L65 |
Impetus/Kundera | src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/ethereum/KunderaWeb3jClient.java | KunderaWeb3jClient.getFirstBlock | public EthBlock getFirstBlock(boolean includeTransactions)
{
try
{
return web3j.ethGetBlockByNumber(DefaultBlockParameterName.EARLIEST, includeTransactions).send();
}
catch (IOException ex)
{
LOGGER.error("Not able to find the EARLIEST block. ", ex);
throw new KunderaException("Not able to find the EARLIEST block. ", ex);
}
} | java | public EthBlock getFirstBlock(boolean includeTransactions)
{
try
{
return web3j.ethGetBlockByNumber(DefaultBlockParameterName.EARLIEST, includeTransactions).send();
}
catch (IOException ex)
{
LOGGER.error("Not able to find the EARLIEST block. ", ex);
throw new KunderaException("Not able to find the EARLIEST block. ", ex);
}
} | [
"public",
"EthBlock",
"getFirstBlock",
"(",
"boolean",
"includeTransactions",
")",
"{",
"try",
"{",
"return",
"web3j",
".",
"ethGetBlockByNumber",
"(",
"DefaultBlockParameterName",
".",
"EARLIEST",
",",
"includeTransactions",
")",
".",
"send",
"(",
")",
";",
"}",
... | Gets the first block.
@param includeTransactions
the include transactions
@return the first block | [
"Gets",
"the",
"first",
"block",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-ethereum/src/main/java/com/impetus/kundera/blockchain/ethereum/KunderaWeb3jClient.java#L217-L229 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java | BNFHeadersImpl.writeByteArray | protected void writeByteArray(ObjectOutput output, byte[] data) throws IOException {
if (null == data || 0 == data.length) {
output.writeInt(-1);
} else {
output.writeInt(data.length);
output.write(data);
}
} | java | protected void writeByteArray(ObjectOutput output, byte[] data) throws IOException {
if (null == data || 0 == data.length) {
output.writeInt(-1);
} else {
output.writeInt(data.length);
output.write(data);
}
} | [
"protected",
"void",
"writeByteArray",
"(",
"ObjectOutput",
"output",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"IOException",
"{",
"if",
"(",
"null",
"==",
"data",
"||",
"0",
"==",
"data",
".",
"length",
")",
"{",
"output",
".",
"writeInt",
"(",
"... | Write information for the input data to the output stream. If the input
data is null or empty, this will write a -1 length marker.
@param output
@param data
@throws IOException | [
"Write",
"information",
"for",
"the",
"input",
"data",
"to",
"the",
"output",
"stream",
".",
"If",
"the",
"input",
"data",
"is",
"null",
"or",
"empty",
"this",
"will",
"write",
"a",
"-",
"1",
"length",
"marker",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L713-L720 |
facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java | FairScheduler.updateFairShares | private void updateFairShares(double totalSlots, final TaskType type) {
// Find the proper ratio of (# of slots share / weight) by bineary search
BinarySearcher searcher = new BinarySearcher() {
@Override
double targetFunction(double x) {
return slotsUsedWithWeightToSlotRatio(x, type);
}
};
double ratio = searcher.getSolution(totalSlots, lastWeightToFairShareRatio);
lastWeightToFairShareRatio = ratio;
// Set the fair shares based on the value of R we've converged to
for (JobInfo info : infos.values()) {
if (type == TaskType.MAP) {
info.mapFairShare = computeShare(info, ratio, type);
} else {
info.reduceFairShare = computeShare(info, ratio, type);
}
}
} | java | private void updateFairShares(double totalSlots, final TaskType type) {
// Find the proper ratio of (# of slots share / weight) by bineary search
BinarySearcher searcher = new BinarySearcher() {
@Override
double targetFunction(double x) {
return slotsUsedWithWeightToSlotRatio(x, type);
}
};
double ratio = searcher.getSolution(totalSlots, lastWeightToFairShareRatio);
lastWeightToFairShareRatio = ratio;
// Set the fair shares based on the value of R we've converged to
for (JobInfo info : infos.values()) {
if (type == TaskType.MAP) {
info.mapFairShare = computeShare(info, ratio, type);
} else {
info.reduceFairShare = computeShare(info, ratio, type);
}
}
} | [
"private",
"void",
"updateFairShares",
"(",
"double",
"totalSlots",
",",
"final",
"TaskType",
"type",
")",
"{",
"// Find the proper ratio of (# of slots share / weight) by bineary search",
"BinarySearcher",
"searcher",
"=",
"new",
"BinarySearcher",
"(",
")",
"{",
"@",
"Ov... | Update fairshare for each JobInfo based on the weight, neededTasks and
minTasks and the size of the pool. We compute the share by finding the
ratio of (# of slots / weight) using binary search. | [
"Update",
"fairshare",
"for",
"each",
"JobInfo",
"based",
"on",
"the",
"weight",
"neededTasks",
"and",
"minTasks",
"and",
"the",
"size",
"of",
"the",
"pool",
".",
"We",
"compute",
"the",
"share",
"by",
"finding",
"the",
"ratio",
"of",
"(",
"#",
"of",
"sl... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java#L1939-L1958 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/TransformerFactoryImpl.java | TransformerFactoryImpl.getAttribute | public Object getAttribute(String name) throws IllegalArgumentException
{
if (name.equals(FEATURE_INCREMENTAL))
{
return new Boolean(m_incremental);
}
else if (name.equals(FEATURE_OPTIMIZE))
{
return new Boolean(m_optimize);
}
else if (name.equals(FEATURE_SOURCE_LOCATION))
{
return new Boolean(m_source_location);
}
else
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_ATTRIB_VALUE_NOT_RECOGNIZED, new Object[]{name})); //name + " attribute not recognized");
} | java | public Object getAttribute(String name) throws IllegalArgumentException
{
if (name.equals(FEATURE_INCREMENTAL))
{
return new Boolean(m_incremental);
}
else if (name.equals(FEATURE_OPTIMIZE))
{
return new Boolean(m_optimize);
}
else if (name.equals(FEATURE_SOURCE_LOCATION))
{
return new Boolean(m_source_location);
}
else
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_ATTRIB_VALUE_NOT_RECOGNIZED, new Object[]{name})); //name + " attribute not recognized");
} | [
"public",
"Object",
"getAttribute",
"(",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"FEATURE_INCREMENTAL",
")",
")",
"{",
"return",
"new",
"Boolean",
"(",
"m_incremental",
")",
";",
"}",
"else",
"... | Allows the user to retrieve specific attributes on the underlying
implementation.
@param name The name of the attribute.
@return value The value of the attribute.
@throws IllegalArgumentException thrown if the underlying
implementation doesn't recognize the attribute. | [
"Allows",
"the",
"user",
"to",
"retrieve",
"specific",
"attributes",
"on",
"the",
"underlying",
"implementation",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/TransformerFactoryImpl.java#L594-L610 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/webhook/WebhookMessageBuilder.java | WebhookMessageBuilder.addFile | public WebhookMessageBuilder addFile(String name, InputStream data)
{
Checks.notNull(data, "InputStream");
Checks.notBlank(name, "Name");
if (fileIndex >= MAX_FILES)
throw new IllegalStateException("Cannot add more than " + MAX_FILES + " attachments to a message");
try
{
MessageAttachment attachment = new MessageAttachment(name, data);
files[fileIndex++] = attachment;
return this;
}
catch (IOException ex)
{
throw new IllegalArgumentException(ex);
}
} | java | public WebhookMessageBuilder addFile(String name, InputStream data)
{
Checks.notNull(data, "InputStream");
Checks.notBlank(name, "Name");
if (fileIndex >= MAX_FILES)
throw new IllegalStateException("Cannot add more than " + MAX_FILES + " attachments to a message");
try
{
MessageAttachment attachment = new MessageAttachment(name, data);
files[fileIndex++] = attachment;
return this;
}
catch (IOException ex)
{
throw new IllegalArgumentException(ex);
}
} | [
"public",
"WebhookMessageBuilder",
"addFile",
"(",
"String",
"name",
",",
"InputStream",
"data",
")",
"{",
"Checks",
".",
"notNull",
"(",
"data",
",",
"\"InputStream\"",
")",
";",
"Checks",
".",
"notBlank",
"(",
"name",
",",
"\"Name\"",
")",
";",
"if",
"("... | Adds the provided file to the resulting message.
@param name
The name to use for this file
@param data
The file data to add
@throws IllegalArgumentException
If the provided name or data is null
@throws IllegalStateException
If the file limit has already been reached
@return The current WebhookMessageBuilder for chaining convenience
@see #resetFiles() | [
"Adds",
"the",
"provided",
"file",
"to",
"the",
"resulting",
"message",
"."
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookMessageBuilder.java#L372-L389 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/security/auth/DefaultHttpCredentialsPlugin.java | DefaultHttpCredentialsPlugin.populateContext | @Override
public ReqContext populateContext(ReqContext context, HttpServletRequest req) {
String userName = getUserName(req);
String doAsUser = req.getHeader("doAsUser");
if (doAsUser == null) {
doAsUser = req.getParameter("doAsUser");
}
if (doAsUser != null) {
context.setRealPrincipal(new SingleUserPrincipal(userName));
userName = doAsUser;
}
Set<Principal> principals = new HashSet<Principal>();
if (userName != null) {
Principal p = new SingleUserPrincipal(userName);
principals.add(p);
}
Subject s = new Subject(true, principals, new HashSet(), new HashSet());
context.setSubject(s);
return context;
} | java | @Override
public ReqContext populateContext(ReqContext context, HttpServletRequest req) {
String userName = getUserName(req);
String doAsUser = req.getHeader("doAsUser");
if (doAsUser == null) {
doAsUser = req.getParameter("doAsUser");
}
if (doAsUser != null) {
context.setRealPrincipal(new SingleUserPrincipal(userName));
userName = doAsUser;
}
Set<Principal> principals = new HashSet<Principal>();
if (userName != null) {
Principal p = new SingleUserPrincipal(userName);
principals.add(p);
}
Subject s = new Subject(true, principals, new HashSet(), new HashSet());
context.setSubject(s);
return context;
} | [
"@",
"Override",
"public",
"ReqContext",
"populateContext",
"(",
"ReqContext",
"context",
",",
"HttpServletRequest",
"req",
")",
"{",
"String",
"userName",
"=",
"getUserName",
"(",
"req",
")",
";",
"String",
"doAsUser",
"=",
"req",
".",
"getHeader",
"(",
"\"do... | Populates a given context with a new Subject derived from the credentials in a servlet request.
@param context the context to be populated
@param req the servlet request
@return the context | [
"Populates",
"a",
"given",
"context",
"with",
"a",
"new",
"Subject",
"derived",
"from",
"the",
"credentials",
"in",
"a",
"servlet",
"request",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/security/auth/DefaultHttpCredentialsPlugin.java#L72-L95 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_database_GET | public ArrayList<String> serviceName_database_GET(String serviceName, OvhModeEnum mode, String name, String server, OvhDatabaseTypeEnum type, String user) throws IOException {
String qPath = "/hosting/web/{serviceName}/database";
StringBuilder sb = path(qPath, serviceName);
query(sb, "mode", mode);
query(sb, "name", name);
query(sb, "server", server);
query(sb, "type", type);
query(sb, "user", user);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> serviceName_database_GET(String serviceName, OvhModeEnum mode, String name, String server, OvhDatabaseTypeEnum type, String user) throws IOException {
String qPath = "/hosting/web/{serviceName}/database";
StringBuilder sb = path(qPath, serviceName);
query(sb, "mode", mode);
query(sb, "name", name);
query(sb, "server", server);
query(sb, "type", type);
query(sb, "user", user);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"serviceName_database_GET",
"(",
"String",
"serviceName",
",",
"OvhModeEnum",
"mode",
",",
"String",
"name",
",",
"String",
"server",
",",
"OvhDatabaseTypeEnum",
"type",
",",
"String",
"user",
")",
"throws",
"IOException"... | Databases linked to your hosting
REST: GET /hosting/web/{serviceName}/database
@param type [required] Filter the value of type property (=)
@param name [required] Filter the value of name property (like)
@param server [required] Filter the value of server property (like)
@param mode [required] Filter the value of mode property (=)
@param user [required] Filter the value of user property (like)
@param serviceName [required] The internal name of your hosting | [
"Databases",
"linked",
"to",
"your",
"hosting"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1086-L1096 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIUtils.java | HBCIUtils.strings2DateTimeISO | public static Date strings2DateTimeISO(String date, String time) {
if (date == null) {
throw new InvalidArgumentException("*** date must not be null");
}
Date result;
try {
if (time != null) {
result = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date + " " + time);
} else {
result = new SimpleDateFormat("yyyy-MM-dd").parse(date);
}
} catch (ParseException e) {
throw new InvalidArgumentException(date + " / " + time);
}
return result;
} | java | public static Date strings2DateTimeISO(String date, String time) {
if (date == null) {
throw new InvalidArgumentException("*** date must not be null");
}
Date result;
try {
if (time != null) {
result = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date + " " + time);
} else {
result = new SimpleDateFormat("yyyy-MM-dd").parse(date);
}
} catch (ParseException e) {
throw new InvalidArgumentException(date + " / " + time);
}
return result;
} | [
"public",
"static",
"Date",
"strings2DateTimeISO",
"(",
"String",
"date",
",",
"String",
"time",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"*** date must not be null\"",
")",
";",
"}",
"Date",
"resu... | Erzeugt ein Datums-Objekt aus Datum und Uhrzeit in der String-Darstellung.
Die String-Darstellung von Datum und Uhrzeit müssen dabei im ISO-Format
vorlegen (Datum als yyyy-mm-dd, Zeit als hh:mm:ss). Der Parameter <code>time</code>
darf auch <code>null</code> sein, <code>date</code> jedoch nicht.
@param date ein Datum in der ISO-Darstellung
@param time eine Uhrzeit in der ISO-Darstellung (darf auch <code>null</code> sein)
@return ein entsprechendes Datumsobjekt | [
"Erzeugt",
"ein",
"Datums",
"-",
"Objekt",
"aus",
"Datum",
"und",
"Uhrzeit",
"in",
"der",
"String",
"-",
"Darstellung",
".",
"Die",
"String",
"-",
"Darstellung",
"von",
"Datum",
"und",
"Uhrzeit",
"müssen",
"dabei",
"im",
"ISO",
"-",
"Format",
"vorlegen",
"... | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIUtils.java#L500-L517 |
lamydev/Android-Notification | core/src/zemin/notification/NotificationEntry.java | NotificationEntry.setWhen | public void setWhen(CharSequence format, long when) {
if (format == null) format = DEFAULT_DATE_FORMAT;
this.whenFormatted = DateFormat.format(format, when);
} | java | public void setWhen(CharSequence format, long when) {
if (format == null) format = DEFAULT_DATE_FORMAT;
this.whenFormatted = DateFormat.format(format, when);
} | [
"public",
"void",
"setWhen",
"(",
"CharSequence",
"format",
",",
"long",
"when",
")",
"{",
"if",
"(",
"format",
"==",
"null",
")",
"format",
"=",
"DEFAULT_DATE_FORMAT",
";",
"this",
".",
"whenFormatted",
"=",
"DateFormat",
".",
"format",
"(",
"format",
","... | Set a timestamp pertaining to this notification.
Only used for:
@see NotificationLocal
@see NotificationGlobal
@param format
@param when | [
"Set",
"a",
"timestamp",
"pertaining",
"to",
"this",
"notification",
"."
] | train | https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationEntry.java#L309-L312 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.maxByLong | public OptionalInt maxByLong(IntToLongFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, i) -> {
long key = keyExtractor.applyAsLong(i);
if (!box.b || box.l < key) {
box.b = true;
box.l = key;
box.i = i;
}
}, PrimitiveBox.MAX_LONG).asInt();
} | java | public OptionalInt maxByLong(IntToLongFunction keyExtractor) {
return collect(PrimitiveBox::new, (box, i) -> {
long key = keyExtractor.applyAsLong(i);
if (!box.b || box.l < key) {
box.b = true;
box.l = key;
box.i = i;
}
}, PrimitiveBox.MAX_LONG).asInt();
} | [
"public",
"OptionalInt",
"maxByLong",
"(",
"IntToLongFunction",
"keyExtractor",
")",
"{",
"return",
"collect",
"(",
"PrimitiveBox",
"::",
"new",
",",
"(",
"box",
",",
"i",
")",
"->",
"{",
"long",
"key",
"=",
"keyExtractor",
".",
"applyAsLong",
"(",
"i",
")... | Returns the maximum element of this stream according to the provided key
extractor function.
<p>
This is a terminal operation.
@param keyExtractor a non-interfering, stateless function
@return an {@code OptionalInt} describing the first element of this
stream for which the highest value was returned by key extractor,
or an empty {@code OptionalInt} if the stream is empty
@since 0.1.2 | [
"Returns",
"the",
"maximum",
"element",
"of",
"this",
"stream",
"according",
"to",
"the",
"provided",
"key",
"extractor",
"function",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L1164-L1173 |
Stratio/bdt | src/main/java/com/stratio/qa/utils/MongoDBUtils.java | MongoDBUtils.insertIntoMongoDBCollection | public void insertIntoMongoDBCollection(String collection, DataTable table) {
// Primero pasamos la fila del datatable a un hashmap de ColumnName-Type
List<String[]> colRel = coltoArrayList(table);
// Vamos insertando fila a fila
for (int i = 1; i < table.raw().size(); i++) {
// Obtenemos la fila correspondiente
BasicDBObject doc = new BasicDBObject();
List<String> row = table.raw().get(i);
for (int x = 0; x < row.size(); x++) {
String[] colNameType = colRel.get(x);
Object data = castSTringTo(colNameType[1], row.get(x));
doc.put(colNameType[0], data);
}
this.dataBase.getCollection(collection).insert(doc);
}
} | java | public void insertIntoMongoDBCollection(String collection, DataTable table) {
// Primero pasamos la fila del datatable a un hashmap de ColumnName-Type
List<String[]> colRel = coltoArrayList(table);
// Vamos insertando fila a fila
for (int i = 1; i < table.raw().size(); i++) {
// Obtenemos la fila correspondiente
BasicDBObject doc = new BasicDBObject();
List<String> row = table.raw().get(i);
for (int x = 0; x < row.size(); x++) {
String[] colNameType = colRel.get(x);
Object data = castSTringTo(colNameType[1], row.get(x));
doc.put(colNameType[0], data);
}
this.dataBase.getCollection(collection).insert(doc);
}
} | [
"public",
"void",
"insertIntoMongoDBCollection",
"(",
"String",
"collection",
",",
"DataTable",
"table",
")",
"{",
"// Primero pasamos la fila del datatable a un hashmap de ColumnName-Type",
"List",
"<",
"String",
"[",
"]",
">",
"colRel",
"=",
"coltoArrayList",
"(",
"tabl... | Insert data in a MongoDB Collection.
@param collection
@param table | [
"Insert",
"data",
"in",
"a",
"MongoDB",
"Collection",
"."
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/MongoDBUtils.java#L200-L215 |
yshrsmz/KeyboardVisibilityEvent | keyboardvisibilityevent/src/main/java/net/yslibrary/android/keyboardvisibilityevent/KeyboardVisibilityEvent.java | KeyboardVisibilityEvent.registerEventListener | public static Unregistrar registerEventListener(final Activity activity,
final KeyboardVisibilityEventListener listener) {
if (activity == null) {
throw new NullPointerException("Parameter:activity must not be null");
}
int softInputAdjust = activity.getWindow().getAttributes().softInputMode
& WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
// fix for #37 and #38.
// The window will not be resized in case of SOFT_INPUT_ADJUST_NOTHING
if ((softInputAdjust & WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)
== WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING) {
throw new IllegalArgumentException("Parameter:activity window SoftInputMethod is SOFT_INPUT_ADJUST_NOTHING. In this case window will not be resized");
}
if (listener == null) {
throw new NullPointerException("Parameter:listener must not be null");
}
final View activityRoot = getActivityRoot(activity);
final ViewTreeObserver.OnGlobalLayoutListener layoutListener =
new ViewTreeObserver.OnGlobalLayoutListener() {
private final Rect r = new Rect();
private boolean wasOpened = false;
@Override
public void onGlobalLayout() {
activityRoot.getWindowVisibleDisplayFrame(r);
int screenHeight = activityRoot.getRootView().getHeight();
int heightDiff = screenHeight - r.height();
boolean isOpen = heightDiff > screenHeight * KEYBOARD_MIN_HEIGHT_RATIO;
if (isOpen == wasOpened) {
// keyboard state has not changed
return;
}
wasOpened = isOpen;
listener.onVisibilityChanged(isOpen);
}
};
activityRoot.getViewTreeObserver().addOnGlobalLayoutListener(layoutListener);
return new SimpleUnregistrar(activity, layoutListener);
} | java | public static Unregistrar registerEventListener(final Activity activity,
final KeyboardVisibilityEventListener listener) {
if (activity == null) {
throw new NullPointerException("Parameter:activity must not be null");
}
int softInputAdjust = activity.getWindow().getAttributes().softInputMode
& WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
// fix for #37 and #38.
// The window will not be resized in case of SOFT_INPUT_ADJUST_NOTHING
if ((softInputAdjust & WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)
== WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING) {
throw new IllegalArgumentException("Parameter:activity window SoftInputMethod is SOFT_INPUT_ADJUST_NOTHING. In this case window will not be resized");
}
if (listener == null) {
throw new NullPointerException("Parameter:listener must not be null");
}
final View activityRoot = getActivityRoot(activity);
final ViewTreeObserver.OnGlobalLayoutListener layoutListener =
new ViewTreeObserver.OnGlobalLayoutListener() {
private final Rect r = new Rect();
private boolean wasOpened = false;
@Override
public void onGlobalLayout() {
activityRoot.getWindowVisibleDisplayFrame(r);
int screenHeight = activityRoot.getRootView().getHeight();
int heightDiff = screenHeight - r.height();
boolean isOpen = heightDiff > screenHeight * KEYBOARD_MIN_HEIGHT_RATIO;
if (isOpen == wasOpened) {
// keyboard state has not changed
return;
}
wasOpened = isOpen;
listener.onVisibilityChanged(isOpen);
}
};
activityRoot.getViewTreeObserver().addOnGlobalLayoutListener(layoutListener);
return new SimpleUnregistrar(activity, layoutListener);
} | [
"public",
"static",
"Unregistrar",
"registerEventListener",
"(",
"final",
"Activity",
"activity",
",",
"final",
"KeyboardVisibilityEventListener",
"listener",
")",
"{",
"if",
"(",
"activity",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Pa... | Set keyboard visibility change event listener.
@param activity Activity
@param listener KeyboardVisibilityEventListener
@return Unregistrar | [
"Set",
"keyboard",
"visibility",
"change",
"event",
"listener",
"."
] | train | https://github.com/yshrsmz/KeyboardVisibilityEvent/blob/fbde29a2c28ff1b2fa44f43cdd1ff3ec1d3321d8/keyboardvisibilityevent/src/main/java/net/yslibrary/android/keyboardvisibilityevent/KeyboardVisibilityEvent.java#L47-L99 |
kiuwan/java-api-client | src/main/java/com/kiuwan/client/KiuwanRestApiClient.java | KiuwanRestApiClient.initializeConnection | private void initializeConnection(String user, String password, String restApiBaseUrl) {
csrfToken = null;
cookies = new HashMap<String, Cookie>();
connection = ClientHelper.createClient().register(HttpAuthenticationFeature.basic(user, password)).target(restApiBaseUrl);
} | java | private void initializeConnection(String user, String password, String restApiBaseUrl) {
csrfToken = null;
cookies = new HashMap<String, Cookie>();
connection = ClientHelper.createClient().register(HttpAuthenticationFeature.basic(user, password)).target(restApiBaseUrl);
} | [
"private",
"void",
"initializeConnection",
"(",
"String",
"user",
",",
"String",
"password",
",",
"String",
"restApiBaseUrl",
")",
"{",
"csrfToken",
"=",
"null",
";",
"cookies",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Cookie",
">",
"(",
")",
";",
"conn... | Initializes the connection.
@param user The user name in Kiuwan.
@param password The password in Kiuwan.
@param restApiBaseUrl Base URL for REST-API. | [
"Initializes",
"the",
"connection",
"."
] | train | https://github.com/kiuwan/java-api-client/blob/5cda6a6ed9f37a03f9418a1846d349f6d59e14f7/src/main/java/com/kiuwan/client/KiuwanRestApiClient.java#L1085-L1090 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.appendUtf8String | public static File appendUtf8String(String content, File file) throws IORuntimeException {
return appendString(content, file, CharsetUtil.CHARSET_UTF_8);
} | java | public static File appendUtf8String(String content, File file) throws IORuntimeException {
return appendString(content, file, CharsetUtil.CHARSET_UTF_8);
} | [
"public",
"static",
"File",
"appendUtf8String",
"(",
"String",
"content",
",",
"File",
"file",
")",
"throws",
"IORuntimeException",
"{",
"return",
"appendString",
"(",
"content",
",",
"file",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
")",
";",
"}"
] | 将String写入文件,UTF-8编码追加模式
@param content 写入的内容
@param file 文件
@return 写入的文件
@throws IORuntimeException IO异常
@since 3.1.2 | [
"将String写入文件,UTF",
"-",
"8编码追加模式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2813-L2815 |
Jasig/uPortal | uPortal-groups/uPortal-groups-pags/src/main/java/org/apereo/portal/groups/pags/dao/PagsService.java | PagsService.deletePagsDefinition | public void deletePagsDefinition(IPerson person, IPersonAttributesGroupDefinition pagsDef) {
// Verify permission
if (!hasPermission(
person,
IPermission.DELETE_GROUP_ACTIVITY,
pagsDef.getCompositeEntityIdentifierForGroup().getKey())) {
throw new RuntimeAuthorizationException(
person,
IPermission.DELETE_GROUP_ACTIVITY,
pagsDef.getCompositeEntityIdentifierForGroup().getKey());
}
pagsGroupDefDao.deletePersonAttributesGroupDefinition(pagsDef);
} | java | public void deletePagsDefinition(IPerson person, IPersonAttributesGroupDefinition pagsDef) {
// Verify permission
if (!hasPermission(
person,
IPermission.DELETE_GROUP_ACTIVITY,
pagsDef.getCompositeEntityIdentifierForGroup().getKey())) {
throw new RuntimeAuthorizationException(
person,
IPermission.DELETE_GROUP_ACTIVITY,
pagsDef.getCompositeEntityIdentifierForGroup().getKey());
}
pagsGroupDefDao.deletePersonAttributesGroupDefinition(pagsDef);
} | [
"public",
"void",
"deletePagsDefinition",
"(",
"IPerson",
"person",
",",
"IPersonAttributesGroupDefinition",
"pagsDef",
")",
"{",
"// Verify permission",
"if",
"(",
"!",
"hasPermission",
"(",
"person",
",",
"IPermission",
".",
"DELETE_GROUP_ACTIVITY",
",",
"pagsDef",
... | NOTE -- This method assumes that pagsDef is an existing JPA-managed entity. | [
"NOTE",
"--",
"This",
"method",
"assumes",
"that",
"pagsDef",
"is",
"an",
"existing",
"JPA",
"-",
"managed",
"entity",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-pags/src/main/java/org/apereo/portal/groups/pags/dao/PagsService.java#L211-L225 |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleSerialAPIGetCapabilitiesResponse | private void handleSerialAPIGetCapabilitiesResponse(SerialMessage incomingMessage) {
logger.trace("Handle Message Serial API Get Capabilities");
this.serialAPIVersion = String.format("%d.%d", incomingMessage.getMessagePayloadByte(0), incomingMessage.getMessagePayloadByte(1));
this.manufactureId = ((incomingMessage.getMessagePayloadByte(2)) << 8) | (incomingMessage.getMessagePayloadByte(3));
this.deviceType = ((incomingMessage.getMessagePayloadByte(4)) << 8) | (incomingMessage.getMessagePayloadByte(5));
this.deviceId = (((incomingMessage.getMessagePayloadByte(6)) << 8) | (incomingMessage.getMessagePayloadByte(7)));
logger.debug(String.format("API Version = %s", this.getSerialAPIVersion()));
logger.debug(String.format("Manufacture ID = 0x%x", this.getManufactureId()));
logger.debug(String.format("Device Type = 0x%x", this.getDeviceType()));
logger.debug(String.format("Device ID = 0x%x", this.getDeviceId()));
// Ready to get information on Serial API
this.enqueue(new SerialMessage(SerialMessage.SerialMessageClass.SerialApiGetInitData, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.SerialApiGetInitData, SerialMessage.SerialMessagePriority.High));
} | java | private void handleSerialAPIGetCapabilitiesResponse(SerialMessage incomingMessage) {
logger.trace("Handle Message Serial API Get Capabilities");
this.serialAPIVersion = String.format("%d.%d", incomingMessage.getMessagePayloadByte(0), incomingMessage.getMessagePayloadByte(1));
this.manufactureId = ((incomingMessage.getMessagePayloadByte(2)) << 8) | (incomingMessage.getMessagePayloadByte(3));
this.deviceType = ((incomingMessage.getMessagePayloadByte(4)) << 8) | (incomingMessage.getMessagePayloadByte(5));
this.deviceId = (((incomingMessage.getMessagePayloadByte(6)) << 8) | (incomingMessage.getMessagePayloadByte(7)));
logger.debug(String.format("API Version = %s", this.getSerialAPIVersion()));
logger.debug(String.format("Manufacture ID = 0x%x", this.getManufactureId()));
logger.debug(String.format("Device Type = 0x%x", this.getDeviceType()));
logger.debug(String.format("Device ID = 0x%x", this.getDeviceId()));
// Ready to get information on Serial API
this.enqueue(new SerialMessage(SerialMessage.SerialMessageClass.SerialApiGetInitData, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.SerialApiGetInitData, SerialMessage.SerialMessagePriority.High));
} | [
"private",
"void",
"handleSerialAPIGetCapabilitiesResponse",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Handle Message Serial API Get Capabilities\"",
")",
";",
"this",
".",
"serialAPIVersion",
"=",
"String",
".",
"format",
"(",
"... | Handles the response of the SerialAPIGetCapabilities request.
@param incomingMessage the response message to process. | [
"Handles",
"the",
"response",
"of",
"the",
"SerialAPIGetCapabilities",
"request",
"."
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L615-L630 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/HarFileSystem.java | HarFileSystem.open | @Override
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
HarStatus hstatus = getFileHarStatus(f, null);
// we got it.. woo hooo!!!
if (hstatus.isDir()) {
throw new FileNotFoundException(f + " : not a file in " +
archivePath);
}
return new HarFSDataInputStream(fs, new Path(archivePath,
hstatus.getPartName()),
hstatus.getStartIndex(), hstatus.getLength(), bufferSize);
} | java | @Override
public FSDataInputStream open(Path f, int bufferSize) throws IOException {
HarStatus hstatus = getFileHarStatus(f, null);
// we got it.. woo hooo!!!
if (hstatus.isDir()) {
throw new FileNotFoundException(f + " : not a file in " +
archivePath);
}
return new HarFSDataInputStream(fs, new Path(archivePath,
hstatus.getPartName()),
hstatus.getStartIndex(), hstatus.getLength(), bufferSize);
} | [
"@",
"Override",
"public",
"FSDataInputStream",
"open",
"(",
"Path",
"f",
",",
"int",
"bufferSize",
")",
"throws",
"IOException",
"{",
"HarStatus",
"hstatus",
"=",
"getFileHarStatus",
"(",
"f",
",",
"null",
")",
";",
"// we got it.. woo hooo!!!",
"if",
"(",
"h... | Returns a har input stream which fakes end of
file. It reads the index files to get the part
file name and the size and start of the file. | [
"Returns",
"a",
"har",
"input",
"stream",
"which",
"fakes",
"end",
"of",
"file",
".",
"It",
"reads",
"the",
"index",
"files",
"to",
"get",
"the",
"part",
"file",
"name",
"and",
"the",
"size",
"and",
"start",
"of",
"the",
"file",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/HarFileSystem.java#L681-L692 |
apache/spark | common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java | YarnShuffleService.initRecoveryDb | protected File initRecoveryDb(String dbName) {
Preconditions.checkNotNull(_recoveryPath,
"recovery path should not be null if NM recovery is enabled");
File recoveryFile = new File(_recoveryPath.toUri().getPath(), dbName);
if (recoveryFile.exists()) {
return recoveryFile;
}
// db doesn't exist in recovery path go check local dirs for it
String[] localDirs = _conf.getTrimmedStrings("yarn.nodemanager.local-dirs");
for (String dir : localDirs) {
File f = new File(new Path(dir).toUri().getPath(), dbName);
if (f.exists()) {
// If the recovery path is set then either NM recovery is enabled or another recovery
// DB has been initialized. If NM recovery is enabled and had set the recovery path
// make sure to move all DBs to the recovery path from the old NM local dirs.
// If another DB was initialized first just make sure all the DBs are in the same
// location.
Path newLoc = new Path(_recoveryPath, dbName);
Path copyFrom = new Path(f.toURI());
if (!newLoc.equals(copyFrom)) {
logger.info("Moving " + copyFrom + " to: " + newLoc);
try {
// The move here needs to handle moving non-empty directories across NFS mounts
FileSystem fs = FileSystem.getLocal(_conf);
fs.rename(copyFrom, newLoc);
} catch (Exception e) {
// Fail to move recovery file to new path, just continue on with new DB location
logger.error("Failed to move recovery file {} to the path {}",
dbName, _recoveryPath.toString(), e);
}
}
return new File(newLoc.toUri().getPath());
}
}
return new File(_recoveryPath.toUri().getPath(), dbName);
} | java | protected File initRecoveryDb(String dbName) {
Preconditions.checkNotNull(_recoveryPath,
"recovery path should not be null if NM recovery is enabled");
File recoveryFile = new File(_recoveryPath.toUri().getPath(), dbName);
if (recoveryFile.exists()) {
return recoveryFile;
}
// db doesn't exist in recovery path go check local dirs for it
String[] localDirs = _conf.getTrimmedStrings("yarn.nodemanager.local-dirs");
for (String dir : localDirs) {
File f = new File(new Path(dir).toUri().getPath(), dbName);
if (f.exists()) {
// If the recovery path is set then either NM recovery is enabled or another recovery
// DB has been initialized. If NM recovery is enabled and had set the recovery path
// make sure to move all DBs to the recovery path from the old NM local dirs.
// If another DB was initialized first just make sure all the DBs are in the same
// location.
Path newLoc = new Path(_recoveryPath, dbName);
Path copyFrom = new Path(f.toURI());
if (!newLoc.equals(copyFrom)) {
logger.info("Moving " + copyFrom + " to: " + newLoc);
try {
// The move here needs to handle moving non-empty directories across NFS mounts
FileSystem fs = FileSystem.getLocal(_conf);
fs.rename(copyFrom, newLoc);
} catch (Exception e) {
// Fail to move recovery file to new path, just continue on with new DB location
logger.error("Failed to move recovery file {} to the path {}",
dbName, _recoveryPath.toString(), e);
}
}
return new File(newLoc.toUri().getPath());
}
}
return new File(_recoveryPath.toUri().getPath(), dbName);
} | [
"protected",
"File",
"initRecoveryDb",
"(",
"String",
"dbName",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"_recoveryPath",
",",
"\"recovery path should not be null if NM recovery is enabled\"",
")",
";",
"File",
"recoveryFile",
"=",
"new",
"File",
"(",
"_reco... | Figure out the recovery path and handle moving the DB if YARN NM recovery gets enabled
and DB exists in the local dir of NM by old version of shuffle service. | [
"Figure",
"out",
"the",
"recovery",
"path",
"and",
"handle",
"moving",
"the",
"DB",
"if",
"YARN",
"NM",
"recovery",
"gets",
"enabled",
"and",
"DB",
"exists",
"in",
"the",
"local",
"dir",
"of",
"NM",
"by",
"old",
"version",
"of",
"shuffle",
"service",
"."... | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java#L363-L401 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/BytesWritable.java | BytesWritable.copyTo | public int copyTo(byte[] dest, int start)
throws BufferTooSmallException {
if (size > (dest.length - start)) {
throw new BufferTooSmallException("size is " + size
+ ", buffer availabe size is " + (dest.length - start));
}
if (size > 0) {
System.arraycopy(bytes, 0, dest, start, size);
}
return size;
} | java | public int copyTo(byte[] dest, int start)
throws BufferTooSmallException {
if (size > (dest.length - start)) {
throw new BufferTooSmallException("size is " + size
+ ", buffer availabe size is " + (dest.length - start));
}
if (size > 0) {
System.arraycopy(bytes, 0, dest, start, size);
}
return size;
} | [
"public",
"int",
"copyTo",
"(",
"byte",
"[",
"]",
"dest",
",",
"int",
"start",
")",
"throws",
"BufferTooSmallException",
"{",
"if",
"(",
"size",
">",
"(",
"dest",
".",
"length",
"-",
"start",
")",
")",
"{",
"throw",
"new",
"BufferTooSmallException",
"(",... | copy the byte array to the dest array, and return the number of bytes
copied.
@param dest
@param maxLen
@param start
@return | [
"copy",
"the",
"byte",
"array",
"to",
"the",
"dest",
"array",
"and",
"return",
"the",
"number",
"of",
"bytes",
"copied",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/BytesWritable.java#L74-L84 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processAVT | AVT processAVT(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
AVT avt = new AVT(handler, uri, name, rawName, value, owner);
return avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | java | AVT processAVT(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
AVT avt = new AVT(handler, uri, name, rawName, value, owner);
return avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | [
"AVT",
"processAVT",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"... | Process an attribute string of type T_AVT into
a AVT value.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value Should be an Attribute Value Template string.
@return An AVT object that may be used to evaluate the Attribute Value Template.
@throws org.xml.sax.SAXException which will wrap a
{@link javax.xml.transform.TransformerException}, if there is a syntax error
in the attribute value template string. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_AVT",
"into",
"a",
"AVT",
"value",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L512-L528 |
Omertron/api-rottentomatoes | src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java | RottenTomatoesApi.getMoviesSearch | public List<RTMovie> getMoviesSearch(String query) throws RottenTomatoesException {
return getMoviesSearch(query, DEFAULT_PAGE_LIMIT, DEFAULT_PAGE);
} | java | public List<RTMovie> getMoviesSearch(String query) throws RottenTomatoesException {
return getMoviesSearch(query, DEFAULT_PAGE_LIMIT, DEFAULT_PAGE);
} | [
"public",
"List",
"<",
"RTMovie",
">",
"getMoviesSearch",
"(",
"String",
"query",
")",
"throws",
"RottenTomatoesException",
"{",
"return",
"getMoviesSearch",
"(",
"query",
",",
"DEFAULT_PAGE_LIMIT",
",",
"DEFAULT_PAGE",
")",
";",
"}"
] | The movies search endpoint for plain text queries. Let's you search for
movies!
@param query
@return
@throws RottenTomatoesException | [
"The",
"movies",
"search",
"endpoint",
"for",
"plain",
"text",
"queries",
".",
"Let",
"s",
"you",
"search",
"for",
"movies!"
] | train | https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L710-L712 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java | GrailsDomainBinder.createPrimaryKeyValue | protected DependantValue createPrimaryKeyValue(InFlightMetadataCollector mappings, PersistentProperty property,
Collection collection, Map<?, ?> persistentClasses) {
KeyValue keyValue;
DependantValue key;
String propertyRef = collection.getReferencedPropertyName();
// this is to support mapping by a property
if (propertyRef == null) {
keyValue = collection.getOwner().getIdentifier();
} else {
keyValue = (KeyValue) collection.getOwner().getProperty(propertyRef).getValue();
}
if (LOG.isDebugEnabled())
LOG.debug("[GrailsDomainBinder] creating dependant key value to table [" + keyValue.getTable().getName() + "]");
key = new DependantValue(metadataBuildingContext, collection.getCollectionTable(), keyValue);
key.setTypeName(null);
// make nullable and non-updateable
key.setNullable(true);
key.setUpdateable(false);
return key;
} | java | protected DependantValue createPrimaryKeyValue(InFlightMetadataCollector mappings, PersistentProperty property,
Collection collection, Map<?, ?> persistentClasses) {
KeyValue keyValue;
DependantValue key;
String propertyRef = collection.getReferencedPropertyName();
// this is to support mapping by a property
if (propertyRef == null) {
keyValue = collection.getOwner().getIdentifier();
} else {
keyValue = (KeyValue) collection.getOwner().getProperty(propertyRef).getValue();
}
if (LOG.isDebugEnabled())
LOG.debug("[GrailsDomainBinder] creating dependant key value to table [" + keyValue.getTable().getName() + "]");
key = new DependantValue(metadataBuildingContext, collection.getCollectionTable(), keyValue);
key.setTypeName(null);
// make nullable and non-updateable
key.setNullable(true);
key.setUpdateable(false);
return key;
} | [
"protected",
"DependantValue",
"createPrimaryKeyValue",
"(",
"InFlightMetadataCollector",
"mappings",
",",
"PersistentProperty",
"property",
",",
"Collection",
"collection",
",",
"Map",
"<",
"?",
",",
"?",
">",
"persistentClasses",
")",
"{",
"KeyValue",
"keyValue",
";... | Creates the DependentValue object that forms a primary key reference for the collection.
@param mappings
@param property The grails property
@param collection The collection object
@param persistentClasses
@return The DependantValue (key) | [
"Creates",
"the",
"DependentValue",
"object",
"that",
"forms",
"a",
"primary",
"key",
"reference",
"for",
"the",
"collection",
"."
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L886-L908 |
Jasig/uPortal | uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/RDBMEntityLockStore.java | RDBMEntityLockStore.find | @Override
public IEntityLock[] find(
Class entityType, String entityKey, Integer lockType, Date expiration, String lockOwner)
throws LockingException {
return select(entityType, entityKey, lockType, expiration, lockOwner);
} | java | @Override
public IEntityLock[] find(
Class entityType, String entityKey, Integer lockType, Date expiration, String lockOwner)
throws LockingException {
return select(entityType, entityKey, lockType, expiration, lockOwner);
} | [
"@",
"Override",
"public",
"IEntityLock",
"[",
"]",
"find",
"(",
"Class",
"entityType",
",",
"String",
"entityKey",
",",
"Integer",
"lockType",
",",
"Date",
"expiration",
",",
"String",
"lockOwner",
")",
"throws",
"LockingException",
"{",
"return",
"select",
"... | Retrieve IEntityLocks from the underlying store. Any or all of the parameters may be null.
@param entityType Class
@param entityKey String
@param lockType Integer - so we can accept a null value.
@param expiration Date
@param lockOwner String
@exception LockingException - wraps an Exception specific to the store. | [
"Retrieve",
"IEntityLocks",
"from",
"the",
"underlying",
"store",
".",
"Any",
"or",
"all",
"of",
"the",
"parameters",
"may",
"be",
"null",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/RDBMEntityLockStore.java#L183-L188 |
knowm/XChange | xchange-bitstamp/src/main/java/org/knowm/xchange/bitstamp/BitstampAdapters.java | BitstampAdapters.adaptTrades | public static Trades adaptTrades(BitstampTransaction[] transactions, CurrencyPair currencyPair) {
List<Trade> trades = new ArrayList<>();
long lastTradeId = 0;
for (BitstampTransaction tx : transactions) {
final long tradeId = tx.getTid();
if (tradeId > lastTradeId) {
lastTradeId = tradeId;
}
trades.add(adaptTrade(tx, currencyPair, 1000));
}
return new Trades(trades, lastTradeId, TradeSortType.SortByID);
} | java | public static Trades adaptTrades(BitstampTransaction[] transactions, CurrencyPair currencyPair) {
List<Trade> trades = new ArrayList<>();
long lastTradeId = 0;
for (BitstampTransaction tx : transactions) {
final long tradeId = tx.getTid();
if (tradeId > lastTradeId) {
lastTradeId = tradeId;
}
trades.add(adaptTrade(tx, currencyPair, 1000));
}
return new Trades(trades, lastTradeId, TradeSortType.SortByID);
} | [
"public",
"static",
"Trades",
"adaptTrades",
"(",
"BitstampTransaction",
"[",
"]",
"transactions",
",",
"CurrencyPair",
"currencyPair",
")",
"{",
"List",
"<",
"Trade",
">",
"trades",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"long",
"lastTradeId",
"=",
"... | Adapts a Transaction[] to a Trades Object
@param transactions The Bitstamp transactions
@param currencyPair (e.g. BTC/USD)
@return The XChange Trades | [
"Adapts",
"a",
"Transaction",
"[]",
"to",
"a",
"Trades",
"Object"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitstamp/src/main/java/org/knowm/xchange/bitstamp/BitstampAdapters.java#L124-L137 |
aws/aws-sdk-java | aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/transform/AckEventUnmarshaller.java | AckEventUnmarshaller.getLongField | private Long getLongField(JsonNode json, String fieldName) {
if (!json.has(fieldName)) {
return null;
}
return json.get(fieldName).longValue();
} | java | private Long getLongField(JsonNode json, String fieldName) {
if (!json.has(fieldName)) {
return null;
}
return json.get(fieldName).longValue();
} | [
"private",
"Long",
"getLongField",
"(",
"JsonNode",
"json",
",",
"String",
"fieldName",
")",
"{",
"if",
"(",
"!",
"json",
".",
"has",
"(",
"fieldName",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"json",
".",
"get",
"(",
"fieldName",
")",
".... | Get a Long field from the JSON.
@param json JSON document.
@param fieldName Field name to get.
@return Long value of field or null if not present. | [
"Get",
"a",
"Long",
"field",
"from",
"the",
"JSON",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/transform/AckEventUnmarshaller.java#L71-L76 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/ParametricCcgParser.java | ParametricCcgParser.getParameterDescription | public String getParameterDescription(SufficientStatistics parameters, int numFeatures) {
ListSufficientStatistics parameterList = parameters.coerceToList();
StringBuilder sb = new StringBuilder();
sb.append("lexicon:\n");
List<SufficientStatistics> lexiconParameterList = parameterList
.getStatisticByName(LEXICON_PARAMETERS).coerceToList().getStatistics();
for (int i = 0; i < lexiconFamilies.size(); i++) {
sb.append(lexiconFamilies.get(i).getParameterDescription(
lexiconParameterList.get(i), numFeatures));
}
sb.append("lexicon scorers:\n");
List<SufficientStatistics> lexiconScorerParameterList = parameterList
.getStatisticByName(LEXICON_SCORER_PARAMETERS).coerceToList().getStatistics();
for (int i = 0; i < lexiconScorerFamilies.size(); i++) {
sb.append(lexiconScorerFamilies.get(i).getParameterDescription(
lexiconScorerParameterList.get(i), numFeatures));
}
if (wordSkipFamily != null) {
sb.append("word skip:\n");
sb.append(wordSkipFamily.getParameterDescription(
parameterList.getStatisticByName(WORD_SKIP_PARAMETERS), numFeatures));
}
sb.append("syntax:\n");
sb.append(syntaxFamily.getParameterDescription(
parameterList.getStatisticByName(SYNTAX_PARAMETERS), numFeatures));
sb.append(unaryRuleFamily.getParameterDescription(
parameterList.getStatisticByName(UNARY_RULE_PARAMETERS), numFeatures));
sb.append(headedBinaryRuleFamily.getParameterDescription(
parameterList.getStatisticByName(HEADED_SYNTAX_PARAMETERS), numFeatures));
sb.append("root:\n");
sb.append(rootSyntaxFamily.getParameterDescription(
parameterList.getStatisticByName(ROOT_SYNTAX_PARAMETERS), numFeatures));
sb.append(headedRootSyntaxFamily.getParameterDescription(
parameterList.getStatisticByName(HEADED_ROOT_SYNTAX_PARAMETERS), numFeatures));
sb.append("dependencies:\n");
sb.append(dependencyFamily.getParameterDescription(
parameterList.getStatisticByName(DEPENDENCY_PARAMETERS), numFeatures));
sb.append("dependency distances:\n");
sb.append(wordDistanceFamily.getParameterDescription(
parameterList.getStatisticByName(WORD_DISTANCE_PARAMETERS), numFeatures));
sb.append(puncDistanceFamily.getParameterDescription(
parameterList.getStatisticByName(PUNC_DISTANCE_PARAMETERS), numFeatures));
sb.append(verbDistanceFamily.getParameterDescription(
parameterList.getStatisticByName(VERB_DISTANCE_PARAMETERS), numFeatures));
return sb.toString();
} | java | public String getParameterDescription(SufficientStatistics parameters, int numFeatures) {
ListSufficientStatistics parameterList = parameters.coerceToList();
StringBuilder sb = new StringBuilder();
sb.append("lexicon:\n");
List<SufficientStatistics> lexiconParameterList = parameterList
.getStatisticByName(LEXICON_PARAMETERS).coerceToList().getStatistics();
for (int i = 0; i < lexiconFamilies.size(); i++) {
sb.append(lexiconFamilies.get(i).getParameterDescription(
lexiconParameterList.get(i), numFeatures));
}
sb.append("lexicon scorers:\n");
List<SufficientStatistics> lexiconScorerParameterList = parameterList
.getStatisticByName(LEXICON_SCORER_PARAMETERS).coerceToList().getStatistics();
for (int i = 0; i < lexiconScorerFamilies.size(); i++) {
sb.append(lexiconScorerFamilies.get(i).getParameterDescription(
lexiconScorerParameterList.get(i), numFeatures));
}
if (wordSkipFamily != null) {
sb.append("word skip:\n");
sb.append(wordSkipFamily.getParameterDescription(
parameterList.getStatisticByName(WORD_SKIP_PARAMETERS), numFeatures));
}
sb.append("syntax:\n");
sb.append(syntaxFamily.getParameterDescription(
parameterList.getStatisticByName(SYNTAX_PARAMETERS), numFeatures));
sb.append(unaryRuleFamily.getParameterDescription(
parameterList.getStatisticByName(UNARY_RULE_PARAMETERS), numFeatures));
sb.append(headedBinaryRuleFamily.getParameterDescription(
parameterList.getStatisticByName(HEADED_SYNTAX_PARAMETERS), numFeatures));
sb.append("root:\n");
sb.append(rootSyntaxFamily.getParameterDescription(
parameterList.getStatisticByName(ROOT_SYNTAX_PARAMETERS), numFeatures));
sb.append(headedRootSyntaxFamily.getParameterDescription(
parameterList.getStatisticByName(HEADED_ROOT_SYNTAX_PARAMETERS), numFeatures));
sb.append("dependencies:\n");
sb.append(dependencyFamily.getParameterDescription(
parameterList.getStatisticByName(DEPENDENCY_PARAMETERS), numFeatures));
sb.append("dependency distances:\n");
sb.append(wordDistanceFamily.getParameterDescription(
parameterList.getStatisticByName(WORD_DISTANCE_PARAMETERS), numFeatures));
sb.append(puncDistanceFamily.getParameterDescription(
parameterList.getStatisticByName(PUNC_DISTANCE_PARAMETERS), numFeatures));
sb.append(verbDistanceFamily.getParameterDescription(
parameterList.getStatisticByName(VERB_DISTANCE_PARAMETERS), numFeatures));
return sb.toString();
} | [
"public",
"String",
"getParameterDescription",
"(",
"SufficientStatistics",
"parameters",
",",
"int",
"numFeatures",
")",
"{",
"ListSufficientStatistics",
"parameterList",
"=",
"parameters",
".",
"coerceToList",
"(",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"Strin... | Gets a human-readable description of the {@code numFeatures}
highest-weighted (in absolute value) features of
{@code parameters}.
@param parameters
@param numFeatures
@return | [
"Gets",
"a",
"human",
"-",
"readable",
"description",
"of",
"the",
"{",
"@code",
"numFeatures",
"}",
"highest",
"-",
"weighted",
"(",
"in",
"absolute",
"value",
")",
"features",
"of",
"{",
"@code",
"parameters",
"}",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/ParametricCcgParser.java#L846-L899 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java | ClustersInner.beginResize | public void beginResize(String resourceGroupName, String clusterName, Integer targetInstanceCount) {
beginResizeWithServiceResponseAsync(resourceGroupName, clusterName, targetInstanceCount).toBlocking().single().body();
} | java | public void beginResize(String resourceGroupName, String clusterName, Integer targetInstanceCount) {
beginResizeWithServiceResponseAsync(resourceGroupName, clusterName, targetInstanceCount).toBlocking().single().body();
} | [
"public",
"void",
"beginResize",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"Integer",
"targetInstanceCount",
")",
"{",
"beginResizeWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
",",
"targetInstanceCount",
")",
".",
... | Resizes the specified HDInsight cluster to the specified size.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param targetInstanceCount The target instance count for the operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Resizes",
"the",
"specified",
"HDInsight",
"cluster",
"to",
"the",
"specified",
"size",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L1093-L1095 |
google/gson | extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java | RuntimeTypeAdapterFactory.registerSubtype | public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type) {
return registerSubtype(type, type.getSimpleName());
} | java | public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type) {
return registerSubtype(type, type.getSimpleName());
} | [
"public",
"RuntimeTypeAdapterFactory",
"<",
"T",
">",
"registerSubtype",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"type",
")",
"{",
"return",
"registerSubtype",
"(",
"type",
",",
"type",
".",
"getSimpleName",
"(",
")",
")",
";",
"}"
] | Registers {@code type} identified by its {@link Class#getSimpleName simple
name}. Labels are case sensitive.
@throws IllegalArgumentException if either {@code type} or its simple name
have already been registered on this type adapter. | [
"Registers",
"{",
"@code",
"type",
"}",
"identified",
"by",
"its",
"{",
"@link",
"Class#getSimpleName",
"simple",
"name",
"}",
".",
"Labels",
"are",
"case",
"sensitive",
"."
] | train | https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/extras/src/main/java/com/google/gson/typeadapters/RuntimeTypeAdapterFactory.java#L191-L193 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4ClientConnection.java | JDBC4ClientConnection.executeAsync | public boolean executeAsync(ProcedureCallback callback, String procedure, Object... parameters)
throws NoConnectionsException, IOException
{
ClientImpl currentClient = this.getClient();
try {
return currentClient.callProcedure(new TrackingCallback(this, procedure, callback),
procedure, parameters);
}
catch (NoConnectionsException e) {
this.dropClient(currentClient);
throw e;
}
} | java | public boolean executeAsync(ProcedureCallback callback, String procedure, Object... parameters)
throws NoConnectionsException, IOException
{
ClientImpl currentClient = this.getClient();
try {
return currentClient.callProcedure(new TrackingCallback(this, procedure, callback),
procedure, parameters);
}
catch (NoConnectionsException e) {
this.dropClient(currentClient);
throw e;
}
} | [
"public",
"boolean",
"executeAsync",
"(",
"ProcedureCallback",
"callback",
",",
"String",
"procedure",
",",
"Object",
"...",
"parameters",
")",
"throws",
"NoConnectionsException",
",",
"IOException",
"{",
"ClientImpl",
"currentClient",
"=",
"this",
".",
"getClient",
... | Executes a procedure asynchronously, then calls the provided user callback with the server
response upon completion.
@param callback
the user-specified callback to call with the server response upon execution
completion.
@param procedure
the name of the procedure to call.
@param parameters
the list of parameters to pass to the procedure.
@return the result of the submission false if the client connection was terminated and unable
to post the request to the server, true otherwise. | [
"Executes",
"a",
"procedure",
"asynchronously",
"then",
"calls",
"the",
"provided",
"user",
"callback",
"with",
"the",
"server",
"response",
"upon",
"completion",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4ClientConnection.java#L415-L427 |
googleads/googleads-java-lib | examples/adwords_axis/src/main/java/adwords/axis/v201809/advancedoperations/UsePortfolioBiddingStrategy.java | UsePortfolioBiddingStrategy.createBiddingStrategy | private static SharedBiddingStrategy createBiddingStrategy(
AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
// Get the BiddingStrategyService, which loads the required classes.
BiddingStrategyServiceInterface biddingStrategyService =
adWordsServices.get(session, BiddingStrategyServiceInterface.class);
// Create a portfolio bidding strategy.
SharedBiddingStrategy portfolioBiddingStrategy = new SharedBiddingStrategy();
portfolioBiddingStrategy.setName("Maximize Clicks" + System.currentTimeMillis());
TargetSpendBiddingScheme biddingScheme = new TargetSpendBiddingScheme();
// Optionally set additional bidding scheme parameters.
biddingScheme.setBidCeiling(new Money(null, 2000000L));
biddingScheme.setSpendTarget(new Money(null, 20000000L));
portfolioBiddingStrategy.setBiddingScheme(biddingScheme);
// Create operation.
BiddingStrategyOperation operation = new BiddingStrategyOperation();
operation.setOperand(portfolioBiddingStrategy);
operation.setOperator(Operator.ADD);
BiddingStrategyOperation[] operations = new BiddingStrategyOperation[] {operation};
BiddingStrategyReturnValue result = biddingStrategyService.mutate(operations);
SharedBiddingStrategy newBiddingStrategy = result.getValue(0);
System.out.printf(
"Portfolio bidding strategy with name '%s' and ID %d of type '%s' was created.%n",
newBiddingStrategy.getName(), newBiddingStrategy.getId(),
newBiddingStrategy.getBiddingScheme().getBiddingSchemeType());
return newBiddingStrategy;
} | java | private static SharedBiddingStrategy createBiddingStrategy(
AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
// Get the BiddingStrategyService, which loads the required classes.
BiddingStrategyServiceInterface biddingStrategyService =
adWordsServices.get(session, BiddingStrategyServiceInterface.class);
// Create a portfolio bidding strategy.
SharedBiddingStrategy portfolioBiddingStrategy = new SharedBiddingStrategy();
portfolioBiddingStrategy.setName("Maximize Clicks" + System.currentTimeMillis());
TargetSpendBiddingScheme biddingScheme = new TargetSpendBiddingScheme();
// Optionally set additional bidding scheme parameters.
biddingScheme.setBidCeiling(new Money(null, 2000000L));
biddingScheme.setSpendTarget(new Money(null, 20000000L));
portfolioBiddingStrategy.setBiddingScheme(biddingScheme);
// Create operation.
BiddingStrategyOperation operation = new BiddingStrategyOperation();
operation.setOperand(portfolioBiddingStrategy);
operation.setOperator(Operator.ADD);
BiddingStrategyOperation[] operations = new BiddingStrategyOperation[] {operation};
BiddingStrategyReturnValue result = biddingStrategyService.mutate(operations);
SharedBiddingStrategy newBiddingStrategy = result.getValue(0);
System.out.printf(
"Portfolio bidding strategy with name '%s' and ID %d of type '%s' was created.%n",
newBiddingStrategy.getName(), newBiddingStrategy.getId(),
newBiddingStrategy.getBiddingScheme().getBiddingSchemeType());
return newBiddingStrategy;
} | [
"private",
"static",
"SharedBiddingStrategy",
"createBiddingStrategy",
"(",
"AdWordsServicesInterface",
"adWordsServices",
",",
"AdWordsSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the BiddingStrategyService, which loads the required classes.",
"BiddingStrategySe... | Creates the bidding strategy object.
@param adWordsServices the user to run the example with
@param session the AdWordsSession
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Creates",
"the",
"bidding",
"strategy",
"object",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/advancedoperations/UsePortfolioBiddingStrategy.java#L152-L185 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfContentByte.java | PdfContentByte.drawRadioField | public void drawRadioField(float llx, float lly, float urx, float ury, boolean on) {
if (llx > urx) { float x = llx; llx = urx; urx = x; }
if (lly > ury) { float y = lly; lly = ury; ury = y; }
// silver circle
setLineWidth(1);
setLineCap(1);
setColorStroke(new Color(0xC0, 0xC0, 0xC0));
arc(llx + 1f, lly + 1f, urx - 1f, ury - 1f, 0f, 360f);
stroke();
// gray circle-segment
setLineWidth(1);
setLineCap(1);
setColorStroke(new Color(0xA0, 0xA0, 0xA0));
arc(llx + 0.5f, lly + 0.5f, urx - 0.5f, ury - 0.5f, 45, 180);
stroke();
// black circle-segment
setLineWidth(1);
setLineCap(1);
setColorStroke(new Color(0x00, 0x00, 0x00));
arc(llx + 1.5f, lly + 1.5f, urx - 1.5f, ury - 1.5f, 45, 180);
stroke();
if (on) {
// gray circle
setLineWidth(1);
setLineCap(1);
setColorFill(new Color(0x00, 0x00, 0x00));
arc(llx + 4f, lly + 4f, urx - 4f, ury - 4f, 0, 360);
fill();
}
} | java | public void drawRadioField(float llx, float lly, float urx, float ury, boolean on) {
if (llx > urx) { float x = llx; llx = urx; urx = x; }
if (lly > ury) { float y = lly; lly = ury; ury = y; }
// silver circle
setLineWidth(1);
setLineCap(1);
setColorStroke(new Color(0xC0, 0xC0, 0xC0));
arc(llx + 1f, lly + 1f, urx - 1f, ury - 1f, 0f, 360f);
stroke();
// gray circle-segment
setLineWidth(1);
setLineCap(1);
setColorStroke(new Color(0xA0, 0xA0, 0xA0));
arc(llx + 0.5f, lly + 0.5f, urx - 0.5f, ury - 0.5f, 45, 180);
stroke();
// black circle-segment
setLineWidth(1);
setLineCap(1);
setColorStroke(new Color(0x00, 0x00, 0x00));
arc(llx + 1.5f, lly + 1.5f, urx - 1.5f, ury - 1.5f, 45, 180);
stroke();
if (on) {
// gray circle
setLineWidth(1);
setLineCap(1);
setColorFill(new Color(0x00, 0x00, 0x00));
arc(llx + 4f, lly + 4f, urx - 4f, ury - 4f, 0, 360);
fill();
}
} | [
"public",
"void",
"drawRadioField",
"(",
"float",
"llx",
",",
"float",
"lly",
",",
"float",
"urx",
",",
"float",
"ury",
",",
"boolean",
"on",
")",
"{",
"if",
"(",
"llx",
">",
"urx",
")",
"{",
"float",
"x",
"=",
"llx",
";",
"llx",
"=",
"urx",
";",... | Draws a TextField.
@param llx
@param lly
@param urx
@param ury
@param on | [
"Draws",
"a",
"TextField",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2657-L2686 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/table/RtfRow.java | RtfRow.importRow | private void importRow(PdfPRow row) {
this.cells = new ArrayList();
this.width = this.document.getDocumentHeader().getPageSetting().getPageWidth() - this.document.getDocumentHeader().getPageSetting().getMarginLeft() - this.document.getDocumentHeader().getPageSetting().getMarginRight();
this.width = (int) (this.width * this.parentTable.getTableWidthPercent() / 100);
int cellRight = 0;
int cellWidth = 0;
PdfPCell[] cells = row.getCells();
for(int i = 0; i < cells.length; i++) {
cellWidth = (int) (this.width * this.parentTable.getProportionalWidths()[i] / 100);
cellRight = cellRight + cellWidth;
PdfPCell cell = cells[i];
RtfCell rtfCell = new RtfCell(this.document, this, cell);
rtfCell.setCellRight(cellRight);
rtfCell.setCellWidth(cellWidth);
this.cells.add(rtfCell);
}
} | java | private void importRow(PdfPRow row) {
this.cells = new ArrayList();
this.width = this.document.getDocumentHeader().getPageSetting().getPageWidth() - this.document.getDocumentHeader().getPageSetting().getMarginLeft() - this.document.getDocumentHeader().getPageSetting().getMarginRight();
this.width = (int) (this.width * this.parentTable.getTableWidthPercent() / 100);
int cellRight = 0;
int cellWidth = 0;
PdfPCell[] cells = row.getCells();
for(int i = 0; i < cells.length; i++) {
cellWidth = (int) (this.width * this.parentTable.getProportionalWidths()[i] / 100);
cellRight = cellRight + cellWidth;
PdfPCell cell = cells[i];
RtfCell rtfCell = new RtfCell(this.document, this, cell);
rtfCell.setCellRight(cellRight);
rtfCell.setCellWidth(cellWidth);
this.cells.add(rtfCell);
}
} | [
"private",
"void",
"importRow",
"(",
"PdfPRow",
"row",
")",
"{",
"this",
".",
"cells",
"=",
"new",
"ArrayList",
"(",
")",
";",
"this",
".",
"width",
"=",
"this",
".",
"document",
".",
"getDocumentHeader",
"(",
")",
".",
"getPageSetting",
"(",
")",
".",... | Imports a PdfPRow and copies all settings
@param row The PdfPRow to import
@since 2.1.3 | [
"Imports",
"a",
"PdfPRow",
"and",
"copies",
"all",
"settings"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/table/RtfRow.java#L249-L267 |
alibaba/ARouter | arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java | Postcard.withByte | public Postcard withByte(@Nullable String key, byte value) {
mBundle.putByte(key, value);
return this;
} | java | public Postcard withByte(@Nullable String key, byte value) {
mBundle.putByte(key, value);
return this;
} | [
"public",
"Postcard",
"withByte",
"(",
"@",
"Nullable",
"String",
"key",
",",
"byte",
"value",
")",
"{",
"mBundle",
".",
"putByte",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a byte value into the mapping of this Bundle, replacing
any existing value for the given key.
@param key a String, or null
@param value a byte
@return current | [
"Inserts",
"a",
"byte",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L322-L325 |
xcesco/kripton | kripton/src/main/java/com/abubusoft/kripton/xml/XMLParser.java | XMLParser.readEndTag | private void readEndTag() throws IOException, KriptonRuntimeException {
read('<');
read('/');
name = readName(); // TODO: pass the expected name in as a hint?
skip();
read('>');
int sp = (depth - 1) * 4;
if (depth == 0) {
checkRelaxed("read end tag " + name + " with no tags open");
type = COMMENT;
return;
}
if (name.equals(elementStack[sp + 3])) {
namespace = elementStack[sp];
prefix = elementStack[sp + 1];
name = elementStack[sp + 2];
} else if (!relaxed) {
throw new KriptonRuntimeException("expected: /" + elementStack[sp + 3] + " read: " + name, true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
}
} | java | private void readEndTag() throws IOException, KriptonRuntimeException {
read('<');
read('/');
name = readName(); // TODO: pass the expected name in as a hint?
skip();
read('>');
int sp = (depth - 1) * 4;
if (depth == 0) {
checkRelaxed("read end tag " + name + " with no tags open");
type = COMMENT;
return;
}
if (name.equals(elementStack[sp + 3])) {
namespace = elementStack[sp];
prefix = elementStack[sp + 1];
name = elementStack[sp + 2];
} else if (!relaxed) {
throw new KriptonRuntimeException("expected: /" + elementStack[sp + 3] + " read: " + name, true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
}
} | [
"private",
"void",
"readEndTag",
"(",
")",
"throws",
"IOException",
",",
"KriptonRuntimeException",
"{",
"read",
"(",
"'",
"'",
")",
";",
"read",
"(",
"'",
"'",
")",
";",
"name",
"=",
"readName",
"(",
")",
";",
"// TODO: pass the expected name in as a hint?",
... | Read end tag.
@throws IOException Signals that an I/O exception has occurred.
@throws KriptonRuntimeException the kripton runtime exception | [
"Read",
"end",
"tag",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XMLParser.java#L1155-L1177 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/zone/ZoneRulesBuilder.java | ZoneRulesBuilder.addWindow | public ZoneRulesBuilder addWindow(
ZoneOffset standardOffset,
LocalDateTime until,
TimeDefinition untilDefinition) {
Jdk8Methods.requireNonNull(standardOffset, "standardOffset");
Jdk8Methods.requireNonNull(until, "until");
Jdk8Methods.requireNonNull(untilDefinition, "untilDefinition");
TZWindow window = new TZWindow(standardOffset, until, untilDefinition);
if (windowList.size() > 0) {
TZWindow previous = windowList.get(windowList.size() - 1);
window.validateWindowOrder(previous);
}
windowList.add(window);
return this;
} | java | public ZoneRulesBuilder addWindow(
ZoneOffset standardOffset,
LocalDateTime until,
TimeDefinition untilDefinition) {
Jdk8Methods.requireNonNull(standardOffset, "standardOffset");
Jdk8Methods.requireNonNull(until, "until");
Jdk8Methods.requireNonNull(untilDefinition, "untilDefinition");
TZWindow window = new TZWindow(standardOffset, until, untilDefinition);
if (windowList.size() > 0) {
TZWindow previous = windowList.get(windowList.size() - 1);
window.validateWindowOrder(previous);
}
windowList.add(window);
return this;
} | [
"public",
"ZoneRulesBuilder",
"addWindow",
"(",
"ZoneOffset",
"standardOffset",
",",
"LocalDateTime",
"until",
",",
"TimeDefinition",
"untilDefinition",
")",
"{",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"standardOffset",
",",
"\"standardOffset\"",
")",
";",
"Jdk8Meth... | Adds a window to the builder that can be used to filter a set of rules.
<p>
This method defines and adds a window to the zone where the standard offset is specified.
The window limits the effect of subsequent additions of transition rules
or fixed savings. If neither rules or fixed savings are added to the window
then the window will default to no savings.
<p>
Each window must be added sequentially, as the start instant of the window
is derived from the until instant of the previous window.
@param standardOffset the standard offset, not null
@param until the date-time that the offset applies until, not null
@param untilDefinition the time type for the until date-time, not null
@return this, for chaining
@throws IllegalStateException if the window order is invalid | [
"Adds",
"a",
"window",
"to",
"the",
"builder",
"that",
"can",
"be",
"used",
"to",
"filter",
"a",
"set",
"of",
"rules",
".",
"<p",
">",
"This",
"method",
"defines",
"and",
"adds",
"a",
"window",
"to",
"the",
"zone",
"where",
"the",
"standard",
"offset",... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/zone/ZoneRulesBuilder.java#L116-L130 |
pressgang-ccms/PressGangCCMSQuery | src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java | BaseFilterQueryBuilder.addIdInArrayCondition | protected void addIdInArrayCondition(final String propertyName, final String[] values) throws NumberFormatException {
addIdInArrayCondition(getRootPath().get(propertyName).as(Integer.class), values);
} | java | protected void addIdInArrayCondition(final String propertyName, final String[] values) throws NumberFormatException {
addIdInArrayCondition(getRootPath().get(propertyName).as(Integer.class), values);
} | [
"protected",
"void",
"addIdInArrayCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"String",
"[",
"]",
"values",
")",
"throws",
"NumberFormatException",
"{",
"addIdInArrayCondition",
"(",
"getRootPath",
"(",
")",
".",
"get",
"(",
"propertyName",
"... | Add a Field Search Condition that will check if the id field exists in an array of id values that are represented as a
String. eg. {@code field IN (values)}
@param propertyName The name of the field id as defined in the Entity mapping class.
@param values The array of Ids to be compared to.
@throws NumberFormatException Thrown if one of the Strings cannot be converted to an Integer. | [
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"check",
"if",
"the",
"id",
"field",
"exists",
"in",
"an",
"array",
"of",
"id",
"values",
"that",
"are",
"represented",
"as",
"a",
"String",
".",
"eg",
".",
"{",
"@code",
"field",
"IN",
"(",
... | train | https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L319-L321 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLibTag.java | TagLibTag.setTTTClassDefinition | public void setTTTClassDefinition(String tttClass, Identification id, Attributes attr) {
this.tttCD = ClassDefinitionImpl.toClassDefinition(tttClass, id, attr);
this.tttConstructor = null;
} | java | public void setTTTClassDefinition(String tttClass, Identification id, Attributes attr) {
this.tttCD = ClassDefinitionImpl.toClassDefinition(tttClass, id, attr);
this.tttConstructor = null;
} | [
"public",
"void",
"setTTTClassDefinition",
"(",
"String",
"tttClass",
",",
"Identification",
"id",
",",
"Attributes",
"attr",
")",
"{",
"this",
".",
"tttCD",
"=",
"ClassDefinitionImpl",
".",
"toClassDefinition",
"(",
"tttClass",
",",
"id",
",",
"attr",
")",
";... | Setzt die implementierende Klassendefinition des Evaluator. Diese Methode wird durch die Klasse
TagLibFactory verwendet.
@param tteClass Klassendefinition der Evaluator-Implementation. | [
"Setzt",
"die",
"implementierende",
"Klassendefinition",
"des",
"Evaluator",
".",
"Diese",
"Methode",
"wird",
"durch",
"die",
"Klasse",
"TagLibFactory",
"verwendet",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLibTag.java#L598-L601 |
dmfs/jdav | src/org/dmfs/dav/rfc4918/PropertyUpdate.java | PropertyUpdate.set | public <T> void set(ElementDescriptor<T> property, T value)
{
if (mSet == null)
{
mSet = new HashMap<ElementDescriptor<?>, Object>(16);
}
mSet.put(property, value);
if (mRemove != null)
{
mRemove.remove(property);
}
} | java | public <T> void set(ElementDescriptor<T> property, T value)
{
if (mSet == null)
{
mSet = new HashMap<ElementDescriptor<?>, Object>(16);
}
mSet.put(property, value);
if (mRemove != null)
{
mRemove.remove(property);
}
} | [
"public",
"<",
"T",
">",
"void",
"set",
"(",
"ElementDescriptor",
"<",
"T",
">",
"property",
",",
"T",
"value",
")",
"{",
"if",
"(",
"mSet",
"==",
"null",
")",
"{",
"mSet",
"=",
"new",
"HashMap",
"<",
"ElementDescriptor",
"<",
"?",
">",
",",
"Objec... | Add a new property with a specific value to the resource.
@param property
The {@link ElementDescriptor} of the property to add.
@param value
The value of the property. | [
"Add",
"a",
"new",
"property",
"with",
"a",
"specific",
"value",
"to",
"the",
"resource",
"."
] | train | https://github.com/dmfs/jdav/blob/a619d85423210a283b3eb1fba9abda4fdc894969/src/org/dmfs/dav/rfc4918/PropertyUpdate.java#L142-L154 |
RuedigerMoeller/kontraktor | modules/kontraktor-reallive/src/main/java/org/nustaq/reallive/messages/ChangeUtils.java | ChangeUtils.copyAndDiff | public static Diff copyAndDiff(Record from, Record to) {
String[] fields = from.getFields();
return copyAndDiff(from, to, fields);
} | java | public static Diff copyAndDiff(Record from, Record to) {
String[] fields = from.getFields();
return copyAndDiff(from, to, fields);
} | [
"public",
"static",
"Diff",
"copyAndDiff",
"(",
"Record",
"from",
",",
"Record",
"to",
")",
"{",
"String",
"[",
"]",
"fields",
"=",
"from",
".",
"getFields",
"(",
")",
";",
"return",
"copyAndDiff",
"(",
"from",
",",
"to",
",",
"fields",
")",
";",
"}"... | copy different (equals) fields and return resulting list of changed fields + old values
@param from
@param to
@return | [
"copy",
"different",
"(",
"equals",
")",
"fields",
"and",
"return",
"resulting",
"list",
"of",
"changed",
"fields",
"+",
"old",
"values"
] | train | https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/modules/kontraktor-reallive/src/main/java/org/nustaq/reallive/messages/ChangeUtils.java#L21-L24 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicatedCloud_serviceName_host_duration_POST | public OvhOrder dedicatedCloud_serviceName_host_duration_POST(String serviceName, String duration, Long datacenterId, String name, Long quantity) throws IOException {
String qPath = "/order/dedicatedCloud/{serviceName}/host/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "datacenterId", datacenterId);
addBody(o, "name", name);
addBody(o, "quantity", quantity);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder dedicatedCloud_serviceName_host_duration_POST(String serviceName, String duration, Long datacenterId, String name, Long quantity) throws IOException {
String qPath = "/order/dedicatedCloud/{serviceName}/host/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "datacenterId", datacenterId);
addBody(o, "name", name);
addBody(o, "quantity", quantity);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"dedicatedCloud_serviceName_host_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"Long",
"datacenterId",
",",
"String",
"name",
",",
"Long",
"quantity",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\... | Create order
REST: POST /order/dedicatedCloud/{serviceName}/host/{duration}
@param datacenterId [required] Datacenter where the Host will be added
@param quantity [required] Quantity of hosts you want to order (default 1)
@param name [required] Host profile you want to order ("name" field of a Profile returned by /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableHostProfiles)
@param serviceName [required]
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5641-L5650 |
cesarferreira/AndroidQuickUtils | library/src/main/java/quickutils/core/categories/system.java | system.navigateToActivityByClassName | public static void navigateToActivityByClassName(Context context, String className) throws ClassNotFoundException {
Class<?> c = null;
if (className != null) {
try {
c = Class.forName(className);
} catch (ClassNotFoundException e) {
QuickUtils.log.d("ClassNotFound", e);
}
}
navigateToActivity(context, c);
} | java | public static void navigateToActivityByClassName(Context context, String className) throws ClassNotFoundException {
Class<?> c = null;
if (className != null) {
try {
c = Class.forName(className);
} catch (ClassNotFoundException e) {
QuickUtils.log.d("ClassNotFound", e);
}
}
navigateToActivity(context, c);
} | [
"public",
"static",
"void",
"navigateToActivityByClassName",
"(",
"Context",
"context",
",",
"String",
"className",
")",
"throws",
"ClassNotFoundException",
"{",
"Class",
"<",
"?",
">",
"c",
"=",
"null",
";",
"if",
"(",
"className",
"!=",
"null",
")",
"{",
"... | Navigate to an activity programmatically by providing the package +
activity name
@param context Context where I am coming from
@param className Full path to the desired Activity (e.g.
"com.sample.MainActivity") | [
"Navigate",
"to",
"an",
"activity",
"programmatically",
"by",
"providing",
"the",
"package",
"+",
"activity",
"name"
] | train | https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/system.java#L80-L91 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.buildSuperJoinTree | protected void buildSuperJoinTree(TableAlias left, ClassDescriptor cld, String name, boolean useOuterJoin)
{
ClassDescriptor superCld = cld.getSuperClassDescriptor();
if (superCld != null)
{
SuperReferenceDescriptor superRef = cld.getSuperReference();
FieldDescriptor[] leftFields = superRef.getForeignKeyFieldDescriptors(cld);
TableAlias base_alias = getTableAliasForPath(name, null, null);
String aliasName = String.valueOf(getAliasChar()) + m_aliasCount++;
TableAlias right = new TableAlias(superCld, aliasName, useOuterJoin, null);
Join join1to1 = new Join(left, leftFields, right, superCld.getPkFields(), useOuterJoin, "superClass");
base_alias.addJoin(join1to1);
buildSuperJoinTree(right, superCld, name, useOuterJoin);
}
} | java | protected void buildSuperJoinTree(TableAlias left, ClassDescriptor cld, String name, boolean useOuterJoin)
{
ClassDescriptor superCld = cld.getSuperClassDescriptor();
if (superCld != null)
{
SuperReferenceDescriptor superRef = cld.getSuperReference();
FieldDescriptor[] leftFields = superRef.getForeignKeyFieldDescriptors(cld);
TableAlias base_alias = getTableAliasForPath(name, null, null);
String aliasName = String.valueOf(getAliasChar()) + m_aliasCount++;
TableAlias right = new TableAlias(superCld, aliasName, useOuterJoin, null);
Join join1to1 = new Join(left, leftFields, right, superCld.getPkFields(), useOuterJoin, "superClass");
base_alias.addJoin(join1to1);
buildSuperJoinTree(right, superCld, name, useOuterJoin);
}
} | [
"protected",
"void",
"buildSuperJoinTree",
"(",
"TableAlias",
"left",
",",
"ClassDescriptor",
"cld",
",",
"String",
"name",
",",
"boolean",
"useOuterJoin",
")",
"{",
"ClassDescriptor",
"superCld",
"=",
"cld",
".",
"getSuperClassDescriptor",
"(",
")",
";",
"if",
... | build the Join-Information if a super reference exists
@param left
@param cld
@param name | [
"build",
"the",
"Join",
"-",
"Information",
"if",
"a",
"super",
"reference",
"exists"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L1730-L1746 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui/src/main/java/org/deeplearning4j/ui/WebReporter.java | WebReporter.postReport | public void postReport(WebTarget target, Entity entity) {
Response resp = target.request(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(entity);
log.debug("{}", resp);
} | java | public void postReport(WebTarget target, Entity entity) {
Response resp = target.request(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).post(entity);
log.debug("{}", resp);
} | [
"public",
"void",
"postReport",
"(",
"WebTarget",
"target",
",",
"Entity",
"entity",
")",
"{",
"Response",
"resp",
"=",
"target",
".",
"request",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"accept",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"... | This method immediately sends UI report to specified target using POST request
@param target
@param entity | [
"This",
"method",
"immediately",
"sends",
"UI",
"report",
"to",
"specified",
"target",
"using",
"POST",
"request"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui/src/main/java/org/deeplearning4j/ui/WebReporter.java#L68-L71 |
lucee/Lucee | core/src/main/java/lucee/commons/io/compress/CompressUtil.java | CompressUtil.compressGZip | private static void compressGZip(Resource source, Resource target) throws IOException {
if (source.isDirectory()) {
throw new IOException("you can only create a GZIP File from a single source file, use TGZ (TAR-GZIP) to first TAR multiple files");
}
InputStream is = null;
OutputStream os = null;
try {
is = source.getInputStream();
os = target.getOutputStream();
}
catch (IOException ioe) {
IOUtil.closeEL(is, os);
throw ioe;
}
compressGZip(is, os);
} | java | private static void compressGZip(Resource source, Resource target) throws IOException {
if (source.isDirectory()) {
throw new IOException("you can only create a GZIP File from a single source file, use TGZ (TAR-GZIP) to first TAR multiple files");
}
InputStream is = null;
OutputStream os = null;
try {
is = source.getInputStream();
os = target.getOutputStream();
}
catch (IOException ioe) {
IOUtil.closeEL(is, os);
throw ioe;
}
compressGZip(is, os);
} | [
"private",
"static",
"void",
"compressGZip",
"(",
"Resource",
"source",
",",
"Resource",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"source",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"you can only create a GZIP F... | compress a source file to a gzip file
@param source
@param target
@throws IOException
@throws IOException | [
"compress",
"a",
"source",
"file",
"to",
"a",
"gzip",
"file"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/compress/CompressUtil.java#L412-L428 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java | Stanza.addCommonAttributes | protected XmlEnvironment addCommonAttributes(XmlStringBuilder xml, XmlEnvironment enclosingXmlEnvironment) {
String language = getLanguage();
String namespace = StreamOpen.CLIENT_NAMESPACE;
if (enclosingXmlEnvironment != null) {
String effectiveEnclosingNamespace = enclosingXmlEnvironment.getEffectiveNamespaceOrUse(namespace);
switch (effectiveEnclosingNamespace) {
case StreamOpen.CLIENT_NAMESPACE:
case StreamOpen.SERVER_NAMESPACE:
break;
default:
namespace = effectiveEnclosingNamespace;
}
}
xml.xmlnsAttribute(namespace);
xml.optAttribute("to", getTo());
xml.optAttribute("from", getFrom());
xml.optAttribute("id", getStanzaId());
xml.xmllangAttribute(language);
return new XmlEnvironment(namespace, language);
} | java | protected XmlEnvironment addCommonAttributes(XmlStringBuilder xml, XmlEnvironment enclosingXmlEnvironment) {
String language = getLanguage();
String namespace = StreamOpen.CLIENT_NAMESPACE;
if (enclosingXmlEnvironment != null) {
String effectiveEnclosingNamespace = enclosingXmlEnvironment.getEffectiveNamespaceOrUse(namespace);
switch (effectiveEnclosingNamespace) {
case StreamOpen.CLIENT_NAMESPACE:
case StreamOpen.SERVER_NAMESPACE:
break;
default:
namespace = effectiveEnclosingNamespace;
}
}
xml.xmlnsAttribute(namespace);
xml.optAttribute("to", getTo());
xml.optAttribute("from", getFrom());
xml.optAttribute("id", getStanzaId());
xml.xmllangAttribute(language);
return new XmlEnvironment(namespace, language);
} | [
"protected",
"XmlEnvironment",
"addCommonAttributes",
"(",
"XmlStringBuilder",
"xml",
",",
"XmlEnvironment",
"enclosingXmlEnvironment",
")",
"{",
"String",
"language",
"=",
"getLanguage",
"(",
")",
";",
"String",
"namespace",
"=",
"StreamOpen",
".",
"CLIENT_NAMESPACE",
... | Add to, from, id and 'xml:lang' attributes
@param xml the {@link XmlStringBuilder}.
@param enclosingXmlEnvironment the enclosing XML namespace.
@return the XML environment for this stanza. | [
"Add",
"to",
"from",
"id",
"and",
"xml",
":",
"lang",
"attributes"
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java#L509-L530 |
lastaflute/lasta-di | src/main/java/org/lastaflute/di/util/LdiSrl.java | LdiSrl.substringLastRearIgnoreCase | public static String substringLastRearIgnoreCase(String str, String... delimiters) {
assertStringNotNull(str);
return doSubstringFirstRear(true, true, true, str, delimiters);
} | java | public static String substringLastRearIgnoreCase(String str, String... delimiters) {
assertStringNotNull(str);
return doSubstringFirstRear(true, true, true, str, delimiters);
} | [
"public",
"static",
"String",
"substringLastRearIgnoreCase",
"(",
"String",
"str",
",",
"String",
"...",
"delimiters",
")",
"{",
"assertStringNotNull",
"(",
"str",
")",
";",
"return",
"doSubstringFirstRear",
"(",
"true",
",",
"true",
",",
"true",
",",
"str",
"... | Extract rear sub-string from last-found delimiter ignoring case.
<pre>
substringLastRear("foo.bar/baz.qux", "A", "U")
returns "x"
</pre>
@param str The target string. (NotNull)
@param delimiters The array of delimiters. (NotNull)
@return The part of string. (NotNull: if delimiter not found, returns argument-plain string) | [
"Extract",
"rear",
"sub",
"-",
"string",
"from",
"last",
"-",
"found",
"delimiter",
"ignoring",
"case",
".",
"<pre",
">",
"substringLastRear",
"(",
"foo",
".",
"bar",
"/",
"baz",
".",
"qux",
"A",
"U",
")",
"returns",
"x",
"<",
"/",
"pre",
">"
] | train | https://github.com/lastaflute/lasta-di/blob/c4e123610c53a04cc836c5e456660e32d613447b/src/main/java/org/lastaflute/di/util/LdiSrl.java#L732-L735 |
languagetool-org/languagetool | languagetool-office-extension/src/main/java/org/languagetool/openoffice/ResultCache.java | ResultCache.removeAndShift | void removeAndShift(int firstPara, int lastPara, int shift) {
for(int i = 0; i < entries.size(); i++) {
if(entries.get(i).numberOfParagraph >= firstPara && entries.get(i).numberOfParagraph <= lastPara) {
entries.remove(i);
i--;
}
}
for (CacheEntry anEntry : entries) {
if (anEntry.numberOfParagraph > lastPara) {
anEntry.numberOfParagraph += shift;
}
}
} | java | void removeAndShift(int firstPara, int lastPara, int shift) {
for(int i = 0; i < entries.size(); i++) {
if(entries.get(i).numberOfParagraph >= firstPara && entries.get(i).numberOfParagraph <= lastPara) {
entries.remove(i);
i--;
}
}
for (CacheEntry anEntry : entries) {
if (anEntry.numberOfParagraph > lastPara) {
anEntry.numberOfParagraph += shift;
}
}
} | [
"void",
"removeAndShift",
"(",
"int",
"firstPara",
",",
"int",
"lastPara",
",",
"int",
"shift",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"entries",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"entries",
".",
"g... | Remove all cache entries between firstPara (included) and lastPara (included)
shift all numberOfParagraph by 'shift' | [
"Remove",
"all",
"cache",
"entries",
"between",
"firstPara",
"(",
"included",
")",
"and",
"lastPara",
"(",
"included",
")",
"shift",
"all",
"numberOfParagraph",
"by",
"shift"
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-office-extension/src/main/java/org/languagetool/openoffice/ResultCache.java#L80-L92 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/DimensionSelectorUtils.java | DimensionSelectorUtils.makeValueMatcherGeneric | public static ValueMatcher makeValueMatcherGeneric(DimensionSelector selector, @Nullable String value)
{
IdLookup idLookup = selector.idLookup();
if (idLookup != null) {
return makeDictionaryEncodedValueMatcherGeneric(selector, idLookup.lookupId(value), value == null);
} else if (selector.getValueCardinality() >= 0 && selector.nameLookupPossibleInAdvance()) {
// Employ caching BitSet optimization
return makeDictionaryEncodedValueMatcherGeneric(selector, Predicates.equalTo(value));
} else {
return makeNonDictionaryEncodedValueMatcherGeneric(selector, value);
}
} | java | public static ValueMatcher makeValueMatcherGeneric(DimensionSelector selector, @Nullable String value)
{
IdLookup idLookup = selector.idLookup();
if (idLookup != null) {
return makeDictionaryEncodedValueMatcherGeneric(selector, idLookup.lookupId(value), value == null);
} else if (selector.getValueCardinality() >= 0 && selector.nameLookupPossibleInAdvance()) {
// Employ caching BitSet optimization
return makeDictionaryEncodedValueMatcherGeneric(selector, Predicates.equalTo(value));
} else {
return makeNonDictionaryEncodedValueMatcherGeneric(selector, value);
}
} | [
"public",
"static",
"ValueMatcher",
"makeValueMatcherGeneric",
"(",
"DimensionSelector",
"selector",
",",
"@",
"Nullable",
"String",
"value",
")",
"{",
"IdLookup",
"idLookup",
"=",
"selector",
".",
"idLookup",
"(",
")",
";",
"if",
"(",
"idLookup",
"!=",
"null",
... | Generic implementation of {@link DimensionSelector#makeValueMatcher(String)}, uses {@link
DimensionSelector#getRow()} of the given {@link DimensionSelector}. "Lazy" DimensionSelectors could delegate
{@code makeValueMatcher()} to this method, but encouraged to implement {@code makeValueMatcher()} themselves,
bypassing the {@link IndexedInts} abstraction. | [
"Generic",
"implementation",
"of",
"{"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/DimensionSelectorUtils.java#L47-L58 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEvents.java | XMLStreamEvents.getAttributeWithPrefix | public Attribute getAttributeWithPrefix(CharSequence prefix, CharSequence name) {
for (Attribute attr : event.attributes)
if (attr.localName.equals(name) && attr.namespacePrefix.equals(prefix))
return attr;
return null;
} | java | public Attribute getAttributeWithPrefix(CharSequence prefix, CharSequence name) {
for (Attribute attr : event.attributes)
if (attr.localName.equals(name) && attr.namespacePrefix.equals(prefix))
return attr;
return null;
} | [
"public",
"Attribute",
"getAttributeWithPrefix",
"(",
"CharSequence",
"prefix",
",",
"CharSequence",
"name",
")",
"{",
"for",
"(",
"Attribute",
"attr",
":",
"event",
".",
"attributes",
")",
"if",
"(",
"attr",
".",
"localName",
".",
"equals",
"(",
"name",
")"... | Shortcut to get the attribute for the given namespace prefix and local name. | [
"Shortcut",
"to",
"get",
"the",
"attribute",
"for",
"the",
"given",
"namespace",
"prefix",
"and",
"local",
"name",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEvents.java#L161-L166 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/ApkParser.java | ApkParser.compXmlStringAt | private String compXmlStringAt(byte[] arr, int strOff) {
int strLen = arr[strOff + 1] << 8 & 0xff00 | arr[strOff] & 0xff;
byte[] chars = new byte[strLen];
for (int ii = 0; ii < strLen; ii++) {
chars[ii] = arr[strOff + 2 + ii * 2];
}
return new String(chars); // Hack, just use 8 byte chars
} | java | private String compXmlStringAt(byte[] arr, int strOff) {
int strLen = arr[strOff + 1] << 8 & 0xff00 | arr[strOff] & 0xff;
byte[] chars = new byte[strLen];
for (int ii = 0; ii < strLen; ii++) {
chars[ii] = arr[strOff + 2 + ii * 2];
}
return new String(chars); // Hack, just use 8 byte chars
} | [
"private",
"String",
"compXmlStringAt",
"(",
"byte",
"[",
"]",
"arr",
",",
"int",
"strOff",
")",
"{",
"int",
"strLen",
"=",
"arr",
"[",
"strOff",
"+",
"1",
"]",
"<<",
"8",
"&",
"0xff00",
"|",
"arr",
"[",
"strOff",
"]",
"&",
"0xff",
";",
"byte",
"... | <p>Get a {@link String} of the value stored in StringTable format at offset strOff. This
offset points to the 16 bit string length, which is followed by that number of 16 bit
(Unicode) chars.</p>
@param arr The {@link Byte} array to be processed.
@param strOff An {@link Integer} denoting the offset within the array to fetch result from.
@return A {@link String} value at the offset specified in parameter <i>strOff</i>. | [
"<p",
">",
"Get",
"a",
"{",
"@link",
"String",
"}",
"of",
"the",
"value",
"stored",
"in",
"StringTable",
"format",
"at",
"offset",
"strOff",
".",
"This",
"offset",
"points",
"to",
"the",
"16",
"bit",
"string",
"length",
"which",
"is",
"followed",
"by",
... | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/ApkParser.java#L261-L268 |
algolia/instantsearch-android | ui/src/main/java/com/algolia/instantsearch/ui/helpers/InstantSearch.java | InstantSearch.registerSearchView | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public void registerSearchView(@NonNull final Activity activity, @NonNull final android.support.v7.widget.SearchView searchView) {
registerSearchView(activity, new SearchViewFacade(searchView));
} | java | @SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public void registerSearchView(@NonNull final Activity activity, @NonNull final android.support.v7.widget.SearchView searchView) {
registerSearchView(activity, new SearchViewFacade(searchView));
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"WeakerAccess\"",
",",
"\"unused\"",
"}",
")",
"// For library users",
"public",
"void",
"registerSearchView",
"(",
"@",
"NonNull",
"final",
"Activity",
"activity",
",",
"@",
"NonNull",
"final",
"android",
".",
"support",
".",
... | Registers a {@link android.support.v7.widget.SearchView} to trigger search requests on text change, replacing the current one if any.
@param activity The searchable activity, see {@link android.app.SearchableInfo}.
@param searchView a SearchView whose query text will be used. | [
"Registers",
"a",
"{",
"@link",
"android",
".",
"support",
".",
"v7",
".",
"widget",
".",
"SearchView",
"}",
"to",
"trigger",
"search",
"requests",
"on",
"text",
"change",
"replacing",
"the",
"current",
"one",
"if",
"any",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/helpers/InstantSearch.java#L214-L217 |
apiman/apiman | gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/connectors/ok/OkUrlFactory.java | OkUrlFactory.createURLStreamHandler | @Override public URLStreamHandler createURLStreamHandler(final String protocol) {
if (!protocol.equals("http") && !protocol.equals("https")) return null;
return new URLStreamHandler() {
@Override protected URLConnection openConnection(URL url) {
return open(url);
}
@Override protected URLConnection openConnection(URL url, Proxy proxy) {
return open(url, proxy);
}
@Override protected int getDefaultPort() {
if (protocol.equals("http")) return 80;
if (protocol.equals("https")) return 443;
throw new AssertionError();
}
};
} | java | @Override public URLStreamHandler createURLStreamHandler(final String protocol) {
if (!protocol.equals("http") && !protocol.equals("https")) return null;
return new URLStreamHandler() {
@Override protected URLConnection openConnection(URL url) {
return open(url);
}
@Override protected URLConnection openConnection(URL url, Proxy proxy) {
return open(url, proxy);
}
@Override protected int getDefaultPort() {
if (protocol.equals("http")) return 80;
if (protocol.equals("https")) return 443;
throw new AssertionError();
}
};
} | [
"@",
"Override",
"public",
"URLStreamHandler",
"createURLStreamHandler",
"(",
"final",
"String",
"protocol",
")",
"{",
"if",
"(",
"!",
"protocol",
".",
"equals",
"(",
"\"http\"",
")",
"&&",
"!",
"protocol",
".",
"equals",
"(",
"\"https\"",
")",
")",
"return"... | Creates a URLStreamHandler as a {@link java.net.URL#setURLStreamHandlerFactory}.
<p>This code configures OkHttp to handle all HTTP and HTTPS connections
created with {@link java.net.URL#openConnection()}: <pre> {@code
OkHttpClient okHttpClient = new OkHttpClient();
URL.setURLStreamHandlerFactory(new OkUrlFactory(okHttpClient));
}</pre> | [
"Creates",
"a",
"URLStreamHandler",
"as",
"a",
"{",
"@link",
"java",
".",
"net",
".",
"URL#setURLStreamHandlerFactory",
"}",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/connectors/ok/OkUrlFactory.java#L70-L88 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/Stripe.java | Stripe.createCvcUpdateTokenSynchronous | @Nullable
public Token createCvcUpdateTokenSynchronous(@NonNull String cvc)
throws AuthenticationException,
InvalidRequestException,
APIConnectionException,
CardException,
APIException {
return createCvcUpdateTokenSynchronous(cvc, mDefaultPublishableKey);
} | java | @Nullable
public Token createCvcUpdateTokenSynchronous(@NonNull String cvc)
throws AuthenticationException,
InvalidRequestException,
APIConnectionException,
CardException,
APIException {
return createCvcUpdateTokenSynchronous(cvc, mDefaultPublishableKey);
} | [
"@",
"Nullable",
"public",
"Token",
"createCvcUpdateTokenSynchronous",
"(",
"@",
"NonNull",
"String",
"cvc",
")",
"throws",
"AuthenticationException",
",",
"InvalidRequestException",
",",
"APIConnectionException",
",",
"CardException",
",",
"APIException",
"{",
"return",
... | Blocking method to create a {@link Token} for CVC updating. Do not call this on the UI thread
or your app will crash. The method uses the currently set {@link #mDefaultPublishableKey}.
@param cvc the CVC to use for this token
@return a {@link Token} that can be used for this card
@throws AuthenticationException failure to properly authenticate yourself (check your key)
@throws InvalidRequestException your request has invalid parameters
@throws APIConnectionException failure to connect to Stripe's API
@throws APIException any other type of problem (for instance, a temporary issue with
Stripe's servers) | [
"Blocking",
"method",
"to",
"create",
"a",
"{",
"@link",
"Token",
"}",
"for",
"CVC",
"updating",
".",
"Do",
"not",
"call",
"this",
"on",
"the",
"UI",
"thread",
"or",
"your",
"app",
"will",
"crash",
".",
"The",
"method",
"uses",
"the",
"currently",
"set... | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/Stripe.java#L631-L639 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsUserQueryBuilder.java | CmsUserQueryBuilder.addSorting | protected void addSorting(CmsSelectQuery select, TableAlias users, CmsUserSearchParameters searchParams) {
boolean ascending = searchParams.isAscending();
String ordering = getSortExpression(users, searchParams);
if (ascending) {
ordering += " ASC";
} else {
ordering += " DESC";
}
select.setOrdering(ordering);
} | java | protected void addSorting(CmsSelectQuery select, TableAlias users, CmsUserSearchParameters searchParams) {
boolean ascending = searchParams.isAscending();
String ordering = getSortExpression(users, searchParams);
if (ascending) {
ordering += " ASC";
} else {
ordering += " DESC";
}
select.setOrdering(ordering);
} | [
"protected",
"void",
"addSorting",
"(",
"CmsSelectQuery",
"select",
",",
"TableAlias",
"users",
",",
"CmsUserSearchParameters",
"searchParams",
")",
"{",
"boolean",
"ascending",
"=",
"searchParams",
".",
"isAscending",
"(",
")",
";",
"String",
"ordering",
"=",
"ge... | Adds a sort order to an SQL query.<p>
@param select the query
@param users the user table alias
@param searchParams the user search criteria | [
"Adds",
"a",
"sort",
"order",
"to",
"an",
"SQL",
"query",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserQueryBuilder.java#L345-L356 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/xml/XmlConfigurer.java | XmlConfigurer.setSerializerConfigParameter | public void setSerializerConfigParameter(LSSerializer serializer, String parameterName, Object value) {
if (serializer.getDomConfig().canSetParameter(parameterName, value)) {
serializer.getDomConfig().setParameter(parameterName, value);
} else {
logParameterNotSet(parameterName, "LSSerializer");
}
} | java | public void setSerializerConfigParameter(LSSerializer serializer, String parameterName, Object value) {
if (serializer.getDomConfig().canSetParameter(parameterName, value)) {
serializer.getDomConfig().setParameter(parameterName, value);
} else {
logParameterNotSet(parameterName, "LSSerializer");
}
} | [
"public",
"void",
"setSerializerConfigParameter",
"(",
"LSSerializer",
"serializer",
",",
"String",
"parameterName",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"serializer",
".",
"getDomConfig",
"(",
")",
".",
"canSetParameter",
"(",
"parameterName",
",",
"value... | Sets a config parameter on LSParser instance if settable. Otherwise logging unset parameter.
@param serializer
@param parameterName
@param value | [
"Sets",
"a",
"config",
"parameter",
"on",
"LSParser",
"instance",
"if",
"settable",
".",
"Otherwise",
"logging",
"unset",
"parameter",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/XmlConfigurer.java#L204-L210 |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getVersionSubjectUrl | public String getVersionSubjectUrl(final UriInfo uriInfo, final Node subject) {
final Map<String, String> breadcrumbs = getNodeBreadcrumbs(uriInfo, subject);
String lastUrl = null;
for (final Map.Entry<String, String> entry : breadcrumbs.entrySet()) {
if (entry.getValue().equals("fcr:versions")) {
return lastUrl;
}
lastUrl = entry.getKey();
}
return null;
} | java | public String getVersionSubjectUrl(final UriInfo uriInfo, final Node subject) {
final Map<String, String> breadcrumbs = getNodeBreadcrumbs(uriInfo, subject);
String lastUrl = null;
for (final Map.Entry<String, String> entry : breadcrumbs.entrySet()) {
if (entry.getValue().equals("fcr:versions")) {
return lastUrl;
}
lastUrl = entry.getKey();
}
return null;
} | [
"public",
"String",
"getVersionSubjectUrl",
"(",
"final",
"UriInfo",
"uriInfo",
",",
"final",
"Node",
"subject",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"breadcrumbs",
"=",
"getNodeBreadcrumbs",
"(",
"uriInfo",
",",
"subject",
")",
";",
... | Gets the URL of the node whose version is represented by the
current node. The current implementation assumes the URI
of that node will be the same as the breadcrumb entry that
precedes one with the path "fcr:versions".
@param uriInfo the uri info
@param subject the subject
@return the URL of the node | [
"Gets",
"the",
"URL",
"of",
"the",
"node",
"whose",
"version",
"is",
"represented",
"by",
"the",
"current",
"node",
".",
"The",
"current",
"implementation",
"assumes",
"the",
"URI",
"of",
"that",
"node",
"will",
"be",
"the",
"same",
"as",
"the",
"breadcrum... | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L136-L146 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcEndpoint.java | RpcEndpoint.scheduleRunAsync | protected void scheduleRunAsync(Runnable runnable, Time delay) {
scheduleRunAsync(runnable, delay.getSize(), delay.getUnit());
} | java | protected void scheduleRunAsync(Runnable runnable, Time delay) {
scheduleRunAsync(runnable, delay.getSize(), delay.getUnit());
} | [
"protected",
"void",
"scheduleRunAsync",
"(",
"Runnable",
"runnable",
",",
"Time",
"delay",
")",
"{",
"scheduleRunAsync",
"(",
"runnable",
",",
"delay",
".",
"getSize",
"(",
")",
",",
"delay",
".",
"getUnit",
"(",
")",
")",
";",
"}"
] | Execute the runnable in the main thread of the underlying RPC endpoint, with
a delay of the given number of milliseconds.
@param runnable Runnable to be executed
@param delay The delay after which the runnable will be executed | [
"Execute",
"the",
"runnable",
"in",
"the",
"main",
"thread",
"of",
"the",
"underlying",
"RPC",
"endpoint",
"with",
"a",
"delay",
"of",
"the",
"given",
"number",
"of",
"milliseconds",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcEndpoint.java#L274-L276 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.