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 |
|---|---|---|---|---|---|---|---|---|---|---|
joniles/mpxj | src/main/java/net/sf/mpxj/common/RtfHelper.java | RtfHelper.stripExtraLineEnd | private static String stripExtraLineEnd(String text, boolean formalRTF)
{
if (formalRTF && text.endsWith("\n"))
{
text = text.substring(0, text.length() - 1);
}
return text;
} | java | private static String stripExtraLineEnd(String text, boolean formalRTF)
{
if (formalRTF && text.endsWith("\n"))
{
text = text.substring(0, text.length() - 1);
}
return text;
} | [
"private",
"static",
"String",
"stripExtraLineEnd",
"(",
"String",
"text",
",",
"boolean",
"formalRTF",
")",
"{",
"if",
"(",
"formalRTF",
"&&",
"text",
".",
"endsWith",
"(",
"\"\\n\"",
")",
")",
"{",
"text",
"=",
"text",
".",
"substring",
"(",
"0",
",",
... | Remove the trailing line end from an RTF block.
@param text source text
@param formalRTF true if this is a real RTF block
@return text with line end stripped | [
"Remove",
"the",
"trailing",
"line",
"end",
"from",
"an",
"RTF",
"block",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/RtfHelper.java#L82-L89 |
misha/iroh | src/main/java/com/github/msoliter/iroh/container/services/Injector.java | Injector.nullify | private void nullify(Object target, Field field) {
Class<?> type = field.getType();
if (!nulls.containsKey(type)) {
nulls.put(
type,
objenesis.newInstance(registrar.resolve(field).getType()));
}
try {
field.set(target, nulls.get(type));
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new IrohException(e);
}
} | java | private void nullify(Object target, Field field) {
Class<?> type = field.getType();
if (!nulls.containsKey(type)) {
nulls.put(
type,
objenesis.newInstance(registrar.resolve(field).getType()));
}
try {
field.set(target, nulls.get(type));
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new IrohException(e);
}
} | [
"private",
"void",
"nullify",
"(",
"Object",
"target",
",",
"Field",
"field",
")",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"field",
".",
"getType",
"(",
")",
";",
"if",
"(",
"!",
"nulls",
".",
"containsKey",
"(",
"type",
")",
")",
"{",
"nulls",
... | Implements lazy injection by filling in a "local null" instance of the
type required by the field. The original idea was to just define a new
location of null itself, but Java didn't like that very much, so now Iroh
will generate a reference for every type it encounters to act as the
null for fields of that particular type.
@param target The target object containing the field to be nullified via
injection with a local null generated with Objenesis.
@param field The target field in the target object to be nullified. | [
"Implements",
"lazy",
"injection",
"by",
"filling",
"in",
"a",
"local",
"null",
"instance",
"of",
"the",
"type",
"required",
"by",
"the",
"field",
".",
"The",
"original",
"idea",
"was",
"to",
"just",
"define",
"a",
"new",
"location",
"of",
"null",
"itself"... | train | https://github.com/misha/iroh/blob/5dc92a01d3b2f3ba63e8ad1bf9b5fe342d0b679a/src/main/java/com/github/msoliter/iroh/container/services/Injector.java#L190-L205 |
astrapi69/mystic-crypt | crypt-data/src/main/java/de/alpharogroup/crypto/key/PrivateKeyExtensions.java | PrivateKeyExtensions.toHexString | public static String toHexString(final PrivateKey privateKey, final boolean lowerCase)
{
final String hexString = HexExtensions.toHexString(privateKey.getEncoded(), lowerCase);
return hexString;
} | java | public static String toHexString(final PrivateKey privateKey, final boolean lowerCase)
{
final String hexString = HexExtensions.toHexString(privateKey.getEncoded(), lowerCase);
return hexString;
} | [
"public",
"static",
"String",
"toHexString",
"(",
"final",
"PrivateKey",
"privateKey",
",",
"final",
"boolean",
"lowerCase",
")",
"{",
"final",
"String",
"hexString",
"=",
"HexExtensions",
".",
"toHexString",
"(",
"privateKey",
".",
"getEncoded",
"(",
")",
",",
... | Transform the given {@link PrivateKey} to a hexadecimal {@link String} value.
@param privateKey
the private key
@param lowerCase
the flag if the result shell be transform in lower case. If true the result is
@return the new hexadecimal {@link String} value. | [
"Transform",
"the",
"given",
"{",
"@link",
"PrivateKey",
"}",
"to",
"a",
"hexadecimal",
"{",
"@link",
"String",
"}",
"value",
"."
] | train | https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/PrivateKeyExtensions.java#L141-L145 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/composition/AbstractCompositeServiceBuilder.java | AbstractCompositeServiceBuilder.serviceAt | @Deprecated
protected T serviceAt(String pathPattern, Service<I, O> service) {
return service(pathPattern, service);
} | java | @Deprecated
protected T serviceAt(String pathPattern, Service<I, O> service) {
return service(pathPattern, service);
} | [
"@",
"Deprecated",
"protected",
"T",
"serviceAt",
"(",
"String",
"pathPattern",
",",
"Service",
"<",
"I",
",",
"O",
">",
"service",
")",
"{",
"return",
"service",
"(",
"pathPattern",
",",
"service",
")",
";",
"}"
] | Binds the specified {@link Service} at the specified path pattern.
@deprecated Use {@link #service(String, Service)} instead. | [
"Binds",
"the",
"specified",
"{",
"@link",
"Service",
"}",
"at",
"the",
"specified",
"path",
"pattern",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/composition/AbstractCompositeServiceBuilder.java#L107-L110 |
aws/aws-sdk-java | aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/PurchaseOfferingRequest.java | PurchaseOfferingRequest.withTags | public PurchaseOfferingRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public PurchaseOfferingRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"PurchaseOfferingRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | A collection of key-value pairs
@param tags
A collection of key-value pairs
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"collection",
"of",
"key",
"-",
"value",
"pairs"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/PurchaseOfferingRequest.java#L250-L253 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.registry/src/com/ibm/ws/security/wim/registry/util/BridgeUtils.java | BridgeUtils.createRealmDataObject | protected void createRealmDataObject(Root inputRootObject, String inputRealm) {
// use the root DataGraph to create a Context DataGraph
List<Context> contexts = inputRootObject.getContexts();
if (contexts != null) {
Context ctx = new Context();
// set "WIM.Realm" in the Context DataGraph to the realm
ctx.setKey(Service.VALUE_CONTEXT_REALM_KEY);
ctx.setValue(inputRealm);
contexts.add(ctx);
}
} | java | protected void createRealmDataObject(Root inputRootObject, String inputRealm) {
// use the root DataGraph to create a Context DataGraph
List<Context> contexts = inputRootObject.getContexts();
if (contexts != null) {
Context ctx = new Context();
// set "WIM.Realm" in the Context DataGraph to the realm
ctx.setKey(Service.VALUE_CONTEXT_REALM_KEY);
ctx.setValue(inputRealm);
contexts.add(ctx);
}
} | [
"protected",
"void",
"createRealmDataObject",
"(",
"Root",
"inputRootObject",
",",
"String",
"inputRealm",
")",
"{",
"// use the root DataGraph to create a Context DataGraph",
"List",
"<",
"Context",
">",
"contexts",
"=",
"inputRootObject",
".",
"getContexts",
"(",
")",
... | Create a DataObject for the realm context.
@param inputRootDataObject The root DataObject.
@param inputRealm The realm.
@pre inputRootDataObject != null
@pre inputRealm != null
@pre inputRealm != "" | [
"Create",
"a",
"DataObject",
"for",
"the",
"realm",
"context",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.registry/src/com/ibm/ws/security/wim/registry/util/BridgeUtils.java#L347-L358 |
VoltDB/voltdb | src/frontend/org/voltdb/expressions/ExpressionUtil.java | ExpressionUtil.buildEquavalenceExpression | public static AbstractExpression buildEquavalenceExpression(Collection<AbstractExpression> leftExprs, Collection<AbstractExpression> rightExprs) {
assert(leftExprs.size() == rightExprs.size());
Iterator<AbstractExpression> leftIt = leftExprs.iterator();
Iterator<AbstractExpression> rightIt = rightExprs.iterator();
AbstractExpression result = null;
while (leftIt.hasNext() && rightIt.hasNext()) {
AbstractExpression leftExpr = leftIt.next();
AbstractExpression rightExpr = rightIt.next();
AbstractExpression eqaulityExpr = new ComparisonExpression(ExpressionType.COMPARE_EQUAL, leftExpr, rightExpr);
if (result == null) {
result = eqaulityExpr;
} else {
result = new ConjunctionExpression(ExpressionType.CONJUNCTION_AND, result, eqaulityExpr);
}
}
return result;
} | java | public static AbstractExpression buildEquavalenceExpression(Collection<AbstractExpression> leftExprs, Collection<AbstractExpression> rightExprs) {
assert(leftExprs.size() == rightExprs.size());
Iterator<AbstractExpression> leftIt = leftExprs.iterator();
Iterator<AbstractExpression> rightIt = rightExprs.iterator();
AbstractExpression result = null;
while (leftIt.hasNext() && rightIt.hasNext()) {
AbstractExpression leftExpr = leftIt.next();
AbstractExpression rightExpr = rightIt.next();
AbstractExpression eqaulityExpr = new ComparisonExpression(ExpressionType.COMPARE_EQUAL, leftExpr, rightExpr);
if (result == null) {
result = eqaulityExpr;
} else {
result = new ConjunctionExpression(ExpressionType.CONJUNCTION_AND, result, eqaulityExpr);
}
}
return result;
} | [
"public",
"static",
"AbstractExpression",
"buildEquavalenceExpression",
"(",
"Collection",
"<",
"AbstractExpression",
">",
"leftExprs",
",",
"Collection",
"<",
"AbstractExpression",
">",
"rightExprs",
")",
"{",
"assert",
"(",
"leftExprs",
".",
"size",
"(",
")",
"=="... | Given two equal length lists of the expressions build a combined equivalence expression
(le1, le2,..., leN) (re1, re2,..., reN) =>
(le1=re1) AND (le2=re2) AND .... AND (leN=reN)
@param leftExprs
@param rightExprs
@return AbstractExpression | [
"Given",
"two",
"equal",
"length",
"lists",
"of",
"the",
"expressions",
"build",
"a",
"combined",
"equivalence",
"expression",
"(",
"le1",
"le2",
"...",
"leN",
")",
"(",
"re1",
"re2",
"...",
"reN",
")",
"=",
">",
"(",
"le1",
"=",
"re1",
")",
"AND",
"... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/ExpressionUtil.java#L697-L713 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Distribution.java | Distribution.goodTuringWithExplicitUnknown | public static <E> Distribution<E> goodTuringWithExplicitUnknown(Counter<E> counter, E UNK) {
// gather count-counts
int[] countCounts = getCountCounts(counter);
// if count-counts are unreliable, we shouldn't be using G-T
// revert to laplace
for (int i = 1; i <= 10; i++) {
if (countCounts[i] < 3) {
return laplaceWithExplicitUnknown(counter, 0.5, UNK);
}
}
double observedMass = counter.totalCount();
// calculate and cache adjusted frequencies
// also adjusting total mass of observed items
double[] adjustedFreq = new double[10];
for (int freq = 1; freq < 10; freq++) {
adjustedFreq[freq] = (double) (freq + 1) * (double) countCounts[freq + 1] / countCounts[freq];
observedMass -= (freq - adjustedFreq[freq]) * countCounts[freq];
}
Distribution<E> norm = new Distribution<E>();
norm.counter = new ClassicCounter<E>();
// fill in the new Distribution, renormalizing as we go
for (E key : counter.keySet()) {
int origFreq = (int) Math.round(counter.getCount(key));
if (origFreq < 10) {
norm.counter.setCount(key, adjustedFreq[origFreq] / observedMass);
} else {
norm.counter.setCount(key, origFreq / observedMass);
}
}
norm.numberOfKeys = counter.size();
norm.reservedMass = 0.0;
return norm;
} | java | public static <E> Distribution<E> goodTuringWithExplicitUnknown(Counter<E> counter, E UNK) {
// gather count-counts
int[] countCounts = getCountCounts(counter);
// if count-counts are unreliable, we shouldn't be using G-T
// revert to laplace
for (int i = 1; i <= 10; i++) {
if (countCounts[i] < 3) {
return laplaceWithExplicitUnknown(counter, 0.5, UNK);
}
}
double observedMass = counter.totalCount();
// calculate and cache adjusted frequencies
// also adjusting total mass of observed items
double[] adjustedFreq = new double[10];
for (int freq = 1; freq < 10; freq++) {
adjustedFreq[freq] = (double) (freq + 1) * (double) countCounts[freq + 1] / countCounts[freq];
observedMass -= (freq - adjustedFreq[freq]) * countCounts[freq];
}
Distribution<E> norm = new Distribution<E>();
norm.counter = new ClassicCounter<E>();
// fill in the new Distribution, renormalizing as we go
for (E key : counter.keySet()) {
int origFreq = (int) Math.round(counter.getCount(key));
if (origFreq < 10) {
norm.counter.setCount(key, adjustedFreq[origFreq] / observedMass);
} else {
norm.counter.setCount(key, origFreq / observedMass);
}
}
norm.numberOfKeys = counter.size();
norm.reservedMass = 0.0;
return norm;
} | [
"public",
"static",
"<",
"E",
">",
"Distribution",
"<",
"E",
">",
"goodTuringWithExplicitUnknown",
"(",
"Counter",
"<",
"E",
">",
"counter",
",",
"E",
"UNK",
")",
"{",
"// gather count-counts\r",
"int",
"[",
"]",
"countCounts",
"=",
"getCountCounts",
"(",
"c... | Creates a Good-Turing smoothed Distribution from the given counter without
creating any reserved mass-- instead, the special object UNK in the counter
is assumed to be the count of "UNSEEN" items. Probability of objects not in
original counter will be zero.
@param counter the counter
@param UNK the unknown symbol
@return a good-turing smoothed distribution | [
"Creates",
"a",
"Good",
"-",
"Turing",
"smoothed",
"Distribution",
"from",
"the",
"given",
"counter",
"without",
"creating",
"any",
"reserved",
"mass",
"--",
"instead",
"the",
"special",
"object",
"UNK",
"in",
"the",
"counter",
"is",
"assumed",
"to",
"be",
"... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Distribution.java#L386-L425 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/OptionUtil.java | OptionUtil.formatForConsole | public static void formatForConsole(StringBuilder buf, int width, Collection<TrackedParameter> options) {
for(TrackedParameter pair : options) {
Parameter<?> par = pair.getParameter();
println(buf//
.append(SerializedParameterization.OPTION_PREFIX).append(par.getOptionID().getName()) //
.append(' ').append(par.getSyntax()).append(FormatUtil.NEWLINE), //
width, getFullDescription(par));
}
} | java | public static void formatForConsole(StringBuilder buf, int width, Collection<TrackedParameter> options) {
for(TrackedParameter pair : options) {
Parameter<?> par = pair.getParameter();
println(buf//
.append(SerializedParameterization.OPTION_PREFIX).append(par.getOptionID().getName()) //
.append(' ').append(par.getSyntax()).append(FormatUtil.NEWLINE), //
width, getFullDescription(par));
}
} | [
"public",
"static",
"void",
"formatForConsole",
"(",
"StringBuilder",
"buf",
",",
"int",
"width",
",",
"Collection",
"<",
"TrackedParameter",
">",
"options",
")",
"{",
"for",
"(",
"TrackedParameter",
"pair",
":",
"options",
")",
"{",
"Parameter",
"<",
"?",
"... | Format a list of options (and associated owning objects) for console help
output.
@param buf Serialization buffer
@param width Screen width
@param options List of options | [
"Format",
"a",
"list",
"of",
"options",
"(",
"and",
"associated",
"owning",
"objects",
")",
"for",
"console",
"help",
"output",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/optionhandling/OptionUtil.java#L62-L70 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DateUtils.java | DateUtils.setDays | public static Date setDays(final Date date, final int amount) {
return set(date, Calendar.DAY_OF_MONTH, amount);
} | java | public static Date setDays(final Date date, final int amount) {
return set(date, Calendar.DAY_OF_MONTH, amount);
} | [
"public",
"static",
"Date",
"setDays",
"(",
"final",
"Date",
"date",
",",
"final",
"int",
"amount",
")",
"{",
"return",
"set",
"(",
"date",
",",
"Calendar",
".",
"DAY_OF_MONTH",
",",
"amount",
")",
";",
"}"
] | Sets the day of month field to a date returning a new object.
The original {@code Date} is unchanged.
@param date the date, not null
@param amount the amount to set
@return a new {@code Date} set with the specified value
@throws IllegalArgumentException if the date is null
@since 2.4 | [
"Sets",
"the",
"day",
"of",
"month",
"field",
"to",
"a",
"date",
"returning",
"a",
"new",
"object",
".",
"The",
"original",
"{",
"@code",
"Date",
"}",
"is",
"unchanged",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L570-L572 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPP9Reader.java | MPP9Reader.populateMemberData | private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
{
m_reader = reader;
m_file = file;
m_eventManager = file.getEventManager();
m_root = root;
//
// Retrieve the high level document properties (never encoded)
//
Props9 props9 = new Props9(new DocumentInputStream(((DocumentEntry) root.getEntry("Props9"))));
//System.out.println(props9);
file.getProjectProperties().setProjectFilePath(props9.getUnicodeString(Props.PROJECT_FILE_PATH));
m_inputStreamFactory = new DocumentInputStreamFactory(props9);
//
// Test for password protection. In the single byte retrieved here:
//
// 0x00 = no password
// 0x01 = protection password has been supplied
// 0x02 = write reservation password has been supplied
// 0x03 = both passwords have been supplied
//
if ((props9.getByte(Props.PASSWORD_FLAG) & 0x01) != 0)
{
// File is password protected for reading, let's read the password
// and see if the correct read password was given to us.
String readPassword = MPPUtility.decodePassword(props9.getByteArray(Props.PROTECTION_PASSWORD_HASH), m_inputStreamFactory.getEncryptionCode());
// It looks like it is possible for a project file to have the password protection flag on without a password. In
// this case MS Project treats the file as NOT protected. We need to do the same. It is worth noting that MS Project does
// correct the problem if the file is re-saved (at least it did for me).
if (readPassword != null && readPassword.length() > 0)
{
// See if the correct read password was given
if (reader.getReadPassword() == null || reader.getReadPassword().matches(readPassword) == false)
{
// Passwords don't match
throw new MPXJException(MPXJException.PASSWORD_PROTECTED_ENTER_PASSWORD);
}
}
// Passwords matched so let's allow the reading to continue.
}
m_resourceMap = new HashMap<Integer, ProjectCalendar>();
m_projectDir = (DirectoryEntry) root.getEntry(" 19");
m_viewDir = (DirectoryEntry) root.getEntry(" 29");
DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry("TBkndOutlCode");
VarMeta outlineCodeVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("VarMeta"))));
m_outlineCodeVarData = new Var2Data(outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Var2Data"))));
m_projectProps = new Props9(m_inputStreamFactory.getInstance(m_projectDir, "Props"));
//MPPUtility.fileDump("c:\\temp\\props.txt", m_projectProps.toString().getBytes());
m_fontBases = new HashMap<Integer, FontBase>();
m_taskSubProjects = new HashMap<Integer, SubProject>();
m_file.getProjectProperties().setMppFileType(Integer.valueOf(9));
m_file.getProjectProperties().setAutoFilter(props9.getBoolean(Props.AUTO_FILTER));
} | java | private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
{
m_reader = reader;
m_file = file;
m_eventManager = file.getEventManager();
m_root = root;
//
// Retrieve the high level document properties (never encoded)
//
Props9 props9 = new Props9(new DocumentInputStream(((DocumentEntry) root.getEntry("Props9"))));
//System.out.println(props9);
file.getProjectProperties().setProjectFilePath(props9.getUnicodeString(Props.PROJECT_FILE_PATH));
m_inputStreamFactory = new DocumentInputStreamFactory(props9);
//
// Test for password protection. In the single byte retrieved here:
//
// 0x00 = no password
// 0x01 = protection password has been supplied
// 0x02 = write reservation password has been supplied
// 0x03 = both passwords have been supplied
//
if ((props9.getByte(Props.PASSWORD_FLAG) & 0x01) != 0)
{
// File is password protected for reading, let's read the password
// and see if the correct read password was given to us.
String readPassword = MPPUtility.decodePassword(props9.getByteArray(Props.PROTECTION_PASSWORD_HASH), m_inputStreamFactory.getEncryptionCode());
// It looks like it is possible for a project file to have the password protection flag on without a password. In
// this case MS Project treats the file as NOT protected. We need to do the same. It is worth noting that MS Project does
// correct the problem if the file is re-saved (at least it did for me).
if (readPassword != null && readPassword.length() > 0)
{
// See if the correct read password was given
if (reader.getReadPassword() == null || reader.getReadPassword().matches(readPassword) == false)
{
// Passwords don't match
throw new MPXJException(MPXJException.PASSWORD_PROTECTED_ENTER_PASSWORD);
}
}
// Passwords matched so let's allow the reading to continue.
}
m_resourceMap = new HashMap<Integer, ProjectCalendar>();
m_projectDir = (DirectoryEntry) root.getEntry(" 19");
m_viewDir = (DirectoryEntry) root.getEntry(" 29");
DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry("TBkndOutlCode");
VarMeta outlineCodeVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("VarMeta"))));
m_outlineCodeVarData = new Var2Data(outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Var2Data"))));
m_projectProps = new Props9(m_inputStreamFactory.getInstance(m_projectDir, "Props"));
//MPPUtility.fileDump("c:\\temp\\props.txt", m_projectProps.toString().getBytes());
m_fontBases = new HashMap<Integer, FontBase>();
m_taskSubProjects = new HashMap<Integer, SubProject>();
m_file.getProjectProperties().setMppFileType(Integer.valueOf(9));
m_file.getProjectProperties().setAutoFilter(props9.getBoolean(Props.AUTO_FILTER));
} | [
"private",
"void",
"populateMemberData",
"(",
"MPPReader",
"reader",
",",
"ProjectFile",
"file",
",",
"DirectoryEntry",
"root",
")",
"throws",
"MPXJException",
",",
"IOException",
"{",
"m_reader",
"=",
"reader",
";",
"m_file",
"=",
"file",
";",
"m_eventManager",
... | Populate member data used by the rest of the reader.
@param reader parent file reader
@param file parent MPP file
@param root Root of the POI file system. | [
"Populate",
"member",
"data",
"used",
"by",
"the",
"rest",
"of",
"the",
"reader",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP9Reader.java#L125-L183 |
rey5137/material | material/src/main/java/com/rey/material/widget/Slider.java | Slider.setValue | public void setValue(float value, boolean animation){
value = Math.min(mMaxValue, Math.max(value, mMinValue));
setPosition((value - mMinValue) / (mMaxValue - mMinValue), animation);
} | java | public void setValue(float value, boolean animation){
value = Math.min(mMaxValue, Math.max(value, mMinValue));
setPosition((value - mMinValue) / (mMaxValue - mMinValue), animation);
} | [
"public",
"void",
"setValue",
"(",
"float",
"value",
",",
"boolean",
"animation",
")",
"{",
"value",
"=",
"Math",
".",
"min",
"(",
"mMaxValue",
",",
"Math",
".",
"max",
"(",
"value",
",",
"mMinValue",
")",
")",
";",
"setPosition",
"(",
"(",
"value",
... | Set the selected value of this Slider.
@param value The selected value.
@param animation Indicate that should show animation when change thumb's position. | [
"Set",
"the",
"selected",
"value",
"of",
"this",
"Slider",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/Slider.java#L476-L479 |
spotify/async-google-pubsub-client | src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java | Pubsub.createSubscription | private PubsubFuture<Subscription> createSubscription(final String canonicalSubscriptionName,
final Subscription subscription) {
validateCanonicalSubscription(canonicalSubscriptionName);
return put("create subscription", canonicalSubscriptionName, SubscriptionCreateRequest.of(subscription),
readJson(Subscription.class));
} | java | private PubsubFuture<Subscription> createSubscription(final String canonicalSubscriptionName,
final Subscription subscription) {
validateCanonicalSubscription(canonicalSubscriptionName);
return put("create subscription", canonicalSubscriptionName, SubscriptionCreateRequest.of(subscription),
readJson(Subscription.class));
} | [
"private",
"PubsubFuture",
"<",
"Subscription",
">",
"createSubscription",
"(",
"final",
"String",
"canonicalSubscriptionName",
",",
"final",
"Subscription",
"subscription",
")",
"{",
"validateCanonicalSubscription",
"(",
"canonicalSubscriptionName",
")",
";",
"return",
"... | Create a Pub/Sub subscription.
@param canonicalSubscriptionName The canonical (including project) name of the subscription to create.
@param subscription The subscription to create.
@return A future that is completed when this request is completed. | [
"Create",
"a",
"Pub",
"/",
"Sub",
"subscription",
"."
] | train | https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L417-L422 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/TaylorSeries.java | TaylorSeries.Sin | public static double Sin(double x, int nTerms) {
if (nTerms < 2) return x;
if (nTerms == 2) {
return x - (x * x * x) / 6D;
} else {
double mult = x * x * x;
double fact = 6;
double sign = 1;
int factS = 5;
double result = x - mult / fact;
for (int i = 3; i <= nTerms; i++) {
mult *= x * x;
fact *= factS * (factS - 1);
factS += 2;
result += sign * (mult / fact);
sign *= -1;
}
return result;
}
} | java | public static double Sin(double x, int nTerms) {
if (nTerms < 2) return x;
if (nTerms == 2) {
return x - (x * x * x) / 6D;
} else {
double mult = x * x * x;
double fact = 6;
double sign = 1;
int factS = 5;
double result = x - mult / fact;
for (int i = 3; i <= nTerms; i++) {
mult *= x * x;
fact *= factS * (factS - 1);
factS += 2;
result += sign * (mult / fact);
sign *= -1;
}
return result;
}
} | [
"public",
"static",
"double",
"Sin",
"(",
"double",
"x",
",",
"int",
"nTerms",
")",
"{",
"if",
"(",
"nTerms",
"<",
"2",
")",
"return",
"x",
";",
"if",
"(",
"nTerms",
"==",
"2",
")",
"{",
"return",
"x",
"-",
"(",
"x",
"*",
"x",
"*",
"x",
")",
... | compute Sin using Taylor Series.
@param x An angle, in radians.
@param nTerms Number of terms.
@return Result. | [
"compute",
"Sin",
"using",
"Taylor",
"Series",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/TaylorSeries.java#L47-L68 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/impl/ItemMap.java | ItemMap.put | public final void put(long key, AbstractItemLink link) {
int i = _indexOfKey(key);
synchronized (_getLock(i)) {
// NOTE: this pushes the new entry onto the front of the list. Means we
// will retrieve in lifo order. This may not be optimal
Entry nextEntry = _entry[i];
Entry newEntry = new Entry(key, link, nextEntry);
_entry[i] = newEntry;
_size++;
}
} | java | public final void put(long key, AbstractItemLink link) {
int i = _indexOfKey(key);
synchronized (_getLock(i)) {
// NOTE: this pushes the new entry onto the front of the list. Means we
// will retrieve in lifo order. This may not be optimal
Entry nextEntry = _entry[i];
Entry newEntry = new Entry(key, link, nextEntry);
_entry[i] = newEntry;
_size++;
}
} | [
"public",
"final",
"void",
"put",
"(",
"long",
"key",
",",
"AbstractItemLink",
"link",
")",
"{",
"int",
"i",
"=",
"_indexOfKey",
"(",
"key",
")",
";",
"synchronized",
"(",
"_getLock",
"(",
"i",
")",
")",
"{",
"// NOTE: this pushes the new entry onto the front ... | Associates the specified value with the specified key in this map.
If the map previously contained a mapping for this key, the old
value is replaced.
@param key key with which the specified value is to be associated.
@param link link to be associated with the specified key. | [
"Associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"in",
"this",
"map",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"this",
"key",
"the",
"old",
"value",
"is",
"replaced",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/impl/ItemMap.java#L182-L193 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java | ZonedDateTime.ofLocal | public static ZonedDateTime ofLocal(LocalDateTime localDateTime, ZoneId zone, ZoneOffset preferredOffset) {
Objects.requireNonNull(localDateTime, "localDateTime");
Objects.requireNonNull(zone, "zone");
if (zone instanceof ZoneOffset) {
return new ZonedDateTime(localDateTime, (ZoneOffset) zone, zone);
}
ZoneRules rules = zone.getRules();
List<ZoneOffset> validOffsets = rules.getValidOffsets(localDateTime);
ZoneOffset offset;
if (validOffsets.size() == 1) {
offset = validOffsets.get(0);
} else if (validOffsets.size() == 0) {
ZoneOffsetTransition trans = rules.getTransition(localDateTime);
localDateTime = localDateTime.plusSeconds(trans.getDuration().getSeconds());
offset = trans.getOffsetAfter();
} else {
if (preferredOffset != null && validOffsets.contains(preferredOffset)) {
offset = preferredOffset;
} else {
offset = Objects.requireNonNull(validOffsets.get(0), "offset"); // protect against bad ZoneRules
}
}
return new ZonedDateTime(localDateTime, offset, zone);
} | java | public static ZonedDateTime ofLocal(LocalDateTime localDateTime, ZoneId zone, ZoneOffset preferredOffset) {
Objects.requireNonNull(localDateTime, "localDateTime");
Objects.requireNonNull(zone, "zone");
if (zone instanceof ZoneOffset) {
return new ZonedDateTime(localDateTime, (ZoneOffset) zone, zone);
}
ZoneRules rules = zone.getRules();
List<ZoneOffset> validOffsets = rules.getValidOffsets(localDateTime);
ZoneOffset offset;
if (validOffsets.size() == 1) {
offset = validOffsets.get(0);
} else if (validOffsets.size() == 0) {
ZoneOffsetTransition trans = rules.getTransition(localDateTime);
localDateTime = localDateTime.plusSeconds(trans.getDuration().getSeconds());
offset = trans.getOffsetAfter();
} else {
if (preferredOffset != null && validOffsets.contains(preferredOffset)) {
offset = preferredOffset;
} else {
offset = Objects.requireNonNull(validOffsets.get(0), "offset"); // protect against bad ZoneRules
}
}
return new ZonedDateTime(localDateTime, offset, zone);
} | [
"public",
"static",
"ZonedDateTime",
"ofLocal",
"(",
"LocalDateTime",
"localDateTime",
",",
"ZoneId",
"zone",
",",
"ZoneOffset",
"preferredOffset",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"localDateTime",
",",
"\"localDateTime\"",
")",
";",
"Objects",
".",
... | Obtains an instance of {@code ZonedDateTime} from a local date-time
using the preferred offset if possible.
<p>
The local date-time is resolved to a single instant on the time-line.
This is achieved by finding a valid offset from UTC/Greenwich for the local
date-time as defined by the {@link ZoneRules rules} of the zone ID.
<p>
In most cases, there is only one valid offset for a local date-time.
In the case of an overlap, where clocks are set back, there are two valid offsets.
If the preferred offset is one of the valid offsets then it is used.
Otherwise the earlier valid offset is used, typically corresponding to "summer".
<p>
In the case of a gap, where clocks jump forward, there is no valid offset.
Instead, the local date-time is adjusted to be later by the length of the gap.
For a typical one hour daylight savings change, the local date-time will be
moved one hour later into the offset typically corresponding to "summer".
@param localDateTime the local date-time, not null
@param zone the time-zone, not null
@param preferredOffset the zone offset, null if no preference
@return the zoned date-time, not null | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"ZonedDateTime",
"}",
"from",
"a",
"local",
"date",
"-",
"time",
"using",
"the",
"preferred",
"offset",
"if",
"possible",
".",
"<p",
">",
"The",
"local",
"date",
"-",
"time",
"is",
"resolved",
"to",
"a",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java#L360-L383 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java | BeetlUtil.renderFromStr | public static String renderFromStr(String templateContent, Map<String, Object> bindingMap) {
return render(getStrTemplate(templateContent), bindingMap);
} | java | public static String renderFromStr(String templateContent, Map<String, Object> bindingMap) {
return render(getStrTemplate(templateContent), bindingMap);
} | [
"public",
"static",
"String",
"renderFromStr",
"(",
"String",
"templateContent",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"bindingMap",
")",
"{",
"return",
"render",
"(",
"getStrTemplate",
"(",
"templateContent",
")",
",",
"bindingMap",
")",
";",
"}"
] | 渲染模板
@param templateContent 模板内容
@param bindingMap 绑定参数
@return 渲染后的内容
@since 3.2.0 | [
"渲染模板"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java#L211-L213 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.getCouponRedemptionsByInvoice | @Deprecated
public Redemptions getCouponRedemptionsByInvoice(final Integer invoiceNumber, final QueryParams params) {
return getCouponRedemptionsByInvoice(invoiceNumber.toString(), params);
} | java | @Deprecated
public Redemptions getCouponRedemptionsByInvoice(final Integer invoiceNumber, final QueryParams params) {
return getCouponRedemptionsByInvoice(invoiceNumber.toString(), params);
} | [
"@",
"Deprecated",
"public",
"Redemptions",
"getCouponRedemptionsByInvoice",
"(",
"final",
"Integer",
"invoiceNumber",
",",
"final",
"QueryParams",
"params",
")",
"{",
"return",
"getCouponRedemptionsByInvoice",
"(",
"invoiceNumber",
".",
"toString",
"(",
")",
",",
"pa... | Lookup all coupon redemptions on an invoice given query params.
@deprecated Prefer using Invoice#getId() as the id param (which is a String)
@param invoiceNumber invoice number
@param params {@link QueryParams}
@return the coupon redemptions for this invoice on success, null otherwise | [
"Lookup",
"all",
"coupon",
"redemptions",
"on",
"an",
"invoice",
"given",
"query",
"params",
"."
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1677-L1680 |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PermissionAwareCrudService.java | PermissionAwareCrudService.findAllUserGroupPermissionsOfUserGroup | @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#userGroup, 'READ')")
@Transactional(readOnly = true)
public Map<PersistentObject, PermissionCollection> findAllUserGroupPermissionsOfUserGroup(UserGroup userGroup) {
return dao.findAllUserGroupPermissionsOfUserGroup(userGroup);
} | java | @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#userGroup, 'READ')")
@Transactional(readOnly = true)
public Map<PersistentObject, PermissionCollection> findAllUserGroupPermissionsOfUserGroup(UserGroup userGroup) {
return dao.findAllUserGroupPermissionsOfUserGroup(userGroup);
} | [
"@",
"PreAuthorize",
"(",
"\"hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#userGroup, 'READ')\"",
")",
"@",
"Transactional",
"(",
"readOnly",
"=",
"true",
")",
"public",
"Map",
"<",
"PersistentObject",
",",
"PermissionCollection",
">",
"findAllUserGroupPermis... | This method returns a {@link Map} that maps {@link PersistentObject}s
to PermissionCollections for the passed {@link UserGroup}. I.e. the keySet
of the map is the collection of all {@link PersistentObject}s where the
user group has at least one permission and the corresponding value contains
the {@link PermissionCollection} for the passed user group on the entity.
@param userGroup
@return | [
"This",
"method",
"returns",
"a",
"{",
"@link",
"Map",
"}",
"that",
"maps",
"{",
"@link",
"PersistentObject",
"}",
"s",
"to",
"PermissionCollections",
"for",
"the",
"passed",
"{",
"@link",
"UserGroup",
"}",
".",
"I",
".",
"e",
".",
"the",
"keySet",
"of",... | train | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PermissionAwareCrudService.java#L361-L365 |
KyoriPowered/text | api/src/main/java/net/kyori/text/event/ClickEvent.java | ClickEvent.openFile | public static @NonNull ClickEvent openFile(final @NonNull String file) {
return new ClickEvent(Action.OPEN_FILE, file);
} | java | public static @NonNull ClickEvent openFile(final @NonNull String file) {
return new ClickEvent(Action.OPEN_FILE, file);
} | [
"public",
"static",
"@",
"NonNull",
"ClickEvent",
"openFile",
"(",
"final",
"@",
"NonNull",
"String",
"file",
")",
"{",
"return",
"new",
"ClickEvent",
"(",
"Action",
".",
"OPEN_FILE",
",",
"file",
")",
";",
"}"
] | Creates a click event that opens a file.
<p>This action is not readable, and may only be used locally on the client.</p>
@param file the file to open
@return a click event | [
"Creates",
"a",
"click",
"event",
"that",
"opens",
"a",
"file",
"."
] | train | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/event/ClickEvent.java#L66-L68 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java | SvgGraphicsContext.moveElement | public void moveElement(String name, Object sourceParent, Object targetParent) {
helper.moveElement(name, sourceParent, targetParent);
} | java | public void moveElement(String name, Object sourceParent, Object targetParent) {
helper.moveElement(name, sourceParent, targetParent);
} | [
"public",
"void",
"moveElement",
"(",
"String",
"name",
",",
"Object",
"sourceParent",
",",
"Object",
"targetParent",
")",
"{",
"helper",
".",
"moveElement",
"(",
"name",
",",
"sourceParent",
",",
"targetParent",
")",
";",
"}"
] | Move an element from on group to another. The elements name will remain the same.
@param name
The name of the element within the sourceParent group.
@param sourceParent
The original parent object associated with the element.
@param targetParent
The target parent object to be associated with the element.
@since 1.8.0 | [
"Move",
"an",
"element",
"from",
"on",
"group",
"to",
"another",
".",
"The",
"elements",
"name",
"will",
"remain",
"the",
"same",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L769-L771 |
google/error-prone-javac | src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java | Startup.fromFileList | static Startup fromFileList(List<String> fns, String context, MessageHandler mh) {
List<StartupEntry> entries = fns.stream()
.map(fn -> readFile(fn, context, mh))
.collect(toList());
if (entries.stream().anyMatch(sue -> sue == null)) {
return null;
}
return new Startup(entries);
} | java | static Startup fromFileList(List<String> fns, String context, MessageHandler mh) {
List<StartupEntry> entries = fns.stream()
.map(fn -> readFile(fn, context, mh))
.collect(toList());
if (entries.stream().anyMatch(sue -> sue == null)) {
return null;
}
return new Startup(entries);
} | [
"static",
"Startup",
"fromFileList",
"(",
"List",
"<",
"String",
">",
"fns",
",",
"String",
"context",
",",
"MessageHandler",
"mh",
")",
"{",
"List",
"<",
"StartupEntry",
">",
"entries",
"=",
"fns",
".",
"stream",
"(",
")",
".",
"map",
"(",
"fn",
"->",... | Factory method: Read Startup from a list of external files or resources.
@param fns list of file/resource names to access
@param context printable non-natural language context for errors
@param mh handler for error messages
@return files as Startup, or null when error (message has been printed) | [
"Factory",
"method",
":",
"Read",
"Startup",
"from",
"a",
"list",
"of",
"external",
"files",
"or",
"resources",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java#L276-L284 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java | PatchModuleInvalidationUtils.computeBadByteSkipArray | private static void computeBadByteSkipArray(byte[] pattern, int[] badByteArray) {
for (int a = 0; a < ALPHABET_SIZE; a++) {
badByteArray[a] = pattern.length;
}
for (int j = 0; j < pattern.length - 1; j++) {
badByteArray[pattern[j] - Byte.MIN_VALUE] = pattern.length - j - 1;
}
} | java | private static void computeBadByteSkipArray(byte[] pattern, int[] badByteArray) {
for (int a = 0; a < ALPHABET_SIZE; a++) {
badByteArray[a] = pattern.length;
}
for (int j = 0; j < pattern.length - 1; j++) {
badByteArray[pattern[j] - Byte.MIN_VALUE] = pattern.length - j - 1;
}
} | [
"private",
"static",
"void",
"computeBadByteSkipArray",
"(",
"byte",
"[",
"]",
"pattern",
",",
"int",
"[",
"]",
"badByteArray",
")",
"{",
"for",
"(",
"int",
"a",
"=",
"0",
";",
"a",
"<",
"ALPHABET_SIZE",
";",
"a",
"++",
")",
"{",
"badByteArray",
"[",
... | Fills the Boyer Moore "bad character array" for the given pattern | [
"Fills",
"the",
"Boyer",
"Moore",
"bad",
"character",
"array",
"for",
"the",
"given",
"pattern"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L520-L528 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/LinkedConverter.java | LinkedConverter.convertIndexToField | public int convertIndexToField(int index, boolean bDisplayOption, int iMoveMode)
{ // Must be overidden
if (this.getNextConverter() != null)
return this.getNextConverter().convertIndexToField(index, bDisplayOption, iMoveMode);
else
return super.convertIndexToField(index, bDisplayOption, iMoveMode);
} | java | public int convertIndexToField(int index, boolean bDisplayOption, int iMoveMode)
{ // Must be overidden
if (this.getNextConverter() != null)
return this.getNextConverter().convertIndexToField(index, bDisplayOption, iMoveMode);
else
return super.convertIndexToField(index, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"convertIndexToField",
"(",
"int",
"index",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"// Must be overidden",
"if",
"(",
"this",
".",
"getNextConverter",
"(",
")",
"!=",
"null",
")",
"return",
"this",
".",
"getNextCo... | Convert the display's index to the field value and move to field.
@param index The index to convert an set this field to.
@param bDisplayOption If true, display the change in the converters.
@param iMoveMove The type of move. | [
"Convert",
"the",
"display",
"s",
"index",
"to",
"the",
"field",
"value",
"and",
"move",
"to",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/LinkedConverter.java#L142-L148 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipPhone.java | SipPhone.addBuddy | public PresenceSubscriber addBuddy(String uri, long timeout) {
return addBuddy(uri, DEFAULT_SUBSCRIBE_DURATION, null, timeout);
} | java | public PresenceSubscriber addBuddy(String uri, long timeout) {
return addBuddy(uri, DEFAULT_SUBSCRIBE_DURATION, null, timeout);
} | [
"public",
"PresenceSubscriber",
"addBuddy",
"(",
"String",
"uri",
",",
"long",
"timeout",
")",
"{",
"return",
"addBuddy",
"(",
"uri",
",",
"DEFAULT_SUBSCRIBE_DURATION",
",",
"null",
",",
"timeout",
")",
";",
"}"
] | This method is the same as addBuddy(uri, duration, eventId, timeout) except that the duration
is defaulted to the default period defined in the event package RFC (3600 seconds) and no event
"id" parameter will be included.
@param uri the URI (ie, sip:bob@nist.gov) of the buddy to be added to the list.
@param timeout The maximum amount of time to wait for a SUBSCRIBE response, in milliseconds.
Use a value of 0 to wait indefinitely.
@return PresenceSubscriber object representing the buddy if the operation is successful so far,
null otherwise. | [
"This",
"method",
"is",
"the",
"same",
"as",
"addBuddy",
"(",
"uri",
"duration",
"eventId",
"timeout",
")",
"except",
"that",
"the",
"duration",
"is",
"defaulted",
"to",
"the",
"default",
"period",
"defined",
"in",
"the",
"event",
"package",
"RFC",
"(",
"3... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipPhone.java#L1441-L1443 |
ludovicianul/selenium-on-steroids | src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java | WebDriverHelper.isValueSelectedInDropDown | public boolean isValueSelectedInDropDown(final By by, final String value) {
WebElement element = driver.findElement(by);
StringBuilder builder = new StringBuilder(".//option[@value = ");
builder.append(escapeQuotes(value));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder
.toString()));
for (WebElement opt : options) {
if (opt.isSelected()) {
return true;
}
}
return false;
} | java | public boolean isValueSelectedInDropDown(final By by, final String value) {
WebElement element = driver.findElement(by);
StringBuilder builder = new StringBuilder(".//option[@value = ");
builder.append(escapeQuotes(value));
builder.append("]");
List<WebElement> options = element.findElements(By.xpath(builder
.toString()));
for (WebElement opt : options) {
if (opt.isSelected()) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"isValueSelectedInDropDown",
"(",
"final",
"By",
"by",
",",
"final",
"String",
"value",
")",
"{",
"WebElement",
"element",
"=",
"driver",
".",
"findElement",
"(",
"by",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"("... | Checks if a value is selected in a drop down list.
@param by
the method of identifying the element
@param value
the value to search for
@return true if the value is selected or false otherwise | [
"Checks",
"if",
"a",
"value",
"is",
"selected",
"in",
"a",
"drop",
"down",
"list",
"."
] | train | https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L677-L693 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpUtils.java | HttpUtils.executeGet | public static HttpResponse executeGet(final String url,
final String basicAuthUsername,
final String basicAuthPassword,
final Map<String, Object> parameters,
final Map<String, Object> headers) {
try {
return execute(url, HttpMethod.GET.name(), basicAuthUsername, basicAuthPassword, parameters, headers);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
return null;
} | java | public static HttpResponse executeGet(final String url,
final String basicAuthUsername,
final String basicAuthPassword,
final Map<String, Object> parameters,
final Map<String, Object> headers) {
try {
return execute(url, HttpMethod.GET.name(), basicAuthUsername, basicAuthPassword, parameters, headers);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
return null;
} | [
"public",
"static",
"HttpResponse",
"executeGet",
"(",
"final",
"String",
"url",
",",
"final",
"String",
"basicAuthUsername",
",",
"final",
"String",
"basicAuthPassword",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
",",
"final",
"Map",
... | Execute get http response.
@param url the url
@param basicAuthUsername the basic auth username
@param basicAuthPassword the basic auth password
@param parameters the parameters
@param headers the headers
@return the http response | [
"Execute",
"get",
"http",
"response",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpUtils.java#L217-L228 |
windup/windup | rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/ip/DiscoverHardcodedIPAddressRuleProvider.java | DiscoverHardcodedIPAddressRuleProvider.isMavenVersionTag | private boolean isMavenVersionTag(GraphContext context, FileLocationModel model)
{
if (isMavenFile(context, model))
{
Document doc = ((XmlFileModel) model.getFile()).asDocument();
for (Element elm : $(doc).find("version"))
{
String text = StringUtils.trim($(elm).text());
if (StringUtils.equals(text, model.getSourceSnippit()))
{
return true;
}
}
}
return false;
} | java | private boolean isMavenVersionTag(GraphContext context, FileLocationModel model)
{
if (isMavenFile(context, model))
{
Document doc = ((XmlFileModel) model.getFile()).asDocument();
for (Element elm : $(doc).find("version"))
{
String text = StringUtils.trim($(elm).text());
if (StringUtils.equals(text, model.getSourceSnippit()))
{
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"isMavenVersionTag",
"(",
"GraphContext",
"context",
",",
"FileLocationModel",
"model",
")",
"{",
"if",
"(",
"isMavenFile",
"(",
"context",
",",
"model",
")",
")",
"{",
"Document",
"doc",
"=",
"(",
"(",
"XmlFileModel",
")",
"model",
"."... | if this is a maven file, checks to see if "version" tags match the discovered text; if the discovered text does match something in a version
tag, it is likely a version, not an IP address
@param context
@param model
@return | [
"if",
"this",
"is",
"a",
"maven",
"file",
"checks",
"to",
"see",
"if",
"version",
"tags",
"match",
"the",
"discovered",
"text",
";",
"if",
"the",
"discovered",
"text",
"does",
"match",
"something",
"in",
"a",
"version",
"tag",
"it",
"is",
"likely",
"a",
... | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/ip/DiscoverHardcodedIPAddressRuleProvider.java#L177-L192 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/IntegerField.java | IntegerField.getSQLFromField | public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
{
if (this.isNull())
{
if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE))
statement.setNull(iParamColumn, Types.INTEGER);
else
statement.setInt(iParamColumn, NAN);
}
else
statement.setInt(iParamColumn, (int)this.getValue());
} | java | public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
{
if (this.isNull())
{
if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE))
statement.setNull(iParamColumn, Types.INTEGER);
else
statement.setInt(iParamColumn, NAN);
}
else
statement.setInt(iParamColumn, (int)this.getValue());
} | [
"public",
"void",
"getSQLFromField",
"(",
"PreparedStatement",
"statement",
",",
"int",
"iType",
",",
"int",
"iParamColumn",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"this",
".",
"isNull",
"(",
")",
")",
"{",
"if",
"(",
"(",
"this",
".",
"isNullable"... | Move the physical binary data to this SQL parameter row.
This is overidden to move the physical data type.
@param statement The SQL prepare statement.
@param iType the type of SQL statement.
@param iParamColumn The column in the prepared statement to set the data.
@exception SQLException From SQL calls. | [
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"SQL",
"parameter",
"row",
".",
"This",
"is",
"overidden",
"to",
"move",
"the",
"physical",
"data",
"type",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/IntegerField.java#L142-L153 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemCache.java | ProxiedFileSystemCache.getProxiedFileSystem | @Deprecated
public static FileSystem getProxiedFileSystem(@NonNull final String userNameToProxyAs, Properties properties,
Configuration conf) throws IOException {
return getProxiedFileSystem(userNameToProxyAs, properties, FileSystem.getDefaultUri(conf), conf);
} | java | @Deprecated
public static FileSystem getProxiedFileSystem(@NonNull final String userNameToProxyAs, Properties properties,
Configuration conf) throws IOException {
return getProxiedFileSystem(userNameToProxyAs, properties, FileSystem.getDefaultUri(conf), conf);
} | [
"@",
"Deprecated",
"public",
"static",
"FileSystem",
"getProxiedFileSystem",
"(",
"@",
"NonNull",
"final",
"String",
"userNameToProxyAs",
",",
"Properties",
"properties",
",",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"return",
"getProxiedFileSystem",
... | Gets a {@link FileSystem} that can perform any operations allowed by the specified userNameToProxyAs.
@param userNameToProxyAs The name of the user the super user should proxy as
@param properties {@link java.util.Properties} containing initialization properties.
@param conf The {@link Configuration} for the {@link FileSystem} that should be created.
@return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs
@throws IOException
@deprecated use {@link #fromProperties} | [
"Gets",
"a",
"{",
"@link",
"FileSystem",
"}",
"that",
"can",
"perform",
"any",
"operations",
"allowed",
"by",
"the",
"specified",
"userNameToProxyAs",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemCache.java#L90-L94 |
google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/InferenceEngine.java | InferenceEngine.checkBlockEndContext | private static void checkBlockEndContext(RenderUnitNode node, Context endContext) {
if (!endContext.isValidEndContextForContentKind(
MoreObjects.firstNonNull(node.getContentKind(), SanitizedContentKind.HTML))) {
String msg =
String.format(
"A block of kind=\"%s\" cannot end in context %s. Likely cause is %s.",
node.getContentKind().asAttributeValue(),
endContext,
endContext.getLikelyEndContextMismatchCause(node.getContentKind()));
throw SoyAutoescapeException.createWithNode(msg, node);
}
} | java | private static void checkBlockEndContext(RenderUnitNode node, Context endContext) {
if (!endContext.isValidEndContextForContentKind(
MoreObjects.firstNonNull(node.getContentKind(), SanitizedContentKind.HTML))) {
String msg =
String.format(
"A block of kind=\"%s\" cannot end in context %s. Likely cause is %s.",
node.getContentKind().asAttributeValue(),
endContext,
endContext.getLikelyEndContextMismatchCause(node.getContentKind()));
throw SoyAutoescapeException.createWithNode(msg, node);
}
} | [
"private",
"static",
"void",
"checkBlockEndContext",
"(",
"RenderUnitNode",
"node",
",",
"Context",
"endContext",
")",
"{",
"if",
"(",
"!",
"endContext",
".",
"isValidEndContextForContentKind",
"(",
"MoreObjects",
".",
"firstNonNull",
"(",
"node",
".",
"getContentKi... | Checks that the end context of a block is compatible with its start context.
@throws SoyAutoescapeException if they mismatch. | [
"Checks",
"that",
"the",
"end",
"context",
"of",
"a",
"block",
"is",
"compatible",
"with",
"its",
"start",
"context",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/InferenceEngine.java#L113-L124 |
Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/RetryHandler.java | RetryHandler.runChildWithRetry | static void runChildWithRetry(Object runner, final FrameworkMethod method, RunNotifier notifier, int maxRetry) {
boolean doRetry = false;
Statement statement = invoke(runner, "methodBlock", method);
Description description = invoke(runner, "describeChild", method);
AtomicInteger count = new AtomicInteger(maxRetry);
do {
EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
eachNotifier.fireTestStarted();
try {
statement.evaluate();
doRetry = false;
} catch (AssumptionViolatedException thrown) {
doRetry = doRetry(method, thrown, count);
if (doRetry) {
description = RetriedTest.proxyFor(description, thrown);
eachNotifier.fireTestIgnored();
} else {
eachNotifier.addFailedAssumption(thrown);
}
} catch (Throwable thrown) {
doRetry = doRetry(method, thrown, count);
if (doRetry) {
description = RetriedTest.proxyFor(description, thrown);
eachNotifier.fireTestIgnored();
} else {
eachNotifier.addFailure(thrown);
}
} finally {
eachNotifier.fireTestFinished();
}
} while (doRetry);
} | java | static void runChildWithRetry(Object runner, final FrameworkMethod method, RunNotifier notifier, int maxRetry) {
boolean doRetry = false;
Statement statement = invoke(runner, "methodBlock", method);
Description description = invoke(runner, "describeChild", method);
AtomicInteger count = new AtomicInteger(maxRetry);
do {
EachTestNotifier eachNotifier = new EachTestNotifier(notifier, description);
eachNotifier.fireTestStarted();
try {
statement.evaluate();
doRetry = false;
} catch (AssumptionViolatedException thrown) {
doRetry = doRetry(method, thrown, count);
if (doRetry) {
description = RetriedTest.proxyFor(description, thrown);
eachNotifier.fireTestIgnored();
} else {
eachNotifier.addFailedAssumption(thrown);
}
} catch (Throwable thrown) {
doRetry = doRetry(method, thrown, count);
if (doRetry) {
description = RetriedTest.proxyFor(description, thrown);
eachNotifier.fireTestIgnored();
} else {
eachNotifier.addFailure(thrown);
}
} finally {
eachNotifier.fireTestFinished();
}
} while (doRetry);
} | [
"static",
"void",
"runChildWithRetry",
"(",
"Object",
"runner",
",",
"final",
"FrameworkMethod",
"method",
",",
"RunNotifier",
"notifier",
",",
"int",
"maxRetry",
")",
"{",
"boolean",
"doRetry",
"=",
"false",
";",
"Statement",
"statement",
"=",
"invoke",
"(",
... | Run the specified method, retrying on failure.
@param runner JUnit test runner
@param method test method to be run
@param notifier run notifier through which events are published
@param maxRetry maximum number of retry attempts | [
"Run",
"the",
"specified",
"method",
"retrying",
"on",
"failure",
"."
] | train | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/RetryHandler.java#L43-L76 |
pip-services3-java/pip-services3-components-java | src/org/pipservices3/components/log/CompositeLogger.java | CompositeLogger.setReferences | @Override
public void setReferences(IReferences references) {
List<Object> loggers = references.getOptional(new Descriptor(null, "logger", null, null, null));
for (Object logger : loggers) {
if (logger instanceof ILogger && logger != this)
_loggers.add((ILogger) logger);
}
} | java | @Override
public void setReferences(IReferences references) {
List<Object> loggers = references.getOptional(new Descriptor(null, "logger", null, null, null));
for (Object logger : loggers) {
if (logger instanceof ILogger && logger != this)
_loggers.add((ILogger) logger);
}
} | [
"@",
"Override",
"public",
"void",
"setReferences",
"(",
"IReferences",
"references",
")",
"{",
"List",
"<",
"Object",
">",
"loggers",
"=",
"references",
".",
"getOptional",
"(",
"new",
"Descriptor",
"(",
"null",
",",
"\"logger\"",
",",
"null",
",",
"null",
... | Sets references to dependent components.
@param references references to locate the component dependencies. | [
"Sets",
"references",
"to",
"dependent",
"components",
"."
] | train | https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/log/CompositeLogger.java#L66-L74 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/conversation/Conversation.java | Conversation.getApplicableInteraction | public Interaction getApplicableInteraction(String eventLabel, boolean verbose) {
String targetsString = getTargets();
if (targetsString != null) {
try {
Targets targets = new Targets(getTargets());
String interactionId = targets.getApplicableInteraction(eventLabel, verbose);
if (interactionId != null) {
String interactionsString = getInteractions();
if (interactionsString != null) {
Interactions interactions = new Interactions(interactionsString);
return interactions.getInteraction(interactionId);
}
}
} catch (JSONException e) {
ApptentiveLog.e(INTERACTIONS, e, "Exception while getting applicable interaction: %s", eventLabel);
logException(e);
}
}
return null;
} | java | public Interaction getApplicableInteraction(String eventLabel, boolean verbose) {
String targetsString = getTargets();
if (targetsString != null) {
try {
Targets targets = new Targets(getTargets());
String interactionId = targets.getApplicableInteraction(eventLabel, verbose);
if (interactionId != null) {
String interactionsString = getInteractions();
if (interactionsString != null) {
Interactions interactions = new Interactions(interactionsString);
return interactions.getInteraction(interactionId);
}
}
} catch (JSONException e) {
ApptentiveLog.e(INTERACTIONS, e, "Exception while getting applicable interaction: %s", eventLabel);
logException(e);
}
}
return null;
} | [
"public",
"Interaction",
"getApplicableInteraction",
"(",
"String",
"eventLabel",
",",
"boolean",
"verbose",
")",
"{",
"String",
"targetsString",
"=",
"getTargets",
"(",
")",
";",
"if",
"(",
"targetsString",
"!=",
"null",
")",
"{",
"try",
"{",
"Targets",
"targ... | Returns an Interaction for <code>eventLabel</code> if there is one that can be displayed. | [
"Returns",
"an",
"Interaction",
"for",
"<code",
">",
"eventLabel<",
"/",
"code",
">",
"if",
"there",
"is",
"one",
"that",
"can",
"be",
"displayed",
"."
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/conversation/Conversation.java#L197-L216 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_output_graylog_stream_streamId_archive_archiveId_GET | public OvhArchive serviceName_output_graylog_stream_streamId_archive_archiveId_GET(String serviceName, String streamId, String archiveId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId}";
StringBuilder sb = path(qPath, serviceName, streamId, archiveId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhArchive.class);
} | java | public OvhArchive serviceName_output_graylog_stream_streamId_archive_archiveId_GET(String serviceName, String streamId, String archiveId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId}";
StringBuilder sb = path(qPath, serviceName, streamId, archiveId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhArchive.class);
} | [
"public",
"OvhArchive",
"serviceName_output_graylog_stream_streamId_archive_archiveId_GET",
"(",
"String",
"serviceName",
",",
"String",
"streamId",
",",
"String",
"archiveId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{serviceName}/output/graylo... | Returns details of specified archive
REST: GET /dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/archive/{archiveId}
@param serviceName [required] Service name
@param streamId [required] Stream ID
@param archiveId [required] Archive ID | [
"Returns",
"details",
"of",
"specified",
"archive"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1457-L1462 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.reverseForEachChar | public static void reverseForEachChar(String string, CharProcedure procedure)
{
for (int i = string.length() - 1; i >= 0; i--)
{
procedure.value(string.charAt(i));
}
} | java | public static void reverseForEachChar(String string, CharProcedure procedure)
{
for (int i = string.length() - 1; i >= 0; i--)
{
procedure.value(string.charAt(i));
}
} | [
"public",
"static",
"void",
"reverseForEachChar",
"(",
"String",
"string",
",",
"CharProcedure",
"procedure",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"string",
".",
"length",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"procedur... | For each char in the {@code string} in reverse order, execute the {@link CharProcedure}.
@since 7.0 | [
"For",
"each",
"char",
"in",
"the",
"{",
"@code",
"string",
"}",
"in",
"reverse",
"order",
"execute",
"the",
"{",
"@link",
"CharProcedure",
"}",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L412-L418 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java | PredictionsImpl.predictImageUrlWithNoStoreWithServiceResponseAsync | public Observable<ServiceResponse<ImagePrediction>> predictImageUrlWithNoStoreWithServiceResponseAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final UUID iterationId = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.iterationId() : null;
final String application = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.application() : null;
final String url = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.url() : null;
return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, iterationId, application, url);
} | java | public Observable<ServiceResponse<ImagePrediction>> predictImageUrlWithNoStoreWithServiceResponseAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final UUID iterationId = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.iterationId() : null;
final String application = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.application() : null;
final String url = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.url() : null;
return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, iterationId, application, url);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"ImagePrediction",
">",
">",
"predictImageUrlWithNoStoreWithServiceResponseAsync",
"(",
"UUID",
"projectId",
",",
"PredictImageUrlWithNoStoreOptionalParameter",
"predictImageUrlWithNoStoreOptionalParameter",
")",
"{",
"if",
"("... | Predict an image url without saving the result.
@param projectId The project id
@param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImagePrediction object | [
"Predict",
"an",
"image",
"url",
"without",
"saving",
"the",
"result",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L317-L329 |
rzwitserloot/lombok | src/core/lombok/javac/JavacNode.java | JavacNode.addError | public void addError(String message, DiagnosticPosition pos) {
ast.printMessage(Diagnostic.Kind.ERROR, message, null, pos, true);
} | java | public void addError(String message, DiagnosticPosition pos) {
ast.printMessage(Diagnostic.Kind.ERROR, message, null, pos, true);
} | [
"public",
"void",
"addError",
"(",
"String",
"message",
",",
"DiagnosticPosition",
"pos",
")",
"{",
"ast",
".",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
".",
"ERROR",
",",
"message",
",",
"null",
",",
"pos",
",",
"true",
")",
";",
"}"
] | Generates an compiler error focused on the AST node represented by this node object. | [
"Generates",
"an",
"compiler",
"error",
"focused",
"on",
"the",
"AST",
"node",
"represented",
"by",
"this",
"node",
"object",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/JavacNode.java#L262-L264 |
neo4j-contrib/neo4j-apoc-procedures | src/main/java/apoc/path/NodeEvaluators.java | NodeEvaluators.endAndTerminatorNodeEvaluator | public static Evaluator endAndTerminatorNodeEvaluator(List<Node> endNodes, List<Node> terminatorNodes) {
Evaluator endNodeEvaluator = null;
Evaluator terminatorNodeEvaluator = null;
if (!endNodes.isEmpty()) {
Node[] nodes = endNodes.toArray(new Node[endNodes.size()]);
endNodeEvaluator = Evaluators.includeWhereEndNodeIs(nodes);
}
if (!terminatorNodes.isEmpty()) {
Node[] nodes = terminatorNodes.toArray(new Node[terminatorNodes.size()]);
terminatorNodeEvaluator = Evaluators.pruneWhereEndNodeIs(nodes);
}
if (endNodeEvaluator != null || terminatorNodeEvaluator != null) {
return new EndAndTerminatorNodeEvaluator(endNodeEvaluator, terminatorNodeEvaluator);
}
return null;
} | java | public static Evaluator endAndTerminatorNodeEvaluator(List<Node> endNodes, List<Node> terminatorNodes) {
Evaluator endNodeEvaluator = null;
Evaluator terminatorNodeEvaluator = null;
if (!endNodes.isEmpty()) {
Node[] nodes = endNodes.toArray(new Node[endNodes.size()]);
endNodeEvaluator = Evaluators.includeWhereEndNodeIs(nodes);
}
if (!terminatorNodes.isEmpty()) {
Node[] nodes = terminatorNodes.toArray(new Node[terminatorNodes.size()]);
terminatorNodeEvaluator = Evaluators.pruneWhereEndNodeIs(nodes);
}
if (endNodeEvaluator != null || terminatorNodeEvaluator != null) {
return new EndAndTerminatorNodeEvaluator(endNodeEvaluator, terminatorNodeEvaluator);
}
return null;
} | [
"public",
"static",
"Evaluator",
"endAndTerminatorNodeEvaluator",
"(",
"List",
"<",
"Node",
">",
"endNodes",
",",
"List",
"<",
"Node",
">",
"terminatorNodes",
")",
"{",
"Evaluator",
"endNodeEvaluator",
"=",
"null",
";",
"Evaluator",
"terminatorNodeEvaluator",
"=",
... | Returns an evaluator which handles end nodes and terminator nodes
Returns null if both lists are empty | [
"Returns",
"an",
"evaluator",
"which",
"handles",
"end",
"nodes",
"and",
"terminator",
"nodes",
"Returns",
"null",
"if",
"both",
"lists",
"are",
"empty"
] | train | https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/path/NodeEvaluators.java#L24-L43 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_udp_farm_farmId_GET | public OvhBackendUdp serviceName_udp_farm_farmId_GET(String serviceName, Long farmId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}";
StringBuilder sb = path(qPath, serviceName, farmId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackendUdp.class);
} | java | public OvhBackendUdp serviceName_udp_farm_farmId_GET(String serviceName, Long farmId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}";
StringBuilder sb = path(qPath, serviceName, farmId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackendUdp.class);
} | [
"public",
"OvhBackendUdp",
"serviceName_udp_farm_farmId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"farmId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/udp/farm/{farmId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"... | Get this object properties
REST: GET /ipLoadbalancing/{serviceName}/udp/farm/{farmId}
@param serviceName [required] The internal name of your IP load balancing
@param farmId [required] Id of your farm
API beta | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L895-L900 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.indexOfIgnoreCase | public static int indexOfIgnoreCase(CharSequence[] array, CharSequence value) {
if (null != array) {
for (int i = 0; i < array.length; i++) {
if (StrUtil.equalsIgnoreCase(array[i], value)) {
return i;
}
}
}
return INDEX_NOT_FOUND;
} | java | public static int indexOfIgnoreCase(CharSequence[] array, CharSequence value) {
if (null != array) {
for (int i = 0; i < array.length; i++) {
if (StrUtil.equalsIgnoreCase(array[i], value)) {
return i;
}
}
}
return INDEX_NOT_FOUND;
} | [
"public",
"static",
"int",
"indexOfIgnoreCase",
"(",
"CharSequence",
"[",
"]",
"array",
",",
"CharSequence",
"value",
")",
"{",
"if",
"(",
"null",
"!=",
"array",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
... | 返回数组中指定元素所在位置,忽略大小写,未找到返回{@link #INDEX_NOT_FOUND}
@param array 数组
@param value 被检查的元素
@return 数组中指定元素所在位置,未找到返回{@link #INDEX_NOT_FOUND}
@since 3.1.2 | [
"返回数组中指定元素所在位置,忽略大小写,未找到返回",
"{",
"@link",
"#INDEX_NOT_FOUND",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L916-L925 |
wisdom-framework/wisdom | core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java | CryptoServiceSingleton.encryptAES | @Override
public String encryptAES(String value, String privateKey) {
try {
byte[] raw = privateKey.getBytes(UTF_8);
SecretKeySpec skeySpec = new SecretKeySpec(raw, AES_ECB_ALGORITHM);
Cipher cipher = Cipher.getInstance(AES_ECB_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
return hexToString(cipher.doFinal(value.getBytes(Charsets.UTF_8)));
} catch (NoSuchAlgorithmException | NoSuchPaddingException |
InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) {
throw new IllegalStateException(e);
}
} | java | @Override
public String encryptAES(String value, String privateKey) {
try {
byte[] raw = privateKey.getBytes(UTF_8);
SecretKeySpec skeySpec = new SecretKeySpec(raw, AES_ECB_ALGORITHM);
Cipher cipher = Cipher.getInstance(AES_ECB_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
return hexToString(cipher.doFinal(value.getBytes(Charsets.UTF_8)));
} catch (NoSuchAlgorithmException | NoSuchPaddingException |
InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) {
throw new IllegalStateException(e);
}
} | [
"@",
"Override",
"public",
"String",
"encryptAES",
"(",
"String",
"value",
",",
"String",
"privateKey",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"raw",
"=",
"privateKey",
".",
"getBytes",
"(",
"UTF_8",
")",
";",
"SecretKeySpec",
"skeySpec",
"=",
"new",
"S... | Encrypt a String with the AES standard encryption (using the ECB mode). Private key must have a length of 16 bytes.
@param value The String to encrypt
@param privateKey The key used to encrypt
@return An hexadecimal encrypted string | [
"Encrypt",
"a",
"String",
"with",
"the",
"AES",
"standard",
"encryption",
"(",
"using",
"the",
"ECB",
"mode",
")",
".",
"Private",
"key",
"must",
"have",
"a",
"length",
"of",
"16",
"bytes",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L286-L298 |
shevek/jcpp | src/main/java/org/anarres/cpp/NumericValue.java | NumericValue.toBigDecimal | @Nonnull
public BigDecimal toBigDecimal() {
int scale = 0;
String text = getIntegerPart();
String t_fraction = getFractionalPart();
if (t_fraction != null) {
text += getFractionalPart();
// XXX Wrong for anything but base 10.
scale += t_fraction.length();
}
String t_exponent = getExponent();
if (t_exponent != null)
scale -= Integer.parseInt(t_exponent);
BigInteger unscaled = new BigInteger(text, getBase());
return new BigDecimal(unscaled, scale);
} | java | @Nonnull
public BigDecimal toBigDecimal() {
int scale = 0;
String text = getIntegerPart();
String t_fraction = getFractionalPart();
if (t_fraction != null) {
text += getFractionalPart();
// XXX Wrong for anything but base 10.
scale += t_fraction.length();
}
String t_exponent = getExponent();
if (t_exponent != null)
scale -= Integer.parseInt(t_exponent);
BigInteger unscaled = new BigInteger(text, getBase());
return new BigDecimal(unscaled, scale);
} | [
"@",
"Nonnull",
"public",
"BigDecimal",
"toBigDecimal",
"(",
")",
"{",
"int",
"scale",
"=",
"0",
";",
"String",
"text",
"=",
"getIntegerPart",
"(",
")",
";",
"String",
"t_fraction",
"=",
"getFractionalPart",
"(",
")",
";",
"if",
"(",
"t_fraction",
"!=",
... | So, it turns out that parsing arbitrary bases into arbitrary
precision numbers is nontrivial, and this routine gets it wrong
in many important cases. | [
"So",
"it",
"turns",
"out",
"that",
"parsing",
"arbitrary",
"bases",
"into",
"arbitrary",
"precision",
"numbers",
"is",
"nontrivial",
"and",
"this",
"routine",
"gets",
"it",
"wrong",
"in",
"many",
"important",
"cases",
"."
] | train | https://github.com/shevek/jcpp/blob/71462c702097cabf8304202c740f780285fc35a8/src/main/java/org/anarres/cpp/NumericValue.java#L96-L111 |
asterisk-java/asterisk-java | src/main/java/org/asteriskjava/live/internal/AsteriskChannelImpl.java | AsteriskChannelImpl.extensionVisited | void extensionVisited(Date date, Extension extension)
{
final Extension oldCurrentExtension = getCurrentExtension();
final ExtensionHistoryEntry historyEntry;
historyEntry = new ExtensionHistoryEntry(date, extension);
synchronized (extensionHistory)
{
extensionHistory.add(historyEntry);
}
firePropertyChange(PROPERTY_CURRENT_EXTENSION, oldCurrentExtension, extension);
} | java | void extensionVisited(Date date, Extension extension)
{
final Extension oldCurrentExtension = getCurrentExtension();
final ExtensionHistoryEntry historyEntry;
historyEntry = new ExtensionHistoryEntry(date, extension);
synchronized (extensionHistory)
{
extensionHistory.add(historyEntry);
}
firePropertyChange(PROPERTY_CURRENT_EXTENSION, oldCurrentExtension, extension);
} | [
"void",
"extensionVisited",
"(",
"Date",
"date",
",",
"Extension",
"extension",
")",
"{",
"final",
"Extension",
"oldCurrentExtension",
"=",
"getCurrentExtension",
"(",
")",
";",
"final",
"ExtensionHistoryEntry",
"historyEntry",
";",
"historyEntry",
"=",
"new",
"Exte... | Adds a visted dialplan entry to the history.
@param date the date the extension has been visited.
@param extension the visted dialplan entry to add. | [
"Adds",
"a",
"visted",
"dialplan",
"entry",
"to",
"the",
"history",
"."
] | train | https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/live/internal/AsteriskChannelImpl.java#L399-L412 |
kaazing/gateway | service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/HttpDirectoryService.java | HttpDirectoryService.resolvePatternSpecificity | private void resolvePatternSpecificity(Map<String, PatternCacheControl> patterns) {
List<String> patternList = new ArrayList<>();
patternList.addAll(patterns.keySet());
int patternCount = patternList.size();
for (int i = 0; i < patternCount - 1; i++) {
String specificPattern = patternList.get(i);
for (int j = i + 1; j < patternCount; j++) {
String generalPattern = patternList.get(j);
checkPatternMatching(patterns, specificPattern, generalPattern);
checkPatternMatching(patterns, generalPattern, specificPattern);
}
}
} | java | private void resolvePatternSpecificity(Map<String, PatternCacheControl> patterns) {
List<String> patternList = new ArrayList<>();
patternList.addAll(patterns.keySet());
int patternCount = patternList.size();
for (int i = 0; i < patternCount - 1; i++) {
String specificPattern = patternList.get(i);
for (int j = i + 1; j < patternCount; j++) {
String generalPattern = patternList.get(j);
checkPatternMatching(patterns, specificPattern, generalPattern);
checkPatternMatching(patterns, generalPattern, specificPattern);
}
}
} | [
"private",
"void",
"resolvePatternSpecificity",
"(",
"Map",
"<",
"String",
",",
"PatternCacheControl",
">",
"patterns",
")",
"{",
"List",
"<",
"String",
">",
"patternList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"patternList",
".",
"addAll",
"(",
"pat... | Matches the patterns from the map and determines each pattern's specificity
@param patterns - the map with the patterns to be matched | [
"Matches",
"the",
"patterns",
"from",
"the",
"map",
"and",
"determines",
"each",
"pattern",
"s",
"specificity"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/HttpDirectoryService.java#L155-L169 |
lets-blade/blade | src/main/java/com/blade/kit/PasswordKit.java | PasswordKit.checkPassword | public static boolean checkPassword(String plaintext, String storedHash) {
boolean password_verified;
if (null == storedHash || !storedHash.startsWith("$2a$"))
throw new IllegalArgumentException("Invalid hash provided for comparison");
password_verified = BCrypt.checkpw(plaintext, storedHash);
return (password_verified);
} | java | public static boolean checkPassword(String plaintext, String storedHash) {
boolean password_verified;
if (null == storedHash || !storedHash.startsWith("$2a$"))
throw new IllegalArgumentException("Invalid hash provided for comparison");
password_verified = BCrypt.checkpw(plaintext, storedHash);
return (password_verified);
} | [
"public",
"static",
"boolean",
"checkPassword",
"(",
"String",
"plaintext",
",",
"String",
"storedHash",
")",
"{",
"boolean",
"password_verified",
";",
"if",
"(",
"null",
"==",
"storedHash",
"||",
"!",
"storedHash",
".",
"startsWith",
"(",
"\"$2a$\"",
")",
")"... | This method can be used to verify a computed hash from a plaintext (e.g. during a login
request) with that of a stored hash from a database. The password hash from the database
must be passed as the second variable.
@param plaintext The account's plaintext password, as provided during a login request
@param storedHash The account's stored password hash, retrieved from the authorization database
@return boolean - true if the password matches the password of the stored hash, false otherwise | [
"This",
"method",
"can",
"be",
"used",
"to",
"verify",
"a",
"computed",
"hash",
"from",
"a",
"plaintext",
"(",
"e",
".",
"g",
".",
"during",
"a",
"login",
"request",
")",
"with",
"that",
"of",
"a",
"stored",
"hash",
"from",
"a",
"database",
".",
"The... | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/PasswordKit.java#L58-L64 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java | DataFormatHelper.padHexString | public static final String padHexString(int num, int width) {
final String zeroPad = "0000000000000000";
String str = Integer.toHexString(num);
final int length = str.length();
if (length >= width)
return str;
StringBuilder buffer = new StringBuilder(zeroPad.substring(0, width));
buffer.replace(width - length, width, str);
return buffer.toString();
} | java | public static final String padHexString(int num, int width) {
final String zeroPad = "0000000000000000";
String str = Integer.toHexString(num);
final int length = str.length();
if (length >= width)
return str;
StringBuilder buffer = new StringBuilder(zeroPad.substring(0, width));
buffer.replace(width - length, width, str);
return buffer.toString();
} | [
"public",
"static",
"final",
"String",
"padHexString",
"(",
"int",
"num",
",",
"int",
"width",
")",
"{",
"final",
"String",
"zeroPad",
"=",
"\"0000000000000000\"",
";",
"String",
"str",
"=",
"Integer",
".",
"toHexString",
"(",
"num",
")",
";",
"final",
"in... | Returns the provided integer, padded to the specified number of characters with zeros.
@param num
Input number as an integer
@param width
Number of characters to return, including padding
@return input number as zero-padded string | [
"Returns",
"the",
"provided",
"integer",
"padded",
"to",
"the",
"specified",
"number",
"of",
"characters",
"with",
"zeros",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java#L202-L214 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/EncodedTransport.java | EncodedTransport.addParam | public void addParam(String strParam, String strValue)
{
if (strValue == null)
strValue = NULL;
m_properties.setProperty(strParam, strValue);
} | java | public void addParam(String strParam, String strValue)
{
if (strValue == null)
strValue = NULL;
m_properties.setProperty(strParam, strValue);
} | [
"public",
"void",
"addParam",
"(",
"String",
"strParam",
",",
"String",
"strValue",
")",
"{",
"if",
"(",
"strValue",
"==",
"null",
")",
"strValue",
"=",
"NULL",
";",
"m_properties",
".",
"setProperty",
"(",
"strParam",
",",
"strValue",
")",
";",
"}"
] | Add this method param to the param list.
(By default, uses the property method... override this to use an app specific method).
NOTE: The param name DOES NOT need to be saved, as params are always added and retrieved in order.
@param strParam The param name.
@param strValue The param value. | [
"Add",
"this",
"method",
"param",
"to",
"the",
"param",
"list",
".",
"(",
"By",
"default",
"uses",
"the",
"property",
"method",
"...",
"override",
"this",
"to",
"use",
"an",
"app",
"specific",
"method",
")",
".",
"NOTE",
":",
"The",
"param",
"name",
"D... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/EncodedTransport.java#L57-L62 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.createProject | @Deprecated
public GitlabProject createProject(String name, Integer namespaceId, String description, Boolean issuesEnabled, Boolean wallEnabled, Boolean mergeRequestsEnabled, Boolean wikiEnabled, Boolean snippetsEnabled, Boolean publik, String visibility, String importUrl) throws IOException {
Query query = new Query()
.append("name", name)
.appendIf("namespace_id", namespaceId)
.appendIf("description", description)
.appendIf("issues_enabled", issuesEnabled)
.appendIf("wall_enabled", wallEnabled)
.appendIf("merge_requests_enabled", mergeRequestsEnabled)
.appendIf("wiki_enabled", wikiEnabled)
.appendIf("snippets_enabled", snippetsEnabled)
.appendIf("visibility", visibility)
.appendIf("import_url", importUrl);
String tailUrl = GitlabProject.URL + query.toString();
return dispatch().to(tailUrl, GitlabProject.class);
} | java | @Deprecated
public GitlabProject createProject(String name, Integer namespaceId, String description, Boolean issuesEnabled, Boolean wallEnabled, Boolean mergeRequestsEnabled, Boolean wikiEnabled, Boolean snippetsEnabled, Boolean publik, String visibility, String importUrl) throws IOException {
Query query = new Query()
.append("name", name)
.appendIf("namespace_id", namespaceId)
.appendIf("description", description)
.appendIf("issues_enabled", issuesEnabled)
.appendIf("wall_enabled", wallEnabled)
.appendIf("merge_requests_enabled", mergeRequestsEnabled)
.appendIf("wiki_enabled", wikiEnabled)
.appendIf("snippets_enabled", snippetsEnabled)
.appendIf("visibility", visibility)
.appendIf("import_url", importUrl);
String tailUrl = GitlabProject.URL + query.toString();
return dispatch().to(tailUrl, GitlabProject.class);
} | [
"@",
"Deprecated",
"public",
"GitlabProject",
"createProject",
"(",
"String",
"name",
",",
"Integer",
"namespaceId",
",",
"String",
"description",
",",
"Boolean",
"issuesEnabled",
",",
"Boolean",
"wallEnabled",
",",
"Boolean",
"mergeRequestsEnabled",
",",
"Boolean",
... | Creates a Project
@param name The name of the project
@param namespaceId The Namespace for the new project, otherwise null indicates to use the GitLab default (user)
@param description A description for the project, null otherwise
@param issuesEnabled Whether Issues should be enabled, otherwise null indicates to use GitLab default
@param wallEnabled Whether The Wall should be enabled, otherwise null indicates to use GitLab default
@param mergeRequestsEnabled Whether Merge Requests should be enabled, otherwise null indicates to use GitLab default
@param wikiEnabled Whether a Wiki should be enabled, otherwise null indicates to use GitLab default
@param snippetsEnabled Whether Snippets should be enabled, otherwise null indicates to use GitLab default
@param visibility The visibility level of the project, otherwise null indicates to use GitLab default
@param importUrl The Import URL for the project, otherwise null
@return the Gitlab Project
@throws IOException on gitlab api call error | [
"Creates",
"a",
"Project"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L1249-L1266 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeValidator.java | TypeValidator.expectValidAsyncReturnType | void expectValidAsyncReturnType(Node n, JSType type) {
if (promiseOfUnknownType.isSubtypeOf(type)) {
return;
}
JSError err = JSError.make(n, INVALID_ASYNC_RETURN_TYPE, type.toString());
registerMismatch(type, promiseOfUnknownType, err);
report(err);
} | java | void expectValidAsyncReturnType(Node n, JSType type) {
if (promiseOfUnknownType.isSubtypeOf(type)) {
return;
}
JSError err = JSError.make(n, INVALID_ASYNC_RETURN_TYPE, type.toString());
registerMismatch(type, promiseOfUnknownType, err);
report(err);
} | [
"void",
"expectValidAsyncReturnType",
"(",
"Node",
"n",
",",
"JSType",
"type",
")",
"{",
"if",
"(",
"promiseOfUnknownType",
".",
"isSubtypeOf",
"(",
"type",
")",
")",
"{",
"return",
";",
"}",
"JSError",
"err",
"=",
"JSError",
".",
"make",
"(",
"n",
",",
... | Expect the type to be a supertype of `Promise`.
<p>`Promise` is the <em>lower</em> bound of the declared return type, since that's what async
functions always return; the user can't return an instance of a more specific type. | [
"Expect",
"the",
"type",
"to",
"be",
"a",
"supertype",
"of",
"Promise",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L342-L350 |
Talend/tesb-rt-se | sam/sam-agent/src/main/java/org/talend/esb/sam/agent/lifecycle/AbstractListenerImpl.java | AbstractListenerImpl.createEvent | private Event createEvent(Endpoint endpoint, EventTypeEnum type) {
Event event = new Event();
MessageInfo messageInfo = new MessageInfo();
Originator originator = new Originator();
event.setMessageInfo(messageInfo);
event.setOriginator(originator);
Date date = new Date();
event.setTimestamp(date);
event.setEventType(type);
messageInfo.setPortType(
endpoint.getBinding().getBindingInfo().getService().getInterface().getName().toString());
String transportType = null;
if (endpoint.getBinding() instanceof SoapBinding) {
SoapBinding soapBinding = (SoapBinding)endpoint.getBinding();
if (soapBinding.getBindingInfo() instanceof SoapBindingInfo) {
SoapBindingInfo soapBindingInfo = (SoapBindingInfo)soapBinding.getBindingInfo();
transportType = soapBindingInfo.getTransportURI();
}
}
messageInfo.setTransportType((transportType != null) ? transportType : "Unknown transport type");
originator.setProcessId(Converter.getPID());
try {
InetAddress inetAddress = InetAddress.getLocalHost();
originator.setIp(inetAddress.getHostAddress());
originator.setHostname(inetAddress.getHostName());
} catch (UnknownHostException e) {
originator.setHostname("Unknown hostname");
originator.setIp("Unknown ip address");
}
String address = endpoint.getEndpointInfo().getAddress();
event.getCustomInfo().put("address", address);
return event;
} | java | private Event createEvent(Endpoint endpoint, EventTypeEnum type) {
Event event = new Event();
MessageInfo messageInfo = new MessageInfo();
Originator originator = new Originator();
event.setMessageInfo(messageInfo);
event.setOriginator(originator);
Date date = new Date();
event.setTimestamp(date);
event.setEventType(type);
messageInfo.setPortType(
endpoint.getBinding().getBindingInfo().getService().getInterface().getName().toString());
String transportType = null;
if (endpoint.getBinding() instanceof SoapBinding) {
SoapBinding soapBinding = (SoapBinding)endpoint.getBinding();
if (soapBinding.getBindingInfo() instanceof SoapBindingInfo) {
SoapBindingInfo soapBindingInfo = (SoapBindingInfo)soapBinding.getBindingInfo();
transportType = soapBindingInfo.getTransportURI();
}
}
messageInfo.setTransportType((transportType != null) ? transportType : "Unknown transport type");
originator.setProcessId(Converter.getPID());
try {
InetAddress inetAddress = InetAddress.getLocalHost();
originator.setIp(inetAddress.getHostAddress());
originator.setHostname(inetAddress.getHostName());
} catch (UnknownHostException e) {
originator.setHostname("Unknown hostname");
originator.setIp("Unknown ip address");
}
String address = endpoint.getEndpointInfo().getAddress();
event.getCustomInfo().put("address", address);
return event;
} | [
"private",
"Event",
"createEvent",
"(",
"Endpoint",
"endpoint",
",",
"EventTypeEnum",
"type",
")",
"{",
"Event",
"event",
"=",
"new",
"Event",
"(",
")",
";",
"MessageInfo",
"messageInfo",
"=",
"new",
"MessageInfo",
"(",
")",
";",
"Originator",
"originator",
... | Creates the event for endpoint with specific type.
@param endpoint the endpoint
@param type the type
@return the event | [
"Creates",
"the",
"event",
"for",
"endpoint",
"with",
"specific",
"type",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/lifecycle/AbstractListenerImpl.java#L126-L165 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java | ApiOvhCdndedicated.serviceName_domains_domain_backends_ip_GET | public OvhBackend serviceName_domains_domain_backends_ip_GET(String serviceName, String domain, String ip) throws IOException {
String qPath = "/cdn/dedicated/{serviceName}/domains/{domain}/backends/{ip}";
StringBuilder sb = path(qPath, serviceName, domain, ip);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackend.class);
} | java | public OvhBackend serviceName_domains_domain_backends_ip_GET(String serviceName, String domain, String ip) throws IOException {
String qPath = "/cdn/dedicated/{serviceName}/domains/{domain}/backends/{ip}";
StringBuilder sb = path(qPath, serviceName, domain, ip);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBackend.class);
} | [
"public",
"OvhBackend",
"serviceName_domains_domain_backends_ip_GET",
"(",
"String",
"serviceName",
",",
"String",
"domain",
",",
"String",
"ip",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cdn/dedicated/{serviceName}/domains/{domain}/backends/{ip}\"",
";",... | Get this object properties
REST: GET /cdn/dedicated/{serviceName}/domains/{domain}/backends/{ip}
@param serviceName [required] The internal name of your CDN offer
@param domain [required] Domain of this object
@param ip [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cdndedicated/src/main/java/net/minidev/ovh/api/ApiOvhCdndedicated.java#L144-L149 |
gitblit/fathom | fathom-core/src/main/java/fathom/utils/RequireUtil.java | RequireUtil.allowClass | public static boolean allowClass(Settings settings, Class<?> aClass) {
// Settings-based class exclusions/inclusions
if (aClass.isAnnotationPresent(RequireSettings.class)) {
// multiple keys required
RequireSetting[] requireSettings = aClass.getAnnotation(RequireSettings.class).value();
StringJoiner joiner = new StringJoiner(", ");
Arrays.asList(requireSettings).forEach((require) -> {
if (!settings.hasSetting(require.value())) {
joiner.add(require.value());
}
});
String requiredSettings = joiner.toString();
if (!requiredSettings.isEmpty()) {
log.warn("skipping {}, it requires the following {} mode settings: {}",
aClass.getName(), settings.getMode(), requiredSettings);
return false;
}
} | java | public static boolean allowClass(Settings settings, Class<?> aClass) {
// Settings-based class exclusions/inclusions
if (aClass.isAnnotationPresent(RequireSettings.class)) {
// multiple keys required
RequireSetting[] requireSettings = aClass.getAnnotation(RequireSettings.class).value();
StringJoiner joiner = new StringJoiner(", ");
Arrays.asList(requireSettings).forEach((require) -> {
if (!settings.hasSetting(require.value())) {
joiner.add(require.value());
}
});
String requiredSettings = joiner.toString();
if (!requiredSettings.isEmpty()) {
log.warn("skipping {}, it requires the following {} mode settings: {}",
aClass.getName(), settings.getMode(), requiredSettings);
return false;
}
} | [
"public",
"static",
"boolean",
"allowClass",
"(",
"Settings",
"settings",
",",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"// Settings-based class exclusions/inclusions",
"if",
"(",
"aClass",
".",
"isAnnotationPresent",
"(",
"RequireSettings",
".",
"class",
")",
... | Determines if this class may be used in the current runtime environment.
Fathom settings are considered as well as runtime modes.
@param settings
@param aClass
@return true if the class may be used | [
"Determines",
"if",
"this",
"class",
"may",
"be",
"used",
"in",
"the",
"current",
"runtime",
"environment",
".",
"Fathom",
"settings",
"are",
"considered",
"as",
"well",
"as",
"runtime",
"modes",
"."
] | train | https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-core/src/main/java/fathom/utils/RequireUtil.java#L74-L93 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.getMetadataWithChildrenIfChanged | public Maybe<DbxEntry./*@Nullable*/WithChildren> getMetadataWithChildrenIfChanged(String path, /*@Nullable*/String previousFolderHash)
throws DbxException
{
return getMetadataWithChildrenIfChanged(path, false, previousFolderHash);
} | java | public Maybe<DbxEntry./*@Nullable*/WithChildren> getMetadataWithChildrenIfChanged(String path, /*@Nullable*/String previousFolderHash)
throws DbxException
{
return getMetadataWithChildrenIfChanged(path, false, previousFolderHash);
} | [
"public",
"Maybe",
"<",
"DbxEntry",
".",
"/*@Nullable*/",
"WithChildren",
">",
"getMetadataWithChildrenIfChanged",
"(",
"String",
"path",
",",
"/*@Nullable*/",
"String",
"previousFolderHash",
")",
"throws",
"DbxException",
"{",
"return",
"getMetadataWithChildrenIfChanged",
... | Same as {@link #getMetadataWithChildrenIfChanged(String, boolean, String)} with {@code includeMediaInfo} set
to {@code false}. | [
"Same",
"as",
"{"
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L274-L278 |
stevespringett/Alpine | alpine/src/main/java/alpine/persistence/AlpineQueryManager.java | AlpineQueryManager.removeUserFromTeam | public boolean removeUserFromTeam(final UserPrincipal user, final Team team) {
final List<Team> teams = user.getTeams();
if (teams == null) {
return false;
}
boolean found = false;
for (final Team t: teams) {
if (team.getUuid().equals(t.getUuid())) {
found = true;
}
}
if (found) {
pm.currentTransaction().begin();
teams.remove(team);
user.setTeams(teams);
pm.currentTransaction().commit();
return true;
}
return false;
} | java | public boolean removeUserFromTeam(final UserPrincipal user, final Team team) {
final List<Team> teams = user.getTeams();
if (teams == null) {
return false;
}
boolean found = false;
for (final Team t: teams) {
if (team.getUuid().equals(t.getUuid())) {
found = true;
}
}
if (found) {
pm.currentTransaction().begin();
teams.remove(team);
user.setTeams(teams);
pm.currentTransaction().commit();
return true;
}
return false;
} | [
"public",
"boolean",
"removeUserFromTeam",
"(",
"final",
"UserPrincipal",
"user",
",",
"final",
"Team",
"team",
")",
"{",
"final",
"List",
"<",
"Team",
">",
"teams",
"=",
"user",
".",
"getTeams",
"(",
")",
";",
"if",
"(",
"teams",
"==",
"null",
")",
"{... | Removes the association of a UserPrincipal to a Team.
@param user The user to unbind
@param team The team to unbind
@return true if operation was successful, false if not. This is not an indication of team disassociation,
an unsuccessful return value may be due to the team or user not existing, or a binding that may not exist.
@since 1.0.0 | [
"Removes",
"the",
"association",
"of",
"a",
"UserPrincipal",
"to",
"a",
"Team",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L422-L441 |
Bandwidth/java-bandwidth | src/main/java/com/bandwidth/sdk/model/Conference.java | Conference.getConference | public static Conference getConference(final String id) throws Exception {
final BandwidthClient client = BandwidthClient.getInstance();
return getConference(client, id);
} | java | public static Conference getConference(final String id) throws Exception {
final BandwidthClient client = BandwidthClient.getInstance();
return getConference(client, id);
} | [
"public",
"static",
"Conference",
"getConference",
"(",
"final",
"String",
"id",
")",
"throws",
"Exception",
"{",
"final",
"BandwidthClient",
"client",
"=",
"BandwidthClient",
".",
"getInstance",
"(",
")",
";",
"return",
"getConference",
"(",
"client",
",",
"id"... | Retrieves the conference information.
@param id conference id
@return conference information.
@throws IOException unexpected error. | [
"Retrieves",
"the",
"conference",
"information",
"."
] | train | https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Conference.java#L28-L32 |
cubedtear/aritzh | aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java | Configuration.loadConfig | public static Configuration loadConfig(Path configFile, boolean compressSpaces) {
if (Files.notExists(configFile)) {
return Configuration.newConfig(OneOrOther.<File, Path>ofOther(configFile));
}
Configuration config = new Configuration(OneOrOther.<File, Path>ofOther(configFile), compressSpaces);
try (BufferedReader reader = Files.newBufferedReader(configFile, Charset.defaultCharset())) {
loadConfig(config, reader, compressSpaces);
} catch (IOException e) {
e.printStackTrace();
}
return config;
} | java | public static Configuration loadConfig(Path configFile, boolean compressSpaces) {
if (Files.notExists(configFile)) {
return Configuration.newConfig(OneOrOther.<File, Path>ofOther(configFile));
}
Configuration config = new Configuration(OneOrOther.<File, Path>ofOther(configFile), compressSpaces);
try (BufferedReader reader = Files.newBufferedReader(configFile, Charset.defaultCharset())) {
loadConfig(config, reader, compressSpaces);
} catch (IOException e) {
e.printStackTrace();
}
return config;
} | [
"public",
"static",
"Configuration",
"loadConfig",
"(",
"Path",
"configFile",
",",
"boolean",
"compressSpaces",
")",
"{",
"if",
"(",
"Files",
".",
"notExists",
"(",
"configFile",
")",
")",
"{",
"return",
"Configuration",
".",
"newConfig",
"(",
"OneOrOther",
".... | Loads the configuration path, specifying if spaces should be compressed or not ({@code currentLine.replaceAll("\\s+", " ")})
If the config path did not exist, it will be created
@param configFile Path to read the configuration from
@param compressSpaces If true subsequent whitespaces will be replaced with a single one (defaults to {@code false})
@return A new configuration object, already parsed, from {@code configFile} | [
"Loads",
"the",
"configuration",
"path",
"specifying",
"if",
"spaces",
"should",
"be",
"compressed",
"or",
"not",
"(",
"{",
"@code",
"currentLine",
".",
"replaceAll",
"(",
"\\\\",
"s",
"+",
")",
"}",
")",
"If",
"the",
"config",
"path",
"did",
"not",
"exi... | train | https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java#L151-L164 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java | PoolsImpl.disableAutoScale | public void disableAutoScale(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions) {
disableAutoScaleWithServiceResponseAsync(poolId, poolDisableAutoScaleOptions).toBlocking().single().body();
} | java | public void disableAutoScale(String poolId, PoolDisableAutoScaleOptions poolDisableAutoScaleOptions) {
disableAutoScaleWithServiceResponseAsync(poolId, poolDisableAutoScaleOptions).toBlocking().single().body();
} | [
"public",
"void",
"disableAutoScale",
"(",
"String",
"poolId",
",",
"PoolDisableAutoScaleOptions",
"poolDisableAutoScaleOptions",
")",
"{",
"disableAutoScaleWithServiceResponseAsync",
"(",
"poolId",
",",
"poolDisableAutoScaleOptions",
")",
".",
"toBlocking",
"(",
")",
".",
... | Disables automatic scaling for a pool.
@param poolId The ID of the pool on which to disable automatic scaling.
@param poolDisableAutoScaleOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Disables",
"automatic",
"scaling",
"for",
"a",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L2158-L2160 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/KeyPointsCircleHexagonalGrid.java | KeyPointsCircleHexagonalGrid.addTangents | private boolean addTangents(Grid grid, int rowA, int colA, int rowB, int colB) {
EllipseRotated_F64 a = grid.get(rowA,colA);
EllipseRotated_F64 b = grid.get(rowB,colB);
if( a == null || b == null ) {
return false;
}
if( !tangentFinder.process(a,b, A0, A1, A2, A3, B0, B1, B2, B3) ) {
return false;
}
Tangents ta = tangents.get(grid.getIndexOfHexEllipse(rowA,colA));
Tangents tb = tangents.get(grid.getIndexOfHexEllipse(rowB,colB));
// add tangent points from the two lines which do not cross the center line
ta.grow().set(A0);
ta.grow().set(A3);
tb.grow().set(B0);
tb.grow().set(B3);
return true;
} | java | private boolean addTangents(Grid grid, int rowA, int colA, int rowB, int colB) {
EllipseRotated_F64 a = grid.get(rowA,colA);
EllipseRotated_F64 b = grid.get(rowB,colB);
if( a == null || b == null ) {
return false;
}
if( !tangentFinder.process(a,b, A0, A1, A2, A3, B0, B1, B2, B3) ) {
return false;
}
Tangents ta = tangents.get(grid.getIndexOfHexEllipse(rowA,colA));
Tangents tb = tangents.get(grid.getIndexOfHexEllipse(rowB,colB));
// add tangent points from the two lines which do not cross the center line
ta.grow().set(A0);
ta.grow().set(A3);
tb.grow().set(B0);
tb.grow().set(B3);
return true;
} | [
"private",
"boolean",
"addTangents",
"(",
"Grid",
"grid",
",",
"int",
"rowA",
",",
"int",
"colA",
",",
"int",
"rowB",
",",
"int",
"colB",
")",
"{",
"EllipseRotated_F64",
"a",
"=",
"grid",
".",
"get",
"(",
"rowA",
",",
"colA",
")",
";",
"EllipseRotated_... | Computes tangent points to the two ellipses specified by the grid coordinates | [
"Computes",
"tangent",
"points",
"to",
"the",
"two",
"ellipses",
"specified",
"by",
"the",
"grid",
"coordinates"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/KeyPointsCircleHexagonalGrid.java#L162-L183 |
alkacon/opencms-core | src-modules/org/opencms/workplace/commons/CmsChtype.java | CmsChtype.actionChtype | public void actionChtype() throws JspException {
int plainId;
try {
plainId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypePlain.getStaticTypeName()).getTypeId();
} catch (CmsLoaderException e) {
// this should really never happen
plainId = CmsResourceTypePlain.getStaticTypeId();
}
try {
int newType = plainId;
try {
// get new resource type id from request
newType = Integer.parseInt(getParamSelectedType());
} catch (NumberFormatException nf) {
throw new CmsException(Messages.get().container(Messages.ERR_GET_RESTYPE_1, getParamSelectedType()));
}
// check the resource lock state
checkLock(getParamResource());
// change the resource type
getCms().chtype(getParamResource(), newType);
// close the dialog window
actionCloseDialog();
} catch (Throwable e) {
// error changing resource type, show error dialog
includeErrorpage(this, e);
}
} | java | public void actionChtype() throws JspException {
int plainId;
try {
plainId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypePlain.getStaticTypeName()).getTypeId();
} catch (CmsLoaderException e) {
// this should really never happen
plainId = CmsResourceTypePlain.getStaticTypeId();
}
try {
int newType = plainId;
try {
// get new resource type id from request
newType = Integer.parseInt(getParamSelectedType());
} catch (NumberFormatException nf) {
throw new CmsException(Messages.get().container(Messages.ERR_GET_RESTYPE_1, getParamSelectedType()));
}
// check the resource lock state
checkLock(getParamResource());
// change the resource type
getCms().chtype(getParamResource(), newType);
// close the dialog window
actionCloseDialog();
} catch (Throwable e) {
// error changing resource type, show error dialog
includeErrorpage(this, e);
}
} | [
"public",
"void",
"actionChtype",
"(",
")",
"throws",
"JspException",
"{",
"int",
"plainId",
";",
"try",
"{",
"plainId",
"=",
"OpenCms",
".",
"getResourceManager",
"(",
")",
".",
"getResourceType",
"(",
"CmsResourceTypePlain",
".",
"getStaticTypeName",
"(",
")",... | Uploads the specified file and replaces the VFS file.<p>
@throws JspException if inclusion of error dialog fails | [
"Uploads",
"the",
"specified",
"file",
"and",
"replaces",
"the",
"VFS",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsChtype.java#L126-L154 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java | TypeConverter.convertToShort | public static short convertToShort (@Nullable final Object aSrcValue, final short nDefault)
{
final Short aValue = convert (aSrcValue, Short.class, null);
return aValue == null ? nDefault : aValue.shortValue ();
} | java | public static short convertToShort (@Nullable final Object aSrcValue, final short nDefault)
{
final Short aValue = convert (aSrcValue, Short.class, null);
return aValue == null ? nDefault : aValue.shortValue ();
} | [
"public",
"static",
"short",
"convertToShort",
"(",
"@",
"Nullable",
"final",
"Object",
"aSrcValue",
",",
"final",
"short",
"nDefault",
")",
"{",
"final",
"Short",
"aValue",
"=",
"convert",
"(",
"aSrcValue",
",",
"Short",
".",
"class",
",",
"null",
")",
";... | Convert the passed source value to short
@param aSrcValue
The source value. May be <code>null</code>.
@param nDefault
The default value to be returned if an error occurs during type
conversion.
@return The converted value.
@throws RuntimeException
If the converter itself throws an exception
@see TypeConverterProviderBestMatch | [
"Convert",
"the",
"passed",
"source",
"value",
"to",
"short"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L415-L419 |
alkacon/opencms-core | src/org/opencms/cache/CmsVfsDiskCache.java | CmsVfsDiskCache.saveFile | public static File saveFile(String rfsName, byte[] content) throws IOException {
File f = new File(rfsName);
File p = f.getParentFile();
if (!p.exists()) {
// create parent folders
p.mkdirs();
}
// write file contents
FileOutputStream fs = new FileOutputStream(f);
fs.write(content);
fs.close();
return f;
} | java | public static File saveFile(String rfsName, byte[] content) throws IOException {
File f = new File(rfsName);
File p = f.getParentFile();
if (!p.exists()) {
// create parent folders
p.mkdirs();
}
// write file contents
FileOutputStream fs = new FileOutputStream(f);
fs.write(content);
fs.close();
return f;
} | [
"public",
"static",
"File",
"saveFile",
"(",
"String",
"rfsName",
",",
"byte",
"[",
"]",
"content",
")",
"throws",
"IOException",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"rfsName",
")",
";",
"File",
"p",
"=",
"f",
".",
"getParentFile",
"(",
")",
"... | Saves the given file content to a RFS file of the given name (full path).<p>
If the required parent folders do not exists, they are also created.<p>
@param rfsName the RFS name of the file to save the content in
@param content the content of the file to save
@return a reference to the File that was saved
@throws IOException in case of disk access errors | [
"Saves",
"the",
"given",
"file",
"content",
"to",
"a",
"RFS",
"file",
"of",
"the",
"given",
"name",
"(",
"full",
"path",
")",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsVfsDiskCache.java#L72-L85 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VFS.java | VFS.mountZip | public static Closeable mountZip(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
return mountZip(zipFile.openStream(), zipFile.getName(), mountPoint, tempFileProvider);
} | java | public static Closeable mountZip(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException {
return mountZip(zipFile.openStream(), zipFile.getName(), mountPoint, tempFileProvider);
} | [
"public",
"static",
"Closeable",
"mountZip",
"(",
"VirtualFile",
"zipFile",
",",
"VirtualFile",
"mountPoint",
",",
"TempFileProvider",
"tempFileProvider",
")",
"throws",
"IOException",
"{",
"return",
"mountZip",
"(",
"zipFile",
".",
"openStream",
"(",
")",
",",
"z... | Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file
system when closed.
@param zipFile a zip file in the VFS
@param mountPoint the point at which the filesystem should be mounted
@param tempFileProvider the temporary file provider
@return a handle
@throws IOException if an error occurs | [
"Create",
"and",
"mount",
"a",
"zip",
"file",
"into",
"the",
"filesystem",
"returning",
"a",
"single",
"handle",
"which",
"will",
"unmount",
"and",
"close",
"the",
"file",
"system",
"when",
"closed",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L367-L369 |
alkacon/opencms-core | src/org/opencms/file/wrapper/CmsObjectWrapper.java | CmsObjectWrapper.copyResource | public void copyResource(String source, String destination, CmsResourceCopyMode siblingMode)
throws CmsException, CmsIllegalArgumentException {
boolean exec = false;
// iterate through all wrappers and call "copyResource" till one does not return null
List<I_CmsResourceWrapper> wrappers = getWrappers();
Iterator<I_CmsResourceWrapper> iter = wrappers.iterator();
while (iter.hasNext()) {
I_CmsResourceWrapper wrapper = iter.next();
exec = wrapper.copyResource(m_cms, source, destination, siblingMode);
if (exec) {
break;
}
}
// delegate the call to the CmsObject
if (!exec) {
m_cms.copyResource(source, destination, siblingMode);
}
} | java | public void copyResource(String source, String destination, CmsResourceCopyMode siblingMode)
throws CmsException, CmsIllegalArgumentException {
boolean exec = false;
// iterate through all wrappers and call "copyResource" till one does not return null
List<I_CmsResourceWrapper> wrappers = getWrappers();
Iterator<I_CmsResourceWrapper> iter = wrappers.iterator();
while (iter.hasNext()) {
I_CmsResourceWrapper wrapper = iter.next();
exec = wrapper.copyResource(m_cms, source, destination, siblingMode);
if (exec) {
break;
}
}
// delegate the call to the CmsObject
if (!exec) {
m_cms.copyResource(source, destination, siblingMode);
}
} | [
"public",
"void",
"copyResource",
"(",
"String",
"source",
",",
"String",
"destination",
",",
"CmsResourceCopyMode",
"siblingMode",
")",
"throws",
"CmsException",
",",
"CmsIllegalArgumentException",
"{",
"boolean",
"exec",
"=",
"false",
";",
"// iterate through all wrap... | Copies a resource.<p>
Iterates through all configured resource wrappers till the first returns <code>true</code>.<p>
@see I_CmsResourceWrapper#copyResource(CmsObject, String, String, CmsResource.CmsResourceCopyMode)
@see CmsObject#copyResource(String, String, CmsResource.CmsResourceCopyMode)
@param source the name of the resource to copy (full path)
@param destination the name of the copy destination (full path)
@param siblingMode indicates how to handle siblings during copy
@throws CmsException if something goes wrong
@throws CmsIllegalArgumentException if the <code>destination</code> argument is null or of length 0 | [
"Copies",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/CmsObjectWrapper.java#L125-L146 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_ssl_GET | public ArrayList<Long> serviceName_ssl_GET(String serviceName, String fingerprint, String serial, OvhSslTypeEnum type) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/ssl";
StringBuilder sb = path(qPath, serviceName);
query(sb, "fingerprint", fingerprint);
query(sb, "serial", serial);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> serviceName_ssl_GET(String serviceName, String fingerprint, String serial, OvhSslTypeEnum type) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/ssl";
StringBuilder sb = path(qPath, serviceName);
query(sb, "fingerprint", fingerprint);
query(sb, "serial", serial);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_ssl_GET",
"(",
"String",
"serviceName",
",",
"String",
"fingerprint",
",",
"String",
"serial",
",",
"OvhSslTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{servic... | Ssl for this iplb
REST: GET /ipLoadbalancing/{serviceName}/ssl
@param type [required] Filter the value of type property (=)
@param serial [required] Filter the value of serial property (like)
@param fingerprint [required] Filter the value of fingerprint property (like)
@param serviceName [required] The internal name of your IP load balancing | [
"Ssl",
"for",
"this",
"iplb"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1914-L1922 |
alkacon/opencms-core | src/org/opencms/main/OpenCmsServlet.java | OpenCmsServlet.tryCustomErrorPage | private boolean tryCustomErrorPage(CmsObject cms, HttpServletRequest req, HttpServletResponse res, int errorCode) {
String siteRoot = OpenCms.getSiteManager().matchRequest(req).getSiteRoot();
CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot);
if (site != null) {
// store current site root and URI
String currentSiteRoot = cms.getRequestContext().getSiteRoot();
String currentUri = cms.getRequestContext().getUri();
try {
if (site.getErrorPage() != null) {
String rootPath = site.getErrorPage();
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
}
String rootPath = CmsStringUtil.joinPaths(siteRoot, "/.errorpages/handle" + errorCode + ".html");
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
} finally {
cms.getRequestContext().setSiteRoot(currentSiteRoot);
cms.getRequestContext().setUri(currentUri);
}
}
return false;
} | java | private boolean tryCustomErrorPage(CmsObject cms, HttpServletRequest req, HttpServletResponse res, int errorCode) {
String siteRoot = OpenCms.getSiteManager().matchRequest(req).getSiteRoot();
CmsSite site = OpenCms.getSiteManager().getSiteForSiteRoot(siteRoot);
if (site != null) {
// store current site root and URI
String currentSiteRoot = cms.getRequestContext().getSiteRoot();
String currentUri = cms.getRequestContext().getUri();
try {
if (site.getErrorPage() != null) {
String rootPath = site.getErrorPage();
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
}
String rootPath = CmsStringUtil.joinPaths(siteRoot, "/.errorpages/handle" + errorCode + ".html");
if (loadCustomErrorPage(cms, req, res, rootPath)) {
return true;
}
} finally {
cms.getRequestContext().setSiteRoot(currentSiteRoot);
cms.getRequestContext().setUri(currentUri);
}
}
return false;
} | [
"private",
"boolean",
"tryCustomErrorPage",
"(",
"CmsObject",
"cms",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"int",
"errorCode",
")",
"{",
"String",
"siteRoot",
"=",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"matchRequest",... | Tries to load a site specific error page. If
@param cms {@link CmsObject} used for reading the resource (site root and uri get adjusted!)
@param req the current request
@param res the current response
@param errorCode the error code to display
@return a flag, indicating if the custom error page could be loaded. | [
"Tries",
"to",
"load",
"a",
"site",
"specific",
"error",
"page",
".",
"If"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsServlet.java#L398-L423 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LOF.java | LOF.computeLOFScores | private void computeLOFScores(KNNQuery<O> knnq, DBIDs ids, DoubleDataStore lrds, WritableDoubleDataStore lofs, DoubleMinMax lofminmax) {
FiniteProgress progressLOFs = LOG.isVerbose() ? new FiniteProgress("Local Outlier Factor (LOF) scores", ids.size(), LOG) : null;
double lof;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
lof = computeLOFScore(knnq, iter, lrds);
lofs.putDouble(iter, lof);
// update minimum and maximum
lofminmax.put(lof);
LOG.incrementProcessed(progressLOFs);
}
LOG.ensureCompleted(progressLOFs);
} | java | private void computeLOFScores(KNNQuery<O> knnq, DBIDs ids, DoubleDataStore lrds, WritableDoubleDataStore lofs, DoubleMinMax lofminmax) {
FiniteProgress progressLOFs = LOG.isVerbose() ? new FiniteProgress("Local Outlier Factor (LOF) scores", ids.size(), LOG) : null;
double lof;
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
lof = computeLOFScore(knnq, iter, lrds);
lofs.putDouble(iter, lof);
// update minimum and maximum
lofminmax.put(lof);
LOG.incrementProcessed(progressLOFs);
}
LOG.ensureCompleted(progressLOFs);
} | [
"private",
"void",
"computeLOFScores",
"(",
"KNNQuery",
"<",
"O",
">",
"knnq",
",",
"DBIDs",
"ids",
",",
"DoubleDataStore",
"lrds",
",",
"WritableDoubleDataStore",
"lofs",
",",
"DoubleMinMax",
"lofminmax",
")",
"{",
"FiniteProgress",
"progressLOFs",
"=",
"LOG",
... | Compute local outlier factors.
@param knnq KNN query
@param ids IDs to process
@param lrds Local reachability distances
@param lofs Local outlier factor storage
@param lofminmax Score minimum/maximum tracker | [
"Compute",
"local",
"outlier",
"factors",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LOF.java#L202-L213 |
apollographql/apollo-android | apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java | ResponseField.forList | public static ResponseField forList(String responseName, String fieldName, Map<String, Object> arguments,
boolean optional, List<Condition> conditions) {
return new ResponseField(Type.LIST, responseName, fieldName, arguments, optional, conditions);
} | java | public static ResponseField forList(String responseName, String fieldName, Map<String, Object> arguments,
boolean optional, List<Condition> conditions) {
return new ResponseField(Type.LIST, responseName, fieldName, arguments, optional, conditions);
} | [
"public",
"static",
"ResponseField",
"forList",
"(",
"String",
"responseName",
",",
"String",
"fieldName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"arguments",
",",
"boolean",
"optional",
",",
"List",
"<",
"Condition",
">",
"conditions",
")",
"{",
"re... | Factory method for creating a Field instance representing {@link Type#LIST}.
@param responseName alias for the result of a field
@param fieldName name of the field in the GraphQL operation
@param arguments arguments to be passed along with the field
@param optional whether the arguments passed along are optional or required
@param conditions list of conditions for this field
@return Field instance representing {@link Type#LIST} | [
"Factory",
"method",
"for",
"creating",
"a",
"Field",
"instance",
"representing",
"{",
"@link",
"Type#LIST",
"}",
"."
] | train | https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java#L145-L148 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.getImagePerformanceCountAsync | public Observable<Integer> getImagePerformanceCountAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) {
return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, getImagePerformanceCountOptionalParameter).map(new Func1<ServiceResponse<Integer>, Integer>() {
@Override
public Integer call(ServiceResponse<Integer> response) {
return response.body();
}
});
} | java | public Observable<Integer> getImagePerformanceCountAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) {
return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, getImagePerformanceCountOptionalParameter).map(new Func1<ServiceResponse<Integer>, Integer>() {
@Override
public Integer call(ServiceResponse<Integer> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Integer",
">",
"getImagePerformanceCountAsync",
"(",
"UUID",
"projectId",
",",
"UUID",
"iterationId",
",",
"GetImagePerformanceCountOptionalParameter",
"getImagePerformanceCountOptionalParameter",
")",
"{",
"return",
"getImagePerformanceCountWithServ... | Gets the number of images tagged with the provided {tagIds} that have prediction results from
training for the provided iteration {iterationId}.
The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and
"Cat" tags, then only images tagged with Dog and/or Cat will be returned.
@param projectId The project id
@param iterationId The iteration id. Defaults to workspace
@param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Integer object | [
"Gets",
"the",
"number",
"of",
"images",
"tagged",
"with",
"the",
"provided",
"{",
"tagIds",
"}",
"that",
"have",
"prediction",
"results",
"from",
"training",
"for",
"the",
"provided",
"iteration",
"{",
"iterationId",
"}",
".",
"The",
"filtering",
"is",
"on"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1250-L1257 |
osmdroid/osmdroid | osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java | SphericalUtil.computeOffsetOrigin | public static IGeoPoint computeOffsetOrigin(IGeoPoint to, double distance, double heading) {
heading = toRadians(heading);
distance /= EARTH_RADIUS;
// http://lists.maptools.org/pipermail/proj/2008-October/003939.html
double n1 = cos(distance);
double n2 = sin(distance) * cos(heading);
double n3 = sin(distance) * sin(heading);
double n4 = sin(toRadians(to.getLatitude()));
// There are two solutions for b. b = n2 * n4 +/- sqrt(), one solution results
// in the latitude outside the [-90, 90] range. We first try one solution and
// back off to the other if we are outside that range.
double n12 = n1 * n1;
double discriminant = n2 * n2 * n12 + n12 * n12 - n12 * n4 * n4;
if (discriminant < 0) {
// No real solution which would make sense in IGeoPoint-space.
return null;
}
double b = n2 * n4 + sqrt(discriminant);
b /= n1 * n1 + n2 * n2;
double a = (n4 - n2 * b) / n1;
double fromLatRadians = atan2(a, b);
if (fromLatRadians < -PI / 2 || fromLatRadians > PI / 2) {
b = n2 * n4 - sqrt(discriminant);
b /= n1 * n1 + n2 * n2;
fromLatRadians = atan2(a, b);
}
if (fromLatRadians < -PI / 2 || fromLatRadians > PI / 2) {
// No solution which would make sense in IGeoPoint-space.
return null;
}
double fromLngRadians = toRadians(to.getLongitude()) -
atan2(n3, n1 * cos(fromLatRadians) - n2 * sin(fromLatRadians));
return new GeoPoint(toDegrees(fromLatRadians), toDegrees(fromLngRadians));
} | java | public static IGeoPoint computeOffsetOrigin(IGeoPoint to, double distance, double heading) {
heading = toRadians(heading);
distance /= EARTH_RADIUS;
// http://lists.maptools.org/pipermail/proj/2008-October/003939.html
double n1 = cos(distance);
double n2 = sin(distance) * cos(heading);
double n3 = sin(distance) * sin(heading);
double n4 = sin(toRadians(to.getLatitude()));
// There are two solutions for b. b = n2 * n4 +/- sqrt(), one solution results
// in the latitude outside the [-90, 90] range. We first try one solution and
// back off to the other if we are outside that range.
double n12 = n1 * n1;
double discriminant = n2 * n2 * n12 + n12 * n12 - n12 * n4 * n4;
if (discriminant < 0) {
// No real solution which would make sense in IGeoPoint-space.
return null;
}
double b = n2 * n4 + sqrt(discriminant);
b /= n1 * n1 + n2 * n2;
double a = (n4 - n2 * b) / n1;
double fromLatRadians = atan2(a, b);
if (fromLatRadians < -PI / 2 || fromLatRadians > PI / 2) {
b = n2 * n4 - sqrt(discriminant);
b /= n1 * n1 + n2 * n2;
fromLatRadians = atan2(a, b);
}
if (fromLatRadians < -PI / 2 || fromLatRadians > PI / 2) {
// No solution which would make sense in IGeoPoint-space.
return null;
}
double fromLngRadians = toRadians(to.getLongitude()) -
atan2(n3, n1 * cos(fromLatRadians) - n2 * sin(fromLatRadians));
return new GeoPoint(toDegrees(fromLatRadians), toDegrees(fromLngRadians));
} | [
"public",
"static",
"IGeoPoint",
"computeOffsetOrigin",
"(",
"IGeoPoint",
"to",
",",
"double",
"distance",
",",
"double",
"heading",
")",
"{",
"heading",
"=",
"toRadians",
"(",
"heading",
")",
";",
"distance",
"/=",
"EARTH_RADIUS",
";",
"// http://lists.maptools.o... | Returns the location of origin when provided with a IGeoPoint destination,
meters travelled and original heading. Headings are expressed in degrees
clockwise from North. This function returns null when no solution is
available.
@param to The destination IGeoPoint.
@param distance The distance travelled, in meters.
@param heading The heading in degrees clockwise from north. | [
"Returns",
"the",
"location",
"of",
"origin",
"when",
"provided",
"with",
"a",
"IGeoPoint",
"destination",
"meters",
"travelled",
"and",
"original",
"heading",
".",
"Headings",
"are",
"expressed",
"in",
"degrees",
"clockwise",
"from",
"North",
".",
"This",
"func... | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java#L182-L215 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java | StreamingLocatorsInner.getAsync | public Observable<StreamingLocatorInner> getAsync(String resourceGroupName, String accountName, String streamingLocatorName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).map(new Func1<ServiceResponse<StreamingLocatorInner>, StreamingLocatorInner>() {
@Override
public StreamingLocatorInner call(ServiceResponse<StreamingLocatorInner> response) {
return response.body();
}
});
} | java | public Observable<StreamingLocatorInner> getAsync(String resourceGroupName, String accountName, String streamingLocatorName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, streamingLocatorName).map(new Func1<ServiceResponse<StreamingLocatorInner>, StreamingLocatorInner>() {
@Override
public StreamingLocatorInner call(ServiceResponse<StreamingLocatorInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StreamingLocatorInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"streamingLocatorName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",... | Get a Streaming Locator.
Get the details of a Streaming Locator in the Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param streamingLocatorName The Streaming Locator name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StreamingLocatorInner object | [
"Get",
"a",
"Streaming",
"Locator",
".",
"Get",
"the",
"details",
"of",
"a",
"Streaming",
"Locator",
"in",
"the",
"Media",
"Services",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java#L403-L410 |
soulwarelabs/jCommons-API | src/main/java/com/soulwarelabs/jcommons/data/Version.java | Version.setNumber | public Version setNumber(int index, int number, String label) {
validateNumber(number);
if (isBeyondBounds(index)) {
String message = String.format("illegal number index: %d", index);
throw new IllegalArgumentException(message);
}
labels.set(--index, label);
numbers.set(index, number);
return this;
} | java | public Version setNumber(int index, int number, String label) {
validateNumber(number);
if (isBeyondBounds(index)) {
String message = String.format("illegal number index: %d", index);
throw new IllegalArgumentException(message);
}
labels.set(--index, label);
numbers.set(index, number);
return this;
} | [
"public",
"Version",
"setNumber",
"(",
"int",
"index",
",",
"int",
"number",
",",
"String",
"label",
")",
"{",
"validateNumber",
"(",
"number",
")",
";",
"if",
"(",
"isBeyondBounds",
"(",
"index",
")",
")",
"{",
"String",
"message",
"=",
"String",
".",
... | Sets a new version number.
@param index available version number index.
@param number version number (not negative).
@param label version number label (optional).
@return version descriptor.
@throws IllegalArgumentException if either index or number are illegal.
@since v1.1.0 | [
"Sets",
"a",
"new",
"version",
"number",
"."
] | train | https://github.com/soulwarelabs/jCommons-API/blob/57795ae28aea144e68502149506ec99dd67f0c67/src/main/java/com/soulwarelabs/jcommons/data/Version.java#L597-L606 |
citrusframework/citrus | modules/citrus-mail/src/main/java/com/consol/citrus/mail/server/MailServer.java | MailServer.createMailMessage | protected MailMessage createMailMessage(Map<String, Object> messageHeaders, String body, String contentType) {
return MailMessage.request(messageHeaders)
.marshaller(marshaller)
.from(messageHeaders.get(CitrusMailMessageHeaders.MAIL_FROM).toString())
.to(messageHeaders.get(CitrusMailMessageHeaders.MAIL_TO).toString())
.cc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_CC).toString())
.bcc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_BCC).toString())
.subject(messageHeaders.get(CitrusMailMessageHeaders.MAIL_SUBJECT).toString())
.body(body, contentType);
} | java | protected MailMessage createMailMessage(Map<String, Object> messageHeaders, String body, String contentType) {
return MailMessage.request(messageHeaders)
.marshaller(marshaller)
.from(messageHeaders.get(CitrusMailMessageHeaders.MAIL_FROM).toString())
.to(messageHeaders.get(CitrusMailMessageHeaders.MAIL_TO).toString())
.cc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_CC).toString())
.bcc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_BCC).toString())
.subject(messageHeaders.get(CitrusMailMessageHeaders.MAIL_SUBJECT).toString())
.body(body, contentType);
} | [
"protected",
"MailMessage",
"createMailMessage",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"messageHeaders",
",",
"String",
"body",
",",
"String",
"contentType",
")",
"{",
"return",
"MailMessage",
".",
"request",
"(",
"messageHeaders",
")",
".",
"marshaller... | Creates a new mail message model object from message headers.
@param messageHeaders
@param body
@param contentType
@return | [
"Creates",
"a",
"new",
"mail",
"message",
"model",
"object",
"from",
"message",
"headers",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-mail/src/main/java/com/consol/citrus/mail/server/MailServer.java#L199-L208 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/MapListenerAdaptors.java | MapListenerAdaptors.createListenerAdapter | private static ListenerAdapter createListenerAdapter(EntryEventType eventType, MapListener mapListener) {
final ConstructorFunction<MapListener, ListenerAdapter> constructorFunction = CONSTRUCTORS.get(eventType);
if (constructorFunction == null) {
throw new IllegalArgumentException("First, define a ListenerAdapter for the event EntryEventType." + eventType);
}
return constructorFunction.createNew(mapListener);
} | java | private static ListenerAdapter createListenerAdapter(EntryEventType eventType, MapListener mapListener) {
final ConstructorFunction<MapListener, ListenerAdapter> constructorFunction = CONSTRUCTORS.get(eventType);
if (constructorFunction == null) {
throw new IllegalArgumentException("First, define a ListenerAdapter for the event EntryEventType." + eventType);
}
return constructorFunction.createNew(mapListener);
} | [
"private",
"static",
"ListenerAdapter",
"createListenerAdapter",
"(",
"EntryEventType",
"eventType",
",",
"MapListener",
"mapListener",
")",
"{",
"final",
"ConstructorFunction",
"<",
"MapListener",
",",
"ListenerAdapter",
">",
"constructorFunction",
"=",
"CONSTRUCTORS",
"... | Creates a {@link ListenerAdapter} for a specific {@link com.hazelcast.core.EntryEventType}.
@param eventType an {@link com.hazelcast.core.EntryEventType}.
@param mapListener a {@link com.hazelcast.map.listener.MapListener} instance.
@return {@link com.hazelcast.map.impl.ListenerAdapter} for a specific {@link com.hazelcast.core.EntryEventType} | [
"Creates",
"a",
"{",
"@link",
"ListenerAdapter",
"}",
"for",
"a",
"specific",
"{",
"@link",
"com",
".",
"hazelcast",
".",
"core",
".",
"EntryEventType",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapListenerAdaptors.java#L222-L228 |
landawn/AbacusUtil | src/com/landawn/abacus/util/ClassUtil.java | ClassUtil.setPropValue | public static void setPropValue(final Object entity, final Method propSetMethod, Object propValue) {
try {
propSetMethod.invoke(entity, propValue == null ? N.defaultValueOf(propSetMethod.getParameterTypes()[0]) : propValue);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
propValue = N.convert(propValue, ParserUtil.getEntityInfo(entity.getClass()).getPropInfo(propSetMethod.getName()).type);
try {
propSetMethod.invoke(entity, propValue);
} catch (IllegalAccessException | InvocationTargetException e2) {
throw N.toRuntimeException(e);
}
}
} | java | public static void setPropValue(final Object entity, final Method propSetMethod, Object propValue) {
try {
propSetMethod.invoke(entity, propValue == null ? N.defaultValueOf(propSetMethod.getParameterTypes()[0]) : propValue);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
propValue = N.convert(propValue, ParserUtil.getEntityInfo(entity.getClass()).getPropInfo(propSetMethod.getName()).type);
try {
propSetMethod.invoke(entity, propValue);
} catch (IllegalAccessException | InvocationTargetException e2) {
throw N.toRuntimeException(e);
}
}
} | [
"public",
"static",
"void",
"setPropValue",
"(",
"final",
"Object",
"entity",
",",
"final",
"Method",
"propSetMethod",
",",
"Object",
"propValue",
")",
"{",
"try",
"{",
"propSetMethod",
".",
"invoke",
"(",
"entity",
",",
"propValue",
"==",
"null",
"?",
"N",
... | Set the specified {@code propValue} to {@code entity} by the specified
method {@code propSetMethod}. This method will try to convert
{@code propValue} to appropriate type and set again if fails to set in
the first time. The final value which is set to the property will be
returned if property is set successfully finally. it could be the input
{@code propValue} or converted property value, otherwise, exception will
be threw if the property value is set unsuccessfully.
@param entity
MapEntity is not supported
@param propSetMethod
@param propValue | [
"Set",
"the",
"specified",
"{",
"@code",
"propValue",
"}",
"to",
"{",
"@code",
"entity",
"}",
"by",
"the",
"specified",
"method",
"{",
"@code",
"propSetMethod",
"}",
".",
"This",
"method",
"will",
"try",
"to",
"convert",
"{",
"@code",
"propValue",
"}",
"... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ClassUtil.java#L1787-L1799 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java | SftpClient.mkdirs | public void mkdirs(String dir) throws SftpStatusException, SshException {
StringTokenizer tokens = new StringTokenizer(dir, "/");
String path = dir.startsWith("/") ? "/" : "";
while (tokens.hasMoreElements()) {
path += (String) tokens.nextElement();
try {
stat(path);
} catch (SftpStatusException ex) {
try {
mkdir(path);
} catch (SftpStatusException ex2) {
if (ex2.getStatus() == SftpStatusException.SSH_FX_PERMISSION_DENIED)
throw ex2;
}
}
path += "/";
}
} | java | public void mkdirs(String dir) throws SftpStatusException, SshException {
StringTokenizer tokens = new StringTokenizer(dir, "/");
String path = dir.startsWith("/") ? "/" : "";
while (tokens.hasMoreElements()) {
path += (String) tokens.nextElement();
try {
stat(path);
} catch (SftpStatusException ex) {
try {
mkdir(path);
} catch (SftpStatusException ex2) {
if (ex2.getStatus() == SftpStatusException.SSH_FX_PERMISSION_DENIED)
throw ex2;
}
}
path += "/";
}
} | [
"public",
"void",
"mkdirs",
"(",
"String",
"dir",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"StringTokenizer",
"tokens",
"=",
"new",
"StringTokenizer",
"(",
"dir",
",",
"\"/\"",
")",
";",
"String",
"path",
"=",
"dir",
".",
"startsWith",
... | <p>
Create a directory or set of directories. This method will not fail even
if the directories exist. It is advisable to test whether the directory
exists before attempting an operation by using <a
href="#stat(java.lang.String)">stat</a> to return the directories
attributes.
</p>
@param dir
the path of directories to create. | [
"<p",
">",
"Create",
"a",
"directory",
"or",
"set",
"of",
"directories",
".",
"This",
"method",
"will",
"not",
"fail",
"even",
"if",
"the",
"directories",
"exist",
".",
"It",
"is",
"advisable",
"to",
"test",
"whether",
"the",
"directory",
"exists",
"before... | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L630-L650 |
tianjing/tgtools.web.develop | src/main/java/tgtools/web/develop/service/AbstractCommonService.java | AbstractCommonService.listPage | @Override
public GridMessage listPage(int pPageIndex, int pPageSize) {
GridMessage data = new GridMessage();
data.setData(invokePage(pPageIndex, pPageSize));
data.setTotal(mDao.selectCount(null));
return data;
} | java | @Override
public GridMessage listPage(int pPageIndex, int pPageSize) {
GridMessage data = new GridMessage();
data.setData(invokePage(pPageIndex, pPageSize));
data.setTotal(mDao.selectCount(null));
return data;
} | [
"@",
"Override",
"public",
"GridMessage",
"listPage",
"(",
"int",
"pPageIndex",
",",
"int",
"pPageSize",
")",
"{",
"GridMessage",
"data",
"=",
"new",
"GridMessage",
"(",
")",
";",
"data",
".",
"setData",
"(",
"invokePage",
"(",
"pPageIndex",
",",
"pPageSize"... | 获取分页的表格数据
@param pPageIndex 页码 从1开始
@param pPageSize 页大小
@return | [
"获取分页的表格数据"
] | train | https://github.com/tianjing/tgtools.web.develop/blob/a18567f3ccf877249f2e33028d1e7c479900e4eb/src/main/java/tgtools/web/develop/service/AbstractCommonService.java#L69-L75 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/QueryContext.java | QueryContext.with | public QueryContext with( Map<String, Object> variables ) {
return new QueryContext(context, repositoryCache, workspaceNames, overriddenNodeCachesByWorkspaceName, schemata,
indexDefns, nodeTypes, bufferManager, hints, problems, variables);
} | java | public QueryContext with( Map<String, Object> variables ) {
return new QueryContext(context, repositoryCache, workspaceNames, overriddenNodeCachesByWorkspaceName, schemata,
indexDefns, nodeTypes, bufferManager, hints, problems, variables);
} | [
"public",
"QueryContext",
"with",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"variables",
")",
"{",
"return",
"new",
"QueryContext",
"(",
"context",
",",
"repositoryCache",
",",
"workspaceNames",
",",
"overriddenNodeCachesByWorkspaceName",
",",
"schemata",
","... | Obtain a copy of this context, except that the copy uses the supplied variables.
@param variables the variables that should be used in the new context; may be null if there are no such variables
@return the new context; never null | [
"Obtain",
"a",
"copy",
"of",
"this",
"context",
"except",
"that",
"the",
"copy",
"uses",
"the",
"supplied",
"variables",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/QueryContext.java#L434-L437 |
cdk/cdk | descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java | XLogPDescriptor.getPiSystemsCount | private int getPiSystemsCount(IAtomContainer ac, IAtom atom) {
List neighbours = ac.getConnectedAtomsList(atom);
int picounter = 0;
List bonds = null;
for (int i = 0; i < neighbours.size(); i++) {
IAtom neighbour = (IAtom) neighbours.get(i);
bonds = ac.getConnectedBondsList(neighbour);
for (int j = 0; j < bonds.size(); j++) {
IBond bond = (IBond) bonds.get(j);
if (bond.getOrder() != IBond.Order.SINGLE && !bond.getOther(neighbour).equals(atom)
&& !neighbour.getSymbol().equals("P") && !neighbour.getSymbol().equals("S")) {
picounter += 1;
}/*
* else if (bonds[j].getOther(neighbours[i])!=atom &&
* !neighbours[i].getSymbol().equals("P") &&
* !neighbours[i].getSymbol().equals("S") &&
* bonds[j].getOther
* (neighbours[i]).getFlag(CDKConstants.ISAROMATIC)){ picounter
* += 1; }
*/
}
}
return picounter;
} | java | private int getPiSystemsCount(IAtomContainer ac, IAtom atom) {
List neighbours = ac.getConnectedAtomsList(atom);
int picounter = 0;
List bonds = null;
for (int i = 0; i < neighbours.size(); i++) {
IAtom neighbour = (IAtom) neighbours.get(i);
bonds = ac.getConnectedBondsList(neighbour);
for (int j = 0; j < bonds.size(); j++) {
IBond bond = (IBond) bonds.get(j);
if (bond.getOrder() != IBond.Order.SINGLE && !bond.getOther(neighbour).equals(atom)
&& !neighbour.getSymbol().equals("P") && !neighbour.getSymbol().equals("S")) {
picounter += 1;
}/*
* else if (bonds[j].getOther(neighbours[i])!=atom &&
* !neighbours[i].getSymbol().equals("P") &&
* !neighbours[i].getSymbol().equals("S") &&
* bonds[j].getOther
* (neighbours[i]).getFlag(CDKConstants.ISAROMATIC)){ picounter
* += 1; }
*/
}
}
return picounter;
} | [
"private",
"int",
"getPiSystemsCount",
"(",
"IAtomContainer",
"ac",
",",
"IAtom",
"atom",
")",
"{",
"List",
"neighbours",
"=",
"ac",
".",
"getConnectedAtomsList",
"(",
"atom",
")",
";",
"int",
"picounter",
"=",
"0",
";",
"List",
"bonds",
"=",
"null",
";",
... | Gets the piSystemsCount attribute of the XLogPDescriptor object.
@param ac Description of the Parameter
@param atom Description of the Parameter
@return The piSystemsCount value | [
"Gets",
"the",
"piSystemsCount",
"attribute",
"of",
"the",
"XLogPDescriptor",
"object",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1255-L1278 |
betfair/cougar | cougar-framework/socket-transport/src/main/java/com/betfair/cougar/transport/socket/PooledServerConnectedObjectManager.java | PooledServerConnectedObjectManager.terminateSubscriptions | private void terminateSubscriptions(IoSession session, String heapUri, Subscription.CloseReason reason) {
terminateSubscriptions(session, heapStates.get(heapUri), heapUri, reason);
} | java | private void terminateSubscriptions(IoSession session, String heapUri, Subscription.CloseReason reason) {
terminateSubscriptions(session, heapStates.get(heapUri), heapUri, reason);
} | [
"private",
"void",
"terminateSubscriptions",
"(",
"IoSession",
"session",
",",
"String",
"heapUri",
",",
"Subscription",
".",
"CloseReason",
"reason",
")",
"{",
"terminateSubscriptions",
"(",
"session",
",",
"heapStates",
".",
"get",
"(",
"heapUri",
")",
",",
"h... | Terminates all subscriptions to a given heap from a single session | [
"Terminates",
"all",
"subscriptions",
"to",
"a",
"given",
"heap",
"from",
"a",
"single",
"session"
] | train | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/socket-transport/src/main/java/com/betfair/cougar/transport/socket/PooledServerConnectedObjectManager.java#L412-L414 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/TokenCachingStrategy.java | TokenCachingStrategy.putLastRefreshMilliseconds | public static void putLastRefreshMilliseconds(Bundle bundle, long value) {
Validate.notNull(bundle, "bundle");
bundle.putLong(LAST_REFRESH_DATE_KEY, value);
} | java | public static void putLastRefreshMilliseconds(Bundle bundle, long value) {
Validate.notNull(bundle, "bundle");
bundle.putLong(LAST_REFRESH_DATE_KEY, value);
} | [
"public",
"static",
"void",
"putLastRefreshMilliseconds",
"(",
"Bundle",
"bundle",
",",
"long",
"value",
")",
"{",
"Validate",
".",
"notNull",
"(",
"bundle",
",",
"\"bundle\"",
")",
";",
"bundle",
".",
"putLong",
"(",
"LAST_REFRESH_DATE_KEY",
",",
"value",
")"... | Puts the last refresh date into a Bundle.
@param bundle
A Bundle in which the last refresh date should be stored.
@param value
The long representing the last refresh date in milliseconds
since the epoch.
@throws NullPointerException if the passed in Bundle is null | [
"Puts",
"the",
"last",
"refresh",
"date",
"into",
"a",
"Bundle",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/TokenCachingStrategy.java#L388-L391 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java | DataStream.keyBy | public KeyedStream<T, Tuple> keyBy(int... fields) {
if (getType() instanceof BasicArrayTypeInfo || getType() instanceof PrimitiveArrayTypeInfo) {
return keyBy(KeySelectorUtil.getSelectorForArray(fields, getType()));
} else {
return keyBy(new Keys.ExpressionKeys<>(fields, getType()));
}
} | java | public KeyedStream<T, Tuple> keyBy(int... fields) {
if (getType() instanceof BasicArrayTypeInfo || getType() instanceof PrimitiveArrayTypeInfo) {
return keyBy(KeySelectorUtil.getSelectorForArray(fields, getType()));
} else {
return keyBy(new Keys.ExpressionKeys<>(fields, getType()));
}
} | [
"public",
"KeyedStream",
"<",
"T",
",",
"Tuple",
">",
"keyBy",
"(",
"int",
"...",
"fields",
")",
"{",
"if",
"(",
"getType",
"(",
")",
"instanceof",
"BasicArrayTypeInfo",
"||",
"getType",
"(",
")",
"instanceof",
"PrimitiveArrayTypeInfo",
")",
"{",
"return",
... | Partitions the operator state of a {@link DataStream} by the given key positions.
@param fields
The position of the fields on which the {@link DataStream}
will be grouped.
@return The {@link DataStream} with partitioned state (i.e. KeyedStream) | [
"Partitions",
"the",
"operator",
"state",
"of",
"a",
"{",
"@link",
"DataStream",
"}",
"by",
"the",
"given",
"key",
"positions",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L317-L323 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java | SVGPath.relativeSmoothCubicTo | public SVGPath relativeSmoothCubicTo(double c2x, double c2y, double x, double y) {
return append(PATH_SMOOTH_CUBIC_TO_RELATIVE).append(c2x).append(c2y).append(x).append(y);
} | java | public SVGPath relativeSmoothCubicTo(double c2x, double c2y, double x, double y) {
return append(PATH_SMOOTH_CUBIC_TO_RELATIVE).append(c2x).append(c2y).append(x).append(y);
} | [
"public",
"SVGPath",
"relativeSmoothCubicTo",
"(",
"double",
"c2x",
",",
"double",
"c2y",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"append",
"(",
"PATH_SMOOTH_CUBIC_TO_RELATIVE",
")",
".",
"append",
"(",
"c2x",
")",
".",
"append",
"(",
"... | Smooth Cubic Bezier line to the given relative coordinates.
@param c2x second control point x
@param c2y second control point y
@param x new coordinates
@param y new coordinates
@return path object, for compact syntax. | [
"Smooth",
"Cubic",
"Bezier",
"line",
"to",
"the",
"given",
"relative",
"coordinates",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L433-L435 |
google/closure-compiler | src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java | JsDocInfoParser.parseTopLevelTypeExpression | private Node parseTopLevelTypeExpression(JsDocToken token) {
Node typeExpr = parseTypeExpression(token);
if (typeExpr != null) {
// top-level unions are allowed
if (match(JsDocToken.PIPE)) {
next();
skipEOLs();
token = next();
return parseUnionTypeWithAlternate(token, typeExpr);
}
}
return typeExpr;
} | java | private Node parseTopLevelTypeExpression(JsDocToken token) {
Node typeExpr = parseTypeExpression(token);
if (typeExpr != null) {
// top-level unions are allowed
if (match(JsDocToken.PIPE)) {
next();
skipEOLs();
token = next();
return parseUnionTypeWithAlternate(token, typeExpr);
}
}
return typeExpr;
} | [
"private",
"Node",
"parseTopLevelTypeExpression",
"(",
"JsDocToken",
"token",
")",
"{",
"Node",
"typeExpr",
"=",
"parseTypeExpression",
"(",
"token",
")",
";",
"if",
"(",
"typeExpr",
"!=",
"null",
")",
"{",
"// top-level unions are allowed",
"if",
"(",
"match",
... | TopLevelTypeExpression := TypeExpression
| TypeUnionList
We made this rule up, for the sake of backwards compatibility. | [
"TopLevelTypeExpression",
":",
"=",
"TypeExpression",
"|",
"TypeUnionList"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java#L2049-L2061 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java | IQ.createErrorResponse | public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Builder error) {
if (!request.isRequestIQ()) {
throw new IllegalArgumentException(
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
}
final ErrorIQ result = new ErrorIQ(error);
result.setStanzaId(request.getStanzaId());
result.setFrom(request.getTo());
result.setTo(request.getFrom());
error.setStanza(result);
return result;
} | java | public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Builder error) {
if (!request.isRequestIQ()) {
throw new IllegalArgumentException(
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
}
final ErrorIQ result = new ErrorIQ(error);
result.setStanzaId(request.getStanzaId());
result.setFrom(request.getTo());
result.setTo(request.getFrom());
error.setStanza(result);
return result;
} | [
"public",
"static",
"ErrorIQ",
"createErrorResponse",
"(",
"final",
"IQ",
"request",
",",
"final",
"StanzaError",
".",
"Builder",
"error",
")",
"{",
"if",
"(",
"!",
"request",
".",
"isRequestIQ",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Convenience method to create a new {@link Type#error IQ.Type.error} IQ
based on a {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}
IQ. The new stanza will be initialized with:<ul>
<li>The sender set to the recipient of the originating IQ.
<li>The recipient set to the sender of the originating IQ.
<li>The type set to {@link Type#error IQ.Type.error}.
<li>The id set to the id of the originating IQ.
<li>The child element contained in the associated originating IQ.
<li>The provided {@link StanzaError XMPPError}.
</ul>
@param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
@param error the error to associate with the created IQ packet.
@throws IllegalArgumentException if the IQ stanza does not have a type of
{@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
@return a new {@link Type#error IQ.Type.error} IQ based on the originating IQ. | [
"Convenience",
"method",
"to",
"create",
"a",
"new",
"{",
"@link",
"Type#error",
"IQ",
".",
"Type",
".",
"error",
"}",
"IQ",
"based",
"on",
"a",
"{",
"@link",
"Type#get",
"IQ",
".",
"Type",
".",
"get",
"}",
"or",
"{",
"@link",
"Type#set",
"IQ",
".",
... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java#L299-L312 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/CreateDevEndpointRequest.java | CreateDevEndpointRequest.withArguments | public CreateDevEndpointRequest withArguments(java.util.Map<String, String> arguments) {
setArguments(arguments);
return this;
} | java | public CreateDevEndpointRequest withArguments(java.util.Map<String, String> arguments) {
setArguments(arguments);
return this;
} | [
"public",
"CreateDevEndpointRequest",
"withArguments",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"arguments",
")",
"{",
"setArguments",
"(",
"arguments",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map of arguments used to configure the DevEndpoint.
</p>
@param arguments
A map of arguments used to configure the DevEndpoint.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"of",
"arguments",
"used",
"to",
"configure",
"the",
"DevEndpoint",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/CreateDevEndpointRequest.java#L792-L795 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneOffsetTransition.java | ZoneOffsetTransition.readExternal | static ZoneOffsetTransition readExternal(DataInput in) throws IOException {
long epochSecond = Ser.readEpochSec(in);
ZoneOffset before = Ser.readOffset(in);
ZoneOffset after = Ser.readOffset(in);
if (before.equals(after)) {
throw new IllegalArgumentException("Offsets must not be equal");
}
return new ZoneOffsetTransition(epochSecond, before, after);
} | java | static ZoneOffsetTransition readExternal(DataInput in) throws IOException {
long epochSecond = Ser.readEpochSec(in);
ZoneOffset before = Ser.readOffset(in);
ZoneOffset after = Ser.readOffset(in);
if (before.equals(after)) {
throw new IllegalArgumentException("Offsets must not be equal");
}
return new ZoneOffsetTransition(epochSecond, before, after);
} | [
"static",
"ZoneOffsetTransition",
"readExternal",
"(",
"DataInput",
"in",
")",
"throws",
"IOException",
"{",
"long",
"epochSecond",
"=",
"Ser",
".",
"readEpochSec",
"(",
"in",
")",
";",
"ZoneOffset",
"before",
"=",
"Ser",
".",
"readOffset",
"(",
"in",
")",
"... | Reads the state from the stream.
@param in the input stream, not null
@return the created object, not null
@throws IOException if an error occurs | [
"Reads",
"the",
"state",
"from",
"the",
"stream",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneOffsetTransition.java#L224-L232 |
reapzor/FiloFirmata | src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java | Firmata.addMessageListener | public void addMessageListener(Integer channel, MessageListener<? extends Message> messageListener) {
addListener(channel, messageListener.getMessageType(), messageListener);
} | java | public void addMessageListener(Integer channel, MessageListener<? extends Message> messageListener) {
addListener(channel, messageListener.getMessageType(), messageListener);
} | [
"public",
"void",
"addMessageListener",
"(",
"Integer",
"channel",
",",
"MessageListener",
"<",
"?",
"extends",
"Message",
">",
"messageListener",
")",
"{",
"addListener",
"(",
"channel",
",",
"messageListener",
".",
"getMessageType",
"(",
")",
",",
"messageListen... | Add a messageListener to the Firmta object which will fire whenever a matching message is received
over the SerialPort that corresponds to the given channel.
@param channel Integer indicating the specific channel or pin to listen on
@param messageListener MessageListener object to handle a received Message event over the SerialPort. | [
"Add",
"a",
"messageListener",
"to",
"the",
"Firmta",
"object",
"which",
"will",
"fire",
"whenever",
"a",
"matching",
"message",
"is",
"received",
"over",
"the",
"SerialPort",
"that",
"corresponds",
"to",
"the",
"given",
"channel",
"."
] | train | https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L174-L176 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java | CommerceTierPriceEntryPersistenceImpl.findByCommercePriceEntryId | @Override
public List<CommerceTierPriceEntry> findByCommercePriceEntryId(
long commercePriceEntryId, int start, int end) {
return findByCommercePriceEntryId(commercePriceEntryId, start, end, null);
} | java | @Override
public List<CommerceTierPriceEntry> findByCommercePriceEntryId(
long commercePriceEntryId, int start, int end) {
return findByCommercePriceEntryId(commercePriceEntryId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceTierPriceEntry",
">",
"findByCommercePriceEntryId",
"(",
"long",
"commercePriceEntryId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCommercePriceEntryId",
"(",
"commercePriceEntryId",
",",
"start... | Returns a range of all the commerce tier price entries where commercePriceEntryId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceTierPriceEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param commercePriceEntryId the commerce price entry ID
@param start the lower bound of the range of commerce tier price entries
@param end the upper bound of the range of commerce tier price entries (not inclusive)
@return the range of matching commerce tier price entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"tier",
"price",
"entries",
"where",
"commercePriceEntryId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java#L2572-L2576 |
netty/netty | codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java | HAProxyMessageDecoder.findVersion | private static int findVersion(final ByteBuf buffer) {
final int n = buffer.readableBytes();
// per spec, the version number is found in the 13th byte
if (n < 13) {
return -1;
}
int idx = buffer.readerIndex();
return match(BINARY_PREFIX, buffer, idx) ? buffer.getByte(idx + BINARY_PREFIX_LENGTH) : 1;
} | java | private static int findVersion(final ByteBuf buffer) {
final int n = buffer.readableBytes();
// per spec, the version number is found in the 13th byte
if (n < 13) {
return -1;
}
int idx = buffer.readerIndex();
return match(BINARY_PREFIX, buffer, idx) ? buffer.getByte(idx + BINARY_PREFIX_LENGTH) : 1;
} | [
"private",
"static",
"int",
"findVersion",
"(",
"final",
"ByteBuf",
"buffer",
")",
"{",
"final",
"int",
"n",
"=",
"buffer",
".",
"readableBytes",
"(",
")",
";",
"// per spec, the version number is found in the 13th byte",
"if",
"(",
"n",
"<",
"13",
")",
"{",
"... | Returns the proxy protocol specification version in the buffer if the version is found.
Returns -1 if no version was found in the buffer. | [
"Returns",
"the",
"proxy",
"protocol",
"specification",
"version",
"in",
"the",
"buffer",
"if",
"the",
"version",
"is",
"found",
".",
"Returns",
"-",
"1",
"if",
"no",
"version",
"was",
"found",
"in",
"the",
"buffer",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java#L163-L172 |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traj/math/RadiusGyrationTensor2D.java | RadiusGyrationTensor2D.getRadiusOfGyrationTensor | public static Array2DRowRealMatrix getRadiusOfGyrationTensor(Trajectory t){
double meanx =0;
double meany =0;
for(int i = 0; i < t.size(); i++){
meanx+= t.get(i).x;
meany+= t.get(i).y;
}
meanx = meanx/t.size();
meany = meany/t.size();
double e11 = 0;
double e12 = 0;
double e21 = 0;
double e22 = 0;
for(int i = 0; i < t.size(); i++){
e11 += Math.pow(t.get(i).x-meanx,2);
e12 += (t.get(i).x-meanx)*(t.get(i).y-meany);
e22 += Math.pow(t.get(i).y-meany,2);
}
e11 = e11 / t.size();
e12 = e12 / t.size();
e21 = e12;
e22 = e22 / t.size();
int rows = 2;
int columns = 2;
Array2DRowRealMatrix gyr = new Array2DRowRealMatrix(rows, columns);
gyr.addToEntry(0, 0, e11);
gyr.addToEntry(0, 1, e12);
gyr.addToEntry(1, 0, e21);
gyr.addToEntry(1, 1, e22);
return gyr;
} | java | public static Array2DRowRealMatrix getRadiusOfGyrationTensor(Trajectory t){
double meanx =0;
double meany =0;
for(int i = 0; i < t.size(); i++){
meanx+= t.get(i).x;
meany+= t.get(i).y;
}
meanx = meanx/t.size();
meany = meany/t.size();
double e11 = 0;
double e12 = 0;
double e21 = 0;
double e22 = 0;
for(int i = 0; i < t.size(); i++){
e11 += Math.pow(t.get(i).x-meanx,2);
e12 += (t.get(i).x-meanx)*(t.get(i).y-meany);
e22 += Math.pow(t.get(i).y-meany,2);
}
e11 = e11 / t.size();
e12 = e12 / t.size();
e21 = e12;
e22 = e22 / t.size();
int rows = 2;
int columns = 2;
Array2DRowRealMatrix gyr = new Array2DRowRealMatrix(rows, columns);
gyr.addToEntry(0, 0, e11);
gyr.addToEntry(0, 1, e12);
gyr.addToEntry(1, 0, e21);
gyr.addToEntry(1, 1, e22);
return gyr;
} | [
"public",
"static",
"Array2DRowRealMatrix",
"getRadiusOfGyrationTensor",
"(",
"Trajectory",
"t",
")",
"{",
"double",
"meanx",
"=",
"0",
";",
"double",
"meany",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"t",
".",
"size",
"(",
")",
... | Calculates the radius of gyration tensor according to formula (6.3) in
ELEMENTS OF THE RANDOM WALK by Rudnick and Gaspari
@return Radius of gyration tensor | [
"Calculates",
"the",
"radius",
"of",
"gyration",
"tensor",
"according",
"to",
"formula",
"(",
"6",
".",
"3",
")",
"in"
] | train | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traj/math/RadiusGyrationTensor2D.java#L56-L90 |
alkacon/opencms-core | src/org/opencms/loader/CmsPointerLoader.java | CmsPointerLoader.appendLinkParams | private static String appendLinkParams(String pointerLink, HttpServletRequest req) {
String result = pointerLink;
if (isRequestParamSupportEnabled()) {
Map<String, String[]> params = req.getParameterMap();
if (params.size() > 0) {
result = CmsRequestUtil.appendParameters(result, params, false);
}
}
return result;
} | java | private static String appendLinkParams(String pointerLink, HttpServletRequest req) {
String result = pointerLink;
if (isRequestParamSupportEnabled()) {
Map<String, String[]> params = req.getParameterMap();
if (params.size() > 0) {
result = CmsRequestUtil.appendParameters(result, params, false);
}
}
return result;
} | [
"private",
"static",
"String",
"appendLinkParams",
"(",
"String",
"pointerLink",
",",
"HttpServletRequest",
"req",
")",
"{",
"String",
"result",
"=",
"pointerLink",
";",
"if",
"(",
"isRequestParamSupportEnabled",
"(",
")",
")",
"{",
"Map",
"<",
"String",
",",
... | Internal helper that is used by
<code>{@link #load(CmsObject, CmsResource, HttpServletRequest, HttpServletResponse)}</code>
and
<code>{@link #export(CmsObject, CmsResource, HttpServletRequest, HttpServletResponse)}</code>
to handle conditional request parameter support for links to pointer
resources.
<p>
@param pointerLink
the link to append request parameters to
@param req
the original request to the pointer
@return the pointer with the parameters | [
"Internal",
"helper",
"that",
"is",
"used",
"by",
"<code",
">",
"{",
"@link",
"#load",
"(",
"CmsObject",
"CmsResource",
"HttpServletRequest",
"HttpServletResponse",
")",
"}",
"<",
"/",
"code",
">",
"and",
"<code",
">",
"{",
"@link",
"#export",
"(",
"CmsObjec... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsPointerLoader.java#L127-L137 |
banq/jdonframework | JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java | PageIteratorSolver.queryMultiObject | public List queryMultiObject(Collection queryParams, String sqlquery) throws Exception {
JdbcTemp jdbcTemp = new JdbcTemp(dataSource);
return jdbcTemp.queryMultiObject(queryParams, sqlquery);
} | java | public List queryMultiObject(Collection queryParams, String sqlquery) throws Exception {
JdbcTemp jdbcTemp = new JdbcTemp(dataSource);
return jdbcTemp.queryMultiObject(queryParams, sqlquery);
} | [
"public",
"List",
"queryMultiObject",
"(",
"Collection",
"queryParams",
",",
"String",
"sqlquery",
")",
"throws",
"Exception",
"{",
"JdbcTemp",
"jdbcTemp",
"=",
"new",
"JdbcTemp",
"(",
"dataSource",
")",
";",
"return",
"jdbcTemp",
".",
"queryMultiObject",
"(",
"... | query multi object from database delgate to JdbCQueryTemp's
queryMultiObject method
@param queryParams
@param sqlquery
@return
@throws Exception | [
"query",
"multi",
"object",
"from",
"database",
"delgate",
"to",
"JdbCQueryTemp",
"s",
"queryMultiObject",
"method"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java#L148-L151 |
HalBuilder/halbuilder-guava | src/main/java/com/theoryinpractise/halbuilder/guava/Representations.java | Representations.withLink | public static void withLink(Representation representation, String rel, URI uri, Predicate<ReadableRepresentation> predicate) {
withLink(representation, rel, uri.toASCIIString(), predicate);
} | java | public static void withLink(Representation representation, String rel, URI uri, Predicate<ReadableRepresentation> predicate) {
withLink(representation, rel, uri.toASCIIString(), predicate);
} | [
"public",
"static",
"void",
"withLink",
"(",
"Representation",
"representation",
",",
"String",
"rel",
",",
"URI",
"uri",
",",
"Predicate",
"<",
"ReadableRepresentation",
">",
"predicate",
")",
"{",
"withLink",
"(",
"representation",
",",
"rel",
",",
"uri",
".... | Add a link to this resource
@param rel
@param uri The target URI for the link, possibly relative to the href of this resource. | [
"Add",
"a",
"link",
"to",
"this",
"resource"
] | train | https://github.com/HalBuilder/halbuilder-guava/blob/648cb1ae6c4b4cebd82364a8d72d9801bd3db771/src/main/java/com/theoryinpractise/halbuilder/guava/Representations.java#L39-L41 |
qiujuer/OkHttpPacker | okhttp/src/main/java/net/qiujuer/common/okhttp/impl/RequestCallBuilder.java | RequestCallBuilder.buildGetParams | protected boolean buildGetParams(StringBuilder sb, boolean isFirst) {
BuilderListener listener = mListener;
if (listener != null) {
return listener.onBuildGetParams(sb, isFirst);
} else {
return isFirst;
}
} | java | protected boolean buildGetParams(StringBuilder sb, boolean isFirst) {
BuilderListener listener = mListener;
if (listener != null) {
return listener.onBuildGetParams(sb, isFirst);
} else {
return isFirst;
}
} | [
"protected",
"boolean",
"buildGetParams",
"(",
"StringBuilder",
"sb",
",",
"boolean",
"isFirst",
")",
"{",
"BuilderListener",
"listener",
"=",
"mListener",
";",
"if",
"(",
"listener",
"!=",
"null",
")",
"{",
"return",
"listener",
".",
"onBuildGetParams",
"(",
... | In this we should add same default params to the get builder
@param sb Get Values
@param isFirst The Url and values is have "?" char
@return values is have "?" char | [
"In",
"this",
"we",
"should",
"add",
"same",
"default",
"params",
"to",
"the",
"get",
"builder"
] | train | https://github.com/qiujuer/OkHttpPacker/blob/d2d484facb66b7e11e6cbbfeb78025f76ce25ebd/okhttp/src/main/java/net/qiujuer/common/okhttp/impl/RequestCallBuilder.java#L59-L66 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getLastIndexOf | public static int getLastIndexOf (@Nullable final String sText, @Nullable final String sSearch)
{
return sText != null && sSearch != null && sText.length () >= sSearch.length () ? sText.lastIndexOf (sSearch)
: STRING_NOT_FOUND;
} | java | public static int getLastIndexOf (@Nullable final String sText, @Nullable final String sSearch)
{
return sText != null && sSearch != null && sText.length () >= sSearch.length () ? sText.lastIndexOf (sSearch)
: STRING_NOT_FOUND;
} | [
"public",
"static",
"int",
"getLastIndexOf",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
")",
"{",
"return",
"sText",
"!=",
"null",
"&&",
"sSearch",
"!=",
"null",
"&&",
"sText",
".",
"length",
"(",
... | Get the last index of sSearch within sText.
@param sText
The text to search in. May be <code>null</code>.
@param sSearch
The text to search for. May be <code>null</code>.
@return The last index of sSearch within sText or {@value #STRING_NOT_FOUND}
if sSearch was not found or if any parameter was <code>null</code>.
@see String#lastIndexOf(String) | [
"Get",
"the",
"last",
"index",
"of",
"sSearch",
"within",
"sText",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2715-L2719 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.convertToMatrix | public static DMatrixRMaj convertToMatrix( Se3_F64 m , DMatrixRMaj A ) {
if( A == null )
A = new DMatrixRMaj(3,4);
else
A.reshape(3,4);
CommonOps_DDRM.insert(m.R,A,0,0);
A.data[3] = m.T.x;
A.data[7] = m.T.y;
A.data[11] = m.T.z;
return A;
} | java | public static DMatrixRMaj convertToMatrix( Se3_F64 m , DMatrixRMaj A ) {
if( A == null )
A = new DMatrixRMaj(3,4);
else
A.reshape(3,4);
CommonOps_DDRM.insert(m.R,A,0,0);
A.data[3] = m.T.x;
A.data[7] = m.T.y;
A.data[11] = m.T.z;
return A;
} | [
"public",
"static",
"DMatrixRMaj",
"convertToMatrix",
"(",
"Se3_F64",
"m",
",",
"DMatrixRMaj",
"A",
")",
"{",
"if",
"(",
"A",
"==",
"null",
")",
"A",
"=",
"new",
"DMatrixRMaj",
"(",
"3",
",",
"4",
")",
";",
"else",
"A",
".",
"reshape",
"(",
"3",
",... | Converts the SE3 into a 3x4 matrix. [R|T]
@param m (Input) transform
@param A (Output) equivalent 3x4 matrix represenation | [
"Converts",
"the",
"SE3",
"into",
"a",
"3x4",
"matrix",
".",
"[",
"R|T",
"]"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L751-L761 |
seedstack/business | core/src/main/java/org/seedstack/business/util/Tuples.java | Tuples.create | @SuppressWarnings("unchecked")
public static <T extends Tuple> T create(Iterable<?> objects, int limit) {
List<Object> list = new ArrayList<>();
int index = 0;
for (Object object : objects) {
if (limit != -1 && ++index > limit) {
break;
}
list.add(object);
}
return create(list);
} | java | @SuppressWarnings("unchecked")
public static <T extends Tuple> T create(Iterable<?> objects, int limit) {
List<Object> list = new ArrayList<>();
int index = 0;
for (Object object : objects) {
if (limit != -1 && ++index > limit) {
break;
}
list.add(object);
}
return create(list);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Tuple",
">",
"T",
"create",
"(",
"Iterable",
"<",
"?",
">",
"objects",
",",
"int",
"limit",
")",
"{",
"List",
"<",
"Object",
">",
"list",
"=",
"new",
"ArrayLi... | Builds a tuple from an {@link Iterable}, optionally limiting the number of items.
@param objects the iterable of objects (size must be less or equal than 10).
@param limit the item number limit (-1 means no limit).
@param <T> the tuple type.
@return the constructed tuple. | [
"Builds",
"a",
"tuple",
"from",
"an",
"{",
"@link",
"Iterable",
"}",
"optionally",
"limiting",
"the",
"number",
"of",
"items",
"."
] | train | https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/core/src/main/java/org/seedstack/business/util/Tuples.java#L83-L94 |
derari/cthul | objects/src/main/java/org/cthul/objects/Boxing.java | Boxing.unboxAllAs | public static <T> T unboxAllAs(Object src, Class<T> type) {
return (T) unboxAll(type, src, 0, -1);
} | java | public static <T> T unboxAllAs(Object src, Class<T> type) {
return (T) unboxAll(type, src, 0, -1);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"unboxAllAs",
"(",
"Object",
"src",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"(",
"T",
")",
"unboxAll",
"(",
"type",
",",
"src",
",",
"0",
",",
"-",
"1",
")",
";",
"}"
] | Transforms any array into a primitive array.
@param <T>
@param src source array
@param type target type
@return primitive array | [
"Transforms",
"any",
"array",
"into",
"a",
"primitive",
"array",
"."
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L227-L229 |
alkacon/opencms-core | src/org/opencms/xml/CmsXmlMessages.java | CmsXmlMessages.getConfigValue | protected String getConfigValue(String key, Object[] args) {
String value = getConfigValue(key);
CmsMacroResolver resolver = CmsMacroResolver.newInstance();
for (int i = 0; i < args.length; i++) {
resolver.addMacro(String.valueOf(i), args[i].toString());
}
return resolver.resolveMacros(value);
} | java | protected String getConfigValue(String key, Object[] args) {
String value = getConfigValue(key);
CmsMacroResolver resolver = CmsMacroResolver.newInstance();
for (int i = 0; i < args.length; i++) {
resolver.addMacro(String.valueOf(i), args[i].toString());
}
return resolver.resolveMacros(value);
} | [
"protected",
"String",
"getConfigValue",
"(",
"String",
"key",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"String",
"value",
"=",
"getConfigValue",
"(",
"key",
")",
";",
"CmsMacroResolver",
"resolver",
"=",
"CmsMacroResolver",
".",
"newInstance",
"(",
")",
"... | Returns the substituted value for the given key and arguments from the configuration file.<p>
@param key the key to get the value for
@param args the arguments that should be substituted
@return the substituted value for the given key and arguments | [
"Returns",
"the",
"substituted",
"value",
"for",
"the",
"given",
"key",
"and",
"arguments",
"from",
"the",
"configuration",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlMessages.java#L238-L246 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.