repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSegment.java | IPAddressSegment.isBitwiseOrCompatibleWithRange | public boolean isBitwiseOrCompatibleWithRange(int maskValue, Integer segmentPrefixLength) throws PrefixLenException {
return super.isBitwiseOrCompatibleWithRange(maskValue, segmentPrefixLength, getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets());
} | java | public boolean isBitwiseOrCompatibleWithRange(int maskValue, Integer segmentPrefixLength) throws PrefixLenException {
return super.isBitwiseOrCompatibleWithRange(maskValue, segmentPrefixLength, getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets());
} | [
"public",
"boolean",
"isBitwiseOrCompatibleWithRange",
"(",
"int",
"maskValue",
",",
"Integer",
"segmentPrefixLength",
")",
"throws",
"PrefixLenException",
"{",
"return",
"super",
".",
"isBitwiseOrCompatibleWithRange",
"(",
"maskValue",
",",
"segmentPrefixLength",
",",
"g... | Similar to masking, checks that the range resulting from the bitwise or is contiguous.
@param maskValue
@param segmentPrefixLength
@return
@throws PrefixLenException | [
"Similar",
"to",
"masking",
"checks",
"that",
"the",
"range",
"resulting",
"from",
"the",
"bitwise",
"or",
"is",
"contiguous",
"."
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSegment.java#L335-L337 |
hltcoe/annotated-nyt | src/main/java/com/nytlabs/corpus/NYTCorpusDocumentParser.java | NYTCorpusDocumentParser.loadValidating | private Document loadValidating(InputStream is) {
try {
return getDOMObject(is, true);
} catch (SAXException e) {
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
} catch (IOException e) {
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
} catch (ParserConfigurationException e) {
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
}
return null;
} | java | private Document loadValidating(InputStream is) {
try {
return getDOMObject(is, true);
} catch (SAXException e) {
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
} catch (IOException e) {
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
} catch (ParserConfigurationException e) {
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
}
return null;
} | [
"private",
"Document",
"loadValidating",
"(",
"InputStream",
"is",
")",
"{",
"try",
"{",
"return",
"getDOMObject",
"(",
"is",
",",
"true",
")",
";",
"}",
"catch",
"(",
"SAXException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"System",
... | Parse the specified file into a DOM Document.
@param file
The file to parse.
@return The parsed DOM Document or null if an error occurs. | [
"Parse",
"the",
"specified",
"file",
"into",
"a",
"DOM",
"Document",
"."
] | train | https://github.com/hltcoe/annotated-nyt/blob/0a4daa97705591cefea9de61614770ae2665a48e/src/main/java/com/nytlabs/corpus/NYTCorpusDocumentParser.java#L362-L376 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/brief/FactoryBriefDefinition.java | FactoryBriefDefinition.randomGaussian | private static void randomGaussian( Random rand , double sigma , int radius , Point2D_I32 pt ) {
int x,y;
while( true ) {
x = (int)(rand.nextGaussian()*sigma);
y = (int)(rand.nextGaussian()*sigma);
if( Math.sqrt(x*x + y*y) < radius )
break;
}
pt.set(x,y);
} | java | private static void randomGaussian( Random rand , double sigma , int radius , Point2D_I32 pt ) {
int x,y;
while( true ) {
x = (int)(rand.nextGaussian()*sigma);
y = (int)(rand.nextGaussian()*sigma);
if( Math.sqrt(x*x + y*y) < radius )
break;
}
pt.set(x,y);
} | [
"private",
"static",
"void",
"randomGaussian",
"(",
"Random",
"rand",
",",
"double",
"sigma",
",",
"int",
"radius",
",",
"Point2D_I32",
"pt",
")",
"{",
"int",
"x",
",",
"y",
";",
"while",
"(",
"true",
")",
"{",
"x",
"=",
"(",
"int",
")",
"(",
"rand... | Randomly selects a point which is inside a square region using a Gaussian distribution. | [
"Randomly",
"selects",
"a",
"point",
"which",
"is",
"inside",
"a",
"square",
"region",
"using",
"a",
"Gaussian",
"distribution",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/brief/FactoryBriefDefinition.java#L73-L85 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/VerboseFormatter.java | VerboseFormatter.appendFunction | private static void appendFunction(StringBuilder message, LogRecord event)
{
final String clazz = event.getSourceClassName();
if (clazz != null)
{
message.append(IN).append(clazz);
}
final String function = event.getSourceMethodName();
if (function != null)
{
message.append(AT).append(function).append(Constant.DOUBLE_DOT);
}
} | java | private static void appendFunction(StringBuilder message, LogRecord event)
{
final String clazz = event.getSourceClassName();
if (clazz != null)
{
message.append(IN).append(clazz);
}
final String function = event.getSourceMethodName();
if (function != null)
{
message.append(AT).append(function).append(Constant.DOUBLE_DOT);
}
} | [
"private",
"static",
"void",
"appendFunction",
"(",
"StringBuilder",
"message",
",",
"LogRecord",
"event",
")",
"{",
"final",
"String",
"clazz",
"=",
"event",
".",
"getSourceClassName",
"(",
")",
";",
"if",
"(",
"clazz",
"!=",
"null",
")",
"{",
"message",
... | Append function location.
@param message The message builder.
@param event The log record. | [
"Append",
"function",
"location",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/VerboseFormatter.java#L74-L87 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConnection.java | SibRaConnection.createProducerSession | @Override
public ProducerSession createProducerSession(
final SIDestinationAddress destAddr,
final DestinationType destType,
final OrderingContext orderingContext, final String alternateUser)
throws SIConnectionDroppedException,
SIConnectionUnavailableException, SIConnectionLostException,
SILimitExceededException, SINotAuthorizedException,
SITemporaryDestinationNotFoundException, SIResourceException,
SIErrorException, SINotPossibleInCurrentConfigurationException,
SIIncorrectCallException {
checkValid();
final ProducerSession session = _delegateConnection
.createProducerSession(destAddr, destType, orderingContext,
alternateUser);
return new SibRaProducerSession(this, session);
} | java | @Override
public ProducerSession createProducerSession(
final SIDestinationAddress destAddr,
final DestinationType destType,
final OrderingContext orderingContext, final String alternateUser)
throws SIConnectionDroppedException,
SIConnectionUnavailableException, SIConnectionLostException,
SILimitExceededException, SINotAuthorizedException,
SITemporaryDestinationNotFoundException, SIResourceException,
SIErrorException, SINotPossibleInCurrentConfigurationException,
SIIncorrectCallException {
checkValid();
final ProducerSession session = _delegateConnection
.createProducerSession(destAddr, destType, orderingContext,
alternateUser);
return new SibRaProducerSession(this, session);
} | [
"@",
"Override",
"public",
"ProducerSession",
"createProducerSession",
"(",
"final",
"SIDestinationAddress",
"destAddr",
",",
"final",
"DestinationType",
"destType",
",",
"final",
"OrderingContext",
"orderingContext",
",",
"final",
"String",
"alternateUser",
")",
"throws"... | Creates a producer session. Checks that the connection is valid and then
delegates. Wraps the <code>ProducerSession</code> returned from the
delegate in a <code>SibRaProducerSession</code>.
@param destAddr
the address of the destination
@param destType
the destination type
@param orderingContext
indicates that the order of messages from multiple
ProducerSessions should be preserved
@param alternateUser
the name of the user under whose authority operations of the
ProducerSession should be performed (may be null)
@return the producer session
@throws SIIncorrectCallException
if the delegation fails
@throws SINotPossibleInCurrentConfigurationException
if the delegation fails
@throws SIErrorException
if the delegation fails
@throws SIResourceException
if the delegation fails
@throws SITemporaryDestinationNotFoundException
if the delegation fails
@throws SINotAuthorizedException
if the delegation fails
@throws SILimitExceededException
if the delegation fails
@throws SIConnectionLostException
if the delegation fails
@throws SIConnectionUnavailableException
if the connection is not valid
@throws SIConnectionDroppedException
if the delegation fails | [
"Creates",
"a",
"producer",
"session",
".",
"Checks",
"that",
"the",
"connection",
"is",
"valid",
"and",
"then",
"delegates",
".",
"Wraps",
"the",
"<code",
">",
"ProducerSession<",
"/",
"code",
">",
"returned",
"from",
"the",
"delegate",
"in",
"a",
"<code",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConnection.java#L514-L534 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/filter/DependentFileFilter.java | DependentFileFilter.doRecordChange | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{ // Read a valid record
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
boolean bSetIfModified = true;
switch (iChangeType)
{
case DBConstants.UPDATE_TYPE: // This should not be necessary (but I do it anyway).
if (!this.getOwner().isRefreshedRecord())
break; // No first add
bSetIfModified = false;
case DBConstants.ADD_TYPE:
boolean bNonNulls = this.setMainKey(bDisplayOption, null, bSetIfModified); // Set up the key (keys are marked as changed if they change!)
if ((bNonNulls == false) && ((this.getOwner().getMasterSlave() & RecordOwner.SLAVE) == 0)) // Don't return for a server!
{
if (this.getOwner().getTask() != null)
return this.getOwner().getTask().setLastError("Main key cannot be null");
return DBConstants.ERROR_RETURN; // Key can't be null!
}
break;
}
return iErrorCode; // Initialize the record
} | java | public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{ // Read a valid record
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode;
boolean bSetIfModified = true;
switch (iChangeType)
{
case DBConstants.UPDATE_TYPE: // This should not be necessary (but I do it anyway).
if (!this.getOwner().isRefreshedRecord())
break; // No first add
bSetIfModified = false;
case DBConstants.ADD_TYPE:
boolean bNonNulls = this.setMainKey(bDisplayOption, null, bSetIfModified); // Set up the key (keys are marked as changed if they change!)
if ((bNonNulls == false) && ((this.getOwner().getMasterSlave() & RecordOwner.SLAVE) == 0)) // Don't return for a server!
{
if (this.getOwner().getTask() != null)
return this.getOwner().getTask().setLastError("Main key cannot be null");
return DBConstants.ERROR_RETURN; // Key can't be null!
}
break;
}
return iErrorCode; // Initialize the record
} | [
"public",
"int",
"doRecordChange",
"(",
"FieldInfo",
"field",
",",
"int",
"iChangeType",
",",
"boolean",
"bDisplayOption",
")",
"{",
"// Read a valid record",
"int",
"iErrorCode",
"=",
"super",
".",
"doRecordChange",
"(",
"field",
",",
"iChangeType",
",",
"bDispla... | Called when a change is the record status is about to happen/has happened.
@param field If this file change is due to a field, this is the field.
@param iChangeType The type of change that occurred.
@param bDisplayOption If true, display any changes.
@return an error code.
Before an add, set the key back to the original value. | [
"Called",
"when",
"a",
"change",
"is",
"the",
"record",
"status",
"is",
"about",
"to",
"happen",
"/",
"has",
"happened",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/filter/DependentFileFilter.java#L142-L165 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/SerializerRegistry.java | SerializerRegistry.registerDefault | public SerializerRegistry registerDefault(Class<?> baseType, Class<? extends TypeSerializer> serializer) {
return registerDefault(baseType, new DefaultTypeSerializerFactory(serializer));
} | java | public SerializerRegistry registerDefault(Class<?> baseType, Class<? extends TypeSerializer> serializer) {
return registerDefault(baseType, new DefaultTypeSerializerFactory(serializer));
} | [
"public",
"SerializerRegistry",
"registerDefault",
"(",
"Class",
"<",
"?",
">",
"baseType",
",",
"Class",
"<",
"?",
"extends",
"TypeSerializer",
">",
"serializer",
")",
"{",
"return",
"registerDefault",
"(",
"baseType",
",",
"new",
"DefaultTypeSerializerFactory",
... | Registers the given class as a default serializer for the given base type.
@param baseType The base type for which to register the serializer.
@param serializer The serializer class.
@return The serializer registry. | [
"Registers",
"the",
"given",
"class",
"as",
"a",
"default",
"serializer",
"for",
"the",
"given",
"base",
"type",
"."
] | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/SerializerRegistry.java#L257-L259 |
vincentk/joptimizer | src/main/java/com/joptimizer/algebra/MatrixLogSumRescaler.java | MatrixLogSumRescaler.getMatrixScalingFactorsSymm | @Override
public DoubleMatrix1D getMatrixScalingFactorsSymm(DoubleMatrix2D A) {
int n = A.rows();
final double log10_b = Math.log10(base);
final int[] x = new int[n];
final double[] cHolder = new double[1];
final double[] tHolder = new double[1];
final int[] currentColumnIndexHolder = new int[] { -1 };
IntIntDoubleFunction myFunct = new IntIntDoubleFunction() {
@Override
public double apply(int i, int j, double pij) {
int currentColumnIndex = currentColumnIndexHolder[0];
// we take into account only the lower left subdiagonal part of Q (that is symmetric)
if(i == currentColumnIndex){
//diagonal element
//log.debug("i:" + i + ", j:" + currentColumnIndex + ": " + pij);
tHolder[0] = tHolder[0] - 0.5 * (Math.log10(Math.abs(pij))/log10_b + 0.5);//log(b, x) = log(k, x) / log(k, b)
cHolder[0] = cHolder[0] + 1;
}else if (i > currentColumnIndex) {
//sub-diagonal elements
//log.debug("i:" + i + ", j:" + currentColumnIndex + ": " + pij);
tHolder[0] = tHolder[0] - 2 * (Math.log10(Math.abs(pij))/log10_b + 0.5) -2*x[i];//log(b, x) = log(k, x) / log(k, b)
cHolder[0] = cHolder[0] + 2;//- 2*x[i]
}
return pij;
}
};
//view A column by column
for (int currentColumnIndex = n - 1; currentColumnIndex >= 0; currentColumnIndex--) {
//log.debug("currentColumnIndex:" + currentColumnIndex);
cHolder[0] = 0;//reset
tHolder[0] = 0;//reset
currentColumnIndexHolder[0] = currentColumnIndex;
DoubleMatrix2D P = A.viewPart(0, currentColumnIndex, n, 1);
P.forEachNonZero(myFunct);
if(cHolder[0] > 0){
x[currentColumnIndex] = (int)Math.round(tHolder[0] / cHolder[0]);
}
}
//log.debug("x: " + ArrayUtils.toString(x));
DoubleMatrix1D u = new DenseDoubleMatrix1D(n);
for (int k = 0; k < n; k++) {
u.setQuick(k, Math.pow(base, x[k]));
}
return u;
} | java | @Override
public DoubleMatrix1D getMatrixScalingFactorsSymm(DoubleMatrix2D A) {
int n = A.rows();
final double log10_b = Math.log10(base);
final int[] x = new int[n];
final double[] cHolder = new double[1];
final double[] tHolder = new double[1];
final int[] currentColumnIndexHolder = new int[] { -1 };
IntIntDoubleFunction myFunct = new IntIntDoubleFunction() {
@Override
public double apply(int i, int j, double pij) {
int currentColumnIndex = currentColumnIndexHolder[0];
// we take into account only the lower left subdiagonal part of Q (that is symmetric)
if(i == currentColumnIndex){
//diagonal element
//log.debug("i:" + i + ", j:" + currentColumnIndex + ": " + pij);
tHolder[0] = tHolder[0] - 0.5 * (Math.log10(Math.abs(pij))/log10_b + 0.5);//log(b, x) = log(k, x) / log(k, b)
cHolder[0] = cHolder[0] + 1;
}else if (i > currentColumnIndex) {
//sub-diagonal elements
//log.debug("i:" + i + ", j:" + currentColumnIndex + ": " + pij);
tHolder[0] = tHolder[0] - 2 * (Math.log10(Math.abs(pij))/log10_b + 0.5) -2*x[i];//log(b, x) = log(k, x) / log(k, b)
cHolder[0] = cHolder[0] + 2;//- 2*x[i]
}
return pij;
}
};
//view A column by column
for (int currentColumnIndex = n - 1; currentColumnIndex >= 0; currentColumnIndex--) {
//log.debug("currentColumnIndex:" + currentColumnIndex);
cHolder[0] = 0;//reset
tHolder[0] = 0;//reset
currentColumnIndexHolder[0] = currentColumnIndex;
DoubleMatrix2D P = A.viewPart(0, currentColumnIndex, n, 1);
P.forEachNonZero(myFunct);
if(cHolder[0] > 0){
x[currentColumnIndex] = (int)Math.round(tHolder[0] / cHolder[0]);
}
}
//log.debug("x: " + ArrayUtils.toString(x));
DoubleMatrix1D u = new DenseDoubleMatrix1D(n);
for (int k = 0; k < n; k++) {
u.setQuick(k, Math.pow(base, x[k]));
}
return u;
} | [
"@",
"Override",
"public",
"DoubleMatrix1D",
"getMatrixScalingFactorsSymm",
"(",
"DoubleMatrix2D",
"A",
")",
"{",
"int",
"n",
"=",
"A",
".",
"rows",
"(",
")",
";",
"final",
"double",
"log10_b",
"=",
"Math",
".",
"log10",
"(",
"base",
")",
";",
"final",
"... | Symmetry preserving scale factors
@see Gajulapalli, Lasdon "Scaling Sparse Matrices for Optimization Algorithms", algorithm 3 | [
"Symmetry",
"preserving",
"scale",
"factors"
] | train | https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/algebra/MatrixLogSumRescaler.java#L181-L230 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WFigureRenderer.java | WFigureRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WFigure figure = (WFigure) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean renderChildren = isRenderContent(figure);
xml.appendTagOpen("ui:figure");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
if (FigureMode.LAZY.equals(figure.getMode())) {
xml.appendOptionalAttribute("hidden", !renderChildren, "true");
} else {
xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
}
FigureMode mode = figure.getMode();
if (mode != null) {
switch (mode) {
case LAZY:
xml.appendAttribute("mode", "lazy");
break;
case EAGER:
xml.appendAttribute("mode", "eager");
break;
default:
throw new SystemException("Unknown figure mode: " + figure.getMode());
}
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(figure, renderContext);
if (renderChildren) {
// Label
figure.getDecoratedLabel().paint(renderContext);
// Content
xml.appendTagOpen("ui:content");
xml.appendAttribute("id", component.getId() + "-content");
xml.appendClose();
figure.getContent().paint(renderContext);
xml.appendEndTag("ui:content");
}
xml.appendEndTag("ui:figure");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WFigure figure = (WFigure) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean renderChildren = isRenderContent(figure);
xml.appendTagOpen("ui:figure");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
if (FigureMode.LAZY.equals(figure.getMode())) {
xml.appendOptionalAttribute("hidden", !renderChildren, "true");
} else {
xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
}
FigureMode mode = figure.getMode();
if (mode != null) {
switch (mode) {
case LAZY:
xml.appendAttribute("mode", "lazy");
break;
case EAGER:
xml.appendAttribute("mode", "eager");
break;
default:
throw new SystemException("Unknown figure mode: " + figure.getMode());
}
}
xml.appendClose();
// Render margin
MarginRendererUtil.renderMargin(figure, renderContext);
if (renderChildren) {
// Label
figure.getDecoratedLabel().paint(renderContext);
// Content
xml.appendTagOpen("ui:content");
xml.appendAttribute("id", component.getId() + "-content");
xml.appendClose();
figure.getContent().paint(renderContext);
xml.appendEndTag("ui:content");
}
xml.appendEndTag("ui:figure");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WFigure",
"figure",
"=",
"(",
"WFigure",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext"... | Paints the given WFigure.
@param component the WFigure to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WFigure",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WFigureRenderer.java#L25-L74 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.copyContent | public static File copyContent(File src, File dest, boolean isOverride) throws IORuntimeException {
return FileCopier.create(src, dest).setCopyContentIfDir(true).setOverride(isOverride).copy();
} | java | public static File copyContent(File src, File dest, boolean isOverride) throws IORuntimeException {
return FileCopier.create(src, dest).setCopyContentIfDir(true).setOverride(isOverride).copy();
} | [
"public",
"static",
"File",
"copyContent",
"(",
"File",
"src",
",",
"File",
"dest",
",",
"boolean",
"isOverride",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileCopier",
".",
"create",
"(",
"src",
",",
"dest",
")",
".",
"setCopyContentIfDir",
"(",
... | 复制文件或目录<br>
情况如下:
<pre>
1、src和dest都为目录,则讲src下所有文件目录拷贝到dest下
2、src和dest都为文件,直接复制,名字为dest
3、src为文件,dest为目录,将src拷贝到dest目录下
</pre>
@param src 源文件
@param dest 目标文件或目录,目标不存在会自动创建(目录、文件都创建)
@param isOverride 是否覆盖目标文件
@return 目标目录或文件
@throws IORuntimeException IO异常 | [
"复制文件或目录<br",
">",
"情况如下:"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1023-L1025 |
structr/structr | structr-rest/src/main/java/org/structr/rest/auth/AuthHelper.java | AuthHelper.getPrincipalForCredential | public static <T> Principal getPrincipalForCredential(final PropertyKey<T> key, final T value) {
return getPrincipalForCredential(key, value, false);
} | java | public static <T> Principal getPrincipalForCredential(final PropertyKey<T> key, final T value) {
return getPrincipalForCredential(key, value, false);
} | [
"public",
"static",
"<",
"T",
">",
"Principal",
"getPrincipalForCredential",
"(",
"final",
"PropertyKey",
"<",
"T",
">",
"key",
",",
"final",
"T",
"value",
")",
"{",
"return",
"getPrincipalForCredential",
"(",
"key",
",",
"value",
",",
"false",
")",
";",
"... | Find a {@link Principal} for the given credential
@param key
@param value
@return principal | [
"Find",
"a",
"{",
"@link",
"Principal",
"}",
"for",
"the",
"given",
"credential"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-rest/src/main/java/org/structr/rest/auth/AuthHelper.java#L64-L68 |
akamai/AkamaiOPEN-edgegrid-java | edgerc-reader/src/main/java/com/akamai/edgegrid/signer/EdgeRcClientCredentialProvider.java | EdgeRcClientCredentialProvider.fromEdgeRc | public static EdgeRcClientCredentialProvider fromEdgeRc(InputStream inputStream, String section)
throws ConfigurationException, IOException {
Objects.requireNonNull(inputStream, "inputStream cannot be null");
return fromEdgeRc(new InputStreamReader(inputStream), section);
} | java | public static EdgeRcClientCredentialProvider fromEdgeRc(InputStream inputStream, String section)
throws ConfigurationException, IOException {
Objects.requireNonNull(inputStream, "inputStream cannot be null");
return fromEdgeRc(new InputStreamReader(inputStream), section);
} | [
"public",
"static",
"EdgeRcClientCredentialProvider",
"fromEdgeRc",
"(",
"InputStream",
"inputStream",
",",
"String",
"section",
")",
"throws",
"ConfigurationException",
",",
"IOException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"inputStream",
",",
"\"inputStream can... | Loads an EdgeRc configuration file and returns an {@link EdgeRcClientCredentialProvider} to
read {@link ClientCredential}s from it.
@param inputStream an open {@link InputStream} to an EdgeRc file
@param section a config section ({@code null} for the default section)
@return a {@link EdgeRcClientCredentialProvider}
@throws ConfigurationException If an error occurs while reading the configuration
@throws IOException if an I/O error occurs | [
"Loads",
"an",
"EdgeRc",
"configuration",
"file",
"and",
"returns",
"an",
"{",
"@link",
"EdgeRcClientCredentialProvider",
"}",
"to",
"read",
"{",
"@link",
"ClientCredential",
"}",
"s",
"from",
"it",
"."
] | train | https://github.com/akamai/AkamaiOPEN-edgegrid-java/blob/29aa39f0f70f62503e6a434c4470ee25cb640f58/edgerc-reader/src/main/java/com/akamai/edgegrid/signer/EdgeRcClientCredentialProvider.java#L78-L82 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java | ResourceUtil.getReader | public static BufferedReader getReader(String resurce, Charset charset) {
return getResourceObj(resurce).getReader(charset);
} | java | public static BufferedReader getReader(String resurce, Charset charset) {
return getResourceObj(resurce).getReader(charset);
} | [
"public",
"static",
"BufferedReader",
"getReader",
"(",
"String",
"resurce",
",",
"Charset",
"charset",
")",
"{",
"return",
"getResourceObj",
"(",
"resurce",
")",
".",
"getReader",
"(",
"charset",
")",
";",
"}"
] | 从ClassPath资源中获取{@link BufferedReader}
@param resurce ClassPath资源
@param charset 编码
@return {@link InputStream}
@since 3.1.2 | [
"从ClassPath资源中获取",
"{",
"@link",
"BufferedReader",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/resource/ResourceUtil.java#L87-L89 |
ltearno/hexa.tools | hexa.core/src/main/java/fr/lteconsulting/hexa/client/form/FormManager.java | FormManager.addGroup | public Object addGroup( String display, String name, Object parent )
{
int row = display != null ? table.getRowCount() : -1;
// create the new group
GroupInfo parentInfo = (GroupInfo) parent;
GroupInfo info = new GroupInfo( name, parentInfo, row );
// display the new group
if( display != null && row >= 0 )
{
table.setHTML( row, 0, display );
table.getCellFormatter().getElement( row, 0 ).getStyle().setVerticalAlign( VerticalAlign.TOP );
table.getCellFormatter().getElement( row, 0 ).setAttribute( "colSpan", "2" );
table.getCellFormatter().getElement( row, 0 ).getStyle().setPaddingTop( 25, Unit.PX );
table.getCellFormatter().getElement( row, 0 ).getStyle().setPaddingBottom( 10, Unit.PX );
table.getCellFormatter().getElement( row, 0 ).getStyle().setFontWeight( FontWeight.BOLD );
}
return info;
} | java | public Object addGroup( String display, String name, Object parent )
{
int row = display != null ? table.getRowCount() : -1;
// create the new group
GroupInfo parentInfo = (GroupInfo) parent;
GroupInfo info = new GroupInfo( name, parentInfo, row );
// display the new group
if( display != null && row >= 0 )
{
table.setHTML( row, 0, display );
table.getCellFormatter().getElement( row, 0 ).getStyle().setVerticalAlign( VerticalAlign.TOP );
table.getCellFormatter().getElement( row, 0 ).setAttribute( "colSpan", "2" );
table.getCellFormatter().getElement( row, 0 ).getStyle().setPaddingTop( 25, Unit.PX );
table.getCellFormatter().getElement( row, 0 ).getStyle().setPaddingBottom( 10, Unit.PX );
table.getCellFormatter().getElement( row, 0 ).getStyle().setFontWeight( FontWeight.BOLD );
}
return info;
} | [
"public",
"Object",
"addGroup",
"(",
"String",
"display",
",",
"String",
"name",
",",
"Object",
"parent",
")",
"{",
"int",
"row",
"=",
"display",
"!=",
"null",
"?",
"table",
".",
"getRowCount",
"(",
")",
":",
"-",
"1",
";",
"// create the new group",
"Gr... | /*
HashMap<FieldInfo,HTMLStream> fieldCommentsSlots = new HashMap<FieldInfo,
HTMLStream>(); public AcceptsOneWidget addCommentSlot( Object field ) {
FieldInfo info = (FieldInfo)field;
HTMLStream stream = fieldCommentsSlots.get( info ); if( stream == null )
{ stream = new HTMLStream(); fieldCommentsSlots.put( info, stream );
table.setWidget( info.row, 3, stream );
table.getCellFormatter().getElement( info.row, 3
).getStyle().setFontWeight( FontWeight.NORMAL ); }
SimplePanel slot = new SimplePanel(); stream.addLeft( slot );
return slot; } | [
"/",
"*",
"HashMap<FieldInfo",
"HTMLStream",
">",
"fieldCommentsSlots",
"=",
"new",
"HashMap<FieldInfo",
"HTMLStream",
">",
"()",
";",
"public",
"AcceptsOneWidget",
"addCommentSlot",
"(",
"Object",
"field",
")",
"{",
"FieldInfo",
"info",
"=",
"(",
"FieldInfo",
")"... | train | https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/form/FormManager.java#L296-L316 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/core/ProductHandler.java | ProductHandler.setProductModules | public void setProductModules(final String name, final List<String> moduleNames) {
final DbProduct dbProduct = getProduct(name);
dbProduct.setModules(moduleNames);
repositoryHandler.store(dbProduct);
} | java | public void setProductModules(final String name, final List<String> moduleNames) {
final DbProduct dbProduct = getProduct(name);
dbProduct.setModules(moduleNames);
repositoryHandler.store(dbProduct);
} | [
"public",
"void",
"setProductModules",
"(",
"final",
"String",
"name",
",",
"final",
"List",
"<",
"String",
">",
"moduleNames",
")",
"{",
"final",
"DbProduct",
"dbProduct",
"=",
"getProduct",
"(",
"name",
")",
";",
"dbProduct",
".",
"setModules",
"(",
"modul... | Patches the product module names
@param name String
@param moduleNames List<String> | [
"Patches",
"the",
"product",
"module",
"names"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ProductHandler.java#L90-L94 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.notNull | public static <T> T notNull (final T aValue, @Nonnull final Supplier <? extends String> aName)
{
if (isEnabled ())
if (aValue == null)
throw new NullPointerException ("The value of '" + aName.get () + "' may not be null!");
return aValue;
} | java | public static <T> T notNull (final T aValue, @Nonnull final Supplier <? extends String> aName)
{
if (isEnabled ())
if (aValue == null)
throw new NullPointerException ("The value of '" + aName.get () + "' may not be null!");
return aValue;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"notNull",
"(",
"final",
"T",
"aValue",
",",
"@",
"Nonnull",
"final",
"Supplier",
"<",
"?",
"extends",
"String",
">",
"aName",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"if",
"(",
"aValue",
"==",
"null... | Check that the passed value is not <code>null</code>.
@param <T>
Type to be checked and returned
@param aValue
The value to check.
@param aName
The name of the value (e.g. the parameter name)
@return The passed value.
@throws NullPointerException
if the passed value is <code>null</code>. | [
"Check",
"that",
"the",
"passed",
"value",
"is",
"not",
"<code",
">",
"null<",
"/",
"code",
">",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L294-L300 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/GVRNewWrapperProvider.java | GVRNewWrapperProvider.wrapColor | @Override
public AiColor wrapColor(ByteBuffer buffer, int offset) {
AiColor color = new AiColor(buffer, offset);
return color;
} | java | @Override
public AiColor wrapColor(ByteBuffer buffer, int offset) {
AiColor color = new AiColor(buffer, offset);
return color;
} | [
"@",
"Override",
"public",
"AiColor",
"wrapColor",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"offset",
")",
"{",
"AiColor",
"color",
"=",
"new",
"AiColor",
"(",
"buffer",
",",
"offset",
")",
";",
"return",
"color",
";",
"}"
] | Wraps a RGBA color.
<p>
A color consists of 4 float values (r,g,b,a) starting from offset
@param buffer
the buffer to wrap
@param offset
the offset into buffer
@return the wrapped color | [
"Wraps",
"a",
"RGBA",
"color",
".",
"<p",
">"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/GVRNewWrapperProvider.java#L23-L27 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/dataobjects/DataframeMatrix.java | DataframeMatrix.parseRecord | public static RealVector parseRecord(Record r, Map<Object, Integer> featureIdsReference) {
if(featureIdsReference.isEmpty()) {
throw new IllegalArgumentException("The featureIdsReference map should not be empty.");
}
int d = featureIdsReference.size();
//create an Map-backed vector only if we have available info about configuration.
RealVector v = (storageEngine != null)?new MapRealVector(d):new OpenMapRealVector(d);
boolean addConstantColumn = featureIdsReference.containsKey(Dataframe.COLUMN_NAME_CONSTANT);
if(addConstantColumn) {
v.setEntry(0, 1.0); //add the constant column
}
for(Map.Entry<Object, Object> entry : r.getX().entrySet()) {
Object feature = entry.getKey();
Double value = TypeInference.toDouble(entry.getValue());
if(value!=null) {
Integer featureId = featureIdsReference.get(feature);
if(featureId!=null) {//if the feature exists
v.setEntry(featureId, value);
}
}
else {
//else the X matrix maintains the 0.0 default value
}
}
return v;
} | java | public static RealVector parseRecord(Record r, Map<Object, Integer> featureIdsReference) {
if(featureIdsReference.isEmpty()) {
throw new IllegalArgumentException("The featureIdsReference map should not be empty.");
}
int d = featureIdsReference.size();
//create an Map-backed vector only if we have available info about configuration.
RealVector v = (storageEngine != null)?new MapRealVector(d):new OpenMapRealVector(d);
boolean addConstantColumn = featureIdsReference.containsKey(Dataframe.COLUMN_NAME_CONSTANT);
if(addConstantColumn) {
v.setEntry(0, 1.0); //add the constant column
}
for(Map.Entry<Object, Object> entry : r.getX().entrySet()) {
Object feature = entry.getKey();
Double value = TypeInference.toDouble(entry.getValue());
if(value!=null) {
Integer featureId = featureIdsReference.get(feature);
if(featureId!=null) {//if the feature exists
v.setEntry(featureId, value);
}
}
else {
//else the X matrix maintains the 0.0 default value
}
}
return v;
} | [
"public",
"static",
"RealVector",
"parseRecord",
"(",
"Record",
"r",
",",
"Map",
"<",
"Object",
",",
"Integer",
">",
"featureIdsReference",
")",
"{",
"if",
"(",
"featureIdsReference",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExceptio... | Parses a single Record and converts it to RealVector by using an already
existing mapping between feature names and column ids.
@param r
@param featureIdsReference
@return | [
"Parses",
"a",
"single",
"Record",
"and",
"converts",
"it",
"to",
"RealVector",
"by",
"using",
"an",
"already",
"existing",
"mapping",
"between",
"feature",
"names",
"and",
"column",
"ids",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/dataobjects/DataframeMatrix.java#L251-L282 |
motown-io/motown | chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java | DomainService.getEvse | public Evse getEvse(Long chargingStationTypeId, Long id) {
ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);
return getEvseById(chargingStationType, id);
} | java | public Evse getEvse(Long chargingStationTypeId, Long id) {
ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);
return getEvseById(chargingStationType, id);
} | [
"public",
"Evse",
"getEvse",
"(",
"Long",
"chargingStationTypeId",
",",
"Long",
"id",
")",
"{",
"ChargingStationType",
"chargingStationType",
"=",
"chargingStationTypeRepository",
".",
"findOne",
"(",
"chargingStationTypeId",
")",
";",
"return",
"getEvseById",
"(",
"c... | Find an evse based on its id.
@param chargingStationTypeId charging station identifier.
@param id the id of the evse to find.
@return the evse. | [
"Find",
"an",
"evse",
"based",
"on",
"its",
"id",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/chargingstation-configuration/view-model/src/main/java/io/motown/chargingstationconfiguration/viewmodel/domain/DomainService.java#L292-L296 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java | Utils.isVisible | public static boolean isVisible(JvmDeclaredType fromType, JvmMember target) {
switch (target.getVisibility()) {
case DEFAULT:
return target.getDeclaringType().getPackageName().equals(fromType.getPackageName());
case PROTECTED:
case PUBLIC:
return true;
case PRIVATE:
default:
}
return false;
} | java | public static boolean isVisible(JvmDeclaredType fromType, JvmMember target) {
switch (target.getVisibility()) {
case DEFAULT:
return target.getDeclaringType().getPackageName().equals(fromType.getPackageName());
case PROTECTED:
case PUBLIC:
return true;
case PRIVATE:
default:
}
return false;
} | [
"public",
"static",
"boolean",
"isVisible",
"(",
"JvmDeclaredType",
"fromType",
",",
"JvmMember",
"target",
")",
"{",
"switch",
"(",
"target",
".",
"getVisibility",
"(",
")",
")",
"{",
"case",
"DEFAULT",
":",
"return",
"target",
".",
"getDeclaringType",
"(",
... | Replies if the target feature is visible from the type.
@param fromType - the type from which the feature visibility is tested.
@param target - the feature to test for the visibility.
@return <code>true</code> if the given type can see the target feature. | [
"Replies",
"if",
"the",
"target",
"feature",
"is",
"visible",
"from",
"the",
"type",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L345-L356 |
apache/groovy | src/main/java/org/codehaus/groovy/reflection/CachedField.java | CachedField.setProperty | public void setProperty(final Object object, Object newValue) {
AccessPermissionChecker.checkAccessPermission(field);
final Object goalValue = DefaultTypeTransformation.castToType(newValue, field.getType());
if (isFinal()) {
throw new GroovyRuntimeException("Cannot set the property '" + name + "' because the backing field is final.");
}
try {
field.set(object, goalValue);
} catch (IllegalAccessException ex) {
throw new GroovyRuntimeException("Cannot set the property '" + name + "'.", ex);
}
} | java | public void setProperty(final Object object, Object newValue) {
AccessPermissionChecker.checkAccessPermission(field);
final Object goalValue = DefaultTypeTransformation.castToType(newValue, field.getType());
if (isFinal()) {
throw new GroovyRuntimeException("Cannot set the property '" + name + "' because the backing field is final.");
}
try {
field.set(object, goalValue);
} catch (IllegalAccessException ex) {
throw new GroovyRuntimeException("Cannot set the property '" + name + "'.", ex);
}
} | [
"public",
"void",
"setProperty",
"(",
"final",
"Object",
"object",
",",
"Object",
"newValue",
")",
"{",
"AccessPermissionChecker",
".",
"checkAccessPermission",
"(",
"field",
")",
";",
"final",
"Object",
"goalValue",
"=",
"DefaultTypeTransformation",
".",
"castToTyp... | Sets the property on the given object to the new value
@param object on which to set the property
@param newValue the new value of the property
@throws RuntimeException if the property could not be set | [
"Sets",
"the",
"property",
"on",
"the",
"given",
"object",
"to",
"the",
"new",
"value"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/reflection/CachedField.java#L68-L80 |
apache/incubator-gobblin | gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/source/jdbc/JdbcExtractor.java | JdbcExtractor.updateDeltaFieldConfig | private void updateDeltaFieldConfig(String srcColumnName, String tgtColumnName) {
if (this.workUnitState.contains(ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY)) {
String watermarkCol = this.workUnitState.getProp(ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY);
this.workUnitState.setProp(ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY,
watermarkCol.replaceAll(srcColumnName, tgtColumnName));
}
} | java | private void updateDeltaFieldConfig(String srcColumnName, String tgtColumnName) {
if (this.workUnitState.contains(ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY)) {
String watermarkCol = this.workUnitState.getProp(ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY);
this.workUnitState.setProp(ConfigurationKeys.EXTRACT_DELTA_FIELDS_KEY,
watermarkCol.replaceAll(srcColumnName, tgtColumnName));
}
} | [
"private",
"void",
"updateDeltaFieldConfig",
"(",
"String",
"srcColumnName",
",",
"String",
"tgtColumnName",
")",
"{",
"if",
"(",
"this",
".",
"workUnitState",
".",
"contains",
"(",
"ConfigurationKeys",
".",
"EXTRACT_DELTA_FIELDS_KEY",
")",
")",
"{",
"String",
"wa... | Update water mark column property if there is an alias defined in query
@param srcColumnName source column name
@param tgtColumnName target column name | [
"Update",
"water",
"mark",
"column",
"property",
"if",
"there",
"is",
"an",
"alias",
"defined",
"in",
"query"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/source/jdbc/JdbcExtractor.java#L509-L515 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optString | @Nullable
public static String optString(@Nullable Bundle bundle, @Nullable String key) {
return optString(bundle, key, null);
} | java | @Nullable
public static String optString(@Nullable Bundle bundle, @Nullable String key) {
return optString(bundle, key, null);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"optString",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
")",
"{",
"return",
"optString",
"(",
"bundle",
",",
"key",
",",
"null",
")",
";",
"}"
] | Returns a optional {@link java.lang.String} value. In other words, returns the value mapped by key if it exists and is a {@link java.lang.String}.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return null.
@param key a key for the value.
@return a {@link java.lang.String} value if exists, null otherwise.
@see android.os.Bundle#getString(String) | [
"Returns",
"a",
"optional",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L965-L968 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.getReportQueryIteratorByQuery | public Iterator getReportQueryIteratorByQuery(Query query) throws PersistenceBrokerException
{
ClassDescriptor cld = getClassDescriptor(query.getSearchClass());
return getReportQueryIteratorFromQuery(query, cld);
} | java | public Iterator getReportQueryIteratorByQuery(Query query) throws PersistenceBrokerException
{
ClassDescriptor cld = getClassDescriptor(query.getSearchClass());
return getReportQueryIteratorFromQuery(query, cld);
} | [
"public",
"Iterator",
"getReportQueryIteratorByQuery",
"(",
"Query",
"query",
")",
"throws",
"PersistenceBrokerException",
"{",
"ClassDescriptor",
"cld",
"=",
"getClassDescriptor",
"(",
"query",
".",
"getSearchClass",
"(",
")",
")",
";",
"return",
"getReportQueryIterato... | Get an Iterator based on the ReportQuery
@param query
@return Iterator | [
"Get",
"an",
"Iterator",
"based",
"on",
"the",
"ReportQuery"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L2084-L2088 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/structures/BuildDatabase.java | BuildDatabase.getIdAttributes | public Set<String> getIdAttributes(final BuildData buildData) {
final Set<String> ids = new HashSet<String>();
// Add all the level id attributes
for (final Level level : levels) {
ids.add(level.getUniqueLinkId(buildData.isUseFixedUrls()));
}
// Add all the topic id attributes
for (final Entry<Integer, List<ITopicNode>> topicEntry : topics.entrySet()) {
final List<ITopicNode> topics = topicEntry.getValue();
for (final ITopicNode topic : topics) {
if (topic instanceof SpecTopic) {
final SpecTopic specTopic = (SpecTopic) topic;
ids.add(specTopic.getUniqueLinkId(buildData.isUseFixedUrls()));
}
}
}
return ids;
} | java | public Set<String> getIdAttributes(final BuildData buildData) {
final Set<String> ids = new HashSet<String>();
// Add all the level id attributes
for (final Level level : levels) {
ids.add(level.getUniqueLinkId(buildData.isUseFixedUrls()));
}
// Add all the topic id attributes
for (final Entry<Integer, List<ITopicNode>> topicEntry : topics.entrySet()) {
final List<ITopicNode> topics = topicEntry.getValue();
for (final ITopicNode topic : topics) {
if (topic instanceof SpecTopic) {
final SpecTopic specTopic = (SpecTopic) topic;
ids.add(specTopic.getUniqueLinkId(buildData.isUseFixedUrls()));
}
}
}
return ids;
} | [
"public",
"Set",
"<",
"String",
">",
"getIdAttributes",
"(",
"final",
"BuildData",
"buildData",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"ids",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"// Add all the level id attributes",
"for",
"(",
... | Get a list of all the ID Attributes of all the topics and levels held in the database.
@param buildData
@return A List of IDs that exist for levels and topics in the database. | [
"Get",
"a",
"list",
"of",
"all",
"the",
"ID",
"Attributes",
"of",
"all",
"the",
"topics",
"and",
"levels",
"held",
"in",
"the",
"database",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/structures/BuildDatabase.java#L210-L230 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java | SecurityServiceImpl.setAndValidateProperties | private void setAndValidateProperties(String systemDomain, String defaultAppDomain) {
if (isConfigurationDefinedInFile()) {
if ((systemDomain == null) || systemDomain.isEmpty()) {
Tr.error(tc, "SECURITY_SERVICE_ERROR_MISSING_ATTRIBUTE", CFG_KEY_SYSTEM_DOMAIN);
throw new IllegalArgumentException(Tr.formatMessage(tc, "SECURITY_SERVICE_ERROR_MISSING_ATTRIBUTE", CFG_KEY_SYSTEM_DOMAIN));
}
this.cfgSystemDomain = systemDomain;
if ((defaultAppDomain == null) || defaultAppDomain.isEmpty()) {
this.cfgDefaultAppDomain = systemDomain;
} else {
this.cfgDefaultAppDomain = defaultAppDomain;
}
}
} | java | private void setAndValidateProperties(String systemDomain, String defaultAppDomain) {
if (isConfigurationDefinedInFile()) {
if ((systemDomain == null) || systemDomain.isEmpty()) {
Tr.error(tc, "SECURITY_SERVICE_ERROR_MISSING_ATTRIBUTE", CFG_KEY_SYSTEM_DOMAIN);
throw new IllegalArgumentException(Tr.formatMessage(tc, "SECURITY_SERVICE_ERROR_MISSING_ATTRIBUTE", CFG_KEY_SYSTEM_DOMAIN));
}
this.cfgSystemDomain = systemDomain;
if ((defaultAppDomain == null) || defaultAppDomain.isEmpty()) {
this.cfgDefaultAppDomain = systemDomain;
} else {
this.cfgDefaultAppDomain = defaultAppDomain;
}
}
} | [
"private",
"void",
"setAndValidateProperties",
"(",
"String",
"systemDomain",
",",
"String",
"defaultAppDomain",
")",
"{",
"if",
"(",
"isConfigurationDefinedInFile",
"(",
")",
")",
"{",
"if",
"(",
"(",
"systemDomain",
"==",
"null",
")",
"||",
"systemDomain",
"."... | Sets and validates the configuration properties.
If the {@link #CFG_KEY_DEFAULT_APP_DOMAIN} property is not set, then
it will use the value of {@link #CFG_KEY_SYSTEM_DOMAIN}.
Note this method will be a no-op if there is no configuration data
from the file.
@param systemDomain
@param defaultAppDomain
@throws IllegalArgumentException if {link #CFG_KEY_SYSTEM_DOMAIN} is not set. | [
"Sets",
"and",
"validates",
"the",
"configuration",
"properties",
".",
"If",
"the",
"{",
"@link",
"#CFG_KEY_DEFAULT_APP_DOMAIN",
"}",
"property",
"is",
"not",
"set",
"then",
"it",
"will",
"use",
"the",
"value",
"of",
"{",
"@link",
"#CFG_KEY_SYSTEM_DOMAIN",
"}",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/internal/SecurityServiceImpl.java#L352-L365 |
lambdazen/bitsy | src/main/java/com/lambdazen/bitsy/store/FileBackedMemoryGraphStore.java | FileBackedMemoryGraphStore.flushTxLog | public void flushTxLog() {
synchronized (flushCompleteSignal) {
BufferName enqueueBuffer;
synchronized (txLogToVEBuf.getPot()) {
// Enqueue the backup task
enqueueBuffer = txLogToVEBuf.getEnqueueBuffer();
FlushNowJob flushJob = new FlushNowJob();
txLogToVEBuf.addAndExecuteWork(flushJob);
}
try {
do {
log.debug("Waiting for flush to complete in buffer {}", enqueueBuffer);
flushCompleteSignal.wait();
log.debug("Flush complete in buffer {}", lastFlushedBuffer);
} while (lastFlushedBuffer != enqueueBuffer);
} catch (InterruptedException e) {
BitsyException toThrow = new BitsyException(BitsyErrorCodes.FLUSH_INTERRUPTED, "Exception while waiting for a transaction-log flush to be performed", e);
log.error("Error while flushing the transaction log", toThrow);
throw toThrow;
}
}
} | java | public void flushTxLog() {
synchronized (flushCompleteSignal) {
BufferName enqueueBuffer;
synchronized (txLogToVEBuf.getPot()) {
// Enqueue the backup task
enqueueBuffer = txLogToVEBuf.getEnqueueBuffer();
FlushNowJob flushJob = new FlushNowJob();
txLogToVEBuf.addAndExecuteWork(flushJob);
}
try {
do {
log.debug("Waiting for flush to complete in buffer {}", enqueueBuffer);
flushCompleteSignal.wait();
log.debug("Flush complete in buffer {}", lastFlushedBuffer);
} while (lastFlushedBuffer != enqueueBuffer);
} catch (InterruptedException e) {
BitsyException toThrow = new BitsyException(BitsyErrorCodes.FLUSH_INTERRUPTED, "Exception while waiting for a transaction-log flush to be performed", e);
log.error("Error while flushing the transaction log", toThrow);
throw toThrow;
}
}
} | [
"public",
"void",
"flushTxLog",
"(",
")",
"{",
"synchronized",
"(",
"flushCompleteSignal",
")",
"{",
"BufferName",
"enqueueBuffer",
";",
"synchronized",
"(",
"txLogToVEBuf",
".",
"getPot",
"(",
")",
")",
"{",
"// Enqueue the backup task",
"enqueueBuffer",
"=",
"tx... | This method flushes the transaction log to the V/E text files | [
"This",
"method",
"flushes",
"the",
"transaction",
"log",
"to",
"the",
"V",
"/",
"E",
"text",
"files"
] | train | https://github.com/lambdazen/bitsy/blob/c0dd4b6c9d6dc9987d0168c91417eb04d80bf712/src/main/java/com/lambdazen/bitsy/store/FileBackedMemoryGraphStore.java#L540-L564 |
molgenis/molgenis | molgenis-jobs/src/main/java/org/molgenis/jobs/schedule/JobScheduler.java | JobScheduler.runNow | public synchronized void runNow(String scheduledJobId) {
ScheduledJob scheduledJob = getJob(scheduledJobId);
try {
JobKey jobKey = new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP);
if (quartzScheduler.checkExists(jobKey)) {
// Run job now
quartzScheduler.triggerJob(jobKey);
} else {
// Schedule with 'now' trigger
Trigger trigger =
newTrigger().withIdentity(scheduledJobId, SCHEDULED_JOB_GROUP).startNow().build();
schedule(scheduledJob, trigger);
}
} catch (SchedulerException e) {
LOG.error("Error runNow ScheduledJob", e);
throw new MolgenisDataException("Error job runNow", e);
}
} | java | public synchronized void runNow(String scheduledJobId) {
ScheduledJob scheduledJob = getJob(scheduledJobId);
try {
JobKey jobKey = new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP);
if (quartzScheduler.checkExists(jobKey)) {
// Run job now
quartzScheduler.triggerJob(jobKey);
} else {
// Schedule with 'now' trigger
Trigger trigger =
newTrigger().withIdentity(scheduledJobId, SCHEDULED_JOB_GROUP).startNow().build();
schedule(scheduledJob, trigger);
}
} catch (SchedulerException e) {
LOG.error("Error runNow ScheduledJob", e);
throw new MolgenisDataException("Error job runNow", e);
}
} | [
"public",
"synchronized",
"void",
"runNow",
"(",
"String",
"scheduledJobId",
")",
"{",
"ScheduledJob",
"scheduledJob",
"=",
"getJob",
"(",
"scheduledJobId",
")",
";",
"try",
"{",
"JobKey",
"jobKey",
"=",
"new",
"JobKey",
"(",
"scheduledJobId",
",",
"SCHEDULED_JO... | Executes a {@link ScheduledJob} immediately.
@param scheduledJobId ID of the {@link ScheduledJob} to run | [
"Executes",
"a",
"{",
"@link",
"ScheduledJob",
"}",
"immediately",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-jobs/src/main/java/org/molgenis/jobs/schedule/JobScheduler.java#L52-L70 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/VariableScopeImpl.java | VariableScopeImpl.getVariable | public Object getVariable(String variableName, boolean fetchAllVariables) {
Object value = null;
VariableInstance variable = getVariableInstance(variableName, fetchAllVariables);
if (variable != null) {
value = variable.getValue();
}
return value;
} | java | public Object getVariable(String variableName, boolean fetchAllVariables) {
Object value = null;
VariableInstance variable = getVariableInstance(variableName, fetchAllVariables);
if (variable != null) {
value = variable.getValue();
}
return value;
} | [
"public",
"Object",
"getVariable",
"(",
"String",
"variableName",
",",
"boolean",
"fetchAllVariables",
")",
"{",
"Object",
"value",
"=",
"null",
";",
"VariableInstance",
"variable",
"=",
"getVariableInstance",
"(",
"variableName",
",",
"fetchAllVariables",
")",
";",... | The same operation as {@link VariableScopeImpl#getVariable(String)},
but with an extra parameter to indicate whether or not all variables need to be fetched.
Note that the default Activiti way (because of backwards compatibility) is to fetch all the variables
when doing a get/set of variables. So this means 'true' is the default value for this method,
and in fact it will simply delegate to {@link #getVariable(String)}.
This can also be the most performant, if you're doing a lot of variable gets in the same transaction (eg in service tasks).
In case 'false' is used, only the specific variable will be fetched. | [
"The",
"same",
"operation",
"as",
"{",
"@link",
"VariableScopeImpl#getVariable",
"(",
"String",
")",
"}",
"but",
"with",
"an",
"extra",
"parameter",
"to",
"indicate",
"whether",
"or",
"not",
"all",
"variables",
"need",
"to",
"be",
"fetched",
"."
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/VariableScopeImpl.java#L250-L257 |
relayrides/pushy | pushy/src/main/java/com/turo/pushy/apns/util/ApnsPayloadBuilder.java | ApnsPayloadBuilder.setSound | public ApnsPayloadBuilder setSound(final String soundFileName, final boolean isCriticalAlert, final double soundVolume) {
Objects.requireNonNull(soundFileName, "Sound file name must not be null.");
if (soundVolume < 0 || soundVolume > 1) {
throw new IllegalArgumentException("Sound volume must be between 0.0 and 1.0 (inclusive).");
}
this.soundFileName = null;
this.soundForCriticalAlert = new SoundForCriticalAlert(soundFileName, isCriticalAlert, soundVolume);
return this;
} | java | public ApnsPayloadBuilder setSound(final String soundFileName, final boolean isCriticalAlert, final double soundVolume) {
Objects.requireNonNull(soundFileName, "Sound file name must not be null.");
if (soundVolume < 0 || soundVolume > 1) {
throw new IllegalArgumentException("Sound volume must be between 0.0 and 1.0 (inclusive).");
}
this.soundFileName = null;
this.soundForCriticalAlert = new SoundForCriticalAlert(soundFileName, isCriticalAlert, soundVolume);
return this;
} | [
"public",
"ApnsPayloadBuilder",
"setSound",
"(",
"final",
"String",
"soundFileName",
",",
"final",
"boolean",
"isCriticalAlert",
",",
"final",
"double",
"soundVolume",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"soundFileName",
",",
"\"Sound file name must not be ... | <p>Sets the name of the sound file to play when the push notification is received along with its volume and
whether it should be presented as a critical alert. According to Apple's documentation, the sound filename
should be:</p>
<blockquote>The name of a sound file in your app’s main bundle or in the {@code Library/Sounds} folder of your
app’s container directory.</blockquote>
<p>By default, no sound is included in the push notification.</p>
<p>To explicitly specify that no sound should be played as part of this notification, use
{@link #setSound(String)} with a {@code null} sound filename.</p>
@param soundFileName the name of the sound file to play; must not be {@code null}
@param isCriticalAlert specifies whether this sound should be played as a "critical alert"
@param soundVolume the volume at which to play the sound; must be between 0.0 (silent) and 1.0 (loudest)
@return a reference to this payload builder
@see ApnsPayloadBuilder#DEFAULT_SOUND_FILENAME
@since 0.13.3 | [
"<p",
">",
"Sets",
"the",
"name",
"of",
"the",
"sound",
"file",
"to",
"play",
"when",
"the",
"push",
"notification",
"is",
"received",
"along",
"with",
"its",
"volume",
"and",
"whether",
"it",
"should",
"be",
"presented",
"as",
"a",
"critical",
"alert",
... | train | https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/util/ApnsPayloadBuilder.java#L469-L480 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java | SDMath.eye | public SDVariable eye(String name, int rows, int cols, DataType dataType, int... batchDimension) {
SDVariable eye = new Eye(sd, rows, cols, dataType, batchDimension).outputVariables()[0];
return updateVariableNameAndReference(eye, name);
} | java | public SDVariable eye(String name, int rows, int cols, DataType dataType, int... batchDimension) {
SDVariable eye = new Eye(sd, rows, cols, dataType, batchDimension).outputVariables()[0];
return updateVariableNameAndReference(eye, name);
} | [
"public",
"SDVariable",
"eye",
"(",
"String",
"name",
",",
"int",
"rows",
",",
"int",
"cols",
",",
"DataType",
"dataType",
",",
"int",
"...",
"batchDimension",
")",
"{",
"SDVariable",
"eye",
"=",
"new",
"Eye",
"(",
"sd",
",",
"rows",
",",
"cols",
",",
... | Generate an identity matrix with the specified number of rows and columns, with optional leading dims<br>
Example:<br>
batchShape: [3,3]<br>
numRows: 2<br>
numCols: 4<br>
returns a tensor of shape (3, 3, 2, 4) that consists of 3 * 3 batches of (2,4)-shaped identity matrices:<br>
1 0 0 0<br>
0 1 0 0<br>
@param rows Number of rows
@param cols Number of columns
@param batchDimension Batch dimensions. May be null | [
"Generate",
"an",
"identity",
"matrix",
"with",
"the",
"specified",
"number",
"of",
"rows",
"and",
"columns",
"with",
"optional",
"leading",
"dims<br",
">",
"Example",
":",
"<br",
">",
"batchShape",
":",
"[",
"3",
"3",
"]",
"<br",
">",
"numRows",
":",
"2... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L1043-L1046 |
dkmfbk/knowledgestore | ks-server/src/main/java/eu/fbk/knowledgestore/triplestore/SelectQuery.java | SelectQuery.replaceDataset | public SelectQuery replaceDataset(@Nullable final Dataset dataset) {
if (Objects.equal(this.dataset, dataset)) {
return this;
} else {
try {
return from(this.expression, dataset);
} catch (final ParseException ex) {
throw new Error("Unexpected error - replacing dataset made the query invalid (!)",
ex);
}
}
} | java | public SelectQuery replaceDataset(@Nullable final Dataset dataset) {
if (Objects.equal(this.dataset, dataset)) {
return this;
} else {
try {
return from(this.expression, dataset);
} catch (final ParseException ex) {
throw new Error("Unexpected error - replacing dataset made the query invalid (!)",
ex);
}
}
} | [
"public",
"SelectQuery",
"replaceDataset",
"(",
"@",
"Nullable",
"final",
"Dataset",
"dataset",
")",
"{",
"if",
"(",
"Objects",
".",
"equal",
"(",
"this",
".",
"dataset",
",",
"dataset",
")",
")",
"{",
"return",
"this",
";",
"}",
"else",
"{",
"try",
"{... | Replaces the dataset of this query with the one specified, returning the resulting
<tt>SelectQuery</tt> object.
@param dataset
the new dataset; as usual, <tt>null</tt> denotes the default dataset (all the
graphs)
@return the resulting <tt>SelectQuery</tt> object (possibly <tt>this</tt> if no change is
required) | [
"Replaces",
"the",
"dataset",
"of",
"this",
"query",
"with",
"the",
"one",
"specified",
"returning",
"the",
"resulting",
"<tt",
">",
"SelectQuery<",
"/",
"tt",
">",
"object",
"."
] | train | https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-server/src/main/java/eu/fbk/knowledgestore/triplestore/SelectQuery.java#L199-L210 |
ben-manes/caffeine | jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java | CacheProxy.writeAllToCacheWriter | private @Nullable CacheWriterException writeAllToCacheWriter(Map<? extends K, ? extends V> map) {
if (!configuration.isWriteThrough() || map.isEmpty()) {
return null;
}
List<Cache.Entry<? extends K, ? extends V>> entries = map.entrySet().stream()
.map(entry -> new EntryProxy<>(entry.getKey(), entry.getValue()))
.collect(toList());
try {
writer.writeAll(entries);
return null;
} catch (CacheWriterException e) {
entries.forEach(entry -> {
map.remove(entry.getKey());
});
throw e;
} catch (RuntimeException e) {
entries.forEach(entry -> {
map.remove(entry.getKey());
});
return new CacheWriterException("Exception in CacheWriter", e);
}
} | java | private @Nullable CacheWriterException writeAllToCacheWriter(Map<? extends K, ? extends V> map) {
if (!configuration.isWriteThrough() || map.isEmpty()) {
return null;
}
List<Cache.Entry<? extends K, ? extends V>> entries = map.entrySet().stream()
.map(entry -> new EntryProxy<>(entry.getKey(), entry.getValue()))
.collect(toList());
try {
writer.writeAll(entries);
return null;
} catch (CacheWriterException e) {
entries.forEach(entry -> {
map.remove(entry.getKey());
});
throw e;
} catch (RuntimeException e) {
entries.forEach(entry -> {
map.remove(entry.getKey());
});
return new CacheWriterException("Exception in CacheWriter", e);
}
} | [
"private",
"@",
"Nullable",
"CacheWriterException",
"writeAllToCacheWriter",
"(",
"Map",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"map",
")",
"{",
"if",
"(",
"!",
"configuration",
".",
"isWriteThrough",
"(",
")",
"||",
"map",
".",
"isEmpty"... | Writes all of the entries to the cache writer if write-through is enabled. | [
"Writes",
"all",
"of",
"the",
"entries",
"to",
"the",
"cache",
"writer",
"if",
"write",
"-",
"through",
"is",
"enabled",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L1008-L1029 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.scaleLocal | public Matrix4f scaleLocal(float x, float y, float z) {
return scaleLocal(x, y, z, thisOrNew());
} | java | public Matrix4f scaleLocal(float x, float y, float z) {
return scaleLocal(x, y, z, thisOrNew());
} | [
"public",
"Matrix4f",
"scaleLocal",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"return",
"scaleLocal",
"(",
"x",
",",
"y",
",",
"z",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"
] | Pre-multiply scaling to this matrix by scaling the base axes by the given x,
y and z factors.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>S * M</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>S * M * v</code>, the
scaling will be applied last!
@param x
the factor of the x component
@param y
the factor of the y component
@param z
the factor of the z component
@return a matrix holding the result | [
"Pre",
"-",
"multiply",
"scaling",
"to",
"this",
"matrix",
"by",
"scaling",
"the",
"base",
"axes",
"by",
"the",
"given",
"x",
"y",
"and",
"z",
"factors",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L4964-L4966 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java | PactDslJsonArray.eachLike | public PactDslJsonArray eachLike(PactDslJsonRootValue value, int numberExamples) {
if (numberExamples == 0) {
throw new IllegalArgumentException("Testing Zero examples is unsafe. Please make sure to provide at least one " +
"example in the Pact provider implementation. See https://github.com/DiUS/pact-jvm/issues/546");
}
matchers.addRule(rootPath + appendArrayIndex(1), matchMin(0));
PactDslJsonArray parent = new PactDslJsonArray(rootPath, "", this, true);
parent.setNumberExamples(numberExamples);
parent.putObject(value);
return (PactDslJsonArray) parent.closeArray();
} | java | public PactDslJsonArray eachLike(PactDslJsonRootValue value, int numberExamples) {
if (numberExamples == 0) {
throw new IllegalArgumentException("Testing Zero examples is unsafe. Please make sure to provide at least one " +
"example in the Pact provider implementation. See https://github.com/DiUS/pact-jvm/issues/546");
}
matchers.addRule(rootPath + appendArrayIndex(1), matchMin(0));
PactDslJsonArray parent = new PactDslJsonArray(rootPath, "", this, true);
parent.setNumberExamples(numberExamples);
parent.putObject(value);
return (PactDslJsonArray) parent.closeArray();
} | [
"public",
"PactDslJsonArray",
"eachLike",
"(",
"PactDslJsonRootValue",
"value",
",",
"int",
"numberExamples",
")",
"{",
"if",
"(",
"numberExamples",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Testing Zero examples is unsafe. Please make sure ... | Array of values that are not objects where each item must match the provided example
@param value Value to use to match each item
@param numberExamples number of examples to generate | [
"Array",
"of",
"values",
"that",
"are",
"not",
"objects",
"where",
"each",
"item",
"must",
"match",
"the",
"provided",
"example"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L1034-L1045 |
Harium/keel | src/main/java/com/harium/keel/core/helper/ColorHelper.java | ColorHelper.fromHSL | public static int fromHSL(float h, float s, float l) {
int alpha = MAX_INT;
return fromHSL(h, s, l, alpha);
} | java | public static int fromHSL(float h, float s, float l) {
int alpha = MAX_INT;
return fromHSL(h, s, l, alpha);
} | [
"public",
"static",
"int",
"fromHSL",
"(",
"float",
"h",
",",
"float",
"s",
",",
"float",
"l",
")",
"{",
"int",
"alpha",
"=",
"MAX_INT",
";",
"return",
"fromHSL",
"(",
"h",
",",
"s",
",",
"l",
",",
"alpha",
")",
";",
"}"
] | Method to transform from HSL to RGB (this method sets alpha as 0xff)
@param h - hue
@param s - saturation
@param l - lightness
@return rgb | [
"Method",
"to",
"transform",
"from",
"HSL",
"to",
"RGB",
"(",
"this",
"method",
"sets",
"alpha",
"as",
"0xff",
")"
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/core/helper/ColorHelper.java#L451-L454 |
probedock/probedock-java | src/main/java/io/probedock/client/common/utils/Inflector.java | Inflector.forgeName | public static String forgeName(Class cl, Method m, ProbeTest methodAnnotation) {
return forgeName(cl, m.getName(), methodAnnotation);
} | java | public static String forgeName(Class cl, Method m, ProbeTest methodAnnotation) {
return forgeName(cl, m.getName(), methodAnnotation);
} | [
"public",
"static",
"String",
"forgeName",
"(",
"Class",
"cl",
",",
"Method",
"m",
",",
"ProbeTest",
"methodAnnotation",
")",
"{",
"return",
"forgeName",
"(",
"cl",
",",
"m",
".",
"getName",
"(",
")",
",",
"methodAnnotation",
")",
";",
"}"
] | Forge a name from a class and a method. If an annotation is provided, then the method
content is used.
@param cl Class to get the name
@param m Method to get the name
@param methodAnnotation The method annotation to override the normal forged name
@return The name forge and humanize | [
"Forge",
"a",
"name",
"from",
"a",
"class",
"and",
"a",
"method",
".",
"If",
"an",
"annotation",
"is",
"provided",
"then",
"the",
"method",
"content",
"is",
"used",
"."
] | train | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/common/utils/Inflector.java#L23-L25 |
doubledutch/LazyJSON | src/main/java/me/doubledutch/lazyjson/LazyNode.java | LazyNode.getDoubleValue | protected double getDoubleValue() throws LazyException{
double d=0.0;
String str=getStringValue();
try{
d=Double.parseDouble(str);
}catch(NumberFormatException nfe){
// This basically can't happen since we already validate the numeric format when parsing
// throw new LazyException("'"+str+"' is not a valid double",startIndex);
}
return d;
} | java | protected double getDoubleValue() throws LazyException{
double d=0.0;
String str=getStringValue();
try{
d=Double.parseDouble(str);
}catch(NumberFormatException nfe){
// This basically can't happen since we already validate the numeric format when parsing
// throw new LazyException("'"+str+"' is not a valid double",startIndex);
}
return d;
} | [
"protected",
"double",
"getDoubleValue",
"(",
")",
"throws",
"LazyException",
"{",
"double",
"d",
"=",
"0.0",
";",
"String",
"str",
"=",
"getStringValue",
"(",
")",
";",
"try",
"{",
"d",
"=",
"Double",
".",
"parseDouble",
"(",
"str",
")",
";",
"}",
"ca... | Parses the characters of this token and attempts to construct a double
value from them.
@return the double value if it could be parsed
@throws LazyException if the value could not be parsed | [
"Parses",
"the",
"characters",
"of",
"this",
"token",
"and",
"attempts",
"to",
"construct",
"a",
"double",
"value",
"from",
"them",
"."
] | train | https://github.com/doubledutch/LazyJSON/blob/1a223f57fc0cb9941bc175739697ac95da5618cc/src/main/java/me/doubledutch/lazyjson/LazyNode.java#L386-L396 |
zaproxy/zaproxy | src/org/parosproxy/paros/view/WorkbenchPanel.java | WorkbenchPanel.addPanels | private static void addPanels(TabbedPanel2 tabbedPanel, List<AbstractPanel> panels, boolean visible) {
for (AbstractPanel panel : panels) {
addPanel(tabbedPanel, panel, visible);
}
tabbedPanel.revalidate();
} | java | private static void addPanels(TabbedPanel2 tabbedPanel, List<AbstractPanel> panels, boolean visible) {
for (AbstractPanel panel : panels) {
addPanel(tabbedPanel, panel, visible);
}
tabbedPanel.revalidate();
} | [
"private",
"static",
"void",
"addPanels",
"(",
"TabbedPanel2",
"tabbedPanel",
",",
"List",
"<",
"AbstractPanel",
">",
"panels",
",",
"boolean",
"visible",
")",
"{",
"for",
"(",
"AbstractPanel",
"panel",
":",
"panels",
")",
"{",
"addPanel",
"(",
"tabbedPanel",
... | Adds the given {@code panels} to the given {@code tabbedPanel} and whether they should be visible.
<p>
After adding all the panels the tabbed panel is revalidated.
@param tabbedPanel the tabbed panel to add the panels
@param panels the panels to add
@param visible {@code true} if the panel should be visible, {@code false} otherwise.
@see #addPanel(TabbedPanel2, AbstractPanel, boolean)
@see javax.swing.JComponent#revalidate() | [
"Adds",
"the",
"given",
"{",
"@code",
"panels",
"}",
"to",
"the",
"given",
"{",
"@code",
"tabbedPanel",
"}",
"and",
"whether",
"they",
"should",
"be",
"visible",
".",
"<p",
">",
"After",
"adding",
"all",
"the",
"panels",
"the",
"tabbed",
"panel",
"is",
... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L878-L883 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java | CPInstancePersistenceImpl.findByLtD_S | @Override
public List<CPInstance> findByLtD_S(Date displayDate, int status,
int start, int end) {
return findByLtD_S(displayDate, status, start, end, null);
} | java | @Override
public List<CPInstance> findByLtD_S(Date displayDate, int status,
int start, int end) {
return findByLtD_S(displayDate, status, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPInstance",
">",
"findByLtD_S",
"(",
"Date",
"displayDate",
",",
"int",
"status",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByLtD_S",
"(",
"displayDate",
",",
"status",
",",
"start",
",",
"... | Returns a range of all the cp instances where displayDate < ? and status = ?.
<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 CPInstanceModelImpl}. 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 displayDate the display date
@param status the status
@param start the lower bound of the range of cp instances
@param end the upper bound of the range of cp instances (not inclusive)
@return the range of matching cp instances | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"instances",
"where",
"displayDate",
"<",
";",
"?",
";",
"and",
"status",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L5674-L5678 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java | SeleniumHelper.dragAndDrop | public void dragAndDrop(WebElement source, WebElement target) {
getActions().dragAndDrop(source, target).perform();
} | java | public void dragAndDrop(WebElement source, WebElement target) {
getActions().dragAndDrop(source, target).perform();
} | [
"public",
"void",
"dragAndDrop",
"(",
"WebElement",
"source",
",",
"WebElement",
"target",
")",
"{",
"getActions",
"(",
")",
".",
"dragAndDrop",
"(",
"source",
",",
"target",
")",
".",
"perform",
"(",
")",
";",
"}"
] | Simulates a drag from source element and drop to target element
@param source element to start the drag
@param target element to end the drag | [
"Simulates",
"a",
"drag",
"from",
"source",
"element",
"and",
"drop",
"to",
"target",
"element"
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L582-L584 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.getXteaSignature | public final static void getXteaSignature(byte[] array, int offset, int keyid) {
int num_rounds = 32;
int v0, v1, sum = 0, delta = 0x9E3779B9;
int[] k = XTEA_KEYS[keyid];
v0 = ByteBuffer.wrap(array, offset, 4).getInt();
v1 = ByteBuffer.wrap(array, offset + 4, 4).getInt();
for (int i = 0; i < num_rounds; i++) {
v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]);
sum += delta;
v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum >> 11) & 3]);
}
ByteBuffer tmp = ByteBuffer.allocate(4);
tmp.putInt(v0);
tmp.flip();
System.arraycopy(tmp.array(), 0, array, offset, 4);
tmp.clear();
tmp.putInt(v1);
tmp.flip();
System.arraycopy(tmp.array(), 0, array, offset + 4, 4);
} | java | public final static void getXteaSignature(byte[] array, int offset, int keyid) {
int num_rounds = 32;
int v0, v1, sum = 0, delta = 0x9E3779B9;
int[] k = XTEA_KEYS[keyid];
v0 = ByteBuffer.wrap(array, offset, 4).getInt();
v1 = ByteBuffer.wrap(array, offset + 4, 4).getInt();
for (int i = 0; i < num_rounds; i++) {
v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]);
sum += delta;
v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum >> 11) & 3]);
}
ByteBuffer tmp = ByteBuffer.allocate(4);
tmp.putInt(v0);
tmp.flip();
System.arraycopy(tmp.array(), 0, array, offset, 4);
tmp.clear();
tmp.putInt(v1);
tmp.flip();
System.arraycopy(tmp.array(), 0, array, offset + 4, 4);
} | [
"public",
"final",
"static",
"void",
"getXteaSignature",
"(",
"byte",
"[",
"]",
"array",
",",
"int",
"offset",
",",
"int",
"keyid",
")",
"{",
"int",
"num_rounds",
"=",
"32",
";",
"int",
"v0",
",",
"v1",
",",
"sum",
"=",
"0",
",",
"delta",
"=",
"0x9... | RTMPE type 8 uses XTEA on the regular signature http://en.wikipedia.org/wiki/XTEA
@param array array to get signature
@param offset offset to start from
@param keyid ID of XTEA key | [
"RTMPE",
"type",
"8",
"uses",
"XTEA",
"on",
"the",
"regular",
"signature",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"XTEA"
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L554-L573 |
finmath/finmath-lib | src/main/java/net/finmath/time/SchedulePrototype.java | SchedulePrototype.generateSchedule | public Schedule generateSchedule(LocalDate referenceDate, int maturity, int termination) {
return generateSchedule(referenceDate, maturity, termination, OffsetUnit.MONTHS);
} | java | public Schedule generateSchedule(LocalDate referenceDate, int maturity, int termination) {
return generateSchedule(referenceDate, maturity, termination, OffsetUnit.MONTHS);
} | [
"public",
"Schedule",
"generateSchedule",
"(",
"LocalDate",
"referenceDate",
",",
"int",
"maturity",
",",
"int",
"termination",
")",
"{",
"return",
"generateSchedule",
"(",
"referenceDate",
",",
"maturity",
",",
"termination",
",",
"OffsetUnit",
".",
"MONTHS",
")"... | Generate a schedule with start / end date determined by an offset in months from the reference date.
@param referenceDate The reference date (corresponds to \( t = 0 \).
@param maturity Offset of the start date to the reference date in months
@param termination Offset of the end date to the start date
@return The schedule | [
"Generate",
"a",
"schedule",
"with",
"start",
"/",
"end",
"date",
"determined",
"by",
"an",
"offset",
"in",
"months",
"from",
"the",
"reference",
"date",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/SchedulePrototype.java#L152-L154 |
beangle/beangle3 | struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java | Component.fieldError | protected StrutsException fieldError(String field, String errorMsg, Exception e) {
String msg = "tag '" + getComponentName() + "', field '" + field
+ (parameters != null && parameters.containsKey("name") ? "', name '" + parameters.get("name") : "")
+ "': " + errorMsg;
throw new StrutsException(msg, e);
} | java | protected StrutsException fieldError(String field, String errorMsg, Exception e) {
String msg = "tag '" + getComponentName() + "', field '" + field
+ (parameters != null && parameters.containsKey("name") ? "', name '" + parameters.get("name") : "")
+ "': " + errorMsg;
throw new StrutsException(msg, e);
} | [
"protected",
"StrutsException",
"fieldError",
"(",
"String",
"field",
",",
"String",
"errorMsg",
",",
"Exception",
"e",
")",
"{",
"String",
"msg",
"=",
"\"tag '\"",
"+",
"getComponentName",
"(",
")",
"+",
"\"', field '\"",
"+",
"field",
"+",
"(",
"parameters",... | Constructs a <code>RuntimeException</code> based on the given
information.
<p/>
A message is constructed and logged at ERROR level before being returned as a
<code>RuntimeException</code>.
@param field
field name used when throwing <code>RuntimeException</code>.
@param errorMsg
error message used when throwing <code>RuntimeException</code> .
@param e
the caused exception, can be <tt>null</tt>.
@return the constructed <code>StrutsException</code>. | [
"Constructs",
"a",
"<code",
">",
"RuntimeException<",
"/",
"code",
">",
"based",
"on",
"the",
"given",
"information",
".",
"<p",
"/",
">",
"A",
"message",
"is",
"constructed",
"and",
"logged",
"at",
"ERROR",
"level",
"before",
"being",
"returned",
"as",
"a... | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/view/component/Component.java#L207-L212 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java | ReviewsImpl.getVideoFrames | public Frames getVideoFrames(String teamName, String reviewId, GetVideoFramesOptionalParameter getVideoFramesOptionalParameter) {
return getVideoFramesWithServiceResponseAsync(teamName, reviewId, getVideoFramesOptionalParameter).toBlocking().single().body();
} | java | public Frames getVideoFrames(String teamName, String reviewId, GetVideoFramesOptionalParameter getVideoFramesOptionalParameter) {
return getVideoFramesWithServiceResponseAsync(teamName, reviewId, getVideoFramesOptionalParameter).toBlocking().single().body();
} | [
"public",
"Frames",
"getVideoFrames",
"(",
"String",
"teamName",
",",
"String",
"reviewId",
",",
"GetVideoFramesOptionalParameter",
"getVideoFramesOptionalParameter",
")",
"{",
"return",
"getVideoFramesWithServiceResponseAsync",
"(",
"teamName",
",",
"reviewId",
",",
"getVi... | The reviews created would show up for Reviewers on your team. As Reviewers complete reviewing, results of the Review would be POSTED (i.e. HTTP POST) on the specified CallBackEndpoint.
<h3>CallBack Schemas </h3>
<h4>Review Completion CallBack Sample</h4>
<p>
{<br/>
"ReviewId": "<Review Id>",<br/>
"ModifiedOn": "2016-10-11T22:36:32.9934851Z",<br/>
"ModifiedBy": "<Name of the Reviewer>",<br/>
"CallBackType": "Review",<br/>
"ContentId": "<The ContentId that was specified input>",<br/>
"Metadata": {<br/>
"adultscore": "0.xxx",<br/>
"a": "False",<br/>
"racyscore": "0.xxx",<br/>
"r": "True"<br/>
},<br/>
"ReviewerResultTags": {<br/>
"a": "False",<br/>
"r": "True"<br/>
}<br/>
}<br/>
</p>.
@param teamName Your team name.
@param reviewId Id of the review.
@param getVideoFramesOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the Frames object if successful. | [
"The",
"reviews",
"created",
"would",
"show",
"up",
"for",
"Reviewers",
"on",
"your",
"team",
".",
"As",
"Reviewers",
"complete",
"reviewing",
"results",
"of",
"the",
"Review",
"would",
"be",
"POSTED",
"(",
"i",
".",
"e",
".",
"HTTP",
"POST",
")",
"on",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L1342-L1344 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MXmlWriter.java | MXmlWriter.writeXml | protected void writeXml(MListTable<?> table, OutputStream outputStream) throws IOException {
final List<?> list = table.getList();
TransportFormatAdapter.writeXml((Serializable) list, outputStream);
} | java | protected void writeXml(MListTable<?> table, OutputStream outputStream) throws IOException {
final List<?> list = table.getList();
TransportFormatAdapter.writeXml((Serializable) list, outputStream);
} | [
"protected",
"void",
"writeXml",
"(",
"MListTable",
"<",
"?",
">",
"table",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
"?",
">",
"list",
"=",
"table",
".",
"getList",
"(",
")",
";",
"TransportFormatAdapter",... | Exporte une MListTable dans un fichier au format xml.
@param table MListTable
@param outputStream OutputStream
@throws IOException Erreur disque | [
"Exporte",
"une",
"MListTable",
"dans",
"un",
"fichier",
"au",
"format",
"xml",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MXmlWriter.java#L73-L76 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.toLongFunction | public static <T> ToLongFunction<T> toLongFunction(CheckedToLongFunction<T> function, Consumer<Throwable> handler) {
return t -> {
try {
return function.applyAsLong(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static <T> ToLongFunction<T> toLongFunction(CheckedToLongFunction<T> function, Consumer<Throwable> handler) {
return t -> {
try {
return function.applyAsLong(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"ToLongFunction",
"<",
"T",
">",
"toLongFunction",
"(",
"CheckedToLongFunction",
"<",
"T",
">",
"function",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"t",
"->",
"{",
"try",
"{",
"return",
"f... | Wrap a {@link CheckedToLongFunction} in a {@link ToLongFunction} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
map.forEach(Unchecked.toLongFunction(
k -> {
if (k.length() > 10)
throw new Exception("Only short strings allowed");
return 42L;
},
e -> {
throw new IllegalStateException(e);
}
));
</pre></code> | [
"Wrap",
"a",
"{",
"@link",
"CheckedToLongFunction",
"}",
"in",
"a",
"{",
"@link",
"ToLongFunction",
"}",
"with",
"a",
"custom",
"handler",
"for",
"checked",
"exceptions",
".",
"<p",
">",
"Example",
":",
"<code",
">",
"<pre",
">",
"map",
".",
"forEach",
"... | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L971-L982 |
HubSpot/Singularity | SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java | SingularityClient.getPendingSingularityRequests | public Collection<SingularityPendingRequest> getPendingSingularityRequests() {
final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_PENDING_FORMAT, getApiBase(host));
return getCollection(requestUri, "pending requests", PENDING_REQUESTS_COLLECTION);
} | java | public Collection<SingularityPendingRequest> getPendingSingularityRequests() {
final Function<String, String> requestUri = (host) -> String.format(REQUESTS_GET_PENDING_FORMAT, getApiBase(host));
return getCollection(requestUri, "pending requests", PENDING_REQUESTS_COLLECTION);
} | [
"public",
"Collection",
"<",
"SingularityPendingRequest",
">",
"getPendingSingularityRequests",
"(",
")",
"{",
"final",
"Function",
"<",
"String",
",",
"String",
">",
"requestUri",
"=",
"(",
"host",
")",
"-",
">",
"String",
".",
"format",
"(",
"REQUESTS_GET_PEND... | Get all requests that are pending to become ACTIVE
@return
A collection of {@link SingularityPendingRequest} instances that hold information about the singularity requests that are pending to become ACTIVE | [
"Get",
"all",
"requests",
"that",
"are",
"pending",
"to",
"become",
"ACTIVE"
] | train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L802-L806 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/colorpicker/ColorPickerHelper.java | ColorPickerHelper.rgbToColorConverter | public static Color rgbToColorConverter(final String value) {
if (StringUtils.isEmpty(value) || (!StringUtils.isEmpty(value) && !value.startsWith("rgb"))) {
throw new IllegalArgumentException(
"String to convert is empty or of invalid format - value: '" + value + "'");
}
// RGB color format rgb/rgba(255,255,255,0.1)
final String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(",");
final int red = Integer.parseInt(colors[0]);
final int green = Integer.parseInt(colors[1]);
final int blue = Integer.parseInt(colors[2]);
if (colors.length > 3) {
final int alpha = (int) (Double.parseDouble(colors[3]) * 255D);
return new Color(red, green, blue, alpha);
}
return new Color(red, green, blue);
} | java | public static Color rgbToColorConverter(final String value) {
if (StringUtils.isEmpty(value) || (!StringUtils.isEmpty(value) && !value.startsWith("rgb"))) {
throw new IllegalArgumentException(
"String to convert is empty or of invalid format - value: '" + value + "'");
}
// RGB color format rgb/rgba(255,255,255,0.1)
final String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(",");
final int red = Integer.parseInt(colors[0]);
final int green = Integer.parseInt(colors[1]);
final int blue = Integer.parseInt(colors[2]);
if (colors.length > 3) {
final int alpha = (int) (Double.parseDouble(colors[3]) * 255D);
return new Color(red, green, blue, alpha);
}
return new Color(red, green, blue);
} | [
"public",
"static",
"Color",
"rgbToColorConverter",
"(",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"value",
")",
"||",
"(",
"!",
"StringUtils",
".",
"isEmpty",
"(",
"value",
")",
"&&",
"!",
"value",
".",
"starts... | Covert RGB code to {@link Color}.
@param value
RGB vale
@return Color | [
"Covert",
"RGB",
"code",
"to",
"{",
"@link",
"Color",
"}",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/colorpicker/ColorPickerHelper.java#L51-L68 |
realtime-framework/RealtimeMessaging-Android | library/src/main/java/ibt/ortc/extensibility/ChannelSubscription.java | ChannelSubscription.runHandler | public void runHandler(OrtcClient sender, String channel, String message){
this.runHandler(sender, channel, message, false, null);
} | java | public void runHandler(OrtcClient sender, String channel, String message){
this.runHandler(sender, channel, message, false, null);
} | [
"public",
"void",
"runHandler",
"(",
"OrtcClient",
"sender",
",",
"String",
"channel",
",",
"String",
"message",
")",
"{",
"this",
".",
"runHandler",
"(",
"sender",
",",
"channel",
",",
"message",
",",
"false",
",",
"null",
")",
";",
"}"
] | Fires the event handler that is associated the subscribed channel
@param channel
@param sender
@param message | [
"Fires",
"the",
"event",
"handler",
"that",
"is",
"associated",
"the",
"subscribed",
"channel"
] | train | https://github.com/realtime-framework/RealtimeMessaging-Android/blob/f0d87b92ed7c591bcfe2b9cf45b947865570e061/library/src/main/java/ibt/ortc/extensibility/ChannelSubscription.java#L111-L113 |
beihaifeiwu/dolphin | dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/merge/expression/NormalAnnotationExprMerger.java | NormalAnnotationExprMerger.doIsEquals | @Override
public boolean doIsEquals(NormalAnnotationExpr first, NormalAnnotationExpr second) {
boolean equals = true;
if (!first.getName().equals(second.getName())) equals = false;
if (equals == true) {
if (first.getPairs() == null) return second.getPairs() == null;
if (!isSmallerHasEqualsInBigger(first.getPairs(), second.getPairs(), true)) return false;
}
return equals;
} | java | @Override
public boolean doIsEquals(NormalAnnotationExpr first, NormalAnnotationExpr second) {
boolean equals = true;
if (!first.getName().equals(second.getName())) equals = false;
if (equals == true) {
if (first.getPairs() == null) return second.getPairs() == null;
if (!isSmallerHasEqualsInBigger(first.getPairs(), second.getPairs(), true)) return false;
}
return equals;
} | [
"@",
"Override",
"public",
"boolean",
"doIsEquals",
"(",
"NormalAnnotationExpr",
"first",
",",
"NormalAnnotationExpr",
"second",
")",
"{",
"boolean",
"equals",
"=",
"true",
";",
"if",
"(",
"!",
"first",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"second",... | 1. check the name
2. check the member including key and value
if their size is not the same and the less one is all matched in the more one return true | [
"1",
".",
"check",
"the",
"name",
"2",
".",
"check",
"the",
"member",
"including",
"key",
"and",
"value",
"if",
"their",
"size",
"is",
"not",
"the",
"same",
"and",
"the",
"less",
"one",
"is",
"all",
"matched",
"in",
"the",
"more",
"one",
"return",
"t... | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/merge/expression/NormalAnnotationExprMerger.java#L29-L45 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/predefined/RequestOrientedStats.java | RequestOrientedStats.getAverageRequestDuration | public double getAverageRequestDuration(String intervalName, TimeUnit unit) {
return unit.transformNanos(totalTime.getValueAsLong(intervalName)) / totalRequests.getValueAsDouble(intervalName);
} | java | public double getAverageRequestDuration(String intervalName, TimeUnit unit) {
return unit.transformNanos(totalTime.getValueAsLong(intervalName)) / totalRequests.getValueAsDouble(intervalName);
} | [
"public",
"double",
"getAverageRequestDuration",
"(",
"String",
"intervalName",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"unit",
".",
"transformNanos",
"(",
"totalTime",
".",
"getValueAsLong",
"(",
"intervalName",
")",
")",
"/",
"totalRequests",
".",
"getValue... | Returns the average request duration for the given interval and converted to the given timeunit.
@param intervalName name of the interval.
@param unit timeunit.
@return | [
"Returns",
"the",
"average",
"request",
"duration",
"for",
"the",
"given",
"interval",
"and",
"converted",
"to",
"the",
"given",
"timeunit",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/RequestOrientedStats.java#L240-L242 |
jbundle/jbundle | thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/cal/JCalendarDualField.java | JCalendarDualField.init | public void init(Convert converter, boolean bAddCalendarButton, boolean bAddTimeButton)
{
m_converter = converter;
this.setBorder(null);
this.setOpaque(false);
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
String strDefault = null;
int iColumns = 15;
if (m_converter != null)
{
strDefault = m_converter.getString();
iColumns = m_converter.getMaxLength();
}
m_tf = new JTextField(strDefault, iColumns);
this.add(m_tf);
BaseApplet applet = BaseApplet.getSharedInstance();
if (bAddCalendarButton)
{
m_button = new JButton(applet.loadImageIcon(JCalendarPopup.CALENDAR_ICON));
m_button.setMargin(JCalendarPopup.NO_INSETS);
m_button.setOpaque(false);
this.add(m_button);
m_button.addActionListener(this);
}
if (bAddTimeButton)
{
m_buttonTime = new JButton(applet.loadImageIcon(JTimePopup.TIME_ICON));
m_buttonTime.setMargin(JCalendarPopup.NO_INSETS);
m_buttonTime.setOpaque(false);
this.add(m_buttonTime);
m_buttonTime.addActionListener(this);
}
} | java | public void init(Convert converter, boolean bAddCalendarButton, boolean bAddTimeButton)
{
m_converter = converter;
this.setBorder(null);
this.setOpaque(false);
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
String strDefault = null;
int iColumns = 15;
if (m_converter != null)
{
strDefault = m_converter.getString();
iColumns = m_converter.getMaxLength();
}
m_tf = new JTextField(strDefault, iColumns);
this.add(m_tf);
BaseApplet applet = BaseApplet.getSharedInstance();
if (bAddCalendarButton)
{
m_button = new JButton(applet.loadImageIcon(JCalendarPopup.CALENDAR_ICON));
m_button.setMargin(JCalendarPopup.NO_INSETS);
m_button.setOpaque(false);
this.add(m_button);
m_button.addActionListener(this);
}
if (bAddTimeButton)
{
m_buttonTime = new JButton(applet.loadImageIcon(JTimePopup.TIME_ICON));
m_buttonTime.setMargin(JCalendarPopup.NO_INSETS);
m_buttonTime.setOpaque(false);
this.add(m_buttonTime);
m_buttonTime.addActionListener(this);
}
} | [
"public",
"void",
"init",
"(",
"Convert",
"converter",
",",
"boolean",
"bAddCalendarButton",
",",
"boolean",
"bAddTimeButton",
")",
"{",
"m_converter",
"=",
"converter",
";",
"this",
".",
"setBorder",
"(",
"null",
")",
";",
"this",
".",
"setOpaque",
"(",
"fa... | Creates new JCalendarDualField.
@param The field this component is tied to. | [
"Creates",
"new",
"JCalendarDualField",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/cal/JCalendarDualField.java#L97-L131 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java | AmazonDynamoDBClient.deleteTable | public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(deleteTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<DeleteTableRequest> request = marshall(deleteTableRequest,
new DeleteTableRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<DeleteTableResult, JsonUnmarshallerContext> unmarshaller = new DeleteTableResultJsonUnmarshaller();
JsonResponseHandler<DeleteTableResult> responseHandler = new JsonResponseHandler<DeleteTableResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | java | public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(deleteTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<DeleteTableRequest> request = marshall(deleteTableRequest,
new DeleteTableRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<DeleteTableResult, JsonUnmarshallerContext> unmarshaller = new DeleteTableResultJsonUnmarshaller();
JsonResponseHandler<DeleteTableResult> responseHandler = new JsonResponseHandler<DeleteTableResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | [
"public",
"DeleteTableResult",
"deleteTable",
"(",
"DeleteTableRequest",
"deleteTableRequest",
")",
"throws",
"AmazonServiceException",
",",
"AmazonClientException",
"{",
"ExecutionContext",
"executionContext",
"=",
"createExecutionContext",
"(",
"deleteTableRequest",
")",
";",... | <p>
Deletes a table and all of its items.
</p>
<p>
If the table is in the <code>ACTIVE</code> state, you can delete it.
If a table is in <code>CREATING</code> or <code>UPDATING</code> states
then Amazon DynamoDB returns a <code>ResourceInUseException</code> .
If the specified table does not exist, Amazon DynamoDB returns a
<code>ResourceNotFoundException</code> .
</p>
@param deleteTableRequest Container for the necessary parameters to
execute the DeleteTable service method on AmazonDynamoDB.
@return The response from the DeleteTable service method, as returned
by AmazonDynamoDB.
@throws ResourceInUseException
@throws LimitExceededException
@throws InternalServerErrorException
@throws ResourceNotFoundException
@throws AmazonClientException
If any internal errors are encountered inside the client while
attempting to make the request or handle the response. For example
if a network connection is not available.
@throws AmazonServiceException
If an error response is returned by AmazonDynamoDB indicating
either a problem with the data in the request, or a server side issue. | [
"<p",
">",
"Deletes",
"a",
"table",
"and",
"all",
"of",
"its",
"items",
".",
"<",
"/",
"p",
">",
"<p",
">",
"If",
"the",
"table",
"is",
"in",
"the",
"<code",
">",
"ACTIVE<",
"/",
"code",
">",
"state",
"you",
"can",
"delete",
"it",
".",
"If",
"a... | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L766-L778 |
elki-project/elki | elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/spatial/SpatialUtil.java | SpatialUtil.volumeScaled | public static double volumeScaled(SpatialComparable box, double scale) {
final int dim = box.getDimensionality();
double vol = 1.;
for(int i = 0; i < dim; i++) {
double delta = box.getMax(i) - box.getMin(i);
if(delta == 0.) {
return 0.;
}
vol *= delta * scale;
}
return vol;
} | java | public static double volumeScaled(SpatialComparable box, double scale) {
final int dim = box.getDimensionality();
double vol = 1.;
for(int i = 0; i < dim; i++) {
double delta = box.getMax(i) - box.getMin(i);
if(delta == 0.) {
return 0.;
}
vol *= delta * scale;
}
return vol;
} | [
"public",
"static",
"double",
"volumeScaled",
"(",
"SpatialComparable",
"box",
",",
"double",
"scale",
")",
"{",
"final",
"int",
"dim",
"=",
"box",
".",
"getDimensionality",
"(",
")",
";",
"double",
"vol",
"=",
"1.",
";",
"for",
"(",
"int",
"i",
"=",
"... | Computes the volume of this SpatialComparable.
@param box Box
@param scale Scaling factor
@return the volume of this SpatialComparable | [
"Computes",
"the",
"volume",
"of",
"this",
"SpatialComparable",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/spatial/SpatialUtil.java#L196-L207 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java | PluginAdapterUtility.configureProperties | public static Map<String, Object> configureProperties(final PropertyResolver resolver,
final Object object) {
//use a default scope of InstanceOnly if the Property doesn't specify it
return configureProperties(resolver, buildDescription(object, DescriptionBuilder.builder()), object,
PropertyScope.InstanceOnly);
} | java | public static Map<String, Object> configureProperties(final PropertyResolver resolver,
final Object object) {
//use a default scope of InstanceOnly if the Property doesn't specify it
return configureProperties(resolver, buildDescription(object, DescriptionBuilder.builder()), object,
PropertyScope.InstanceOnly);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"configureProperties",
"(",
"final",
"PropertyResolver",
"resolver",
",",
"final",
"Object",
"object",
")",
"{",
"//use a default scope of InstanceOnly if the Property doesn't specify it",
"return",
"configurePro... | Set field values on a plugin object by using annotated field values to create a Description, and setting field
values to resolved property values. Any resolved properties that are not mapped to a field will be included in
the return result.
@param resolver property resolver
@param object plugin object
@return Map of resolved properties that were not configured in the object's fields | [
"Set",
"field",
"values",
"on",
"a",
"plugin",
"object",
"by",
"using",
"annotated",
"field",
"values",
"to",
"create",
"a",
"Description",
"and",
"setting",
"field",
"values",
"to",
"resolved",
"property",
"values",
".",
"Any",
"resolved",
"properties",
"that... | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PluginAdapterUtility.java#L337-L342 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java | ComparableExtensions.operator_spaceship | @Pure /* not guaranteed, since compareTo() is invoked */
@Inline("($1.compareTo($2))")
public static <C> int operator_spaceship(Comparable<? super C> left, C right) {
return left.compareTo(right);
} | java | @Pure /* not guaranteed, since compareTo() is invoked */
@Inline("($1.compareTo($2))")
public static <C> int operator_spaceship(Comparable<? super C> left, C right) {
return left.compareTo(right);
} | [
"@",
"Pure",
"/* not guaranteed, since compareTo() is invoked */",
"@",
"Inline",
"(",
"\"($1.compareTo($2))\"",
")",
"public",
"static",
"<",
"C",
">",
"int",
"operator_spaceship",
"(",
"Comparable",
"<",
"?",
"super",
"C",
">",
"left",
",",
"C",
"right",
")",
... | The spaceship operator <code><=></code>.
@param left
a comparable
@param right
the value to compare with
@return <code>left.compareTo(right)</code>
@since 2.4 | [
"The",
"spaceship",
"operator",
"<code",
">",
"<",
";",
"=",
">",
";",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java#L90-L94 |
alipay/sofa-rpc | extension-impl/codec-protobuf/src/main/java/com/alipay/sofa/rpc/codec/protobuf/ProtobufHelper.java | ProtobufHelper.getResClass | public Class getResClass(String service, String methodName) {
String key = service + "#" + methodName;
Class reqClass = responseClassCache.get(key);
if (reqClass == null) {
// 读取接口里的方法参数和返回值
String interfaceClass = ConfigUniqueNameGenerator.getInterfaceName(service);
Class clazz = ClassUtils.forName(interfaceClass, true);
loadProtoClassToCache(key, clazz, methodName);
}
return responseClassCache.get(key);
} | java | public Class getResClass(String service, String methodName) {
String key = service + "#" + methodName;
Class reqClass = responseClassCache.get(key);
if (reqClass == null) {
// 读取接口里的方法参数和返回值
String interfaceClass = ConfigUniqueNameGenerator.getInterfaceName(service);
Class clazz = ClassUtils.forName(interfaceClass, true);
loadProtoClassToCache(key, clazz, methodName);
}
return responseClassCache.get(key);
} | [
"public",
"Class",
"getResClass",
"(",
"String",
"service",
",",
"String",
"methodName",
")",
"{",
"String",
"key",
"=",
"service",
"+",
"\"#\"",
"+",
"methodName",
";",
"Class",
"reqClass",
"=",
"responseClassCache",
".",
"get",
"(",
"key",
")",
";",
"if"... | 从缓存中获取返回值类
@param service 接口名
@param methodName 方法名
@return 请求参数类 | [
"从缓存中获取返回值类"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/codec-protobuf/src/main/java/com/alipay/sofa/rpc/codec/protobuf/ProtobufHelper.java#L88-L98 |
darylteo/directory-watcher | src/main/java/com/darylteo/nio/AbstractDirectoryWatchService.java | AbstractDirectoryWatchService.newWatcher | public DirectoryWatcher newWatcher(Path dir, String separator) throws IOException {
DirectoryWatcher watcher = new DirectoryWatcher(this.watchService, dir, separator);
addWatcher(watcher);
return watcher;
} | java | public DirectoryWatcher newWatcher(Path dir, String separator) throws IOException {
DirectoryWatcher watcher = new DirectoryWatcher(this.watchService, dir, separator);
addWatcher(watcher);
return watcher;
} | [
"public",
"DirectoryWatcher",
"newWatcher",
"(",
"Path",
"dir",
",",
"String",
"separator",
")",
"throws",
"IOException",
"{",
"DirectoryWatcher",
"watcher",
"=",
"new",
"DirectoryWatcher",
"(",
"this",
".",
"watchService",
",",
"dir",
",",
"separator",
")",
";"... | <p>
Instantiates a new DirectoryWatcher for the path given.
</p>
@param dir the path to watch for events.
@param separator the file path separator for this watcher
@return a DirectoryWatcher for this path (and all child paths)
@throws IOException | [
"<p",
">",
"Instantiates",
"a",
"new",
"DirectoryWatcher",
"for",
"the",
"path",
"given",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/darylteo/directory-watcher/blob/c1144366dcf58443073c0a67d1a5f6535ac5e8d8/src/main/java/com/darylteo/nio/AbstractDirectoryWatchService.java#L93-L98 |
zeroturnaround/zt-exec | src/main/java/org/zeroturnaround/exec/ProcessExecutor.java | ProcessExecutor.wrapTask | protected <T> Callable<T> wrapTask(Callable<T> task) {
// Preserve the MDC context of the caller thread.
Map contextMap = MDC.getCopyOfContextMap();
if (contextMap != null) {
return new MDCCallableAdapter(task, contextMap);
}
return task;
} | java | protected <T> Callable<T> wrapTask(Callable<T> task) {
// Preserve the MDC context of the caller thread.
Map contextMap = MDC.getCopyOfContextMap();
if (contextMap != null) {
return new MDCCallableAdapter(task, contextMap);
}
return task;
} | [
"protected",
"<",
"T",
">",
"Callable",
"<",
"T",
">",
"wrapTask",
"(",
"Callable",
"<",
"T",
">",
"task",
")",
"{",
"// Preserve the MDC context of the caller thread.",
"Map",
"contextMap",
"=",
"MDC",
".",
"getCopyOfContextMap",
"(",
")",
";",
"if",
"(",
"... | Override this to customize how the background task is created.
@param <T> the type of the Task
@param task the Task to be wrapped
@return the wrapped task | [
"Override",
"this",
"to",
"customize",
"how",
"the",
"background",
"task",
"is",
"created",
"."
] | train | https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/ProcessExecutor.java#L1179-L1186 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.findIndexValues | public static List<Number> findIndexValues(Object self, Closure condition) {
return findIndexValues(self, 0, condition);
} | java | public static List<Number> findIndexValues(Object self, Closure condition) {
return findIndexValues(self, 0, condition);
} | [
"public",
"static",
"List",
"<",
"Number",
">",
"findIndexValues",
"(",
"Object",
"self",
",",
"Closure",
"condition",
")",
"{",
"return",
"findIndexValues",
"(",
"self",
",",
"0",
",",
"condition",
")",
";",
"}"
] | Iterates over the elements of an aggregate of items and returns
the index values of the items that match the condition specified in the closure.
@param self the iteration object over which to iterate
@param condition the matching condition
@return a list of numbers corresponding to the index values of all matched objects
@since 1.5.2 | [
"Iterates",
"over",
"the",
"elements",
"of",
"an",
"aggregate",
"of",
"items",
"and",
"returns",
"the",
"index",
"values",
"of",
"the",
"items",
"that",
"match",
"the",
"condition",
"specified",
"in",
"the",
"closure",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16944-L16946 |
google/error-prone | core/src/main/java/com/google/errorprone/refaster/BlockTemplate.java | BlockTemplate.printStatement | private static String printStatement(Context context, JCStatement statement) {
StringWriter writer = new StringWriter();
try {
pretty(context, writer).printStat(statement);
} catch (IOException e) {
throw new AssertionError("StringWriter cannot throw IOExceptions");
}
return writer.toString();
} | java | private static String printStatement(Context context, JCStatement statement) {
StringWriter writer = new StringWriter();
try {
pretty(context, writer).printStat(statement);
} catch (IOException e) {
throw new AssertionError("StringWriter cannot throw IOExceptions");
}
return writer.toString();
} | [
"private",
"static",
"String",
"printStatement",
"(",
"Context",
"context",
",",
"JCStatement",
"statement",
")",
"{",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"try",
"{",
"pretty",
"(",
"context",
",",
"writer",
")",
".",
"printS... | Returns a {@code String} representation of a statement, including semicolon. | [
"Returns",
"a",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/refaster/BlockTemplate.java#L176-L184 |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SessionManagerUtil.java | SessionManagerUtil.parseHaSipSessionKey | public static SipSessionKey parseHaSipSessionKey(
String sipSessionKey, String sipAppSessionId, String sipApplicationName) throws ParseException {
if(logger.isDebugEnabled()) {
logger.debug("parseHaSipSessionKey - sipSessionKey=" + sipSessionKey + ", sipAppSessionId=" + sipAppSessionId + ", sipApplicationName=" + sipApplicationName);
}
StringTokenizer stringTokenizer = new StringTokenizer(sipSessionKey, SESSION_KEY_SEPARATOR);
String fromTag = stringTokenizer.nextToken();
String callId = stringTokenizer.nextToken();
return new SipSessionKey(fromTag, null, callId, sipAppSessionId, sipApplicationName);
} | java | public static SipSessionKey parseHaSipSessionKey(
String sipSessionKey, String sipAppSessionId, String sipApplicationName) throws ParseException {
if(logger.isDebugEnabled()) {
logger.debug("parseHaSipSessionKey - sipSessionKey=" + sipSessionKey + ", sipAppSessionId=" + sipAppSessionId + ", sipApplicationName=" + sipApplicationName);
}
StringTokenizer stringTokenizer = new StringTokenizer(sipSessionKey, SESSION_KEY_SEPARATOR);
String fromTag = stringTokenizer.nextToken();
String callId = stringTokenizer.nextToken();
return new SipSessionKey(fromTag, null, callId, sipAppSessionId, sipApplicationName);
} | [
"public",
"static",
"SipSessionKey",
"parseHaSipSessionKey",
"(",
"String",
"sipSessionKey",
",",
"String",
"sipAppSessionId",
",",
"String",
"sipApplicationName",
")",
"throws",
"ParseException",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
... | Parse a sip application key that was previously generated and put as an http request param
through the encodeURL method of SipApplicationSession
@param sipSessionKey the stringified version of the sip application key
@return the corresponding sip application session key
@throws ParseException if the stringfied key cannot be parse to a valid key | [
"Parse",
"a",
"sip",
"application",
"key",
"that",
"was",
"previously",
"generated",
"and",
"put",
"as",
"an",
"http",
"request",
"param",
"through",
"the",
"encodeURL",
"method",
"of",
"SipApplicationSession"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SessionManagerUtil.java#L208-L219 |
pressgang-ccms/PressGangCCMSDatasourceProviders | rest-provider/src/main/java/org/jboss/pressgang/ccms/provider/RESTDataProvider.java | RESTDataProvider.getExpansion | protected ExpandDataTrunk getExpansion(final String expansionName, final Map<String, Collection<String>> subExpansionNames) {
final ExpandDataTrunk expandData = new ExpandDataTrunk(new ExpandDataDetails(expansionName));
// Add the sub expansions
expandData.setBranches(getExpansionBranches(subExpansionNames));
return expandData;
} | java | protected ExpandDataTrunk getExpansion(final String expansionName, final Map<String, Collection<String>> subExpansionNames) {
final ExpandDataTrunk expandData = new ExpandDataTrunk(new ExpandDataDetails(expansionName));
// Add the sub expansions
expandData.setBranches(getExpansionBranches(subExpansionNames));
return expandData;
} | [
"protected",
"ExpandDataTrunk",
"getExpansion",
"(",
"final",
"String",
"expansionName",
",",
"final",
"Map",
"<",
"String",
",",
"Collection",
"<",
"String",
">",
">",
"subExpansionNames",
")",
"{",
"final",
"ExpandDataTrunk",
"expandData",
"=",
"new",
"ExpandDat... | Create an expansion with sub expansions.
@param expansionName The name of the root expansion.
@param subExpansionNames The list of names to create the branches from.
@return The expansion with the branches set. | [
"Create",
"an",
"expansion",
"with",
"sub",
"expansions",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSDatasourceProviders/blob/e47588adad0dcd55608b197b37825a512bc8fd25/rest-provider/src/main/java/org/jboss/pressgang/ccms/provider/RESTDataProvider.java#L241-L246 |
aws/aws-sdk-java | aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchdomain/model/SearchResult.java | SearchResult.withStats | public SearchResult withStats(java.util.Map<String, FieldStats> stats) {
setStats(stats);
return this;
} | java | public SearchResult withStats(java.util.Map<String, FieldStats> stats) {
setStats(stats);
return this;
} | [
"public",
"SearchResult",
"withStats",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"FieldStats",
">",
"stats",
")",
"{",
"setStats",
"(",
"stats",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The requested field statistics information.
</p>
@param stats
The requested field statistics information.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"requested",
"field",
"statistics",
"information",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchdomain/model/SearchResult.java#L234-L237 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java | PatchModuleInvalidationUtils.validateLocalFileRecord | private static boolean validateLocalFileRecord(FileChannel channel, long startLocRecord, long compressedSize) throws IOException {
ByteBuffer lfhBuffer = getByteBuffer(LOCLEN);
read(lfhBuffer, channel, startLocRecord);
if (lfhBuffer.limit() < LOCLEN || getUnsignedInt(lfhBuffer, 0) != LOCSIG) {
return false;
}
if (compressedSize == -1) {
// We can't further evaluate
return true;
}
int fnLen = getUnsignedShort(lfhBuffer, LOC_FILENAMELEN);
int extFieldLen = getUnsignedShort(lfhBuffer, LOC_EXTFLDLEN);
long nextSigPos = startLocRecord + LOCLEN + compressedSize + fnLen + extFieldLen;
read(lfhBuffer, channel, nextSigPos);
long header = getUnsignedInt(lfhBuffer, 0);
return header == LOCSIG || header == EXTSIG || header == CENSIG;
} | java | private static boolean validateLocalFileRecord(FileChannel channel, long startLocRecord, long compressedSize) throws IOException {
ByteBuffer lfhBuffer = getByteBuffer(LOCLEN);
read(lfhBuffer, channel, startLocRecord);
if (lfhBuffer.limit() < LOCLEN || getUnsignedInt(lfhBuffer, 0) != LOCSIG) {
return false;
}
if (compressedSize == -1) {
// We can't further evaluate
return true;
}
int fnLen = getUnsignedShort(lfhBuffer, LOC_FILENAMELEN);
int extFieldLen = getUnsignedShort(lfhBuffer, LOC_EXTFLDLEN);
long nextSigPos = startLocRecord + LOCLEN + compressedSize + fnLen + extFieldLen;
read(lfhBuffer, channel, nextSigPos);
long header = getUnsignedInt(lfhBuffer, 0);
return header == LOCSIG || header == EXTSIG || header == CENSIG;
} | [
"private",
"static",
"boolean",
"validateLocalFileRecord",
"(",
"FileChannel",
"channel",
",",
"long",
"startLocRecord",
",",
"long",
"compressedSize",
")",
"throws",
"IOException",
"{",
"ByteBuffer",
"lfhBuffer",
"=",
"getByteBuffer",
"(",
"LOCLEN",
")",
";",
"read... | Checks that the data starting at startLocRecord looks like a local file record header.
@param channel the channel
@param startLocRecord offset into channel of the start of the local record
@param compressedSize expected compressed size of the file, or -1 to indicate this isn't known | [
"Checks",
"that",
"the",
"data",
"starting",
"at",
"startLocRecord",
"looks",
"like",
"a",
"local",
"file",
"record",
"header",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/PatchModuleInvalidationUtils.java#L469-L489 |
susom/database | src/main/java/com/github/susom/database/DatabaseProviderVertx.java | DatabaseProviderVertx.transactAsync | public <T> void transactAsync(final DbCodeTyped<T> code, Handler<AsyncResult<T>> resultHandler) {
VertxUtil.executeBlocking(executor, future -> {
try {
T returnValue;
boolean complete = false;
try {
returnValue = code.run(this);
complete = true;
} catch (ThreadDeath | DatabaseException t) {
throw t;
} catch (Throwable t) {
throw new DatabaseException("Error during transaction", t);
} finally {
if (!complete) {
rollbackAndClose();
} else {
commitAndClose();
}
}
future.complete(returnValue);
} catch (ThreadDeath t) {
throw t;
} catch (Throwable t) {
future.fail(t);
}
}, resultHandler);
} | java | public <T> void transactAsync(final DbCodeTyped<T> code, Handler<AsyncResult<T>> resultHandler) {
VertxUtil.executeBlocking(executor, future -> {
try {
T returnValue;
boolean complete = false;
try {
returnValue = code.run(this);
complete = true;
} catch (ThreadDeath | DatabaseException t) {
throw t;
} catch (Throwable t) {
throw new DatabaseException("Error during transaction", t);
} finally {
if (!complete) {
rollbackAndClose();
} else {
commitAndClose();
}
}
future.complete(returnValue);
} catch (ThreadDeath t) {
throw t;
} catch (Throwable t) {
future.fail(t);
}
}, resultHandler);
} | [
"public",
"<",
"T",
">",
"void",
"transactAsync",
"(",
"final",
"DbCodeTyped",
"<",
"T",
">",
"code",
",",
"Handler",
"<",
"AsyncResult",
"<",
"T",
">",
">",
"resultHandler",
")",
"{",
"VertxUtil",
".",
"executeBlocking",
"(",
"executor",
",",
"future",
... | Execute a transaction on a Vert.x worker thread, with default semantics (commit if
the code completes successfully, or rollback if it throws an error). The provided
result handler will be call after the commit or rollback, and will run on the event
loop thread (the same thread that is calling this method). | [
"Execute",
"a",
"transaction",
"on",
"a",
"Vert",
".",
"x",
"worker",
"thread",
"with",
"default",
"semantics",
"(",
"commit",
"if",
"the",
"code",
"completes",
"successfully",
"or",
"rollback",
"if",
"it",
"throws",
"an",
"error",
")",
".",
"The",
"provid... | train | https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProviderVertx.java#L191-L217 |
buschmais/jqa-core-framework | rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/XmlRuleParserPlugin.java | XmlRuleParserPlugin.getSeverity | private Severity getSeverity(SeverityEnumType severityType, Severity defaultSeverity) throws RuleException {
return severityType == null ? defaultSeverity : Severity.fromValue(severityType.value());
} | java | private Severity getSeverity(SeverityEnumType severityType, Severity defaultSeverity) throws RuleException {
return severityType == null ? defaultSeverity : Severity.fromValue(severityType.value());
} | [
"private",
"Severity",
"getSeverity",
"(",
"SeverityEnumType",
"severityType",
",",
"Severity",
"defaultSeverity",
")",
"throws",
"RuleException",
"{",
"return",
"severityType",
"==",
"null",
"?",
"defaultSeverity",
":",
"Severity",
".",
"fromValue",
"(",
"severityTyp... | Get the severity.
@param severityType
The severity type.
@param defaultSeverity
The default severity.
@return The severity. | [
"Get",
"the",
"severity",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/XmlRuleParserPlugin.java#L274-L276 |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/ServletUtil.java | ServletUtil.resourceExists | @Deprecated
public static boolean resourceExists(ServletContext servletContext, String path) throws MalformedURLException {
return getResource(servletContext, path)!=null;
} | java | @Deprecated
public static boolean resourceExists(ServletContext servletContext, String path) throws MalformedURLException {
return getResource(servletContext, path)!=null;
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"resourceExists",
"(",
"ServletContext",
"servletContext",
",",
"String",
"path",
")",
"throws",
"MalformedURLException",
"{",
"return",
"getResource",
"(",
"servletContext",
",",
"path",
")",
"!=",
"null",
";",
"}... | Checks if a resource with the possibly-relative path exists.
@deprecated Use regular methods directly
@see ServletContext#getResource(java.lang.String)
@see ServletContextCache#getResource(java.lang.String)
@see ServletContextCache#getResource(javax.servlet.ServletContext, java.lang.String) | [
"Checks",
"if",
"a",
"resource",
"with",
"the",
"possibly",
"-",
"relative",
"path",
"exists",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L189-L192 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java | LockTable.ixLock | void ixLock(Object obj, long txNum) {
Object anchor = getAnchor(obj);
txWaitMap.put(txNum, anchor);
synchronized (anchor) {
Lockers lks = prepareLockers(obj);
if (hasIxLock(lks, txNum))
return;
try {
long timestamp = System.currentTimeMillis();
while (!ixLockable(lks, txNum) && !waitingTooLong(timestamp)) {
avoidDeadlock(lks, txNum, IX_LOCK);
lks.requestSet.add(txNum);
anchor.wait(MAX_TIME);
lks.requestSet.remove(txNum);
}
if (!ixLockable(lks, txNum))
throw new LockAbortException();
lks.ixLockers.add(txNum);
getObjectSet(txNum).add(obj);
} catch (InterruptedException e) {
throw new LockAbortException();
}
}
txWaitMap.remove(txNum);
} | java | void ixLock(Object obj, long txNum) {
Object anchor = getAnchor(obj);
txWaitMap.put(txNum, anchor);
synchronized (anchor) {
Lockers lks = prepareLockers(obj);
if (hasIxLock(lks, txNum))
return;
try {
long timestamp = System.currentTimeMillis();
while (!ixLockable(lks, txNum) && !waitingTooLong(timestamp)) {
avoidDeadlock(lks, txNum, IX_LOCK);
lks.requestSet.add(txNum);
anchor.wait(MAX_TIME);
lks.requestSet.remove(txNum);
}
if (!ixLockable(lks, txNum))
throw new LockAbortException();
lks.ixLockers.add(txNum);
getObjectSet(txNum).add(obj);
} catch (InterruptedException e) {
throw new LockAbortException();
}
}
txWaitMap.remove(txNum);
} | [
"void",
"ixLock",
"(",
"Object",
"obj",
",",
"long",
"txNum",
")",
"{",
"Object",
"anchor",
"=",
"getAnchor",
"(",
"obj",
")",
";",
"txWaitMap",
".",
"put",
"(",
"txNum",
",",
"anchor",
")",
";",
"synchronized",
"(",
"anchor",
")",
"{",
"Lockers",
"l... | Grants an ixlock on the specified item. If any conflict lock exists when
the method is called, then the calling thread will be placed on a wait
list until the lock is released. If the thread remains on the wait list
for a certain amount of time, then an exception is thrown.
@param obj
a lockable item
@param txNum
a transaction number | [
"Grants",
"an",
"ixlock",
"on",
"the",
"specified",
"item",
".",
"If",
"any",
"conflict",
"lock",
"exists",
"when",
"the",
"method",
"is",
"called",
"then",
"the",
"calling",
"thread",
"will",
"be",
"placed",
"on",
"a",
"wait",
"list",
"until",
"the",
"l... | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/tx/concurrency/LockTable.java#L346-L373 |
cqframework/clinical_quality_language | Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java | ElmBaseVisitor.visitTupleElementDefinition | public T visitTupleElementDefinition(TupleElementDefinition elm, C context) {
visitElement(elm.getType(), context);
return null;
} | java | public T visitTupleElementDefinition(TupleElementDefinition elm, C context) {
visitElement(elm.getType(), context);
return null;
} | [
"public",
"T",
"visitTupleElementDefinition",
"(",
"TupleElementDefinition",
"elm",
",",
"C",
"context",
")",
"{",
"visitElement",
"(",
"elm",
".",
"getType",
"(",
")",
",",
"context",
")",
";",
"return",
"null",
";",
"}"
] | Visit a TupleElementDefinition. This method will be called for
every node in the tree that is a TupleElementDefinition.
@param elm the ELM tree
@param context the context passed to the visitor
@return the visitor result | [
"Visit",
"a",
"TupleElementDefinition",
".",
"This",
"method",
"will",
"be",
"called",
"for",
"every",
"node",
"in",
"the",
"tree",
"that",
"is",
"a",
"TupleElementDefinition",
"."
] | train | https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L97-L100 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.addCrossBlacklist | public ResponseWrapper addCrossBlacklist(String username, CrossBlacklist[] blacklists)
throws APIConnectionException, APIRequestException {
return _crossAppClient.addCrossBlacklist(username, blacklists);
} | java | public ResponseWrapper addCrossBlacklist(String username, CrossBlacklist[] blacklists)
throws APIConnectionException, APIRequestException {
return _crossAppClient.addCrossBlacklist(username, blacklists);
} | [
"public",
"ResponseWrapper",
"addCrossBlacklist",
"(",
"String",
"username",
",",
"CrossBlacklist",
"[",
"]",
"blacklists",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_crossAppClient",
".",
"addCrossBlacklist",
"(",
"username",
... | Add blacklist whose users belong to another app to a given user.
@param username The owner of the blacklist
@param blacklists CrossBlacklist array
@return No Content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Add",
"blacklist",
"whose",
"users",
"belong",
"to",
"another",
"app",
"to",
"a",
"given",
"user",
"."
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L619-L622 |
srikalyc/Sql4D | Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DruidNodeAccessor.java | DruidNodeAccessor.postJson | public CloseableHttpResponse postJson(String url, String json, Map<String, String> reqHeaders) throws IOException {
CloseableHttpClient req = getClient();
CloseableHttpResponse resp = null;
HttpPost post = new HttpPost(url);
addHeaders(post, reqHeaders);
post.setHeader(json, url);
StringEntity input = new StringEntity(json, ContentType.APPLICATION_JSON);
post.setEntity(input);
resp = req.execute(post);
return resp;
} | java | public CloseableHttpResponse postJson(String url, String json, Map<String, String> reqHeaders) throws IOException {
CloseableHttpClient req = getClient();
CloseableHttpResponse resp = null;
HttpPost post = new HttpPost(url);
addHeaders(post, reqHeaders);
post.setHeader(json, url);
StringEntity input = new StringEntity(json, ContentType.APPLICATION_JSON);
post.setEntity(input);
resp = req.execute(post);
return resp;
} | [
"public",
"CloseableHttpResponse",
"postJson",
"(",
"String",
"url",
",",
"String",
"json",
",",
"Map",
"<",
"String",
",",
"String",
">",
"reqHeaders",
")",
"throws",
"IOException",
"{",
"CloseableHttpClient",
"req",
"=",
"getClient",
"(",
")",
";",
"Closeabl... | Convenient method for POSTing json strings. It is the responsibility of the
caller to call returnClient() to ensure clean state of the pool.
@param url
@param json
@param reqHeaders
@return
@throws IOException | [
"Convenient",
"method",
"for",
"POSTing",
"json",
"strings",
".",
"It",
"is",
"the",
"responsibility",
"of",
"the",
"caller",
"to",
"call",
"returnClient",
"()",
"to",
"ensure",
"clean",
"state",
"of",
"the",
"pool",
"."
] | train | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4Ddriver/src/main/java/com/yahoo/sql4d/sql4ddriver/DruidNodeAccessor.java#L133-L143 |
jbundle/jbundle | thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java | ThinTableModel.setColumnValue | public boolean setColumnValue(int iColumnIndex, Object value, boolean bDisplay, int iMoveMode)
{
Convert fieldInfo = this.getFieldInfo(iColumnIndex);
if (fieldInfo != null)
{
Object dataBefore = fieldInfo.getData();
if (!(value instanceof String))
fieldInfo.setData(value, bDisplay, iMoveMode);
else
fieldInfo.setString((String)value, bDisplay, iMoveMode);
Object dataAfter = fieldInfo.getData();
if (dataBefore == null)
return (dataAfter != null);
else
return (!dataBefore.equals(dataAfter));
}
return false;
} | java | public boolean setColumnValue(int iColumnIndex, Object value, boolean bDisplay, int iMoveMode)
{
Convert fieldInfo = this.getFieldInfo(iColumnIndex);
if (fieldInfo != null)
{
Object dataBefore = fieldInfo.getData();
if (!(value instanceof String))
fieldInfo.setData(value, bDisplay, iMoveMode);
else
fieldInfo.setString((String)value, bDisplay, iMoveMode);
Object dataAfter = fieldInfo.getData();
if (dataBefore == null)
return (dataAfter != null);
else
return (!dataBefore.equals(dataAfter));
}
return false;
} | [
"public",
"boolean",
"setColumnValue",
"(",
"int",
"iColumnIndex",
",",
"Object",
"value",
",",
"boolean",
"bDisplay",
",",
"int",
"iMoveMode",
")",
"{",
"Convert",
"fieldInfo",
"=",
"this",
".",
"getFieldInfo",
"(",
"iColumnIndex",
")",
";",
"if",
"(",
"fie... | Set the value at the field at the column.
Since this is only used by the restore current record method,
pass dont_display and read_move when you set the data.
This is NOT a TableModel override, this is my method.
@param iColumnIndex The column.
@param value The raw data value or string to set.
@return True if the value at this cell changed. | [
"Set",
"the",
"value",
"at",
"the",
"field",
"at",
"the",
"column",
".",
"Since",
"this",
"is",
"only",
"used",
"by",
"the",
"restore",
"current",
"record",
"method",
"pass",
"dont_display",
"and",
"read_move",
"when",
"you",
"set",
"the",
"data",
".",
"... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/ThinTableModel.java#L291-L308 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseQuantifierExpression | private Expr parseQuantifierExpression(Token lookahead, EnclosingScope scope, boolean terminated) {
int start = index - 1;
scope = scope.newEnclosingScope();
match(LeftCurly);
// Parse one or more source variables / expressions
Tuple<Decl.Variable> parameters = parseQuantifierParameters(scope);
// Parse condition over source variables
Expr condition = parseLogicalExpression(scope, true);
//
match(RightCurly);
//
Expr.Quantifier qf;
if (lookahead.kind == All) {
qf = new Expr.UniversalQuantifier(parameters, condition);
} else {
qf = new Expr.ExistentialQuantifier(parameters, condition);
}
return annotateSourceLocation(qf, start);
} | java | private Expr parseQuantifierExpression(Token lookahead, EnclosingScope scope, boolean terminated) {
int start = index - 1;
scope = scope.newEnclosingScope();
match(LeftCurly);
// Parse one or more source variables / expressions
Tuple<Decl.Variable> parameters = parseQuantifierParameters(scope);
// Parse condition over source variables
Expr condition = parseLogicalExpression(scope, true);
//
match(RightCurly);
//
Expr.Quantifier qf;
if (lookahead.kind == All) {
qf = new Expr.UniversalQuantifier(parameters, condition);
} else {
qf = new Expr.ExistentialQuantifier(parameters, condition);
}
return annotateSourceLocation(qf, start);
} | [
"private",
"Expr",
"parseQuantifierExpression",
"(",
"Token",
"lookahead",
",",
"EnclosingScope",
"scope",
",",
"boolean",
"terminated",
")",
"{",
"int",
"start",
"=",
"index",
"-",
"1",
";",
"scope",
"=",
"scope",
".",
"newEnclosingScope",
"(",
")",
";",
"m... | Parse a quantifier expression, which is of the form:
<pre>
QuantExpr ::= ("no" | "some" | "all")
'{'
Identifier "in" Expr (',' Identifier "in" Expr)+
'|' LogicalExpr
'}'
</pre>
@param scope
The enclosing scope for this statement, which determines the
set of visible (i.e. declared) variables and also the current
indentation level.
@param terminated
This indicates that the expression is known to be terminated
(or not). An expression that's known to be terminated is one
which is guaranteed to be followed by something. This is
important because it means that we can ignore any newline
characters encountered in parsing this expression, and that
we'll never overrun the end of the expression (i.e. because
there's guaranteed to be something which terminates this
expression). A classic situation where terminated is true is
when parsing an expression surrounded in braces. In such case,
we know the right-brace will always terminate this expression.
@return | [
"Parse",
"a",
"quantifier",
"expression",
"which",
"is",
"of",
"the",
"form",
":"
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L1932-L1950 |
centic9/commons-dost | src/main/java/org/dstadler/commons/svn/SVNCommands.java | SVNCommands.getBranchRevision | public static long getBranchRevision(String branch, String baseUrl) throws IOException {
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_LOG);
cmdLine.addArgument(OPT_XML);
addDefaultArguments(cmdLine, null, null);
cmdLine.addArgument("-v");
cmdLine.addArgument("-r0:HEAD");
cmdLine.addArgument("--stop-on-copy");
cmdLine.addArgument("--limit");
cmdLine.addArgument("1");
cmdLine.addArgument(baseUrl + branch);
try (InputStream inStr = ExecutionHelper.getCommandResult(cmdLine, new File("."), 0, 120000)) {
String xml = IOUtils.toString(inStr, "UTF-8");
log.info("XML:\n" + xml);
// read the revision
Matcher matcher = Pattern.compile("copyfrom-rev=\"([0-9]+)\"").matcher(xml);
if (!matcher.find()) {
throw new IOException("Could not find copyfrom-rev entry in xml: " + xml);
}
log.info("Found copyfrom-rev: " + matcher.group(1));
return Long.parseLong(matcher.group(1));
}
} | java | public static long getBranchRevision(String branch, String baseUrl) throws IOException {
CommandLine cmdLine = new CommandLine(SVN_CMD);
cmdLine.addArgument(CMD_LOG);
cmdLine.addArgument(OPT_XML);
addDefaultArguments(cmdLine, null, null);
cmdLine.addArgument("-v");
cmdLine.addArgument("-r0:HEAD");
cmdLine.addArgument("--stop-on-copy");
cmdLine.addArgument("--limit");
cmdLine.addArgument("1");
cmdLine.addArgument(baseUrl + branch);
try (InputStream inStr = ExecutionHelper.getCommandResult(cmdLine, new File("."), 0, 120000)) {
String xml = IOUtils.toString(inStr, "UTF-8");
log.info("XML:\n" + xml);
// read the revision
Matcher matcher = Pattern.compile("copyfrom-rev=\"([0-9]+)\"").matcher(xml);
if (!matcher.find()) {
throw new IOException("Could not find copyfrom-rev entry in xml: " + xml);
}
log.info("Found copyfrom-rev: " + matcher.group(1));
return Long.parseLong(matcher.group(1));
}
} | [
"public",
"static",
"long",
"getBranchRevision",
"(",
"String",
"branch",
",",
"String",
"baseUrl",
")",
"throws",
"IOException",
"{",
"CommandLine",
"cmdLine",
"=",
"new",
"CommandLine",
"(",
"SVN_CMD",
")",
";",
"cmdLine",
".",
"addArgument",
"(",
"CMD_LOG",
... | Return the revision from which the branch was branched off.
@param branch The name of the branch including the path to the branch, e.g. branches/4.2.x
@param baseUrl The SVN url to connect to
@return The revision where the branch was branched off from it's parent branch.
@throws IOException Execution of the SVN sub-process failed or the
sub-process returned a exit value indicating a failure | [
"Return",
"the",
"revision",
"from",
"which",
"the",
"branch",
"was",
"branched",
"off",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L274-L299 |
EsotericSoftware/jsonbeans | src/com/esotericsoftware/jsonbeans/Json.java | Json.writeValue | public void writeValue (Object value) {
if (value == null)
writeValue(value, null, null);
else
writeValue(value, value.getClass(), null);
} | java | public void writeValue (Object value) {
if (value == null)
writeValue(value, null, null);
else
writeValue(value, value.getClass(), null);
} | [
"public",
"void",
"writeValue",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"writeValue",
"(",
"value",
",",
"null",
",",
"null",
")",
";",
"else",
"writeValue",
"(",
"value",
",",
"value",
".",
"getClass",
"(",
")",
",",... | Writes the value, without writing the class of the object.
@param value May be null. | [
"Writes",
"the",
"value",
"without",
"writing",
"the",
"class",
"of",
"the",
"object",
"."
] | train | https://github.com/EsotericSoftware/jsonbeans/blob/ff4502d0ff86cc77aa5c61d47371d0c66c14fe2f/src/com/esotericsoftware/jsonbeans/Json.java#L423-L428 |
icode/ameba | src/main/java/ameba/core/Requests.java | Requests.readEntity | public static <T> T readEntity(Class<T> rawType, Annotation[] annotations) {
return getRequest().readEntity(rawType, annotations);
} | java | public static <T> T readEntity(Class<T> rawType, Annotation[] annotations) {
return getRequest().readEntity(rawType, annotations);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"readEntity",
"(",
"Class",
"<",
"T",
">",
"rawType",
",",
"Annotation",
"[",
"]",
"annotations",
")",
"{",
"return",
"getRequest",
"(",
")",
".",
"readEntity",
"(",
"rawType",
",",
"annotations",
")",
";",
"}"
] | <p>readEntity.</p>
@param rawType a {@link java.lang.Class} object.
@param annotations an array of {@link java.lang.annotation.Annotation} objects.
@param <T> a T object.
@return a T object. | [
"<p",
">",
"readEntity",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/core/Requests.java#L626-L628 |
smallnest/fastjson-jaxrs-json-provider | src/main/java/com/colobu/fastjson/FastJsonProvider.java | FastJsonProvider.isReadable | public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
if (!hasMatchingMediaType(mediaType)) {
return false;
}
return isValidType(type, annotations);
} | java | public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
if (!hasMatchingMediaType(mediaType)) {
return false;
}
return isValidType(type, annotations);
} | [
"public",
"boolean",
"isReadable",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Type",
"genericType",
",",
"Annotation",
"[",
"]",
"annotations",
",",
"MediaType",
"mediaType",
")",
"{",
"if",
"(",
"!",
"hasMatchingMediaType",
"(",
"mediaType",
")",
")",
"{"... | Method that JAX-RS container calls to try to check whether values of
given type (and media type) can be deserialized by this provider. | [
"Method",
"that",
"JAX",
"-",
"RS",
"container",
"calls",
"to",
"try",
"to",
"check",
"whether",
"values",
"of",
"given",
"type",
"(",
"and",
"media",
"type",
")",
"can",
"be",
"deserialized",
"by",
"this",
"provider",
"."
] | train | https://github.com/smallnest/fastjson-jaxrs-json-provider/blob/bbdb2e3d101069bf62c026976ff9d00967671ec0/src/main/java/com/colobu/fastjson/FastJsonProvider.java#L259-L265 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedClient.java | MemcachedClient.getBulk | @Override
public <T> Map<String, T> getBulk(Iterator<String> keyIter,
Transcoder<T> tc) {
try {
return asyncGetBulk(keyIter, tc).get(operationTimeout,
TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted getting bulk values", e);
} catch (ExecutionException e) {
if(e.getCause() instanceof CancellationException) {
throw (CancellationException) e.getCause();
} else {
throw new RuntimeException("Exception waiting for bulk values", e);
}
} catch (TimeoutException e) {
throw new OperationTimeoutException("Timeout waiting for bulk values: "
+ buildTimeoutMessage(operationTimeout, TimeUnit.MILLISECONDS), e);
}
} | java | @Override
public <T> Map<String, T> getBulk(Iterator<String> keyIter,
Transcoder<T> tc) {
try {
return asyncGetBulk(keyIter, tc).get(operationTimeout,
TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted getting bulk values", e);
} catch (ExecutionException e) {
if(e.getCause() instanceof CancellationException) {
throw (CancellationException) e.getCause();
} else {
throw new RuntimeException("Exception waiting for bulk values", e);
}
} catch (TimeoutException e) {
throw new OperationTimeoutException("Timeout waiting for bulk values: "
+ buildTimeoutMessage(operationTimeout, TimeUnit.MILLISECONDS), e);
}
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"Map",
"<",
"String",
",",
"T",
">",
"getBulk",
"(",
"Iterator",
"<",
"String",
">",
"keyIter",
",",
"Transcoder",
"<",
"T",
">",
"tc",
")",
"{",
"try",
"{",
"return",
"asyncGetBulk",
"(",
"keyIter",
",",
"... | Get the values for multiple keys from the cache.
@param <T>
@param keyIter Iterator that produces the keys
@param tc the transcoder to serialize and unserialize value
@return a map of the values (for each value that exists)
@throws OperationTimeoutException if the global operation timeout is
exceeded
@throws CancellationException if operation was canceled
@throws IllegalStateException in the rare circumstance where queue is too
full to accept any more requests | [
"Get",
"the",
"values",
"for",
"multiple",
"keys",
"from",
"the",
"cache",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L1551-L1569 |
tipsy/javalin | src/main/java/io/javalin/apibuilder/ApiBuilder.java | ApiBuilder.ws | public static void ws(@NotNull String path, @NotNull Consumer<WsHandler> ws, @NotNull Set<Role> permittedRoles) {
staticInstance().ws(prefixPath(path), ws, permittedRoles);
} | java | public static void ws(@NotNull String path, @NotNull Consumer<WsHandler> ws, @NotNull Set<Role> permittedRoles) {
staticInstance().ws(prefixPath(path), ws, permittedRoles);
} | [
"public",
"static",
"void",
"ws",
"(",
"@",
"NotNull",
"String",
"path",
",",
"@",
"NotNull",
"Consumer",
"<",
"WsHandler",
">",
"ws",
",",
"@",
"NotNull",
"Set",
"<",
"Role",
">",
"permittedRoles",
")",
"{",
"staticInstance",
"(",
")",
".",
"ws",
"(",... | Adds a WebSocket handler with the given roles for the specified path.
The method can only be called inside a {@link Javalin#routes(EndpointGroup)}.
@see <a href="https://javalin.io/documentation#websockets">WebSockets in docs</a> | [
"Adds",
"a",
"WebSocket",
"handler",
"with",
"the",
"given",
"roles",
"for",
"the",
"specified",
"path",
".",
"The",
"method",
"can",
"only",
"be",
"called",
"inside",
"a",
"{",
"@link",
"Javalin#routes",
"(",
"EndpointGroup",
")",
"}",
"."
] | train | https://github.com/tipsy/javalin/blob/68b2f7592f237db1c2b597e645697eb75fdaee53/src/main/java/io/javalin/apibuilder/ApiBuilder.java#L384-L386 |
lmdbjava/lmdbjava | src/main/java/org/lmdbjava/Verifier.java | Verifier.runFor | public long runFor(final long duration, final TimeUnit unit) {
final long deadline = System.currentTimeMillis() + unit.toMillis(duration);
final ExecutorService es = Executors.newSingleThreadExecutor();
final Future<Long> future = es.submit(this);
try {
while (System.currentTimeMillis() < deadline && !future.isDone()) {
Thread.sleep(unit.toMillis(1));
}
} catch (final InterruptedException ignored) {
} finally {
stop();
}
final long result;
try {
result = future.get();
} catch (final InterruptedException | ExecutionException ex) {
throw new IllegalStateException(ex);
} finally {
es.shutdown();
}
return result;
} | java | public long runFor(final long duration, final TimeUnit unit) {
final long deadline = System.currentTimeMillis() + unit.toMillis(duration);
final ExecutorService es = Executors.newSingleThreadExecutor();
final Future<Long> future = es.submit(this);
try {
while (System.currentTimeMillis() < deadline && !future.isDone()) {
Thread.sleep(unit.toMillis(1));
}
} catch (final InterruptedException ignored) {
} finally {
stop();
}
final long result;
try {
result = future.get();
} catch (final InterruptedException | ExecutionException ex) {
throw new IllegalStateException(ex);
} finally {
es.shutdown();
}
return result;
} | [
"public",
"long",
"runFor",
"(",
"final",
"long",
"duration",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"final",
"long",
"deadline",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"unit",
".",
"toMillis",
"(",
"duration",
")",
";",
"final",
"E... | Execute the verifier for the given duration.
<p>
This provides a simple way to execute the verifier for those applications
which do not wish to manage threads directly.
@param duration amount of time to execute
@param unit units used to express the duration
@return number of database rows successfully verified | [
"Execute",
"the",
"verifier",
"for",
"the",
"given",
"duration",
"."
] | train | https://github.com/lmdbjava/lmdbjava/blob/5912beb1037722c71f3ddc05e70fcbe739dfa272/src/main/java/org/lmdbjava/Verifier.java#L166-L187 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Primitives.java | Primitives.unbox | public static float[] unbox(final Float[] a, final float valueForNull) {
if (a == null) {
return null;
}
return unbox(a, 0, a.length, valueForNull);
} | java | public static float[] unbox(final Float[] a, final float valueForNull) {
if (a == null) {
return null;
}
return unbox(a, 0, a.length, valueForNull);
} | [
"public",
"static",
"float",
"[",
"]",
"unbox",
"(",
"final",
"Float",
"[",
"]",
"a",
",",
"final",
"float",
"valueForNull",
")",
"{",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"unbox",
"(",
"a",
",",
"0",
",",... | <p>
Converts an array of object Floats to primitives handling {@code null}.
</p>
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param a
a {@code Float} array, may be {@code null}
@param valueForNull
the value to insert if {@code null} found
@return a {@code float} array, {@code null} if null array input | [
"<p",
">",
"Converts",
"an",
"array",
"of",
"object",
"Floats",
"to",
"primitives",
"handling",
"{",
"@code",
"null",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Primitives.java#L1137-L1143 |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/PathHandler.java | PathHandler.addPrefixPath | public synchronized PathHandler addPrefixPath(final String path, final HttpHandler handler) {
Handlers.handlerNotNull(handler);
pathMatcher.addPrefixPath(path, handler);
return this;
} | java | public synchronized PathHandler addPrefixPath(final String path, final HttpHandler handler) {
Handlers.handlerNotNull(handler);
pathMatcher.addPrefixPath(path, handler);
return this;
} | [
"public",
"synchronized",
"PathHandler",
"addPrefixPath",
"(",
"final",
"String",
"path",
",",
"final",
"HttpHandler",
"handler",
")",
"{",
"Handlers",
".",
"handlerNotNull",
"(",
"handler",
")",
";",
"pathMatcher",
".",
"addPrefixPath",
"(",
"path",
",",
"handl... | Adds a path prefix and a handler for that path. If the path does not start
with a / then one will be prepended.
<p>
The match is done on a prefix bases, so registering /foo will also match /foo/bar.
Though exact path matches are taken into account before prefix path matches. So
if an exact path match exists it's handler will be triggered.
<p>
If / is specified as the path then it will replace the default handler.
@param path If the request contains this prefix, run handler.
@param handler The handler which is activated upon match.
@return The resulting PathHandler after this path has been added to it. | [
"Adds",
"a",
"path",
"prefix",
"and",
"a",
"handler",
"for",
"that",
"path",
".",
"If",
"the",
"path",
"does",
"not",
"start",
"with",
"a",
"/",
"then",
"one",
"will",
"be",
"prepended",
".",
"<p",
">",
"The",
"match",
"is",
"done",
"on",
"a",
"pre... | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/PathHandler.java#L127-L131 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java | LSSerializerImpl.getPathWithoutEscapes | private static String getPathWithoutEscapes(String origPath) {
if (origPath != null && origPath.length() != 0 && origPath.indexOf('%') != -1) {
// Locate the escape characters
StringTokenizer tokenizer = new StringTokenizer(origPath, "%");
StringBuffer result = new StringBuffer(origPath.length());
int size = tokenizer.countTokens();
result.append(tokenizer.nextToken());
for(int i = 1; i < size; ++i) {
String token = tokenizer.nextToken();
if (token.length() >= 2 && isHexDigit(token.charAt(0)) &&
isHexDigit(token.charAt(1))) {
// Decode the 2 digit hexadecimal number following % in '%nn'
result.append((char)Integer.valueOf(token.substring(0, 2), 16).intValue());
token = token.substring(2);
}
result.append(token);
}
return result.toString();
}
return origPath;
} | java | private static String getPathWithoutEscapes(String origPath) {
if (origPath != null && origPath.length() != 0 && origPath.indexOf('%') != -1) {
// Locate the escape characters
StringTokenizer tokenizer = new StringTokenizer(origPath, "%");
StringBuffer result = new StringBuffer(origPath.length());
int size = tokenizer.countTokens();
result.append(tokenizer.nextToken());
for(int i = 1; i < size; ++i) {
String token = tokenizer.nextToken();
if (token.length() >= 2 && isHexDigit(token.charAt(0)) &&
isHexDigit(token.charAt(1))) {
// Decode the 2 digit hexadecimal number following % in '%nn'
result.append((char)Integer.valueOf(token.substring(0, 2), 16).intValue());
token = token.substring(2);
}
result.append(token);
}
return result.toString();
}
return origPath;
} | [
"private",
"static",
"String",
"getPathWithoutEscapes",
"(",
"String",
"origPath",
")",
"{",
"if",
"(",
"origPath",
"!=",
"null",
"&&",
"origPath",
".",
"length",
"(",
")",
"!=",
"0",
"&&",
"origPath",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1"... | Replaces all escape sequences in the given path with their literal characters. | [
"Replaces",
"all",
"escape",
"sequences",
"in",
"the",
"given",
"path",
"with",
"their",
"literal",
"characters",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java#L1464-L1484 |
wisdom-framework/wisdom-orientdb | wisdom-orientdb-manager/src/main/java/org/wisdom/orientdb/conf/WOrientConf.java | WOrientConf.createFromApplicationConf | public static Collection<WOrientConf> createFromApplicationConf(Configuration config, String prefix) {
Configuration orient = config.getConfiguration(prefix);
if(orient == null){
return Collections.EMPTY_SET;
}
Set<String> subkeys = new HashSet<>();
for (String key : orient.asMap().keySet()) {
subkeys.add(key);
}
Collection<WOrientConf> subconfs = new ArrayList<>(subkeys.size());
for (String subkey : subkeys) {
subconfs.add(new WOrientConf(subkey, orient.getConfiguration(subkey)));
}
return subconfs;
} | java | public static Collection<WOrientConf> createFromApplicationConf(Configuration config, String prefix) {
Configuration orient = config.getConfiguration(prefix);
if(orient == null){
return Collections.EMPTY_SET;
}
Set<String> subkeys = new HashSet<>();
for (String key : orient.asMap().keySet()) {
subkeys.add(key);
}
Collection<WOrientConf> subconfs = new ArrayList<>(subkeys.size());
for (String subkey : subkeys) {
subconfs.add(new WOrientConf(subkey, orient.getConfiguration(subkey)));
}
return subconfs;
} | [
"public",
"static",
"Collection",
"<",
"WOrientConf",
">",
"createFromApplicationConf",
"(",
"Configuration",
"config",
",",
"String",
"prefix",
")",
"{",
"Configuration",
"orient",
"=",
"config",
".",
"getConfiguration",
"(",
"prefix",
")",
";",
"if",
"(",
"ori... | Extract all WOrientConf configuration with the given prefix from the parent wisdom configuration.
If the prefix is <code>"orientdb"</code> and the configuration is: <br/>
<code>
orientdb.default.url = "plocal:/home/wisdom/db"
orientdb.test.url = "plocal:/home/wisdom/test/db"
</code>
<p/>
the sub configuration will be:
<p/>
<code>
[alias:default]
url = "plocal:/home/wisdom/db"
[alias:test]
url = "plocal:/home/wisdom/test/db"
</code>
@param config The wisdom configuration
@param prefix The prefix of the wisdom-orientdb configuration.
@return A Collection of WOrientConf retrieve from the Wisdom configuration file, or an empty set if there is no configuration under the given prefix. | [
"Extract",
"all",
"WOrientConf",
"configuration",
"with",
"the",
"given",
"prefix",
"from",
"the",
"parent",
"wisdom",
"configuration",
".",
"If",
"the",
"prefix",
"is",
"<code",
">",
"orientdb",
"<",
"/",
"code",
">",
"and",
"the",
"configuration",
"is",
":... | train | https://github.com/wisdom-framework/wisdom-orientdb/blob/fd172fc19f03ca151d81a4f9cf0ad38cb8411852/wisdom-orientdb-manager/src/main/java/org/wisdom/orientdb/conf/WOrientConf.java#L160-L180 |
mapbox/mapbox-java | services-turf/src/main/java/com/mapbox/turf/TurfMeta.java | TurfMeta.addCoordAll | @NonNull
private static List<Point> addCoordAll(@NonNull List<Point> pointList, @NonNull Feature feature,
@NonNull boolean excludeWrapCoord) {
return coordAllFromSingleGeometry(pointList, feature.geometry(), excludeWrapCoord);
} | java | @NonNull
private static List<Point> addCoordAll(@NonNull List<Point> pointList, @NonNull Feature feature,
@NonNull boolean excludeWrapCoord) {
return coordAllFromSingleGeometry(pointList, feature.geometry(), excludeWrapCoord);
} | [
"@",
"NonNull",
"private",
"static",
"List",
"<",
"Point",
">",
"addCoordAll",
"(",
"@",
"NonNull",
"List",
"<",
"Point",
">",
"pointList",
",",
"@",
"NonNull",
"Feature",
"feature",
",",
"@",
"NonNull",
"boolean",
"excludeWrapCoord",
")",
"{",
"return",
"... | Private helper method to be used with other methods in this class.
@param pointList the {@code List} of {@link Point}s.
@param feature the {@link Feature} that you'd like
to extract the Points from.
@param excludeWrapCoord whether or not to include the final
coordinate of LinearRings that wraps the ring
in its iteration. Used if a {@link Feature} in the
{@link FeatureCollection} that's passed through
this method, is a {@link Polygon} or {@link MultiPolygon}
geometry.
@return a {@code List} made up of {@link Point}s.
@since 4.8.0 | [
"Private",
"helper",
"method",
"to",
"be",
"used",
"with",
"other",
"methods",
"in",
"this",
"class",
"."
] | train | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-turf/src/main/java/com/mapbox/turf/TurfMeta.java#L287-L291 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/ClassUtil.java | ClassUtil.findEnumConstant | public static Object findEnumConstant(Class<?> type, String constantName, boolean caseSensitive) {
if (!type.isEnum()) {
return null;
}
for (Object obj : type.getEnumConstants()) {
String name = obj.toString();
if ((caseSensitive && name.equals(constantName)) || (!caseSensitive && name.equalsIgnoreCase(constantName))) {
return obj;
}
}
// otherwise, it wasn't found
return null;
} | java | public static Object findEnumConstant(Class<?> type, String constantName, boolean caseSensitive) {
if (!type.isEnum()) {
return null;
}
for (Object obj : type.getEnumConstants()) {
String name = obj.toString();
if ((caseSensitive && name.equals(constantName)) || (!caseSensitive && name.equalsIgnoreCase(constantName))) {
return obj;
}
}
// otherwise, it wasn't found
return null;
} | [
"public",
"static",
"Object",
"findEnumConstant",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"constantName",
",",
"boolean",
"caseSensitive",
")",
"{",
"if",
"(",
"!",
"type",
".",
"isEnum",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"for... | Finds an instance of an Enum constant on a class. Useful for safely
getting the value of an enum constant without an exception being thrown
like the Enum.valueOf() method causes. Also, this method optionally allows
the caller to choose whether case matters during the search. | [
"Finds",
"an",
"instance",
"of",
"an",
"Enum",
"constant",
"on",
"a",
"class",
".",
"Useful",
"for",
"safely",
"getting",
"the",
"value",
"of",
"an",
"enum",
"constant",
"without",
"an",
"exception",
"being",
"thrown",
"like",
"the",
"Enum",
".",
"valueOf"... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/ClassUtil.java#L52-L64 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java | AttributedString.addAttribute | public void addAttribute(Attribute attribute, Object value) {
if (attribute == null) {
throw new NullPointerException();
}
int len = length();
if (len == 0) {
throw new IllegalArgumentException("Can't add attribute to 0-length text");
}
addAttributeImpl(attribute, value, 0, len);
} | java | public void addAttribute(Attribute attribute, Object value) {
if (attribute == null) {
throw new NullPointerException();
}
int len = length();
if (len == 0) {
throw new IllegalArgumentException("Can't add attribute to 0-length text");
}
addAttributeImpl(attribute, value, 0, len);
} | [
"public",
"void",
"addAttribute",
"(",
"Attribute",
"attribute",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"attribute",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"int",
"len",
"=",
"length",
"(",
")",
";",
"... | Adds an attribute to the entire string.
@param attribute the attribute key
@param value the value of the attribute; may be null
@exception NullPointerException if <code>attribute</code> is null.
@exception IllegalArgumentException if the AttributedString has length 0
(attributes cannot be applied to a 0-length range). | [
"Adds",
"an",
"attribute",
"to",
"the",
"entire",
"string",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L316-L328 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java | CmsXmlContentPropertyHelper.mergeDefaults | public static Map<String, String> mergeDefaults(
CmsObject cms,
CmsResource resource,
Map<String, String> properties,
Locale locale,
ServletRequest request) {
Map<String, CmsXmlContentProperty> propertyConfig = null;
if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
I_CmsFormatterBean formatter = null;
// check formatter configuration setting
for (Entry<String, String> property : properties.entrySet()) {
if (property.getKey().startsWith(CmsFormatterConfig.FORMATTER_SETTINGS_KEY)
&& CmsUUID.isValidUUID(property.getValue())) {
formatter = OpenCms.getADEManager().getCachedFormatters(
cms.getRequestContext().getCurrentProject().isOnlineProject()).getFormatters().get(
new CmsUUID(property.getValue()));
break;
}
}
try {
if (formatter != null) {
propertyConfig = OpenCms.getADEManager().getFormatterSettings(
cms,
formatter,
resource,
locale,
request);
} else {
// fall back to schema configuration
propertyConfig = CmsXmlContentDefinition.getContentHandlerForResource(cms, resource).getSettings(
cms,
resource);
}
} catch (CmsException e) {
// should never happen
LOG.error(e.getLocalizedMessage(), e);
}
}
return mergeDefaults(cms, propertyConfig, properties);
} | java | public static Map<String, String> mergeDefaults(
CmsObject cms,
CmsResource resource,
Map<String, String> properties,
Locale locale,
ServletRequest request) {
Map<String, CmsXmlContentProperty> propertyConfig = null;
if (CmsResourceTypeXmlContent.isXmlContent(resource)) {
I_CmsFormatterBean formatter = null;
// check formatter configuration setting
for (Entry<String, String> property : properties.entrySet()) {
if (property.getKey().startsWith(CmsFormatterConfig.FORMATTER_SETTINGS_KEY)
&& CmsUUID.isValidUUID(property.getValue())) {
formatter = OpenCms.getADEManager().getCachedFormatters(
cms.getRequestContext().getCurrentProject().isOnlineProject()).getFormatters().get(
new CmsUUID(property.getValue()));
break;
}
}
try {
if (formatter != null) {
propertyConfig = OpenCms.getADEManager().getFormatterSettings(
cms,
formatter,
resource,
locale,
request);
} else {
// fall back to schema configuration
propertyConfig = CmsXmlContentDefinition.getContentHandlerForResource(cms, resource).getSettings(
cms,
resource);
}
} catch (CmsException e) {
// should never happen
LOG.error(e.getLocalizedMessage(), e);
}
}
return mergeDefaults(cms, propertyConfig, properties);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"mergeDefaults",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
",",
"Locale",
"locale",
",",
"ServletRequest",
"request",
")... | Extends the given properties with the default values
from the resource's property configuration.<p>
@param cms the current CMS context
@param resource the resource to get the property configuration from
@param properties the properties to extend
@param locale the content locale
@param request the current request, if available
@return a merged map of properties | [
"Extends",
"the",
"given",
"properties",
"with",
"the",
"default",
"values",
"from",
"the",
"resource",
"s",
"property",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L402-L445 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_spla_GET | public ArrayList<Long> serviceName_spla_GET(String serviceName, OvhSplaStatusEnum status, OvhSplaTypeEnum type) throws IOException {
String qPath = "/dedicated/server/{serviceName}/spla";
StringBuilder sb = path(qPath, serviceName);
query(sb, "status", status);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | java | public ArrayList<Long> serviceName_spla_GET(String serviceName, OvhSplaStatusEnum status, OvhSplaTypeEnum type) throws IOException {
String qPath = "/dedicated/server/{serviceName}/spla";
StringBuilder sb = path(qPath, serviceName);
query(sb, "status", status);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_spla_GET",
"(",
"String",
"serviceName",
",",
"OvhSplaStatusEnum",
"status",
",",
"OvhSplaTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/spla\"",
";",... | Your own SPLA licenses attached to this dedicated server
REST: GET /dedicated/server/{serviceName}/spla
@param status [required] Filter the value of status property (=)
@param type [required] Filter the value of type property (=)
@param serviceName [required] The internal name of your dedicated server | [
"Your",
"own",
"SPLA",
"licenses",
"attached",
"to",
"this",
"dedicated",
"server"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L706-L713 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java | PgCallableStatement.checkIndex | protected void checkIndex(int parameterIndex, int type1, int type2, String getName)
throws SQLException {
checkIndex(parameterIndex);
if (type1 != this.testReturn[parameterIndex - 1]
&& type2 != this.testReturn[parameterIndex - 1]) {
throw new PSQLException(
GT.tr("Parameter of type {0} was registered, but call to get{1} (sqltype={2}) was made.",
"java.sql.Types=" + testReturn[parameterIndex - 1], getName,
"java.sql.Types=" + type1),
PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH);
}
} | java | protected void checkIndex(int parameterIndex, int type1, int type2, String getName)
throws SQLException {
checkIndex(parameterIndex);
if (type1 != this.testReturn[parameterIndex - 1]
&& type2 != this.testReturn[parameterIndex - 1]) {
throw new PSQLException(
GT.tr("Parameter of type {0} was registered, but call to get{1} (sqltype={2}) was made.",
"java.sql.Types=" + testReturn[parameterIndex - 1], getName,
"java.sql.Types=" + type1),
PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH);
}
} | [
"protected",
"void",
"checkIndex",
"(",
"int",
"parameterIndex",
",",
"int",
"type1",
",",
"int",
"type2",
",",
"String",
"getName",
")",
"throws",
"SQLException",
"{",
"checkIndex",
"(",
"parameterIndex",
")",
";",
"if",
"(",
"type1",
"!=",
"this",
".",
"... | helperfunction for the getXXX calls to check isFunction and index == 1 Compare BOTH type fields
against the return type.
@param parameterIndex parameter index (1-based)
@param type1 type 1
@param type2 type 2
@param getName getter name
@throws SQLException if something goes wrong | [
"helperfunction",
"for",
"the",
"getXXX",
"calls",
"to",
"check",
"isFunction",
"and",
"index",
"==",
"1",
"Compare",
"BOTH",
"type",
"fields",
"against",
"the",
"return",
"type",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java#L361-L372 |
dwdyer/uncommons-maths | core/src/java/main/org/uncommons/maths/Maths.java | Maths.raiseToPower | public static long raiseToPower(int value, int power)
{
if (power < 0)
{
throw new IllegalArgumentException("This method does not support negative powers.");
}
long result = 1;
for (int i = 0; i < power; i++)
{
result *= value;
}
return result;
} | java | public static long raiseToPower(int value, int power)
{
if (power < 0)
{
throw new IllegalArgumentException("This method does not support negative powers.");
}
long result = 1;
for (int i = 0; i < power; i++)
{
result *= value;
}
return result;
} | [
"public",
"static",
"long",
"raiseToPower",
"(",
"int",
"value",
",",
"int",
"power",
")",
"{",
"if",
"(",
"power",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"This method does not support negative powers.\"",
")",
";",
"}",
"long",
... | Calculate the first argument raised to the power of the second.
This method only supports non-negative powers.
@param value The number to be raised.
@param power The exponent (must be positive).
@return {@code value} raised to {@code power}. | [
"Calculate",
"the",
"first",
"argument",
"raised",
"to",
"the",
"power",
"of",
"the",
"second",
".",
"This",
"method",
"only",
"supports",
"non",
"-",
"negative",
"powers",
"."
] | train | https://github.com/dwdyer/uncommons-maths/blob/b7ba13aea70625bb7f37c856783a29e17e354964/core/src/java/main/org/uncommons/maths/Maths.java#L111-L123 |
GistLabs/mechanize | src/main/java/com/gistlabs/mechanize/util/apache/URLEncodedUtils.java | URLEncodedUtils.encPath | static String encPath(final String content, final Charset charset) {
return urlencode(content, charset, PATHSAFE, false);
} | java | static String encPath(final String content, final Charset charset) {
return urlencode(content, charset, PATHSAFE, false);
} | [
"static",
"String",
"encPath",
"(",
"final",
"String",
"content",
",",
"final",
"Charset",
"charset",
")",
"{",
"return",
"urlencode",
"(",
"content",
",",
"charset",
",",
"PATHSAFE",
",",
"false",
")",
";",
"}"
] | Encode a String using the {@link #PATHSAFE} set of characters.
<p>
Used by URIBuilder to encode path segments.
@param content the string to encode, does not convert space to '+'
@param charset the charset to use
@return the encoded string | [
"Encode",
"a",
"String",
"using",
"the",
"{",
"@link",
"#PATHSAFE",
"}",
"set",
"of",
"characters",
".",
"<p",
">",
"Used",
"by",
"URIBuilder",
"to",
"encode",
"path",
"segments",
"."
] | train | https://github.com/GistLabs/mechanize/blob/32ddd0774439a4c08513c05d7ac7416a3899efed/src/main/java/com/gistlabs/mechanize/util/apache/URLEncodedUtils.java#L520-L522 |
Credntia/MVBarcodeReader | mvbarcodereader/src/main/java/devliving/online/mvbarcodereader/BarcodeCaptureFragment.java | BarcodeCaptureFragment.onTouch | @Override
public boolean onTouch(View v, MotionEvent event) {
boolean b = scaleGestureDetector.onTouchEvent(event);
boolean c = gestureDetector.onTouchEvent(event);
return b || c || v.onTouchEvent(event);
} | java | @Override
public boolean onTouch(View v, MotionEvent event) {
boolean b = scaleGestureDetector.onTouchEvent(event);
boolean c = gestureDetector.onTouchEvent(event);
return b || c || v.onTouchEvent(event);
} | [
"@",
"Override",
"public",
"boolean",
"onTouch",
"(",
"View",
"v",
",",
"MotionEvent",
"event",
")",
"{",
"boolean",
"b",
"=",
"scaleGestureDetector",
".",
"onTouchEvent",
"(",
"event",
")",
";",
"boolean",
"c",
"=",
"gestureDetector",
".",
"onTouchEvent",
"... | Called when a touch event is dispatched to a view. This allows listeners to
get a chance to respond before the target view.
@param v The view the touch event has been dispatched to.
@param event The MotionEvent object containing full information about
the event.
@return True if the listener has consumed the event, false otherwise. | [
"Called",
"when",
"a",
"touch",
"event",
"is",
"dispatched",
"to",
"a",
"view",
".",
"This",
"allows",
"listeners",
"to",
"get",
"a",
"chance",
"to",
"respond",
"before",
"the",
"target",
"view",
"."
] | train | https://github.com/Credntia/MVBarcodeReader/blob/2a2561f1c3b4d4e3c046a341fbf23a31eabfda8d/mvbarcodereader/src/main/java/devliving/online/mvbarcodereader/BarcodeCaptureFragment.java#L423-L430 |
alkacon/opencms-core | src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java | CmsSetupXmlHelper.getValue | public static String getValue(Document document, String xPath) {
Node node = document.selectSingleNode(xPath);
if (node != null) {
// return the value
return node.getText();
} else {
return null;
}
} | java | public static String getValue(Document document, String xPath) {
Node node = document.selectSingleNode(xPath);
if (node != null) {
// return the value
return node.getText();
} else {
return null;
}
} | [
"public",
"static",
"String",
"getValue",
"(",
"Document",
"document",
",",
"String",
"xPath",
")",
"{",
"Node",
"node",
"=",
"document",
".",
"selectSingleNode",
"(",
"xPath",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"// return the value",
"re... | Returns the value in the given xpath of the given xml file.<p>
@param document the xml document
@param xPath the xpath to read (should select a single node or attribute)
@return the value in the given xpath of the given xml file, or <code>null</code> if no matching node | [
"Returns",
"the",
"value",
"in",
"the",
"given",
"xpath",
"of",
"the",
"given",
"xml",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java#L137-L146 |
dhanji/sitebricks | sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java | HtmlTemplateCompiler.lexicalDescend | private void lexicalDescend(PageCompilingContext pc, Element element, boolean shouldPopScope) {
//pop form
if ("form".equals(element.tagName()))
pc.form = null;
//pop compiler if the scope ends
if (shouldPopScope) {
pc.lexicalScopes.pop();
}
} | java | private void lexicalDescend(PageCompilingContext pc, Element element, boolean shouldPopScope) {
//pop form
if ("form".equals(element.tagName()))
pc.form = null;
//pop compiler if the scope ends
if (shouldPopScope) {
pc.lexicalScopes.pop();
}
} | [
"private",
"void",
"lexicalDescend",
"(",
"PageCompilingContext",
"pc",
",",
"Element",
"element",
",",
"boolean",
"shouldPopScope",
")",
"{",
"//pop form",
"if",
"(",
"\"form\"",
".",
"equals",
"(",
"element",
".",
"tagName",
"(",
")",
")",
")",
"pc",
".",
... | Complement of HtmlTemplateCompiler#lexicalClimb().
This method pops off the stack of lexical scopes when
we're done processing a sitebricks widget. | [
"Complement",
"of",
"HtmlTemplateCompiler#lexicalClimb",
"()",
".",
"This",
"method",
"pops",
"off",
"the",
"stack",
"of",
"lexical",
"scopes",
"when",
"we",
"re",
"done",
"processing",
"a",
"sitebricks",
"widget",
"."
] | train | https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java#L209-L219 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/organization/MemberUpdater.java | MemberUpdater.synchronizeUserOrganizationMembership | public void synchronizeUserOrganizationMembership(DbSession dbSession, UserDto user, ALM alm, Set<String> organizationAlmIds) {
Set<String> userOrganizationUuids = dbClient.organizationMemberDao().selectOrganizationUuidsByUser(dbSession, user.getId());
Set<String> userOrganizationUuidsWithMembersSyncEnabled = dbClient.organizationAlmBindingDao().selectByOrganizationUuids(dbSession, userOrganizationUuids).stream()
.filter(OrganizationAlmBindingDto::isMembersSyncEnable)
.map(OrganizationAlmBindingDto::getOrganizationUuid)
.collect(toSet());
Set<String> almOrganizationUuidsWithMembersSyncEnabled = dbClient.organizationAlmBindingDao().selectByOrganizationAlmIds(dbSession, alm, organizationAlmIds).stream()
.filter(OrganizationAlmBindingDto::isMembersSyncEnable)
.map(OrganizationAlmBindingDto::getOrganizationUuid)
.collect(toSet());
Set<String> organizationUuidsToBeAdded = difference(almOrganizationUuidsWithMembersSyncEnabled, userOrganizationUuidsWithMembersSyncEnabled);
Set<String> organizationUuidsToBeRemoved = difference(userOrganizationUuidsWithMembersSyncEnabled, almOrganizationUuidsWithMembersSyncEnabled);
Map<String, OrganizationDto> allOrganizationsByUuid = dbClient.organizationDao().selectByUuids(dbSession, union(organizationUuidsToBeAdded, organizationUuidsToBeRemoved))
.stream()
.collect(uniqueIndex(OrganizationDto::getUuid));
allOrganizationsByUuid.entrySet().stream()
.filter(entry -> organizationUuidsToBeAdded.contains(entry.getKey()))
.forEach(entry -> addMemberInDb(dbSession, entry.getValue(), user));
allOrganizationsByUuid.entrySet().stream()
.filter(entry -> organizationUuidsToBeRemoved.contains(entry.getKey()))
.forEach(entry -> removeMemberInDb(dbSession, entry.getValue(), user));
} | java | public void synchronizeUserOrganizationMembership(DbSession dbSession, UserDto user, ALM alm, Set<String> organizationAlmIds) {
Set<String> userOrganizationUuids = dbClient.organizationMemberDao().selectOrganizationUuidsByUser(dbSession, user.getId());
Set<String> userOrganizationUuidsWithMembersSyncEnabled = dbClient.organizationAlmBindingDao().selectByOrganizationUuids(dbSession, userOrganizationUuids).stream()
.filter(OrganizationAlmBindingDto::isMembersSyncEnable)
.map(OrganizationAlmBindingDto::getOrganizationUuid)
.collect(toSet());
Set<String> almOrganizationUuidsWithMembersSyncEnabled = dbClient.organizationAlmBindingDao().selectByOrganizationAlmIds(dbSession, alm, organizationAlmIds).stream()
.filter(OrganizationAlmBindingDto::isMembersSyncEnable)
.map(OrganizationAlmBindingDto::getOrganizationUuid)
.collect(toSet());
Set<String> organizationUuidsToBeAdded = difference(almOrganizationUuidsWithMembersSyncEnabled, userOrganizationUuidsWithMembersSyncEnabled);
Set<String> organizationUuidsToBeRemoved = difference(userOrganizationUuidsWithMembersSyncEnabled, almOrganizationUuidsWithMembersSyncEnabled);
Map<String, OrganizationDto> allOrganizationsByUuid = dbClient.organizationDao().selectByUuids(dbSession, union(organizationUuidsToBeAdded, organizationUuidsToBeRemoved))
.stream()
.collect(uniqueIndex(OrganizationDto::getUuid));
allOrganizationsByUuid.entrySet().stream()
.filter(entry -> organizationUuidsToBeAdded.contains(entry.getKey()))
.forEach(entry -> addMemberInDb(dbSession, entry.getValue(), user));
allOrganizationsByUuid.entrySet().stream()
.filter(entry -> organizationUuidsToBeRemoved.contains(entry.getKey()))
.forEach(entry -> removeMemberInDb(dbSession, entry.getValue(), user));
} | [
"public",
"void",
"synchronizeUserOrganizationMembership",
"(",
"DbSession",
"dbSession",
",",
"UserDto",
"user",
",",
"ALM",
"alm",
",",
"Set",
"<",
"String",
">",
"organizationAlmIds",
")",
"{",
"Set",
"<",
"String",
">",
"userOrganizationUuids",
"=",
"dbClient"... | Synchronize organization membership of a user from a list of ALM organization specific ids
Please note that no commit will not be executed. | [
"Synchronize",
"organization",
"membership",
"of",
"a",
"user",
"from",
"a",
"list",
"of",
"ALM",
"organization",
"specific",
"ids",
"Please",
"note",
"that",
"no",
"commit",
"will",
"not",
"be",
"executed",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/organization/MemberUpdater.java#L110-L133 |
microfocus-idol/java-content-parameter-api | src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java | FieldTextBuilder.binaryOperation | private FieldTextBuilder binaryOperation(final String operator, final FieldText fieldText) {
// This should never happen as the AND, OR, XOR and WHEN methods should already have checked this
Validate.isTrue(fieldText != this);
// Optimized case when fieldText is a FieldTextBuilder
if(fieldText instanceof FieldTextBuilder) {
return binaryOp(operator, (FieldTextBuilder)fieldText);
}
// Special case when we're empty
if(componentCount == 0) {
fieldTextString.append(fieldText.toString());
if(fieldText.size() > 1) {
lastOperator = "";
}
} else {
// Add the NOTs, parentheses and operator
addOperator(operator);
// Size 1 means a single specifier, so no parentheses
if(fieldText.size() == 1) {
fieldTextString.append(fieldText.toString());
} else {
fieldTextString.append('(').append(fieldText.toString()).append(')');
}
}
componentCount += fieldText.size();
not = false;
return this;
} | java | private FieldTextBuilder binaryOperation(final String operator, final FieldText fieldText) {
// This should never happen as the AND, OR, XOR and WHEN methods should already have checked this
Validate.isTrue(fieldText != this);
// Optimized case when fieldText is a FieldTextBuilder
if(fieldText instanceof FieldTextBuilder) {
return binaryOp(operator, (FieldTextBuilder)fieldText);
}
// Special case when we're empty
if(componentCount == 0) {
fieldTextString.append(fieldText.toString());
if(fieldText.size() > 1) {
lastOperator = "";
}
} else {
// Add the NOTs, parentheses and operator
addOperator(operator);
// Size 1 means a single specifier, so no parentheses
if(fieldText.size() == 1) {
fieldTextString.append(fieldText.toString());
} else {
fieldTextString.append('(').append(fieldText.toString()).append(')');
}
}
componentCount += fieldText.size();
not = false;
return this;
} | [
"private",
"FieldTextBuilder",
"binaryOperation",
"(",
"final",
"String",
"operator",
",",
"final",
"FieldText",
"fieldText",
")",
"{",
"// This should never happen as the AND, OR, XOR and WHEN methods should already have checked this",
"Validate",
".",
"isTrue",
"(",
"fieldText"... | Does the work for the OR, AND, XOR and WHEN methods.
@param operator
@param fieldText
@return | [
"Does",
"the",
"work",
"for",
"the",
"OR",
"AND",
"XOR",
"and",
"WHEN",
"methods",
"."
] | train | https://github.com/microfocus-idol/java-content-parameter-api/blob/8d33dc633f8df2a470a571ac7694e423e7004ad0/src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java#L299-L331 |
timtiemens/secretshare | src/main/java/com/tiemens/secretshare/math/BigIntStringChecksum.java | BigIntStringChecksum.asBigInteger | public BigInteger asBigInteger()
{
try
{
return new BigInteger(asHex, HEX_RADIX);
}
catch (NumberFormatException e)
{
throw new SecretShareException("Invalid input='" + asHex + "'", e);
}
} | java | public BigInteger asBigInteger()
{
try
{
return new BigInteger(asHex, HEX_RADIX);
}
catch (NumberFormatException e)
{
throw new SecretShareException("Invalid input='" + asHex + "'", e);
}
} | [
"public",
"BigInteger",
"asBigInteger",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"BigInteger",
"(",
"asHex",
",",
"HEX_RADIX",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"throw",
"new",
"SecretShareException",
"(",
"\"Invalid input... | Return the original BigInteger.
(or throw an exception if something went wrong).
@return BigInteger or throw exception
@throws SecretShareException if the hex is invalid | [
"Return",
"the",
"original",
"BigInteger",
".",
"(",
"or",
"throw",
"an",
"exception",
"if",
"something",
"went",
"wrong",
")",
"."
] | train | https://github.com/timtiemens/secretshare/blob/f5f88929af99ae0ed0df02dc802e40cdb25fceac/src/main/java/com/tiemens/secretshare/math/BigIntStringChecksum.java#L309-L319 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.