repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.sameArgument | public static Matcher<? super MethodInvocationTree> sameArgument(
final int index1, final int index2) {
return new Matcher<MethodInvocationTree>() {
@Override
public boolean matches(MethodInvocationTree methodInvocationTree, VisitorState state) {
List<? extends ExpressionTree> args = methodInvocationTree.getArguments();
return ASTHelpers.sameVariable(args.get(index1), args.get(index2));
}
};
} | java | public static Matcher<? super MethodInvocationTree> sameArgument(
final int index1, final int index2) {
return new Matcher<MethodInvocationTree>() {
@Override
public boolean matches(MethodInvocationTree methodInvocationTree, VisitorState state) {
List<? extends ExpressionTree> args = methodInvocationTree.getArguments();
return ASTHelpers.sameVariable(args.get(index1), args.get(index2));
}
};
} | [
"public",
"static",
"Matcher",
"<",
"?",
"super",
"MethodInvocationTree",
">",
"sameArgument",
"(",
"final",
"int",
"index1",
",",
"final",
"int",
"index2",
")",
"{",
"return",
"new",
"Matcher",
"<",
"MethodInvocationTree",
">",
"(",
")",
"{",
"@",
"Override... | Matches a {@link MethodInvocation} when the arguments at the two given indices are both the
same variable, as determined by {@link ASTHelpers#sameVariable}.
@param index1 the index of the first actual parameter to test
@param index2 the index of the second actual parameter to test
@throws IndexOutOfBoundsException if the given indices are invalid | [
"Matches",
"a",
"{",
"@link",
"MethodInvocation",
"}",
"when",
"the",
"arguments",
"at",
"the",
"two",
"given",
"indices",
"are",
"both",
"the",
"same",
"variable",
"as",
"determined",
"by",
"{",
"@link",
"ASTHelpers#sameVariable",
"}",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L739-L748 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/LogManager.java | LogManager.getLogger | protected static Logger getLogger(final String fqcn, final String name) {
return factory.getContext(fqcn, null, null, false).getLogger(name);
} | java | protected static Logger getLogger(final String fqcn, final String name) {
return factory.getContext(fqcn, null, null, false).getLogger(name);
} | [
"protected",
"static",
"Logger",
"getLogger",
"(",
"final",
"String",
"fqcn",
",",
"final",
"String",
"name",
")",
"{",
"return",
"factory",
".",
"getContext",
"(",
"fqcn",
",",
"null",
",",
"null",
",",
"false",
")",
".",
"getLogger",
"(",
"name",
")",
... | Returns a Logger with the specified name.
@param fqcn The fully qualified class name of the class that this method is a member of.
@param name The logger name.
@return The Logger. | [
"Returns",
"a",
"Logger",
"with",
"the",
"specified",
"name",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/LogManager.java#L584-L586 |
headius/invokebinder | src/main/java/com/headius/invokebinder/SmartBinder.java | SmartBinder.foldVirtual | public SmartBinder foldVirtual(String newName, Lookup lookup, String method) {
Binder newBinder = binder.foldVirtual(lookup, method);
return new SmartBinder(this, signature().prependArg(newName, newBinder.type().parameterType(0)), newBinder);
} | java | public SmartBinder foldVirtual(String newName, Lookup lookup, String method) {
Binder newBinder = binder.foldVirtual(lookup, method);
return new SmartBinder(this, signature().prependArg(newName, newBinder.type().parameterType(0)), newBinder);
} | [
"public",
"SmartBinder",
"foldVirtual",
"(",
"String",
"newName",
",",
"Lookup",
"lookup",
",",
"String",
"method",
")",
"{",
"Binder",
"newBinder",
"=",
"binder",
".",
"foldVirtual",
"(",
"lookup",
",",
"method",
")",
";",
"return",
"new",
"SmartBinder",
"(... | Acquire a virtual folding function from the first argument's class,
using the given name and Lookup. Pass all arguments to that function and
insert the resulting value as newName into the argument list.
@param newName the name of the new first argument where the fold
function's result will be passed
@param lookup the Lookup to use for acquiring a folding function
@param method the name of the method to become a folding function
@return a new SmartBinder with the fold applied | [
"Acquire",
"a",
"virtual",
"folding",
"function",
"from",
"the",
"first",
"argument",
"s",
"class",
"using",
"the",
"given",
"name",
"and",
"Lookup",
".",
"Pass",
"all",
"arguments",
"to",
"that",
"function",
"and",
"insert",
"the",
"resulting",
"value",
"as... | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartBinder.java#L262-L265 |
h2oai/h2o-2 | src/main/java/water/parser/XlsParser.java | XlsParser.guessSetup | public static PSetupGuess guessSetup(byte [] bits){
InputStream is = new ByteArrayInputStream(bits);
XlsParser p = new XlsParser();
CustomInspectDataOut dout = new CustomInspectDataOut();
try{p.streamParse(is, dout);}catch(Exception e){}
return new PSetupGuess(new ParserSetup(ParserType.XLS,CsvParser.AUTO_SEP,dout._ncols, dout._header,dout._header?dout.data()[0]:null,false),dout._nlines,dout._invalidLines,dout.data(),dout._nlines > dout._invalidLines,null);
} | java | public static PSetupGuess guessSetup(byte [] bits){
InputStream is = new ByteArrayInputStream(bits);
XlsParser p = new XlsParser();
CustomInspectDataOut dout = new CustomInspectDataOut();
try{p.streamParse(is, dout);}catch(Exception e){}
return new PSetupGuess(new ParserSetup(ParserType.XLS,CsvParser.AUTO_SEP,dout._ncols, dout._header,dout._header?dout.data()[0]:null,false),dout._nlines,dout._invalidLines,dout.data(),dout._nlines > dout._invalidLines,null);
} | [
"public",
"static",
"PSetupGuess",
"guessSetup",
"(",
"byte",
"[",
"]",
"bits",
")",
"{",
"InputStream",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"bits",
")",
";",
"XlsParser",
"p",
"=",
"new",
"XlsParser",
"(",
")",
";",
"CustomInspectDataOut",
"dout"... | Try to parse the bits as svm light format, return SVMParser instance if the input is in svm light format, null otherwise.
@param bits
@return SVMLightPArser instance or null | [
"Try",
"to",
"parse",
"the",
"bits",
"as",
"svm",
"light",
"format",
"return",
"SVMParser",
"instance",
"if",
"the",
"input",
"is",
"in",
"svm",
"light",
"format",
"null",
"otherwise",
"."
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/parser/XlsParser.java#L49-L55 |
ginere/ginere-base | src/main/java/eu/ginere/base/util/exception/ExceptionUtils.java | ExceptionUtils.printStackTraceElement | public static void printStackTraceElement(StackTraceElement element,StringBuilder buffer){
buffer.append(element.getClassName());
buffer.append('.');
buffer.append(element.getMethodName());
buffer.append('(');
buffer.append(element.getFileName());
if (element.getLineNumber() > 0) {
buffer.append(':');
buffer.append(element.getLineNumber());
}
buffer.append(')');
} | java | public static void printStackTraceElement(StackTraceElement element,StringBuilder buffer){
buffer.append(element.getClassName());
buffer.append('.');
buffer.append(element.getMethodName());
buffer.append('(');
buffer.append(element.getFileName());
if (element.getLineNumber() > 0) {
buffer.append(':');
buffer.append(element.getLineNumber());
}
buffer.append(')');
} | [
"public",
"static",
"void",
"printStackTraceElement",
"(",
"StackTraceElement",
"element",
",",
"StringBuilder",
"buffer",
")",
"{",
"buffer",
".",
"append",
"(",
"element",
".",
"getClassName",
"(",
")",
")",
";",
"buffer",
".",
"append",
"(",
"'",
"'",
")"... | IMprime un stacktrace element.
@param element el elemento a pintar
@param buffer el bufer donde pintar | [
"IMprime",
"un",
"stacktrace",
"element",
"."
] | train | https://github.com/ginere/ginere-base/blob/b1cc1c5834bd8a31df475c6f3fc0ee51273c5a24/src/main/java/eu/ginere/base/util/exception/ExceptionUtils.java#L78-L89 |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/p3/TableReader.java | TableReader.readPage | private void readPage(byte[] buffer, Table table)
{
int magicNumber = getShort(buffer, 0);
if (magicNumber == 0x4400)
{
//System.out.println(ByteArrayHelper.hexdump(buffer, 0, 6, true, 16, ""));
int recordSize = m_definition.getRecordSize();
RowValidator rowValidator = m_definition.getRowValidator();
String primaryKeyColumnName = m_definition.getPrimaryKeyColumnName();
int index = 6;
while (index + recordSize <= buffer.length)
{
//System.out.println(ByteArrayHelper.hexdump(buffer, index, recordSize, true, 16, ""));
int btrieveValue = getShort(buffer, index);
if (btrieveValue != 0)
{
Map<String, Object> row = new HashMap<String, Object>();
row.put("ROW_VERSION", Integer.valueOf(btrieveValue));
for (ColumnDefinition column : m_definition.getColumns())
{
Object value = column.read(index, buffer);
//System.out.println(column.getName() + ": " + value);
row.put(column.getName(), value);
}
if (rowValidator == null || rowValidator.validRow(row))
{
table.addRow(primaryKeyColumnName, row);
}
}
index += recordSize;
}
}
} | java | private void readPage(byte[] buffer, Table table)
{
int magicNumber = getShort(buffer, 0);
if (magicNumber == 0x4400)
{
//System.out.println(ByteArrayHelper.hexdump(buffer, 0, 6, true, 16, ""));
int recordSize = m_definition.getRecordSize();
RowValidator rowValidator = m_definition.getRowValidator();
String primaryKeyColumnName = m_definition.getPrimaryKeyColumnName();
int index = 6;
while (index + recordSize <= buffer.length)
{
//System.out.println(ByteArrayHelper.hexdump(buffer, index, recordSize, true, 16, ""));
int btrieveValue = getShort(buffer, index);
if (btrieveValue != 0)
{
Map<String, Object> row = new HashMap<String, Object>();
row.put("ROW_VERSION", Integer.valueOf(btrieveValue));
for (ColumnDefinition column : m_definition.getColumns())
{
Object value = column.read(index, buffer);
//System.out.println(column.getName() + ": " + value);
row.put(column.getName(), value);
}
if (rowValidator == null || rowValidator.validRow(row))
{
table.addRow(primaryKeyColumnName, row);
}
}
index += recordSize;
}
}
} | [
"private",
"void",
"readPage",
"(",
"byte",
"[",
"]",
"buffer",
",",
"Table",
"table",
")",
"{",
"int",
"magicNumber",
"=",
"getShort",
"(",
"buffer",
",",
"0",
")",
";",
"if",
"(",
"magicNumber",
"==",
"0x4400",
")",
"{",
"//System.out.println(ByteArrayHe... | Reads data from a single page of the database file.
@param buffer page from the database file
@param table Table instance | [
"Reads",
"data",
"from",
"a",
"single",
"page",
"of",
"the",
"database",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/TableReader.java#L108-L142 |
actorapp/droidkit-actors | actors/src/main/java/com/droidkit/actors/mailbox/Mailbox.java | Mailbox.scheduleOnce | public void scheduleOnce(Envelope envelope, long time) {
if (envelope.getMailbox() != this) {
throw new RuntimeException("envelope.mailbox != this mailbox");
}
envelopes.putEnvelopeOnce(envelope, time, comparator);
} | java | public void scheduleOnce(Envelope envelope, long time) {
if (envelope.getMailbox() != this) {
throw new RuntimeException("envelope.mailbox != this mailbox");
}
envelopes.putEnvelopeOnce(envelope, time, comparator);
} | [
"public",
"void",
"scheduleOnce",
"(",
"Envelope",
"envelope",
",",
"long",
"time",
")",
"{",
"if",
"(",
"envelope",
".",
"getMailbox",
"(",
")",
"!=",
"this",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"envelope.mailbox != this mailbox\"",
")",
";",... | Send envelope once at time
@param envelope envelope
@param time time | [
"Send",
"envelope",
"once",
"at",
"time"
] | train | https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/mailbox/Mailbox.java#L50-L56 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/SymbolTable.java | SymbolTable.calcHash | @SuppressWarnings("cast")
public static int calcHash(char[] buffer, int start, int len) {
int hash = (int) buffer[start];
for (int i = 1; i < len; ++i) {
hash = (hash * 31) + (int) buffer[start+i];
}
return hash;
} | java | @SuppressWarnings("cast")
public static int calcHash(char[] buffer, int start, int len) {
int hash = (int) buffer[start];
for (int i = 1; i < len; ++i) {
hash = (hash * 31) + (int) buffer[start+i];
}
return hash;
} | [
"@",
"SuppressWarnings",
"(",
"\"cast\"",
")",
"public",
"static",
"int",
"calcHash",
"(",
"char",
"[",
"]",
"buffer",
",",
"int",
"start",
",",
"int",
"len",
")",
"{",
"int",
"hash",
"=",
"(",
"int",
")",
"buffer",
"[",
"start",
"]",
";",
"for",
"... | Implementation of a hashing method for variable length
Strings. Most of the time intention is that this calculation
is done by caller during parsing, not here; however, sometimes
it needs to be done for parsed "String" too.
@param len Length of String; has to be at least 1 (caller guarantees
this pre-condition) | [
"Implementation",
"of",
"a",
"hashing",
"method",
"for",
"variable",
"length",
"Strings",
".",
"Most",
"of",
"the",
"time",
"intention",
"is",
"that",
"this",
"calculation",
"is",
"done",
"by",
"caller",
"during",
"parsing",
"not",
"here",
";",
"however",
"s... | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/SymbolTable.java#L558-L565 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java | SdkUtils.concatStringWithDelimiter | public static String concatStringWithDelimiter(String[] strings, String delimiter) {
StringBuilder sbr = new StringBuilder();
int size = strings.length;
for (int i = 0; i < size - 1; i++) {
sbr.append(strings[i]).append(delimiter);
}
sbr.append(strings[size - 1]);
return sbr.toString();
} | java | public static String concatStringWithDelimiter(String[] strings, String delimiter) {
StringBuilder sbr = new StringBuilder();
int size = strings.length;
for (int i = 0; i < size - 1; i++) {
sbr.append(strings[i]).append(delimiter);
}
sbr.append(strings[size - 1]);
return sbr.toString();
} | [
"public",
"static",
"String",
"concatStringWithDelimiter",
"(",
"String",
"[",
"]",
"strings",
",",
"String",
"delimiter",
")",
"{",
"StringBuilder",
"sbr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"size",
"=",
"strings",
".",
"length",
";",
"for",... | Utility method to create a large String with the given delimiter.
@param strings Strings to concatenate.
@param delimiter The delimiter to use to put between each string item.
@return a large string with all items separated by given delimiter. | [
"Utility",
"method",
"to",
"create",
"a",
"large",
"String",
"with",
"the",
"given",
"delimiter",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java#L290-L298 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WPanelRenderer.java | WPanelRenderer.renderChildren | private void renderChildren(final WPanel panel, final WebXmlRenderContext renderContext) {
LayoutManager layout = panel.getLayout();
Renderer layoutRenderer = null;
if (layout != null) {
layoutRenderer = new RendererFactoryImpl().getRenderer(layout.getClass());
}
if (layoutRenderer == null) {
renderContext.getWriter().appendTag("ui:content");
paintChildren(panel, renderContext);
renderContext.getWriter().appendEndTag("ui:content");
} else {
layoutRenderer.render(panel, renderContext);
}
} | java | private void renderChildren(final WPanel panel, final WebXmlRenderContext renderContext) {
LayoutManager layout = panel.getLayout();
Renderer layoutRenderer = null;
if (layout != null) {
layoutRenderer = new RendererFactoryImpl().getRenderer(layout.getClass());
}
if (layoutRenderer == null) {
renderContext.getWriter().appendTag("ui:content");
paintChildren(panel, renderContext);
renderContext.getWriter().appendEndTag("ui:content");
} else {
layoutRenderer.render(panel, renderContext);
}
} | [
"private",
"void",
"renderChildren",
"(",
"final",
"WPanel",
"panel",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"LayoutManager",
"layout",
"=",
"panel",
".",
"getLayout",
"(",
")",
";",
"Renderer",
"layoutRenderer",
"=",
"null",
";",
"if",
... | Paints the children contained within the panel. This defers rendering to a layout renderer (if available).
@param panel the panel to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"children",
"contained",
"within",
"the",
"panel",
".",
"This",
"defers",
"rendering",
"to",
"a",
"layout",
"renderer",
"(",
"if",
"available",
")",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WPanelRenderer.java#L150-L165 |
hibernate/hibernate-metamodelgen | src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaEntity.java | XmlMetaEntity.getType | private String getType(String propertyName, String explicitTargetEntity, ElementKind expectedElementKind) {
for ( Element elem : element.getEnclosedElements() ) {
if ( !expectedElementKind.equals( elem.getKind() ) ) {
continue;
}
TypeMirror mirror;
String name = elem.getSimpleName().toString();
if ( ElementKind.METHOD.equals( elem.getKind() ) ) {
name = StringUtil.getPropertyName( name );
mirror = ( (ExecutableElement) elem ).getReturnType();
}
else {
mirror = elem.asType();
}
if ( name == null || !name.equals( propertyName ) ) {
continue;
}
if ( explicitTargetEntity != null ) {
// TODO should there be a check of the target entity class and if it is loadable?
return explicitTargetEntity;
}
switch ( mirror.getKind() ) {
case INT: {
return "java.lang.Integer";
}
case LONG: {
return "java.lang.Long";
}
case BOOLEAN: {
return "java.lang.Boolean";
}
case BYTE: {
return "java.lang.Byte";
}
case SHORT: {
return "java.lang.Short";
}
case CHAR: {
return "java.lang.Char";
}
case FLOAT: {
return "java.lang.Float";
}
case DOUBLE: {
return "java.lang.Double";
}
case DECLARED: {
return mirror.toString();
}
case TYPEVAR: {
return mirror.toString();
}
default: {
}
}
}
context.logMessage(
Diagnostic.Kind.WARNING,
"Unable to determine type for property " + propertyName + " of class " + getQualifiedName()
+ " using access type " + accessTypeInfo.getDefaultAccessType()
);
return null;
} | java | private String getType(String propertyName, String explicitTargetEntity, ElementKind expectedElementKind) {
for ( Element elem : element.getEnclosedElements() ) {
if ( !expectedElementKind.equals( elem.getKind() ) ) {
continue;
}
TypeMirror mirror;
String name = elem.getSimpleName().toString();
if ( ElementKind.METHOD.equals( elem.getKind() ) ) {
name = StringUtil.getPropertyName( name );
mirror = ( (ExecutableElement) elem ).getReturnType();
}
else {
mirror = elem.asType();
}
if ( name == null || !name.equals( propertyName ) ) {
continue;
}
if ( explicitTargetEntity != null ) {
// TODO should there be a check of the target entity class and if it is loadable?
return explicitTargetEntity;
}
switch ( mirror.getKind() ) {
case INT: {
return "java.lang.Integer";
}
case LONG: {
return "java.lang.Long";
}
case BOOLEAN: {
return "java.lang.Boolean";
}
case BYTE: {
return "java.lang.Byte";
}
case SHORT: {
return "java.lang.Short";
}
case CHAR: {
return "java.lang.Char";
}
case FLOAT: {
return "java.lang.Float";
}
case DOUBLE: {
return "java.lang.Double";
}
case DECLARED: {
return mirror.toString();
}
case TYPEVAR: {
return mirror.toString();
}
default: {
}
}
}
context.logMessage(
Diagnostic.Kind.WARNING,
"Unable to determine type for property " + propertyName + " of class " + getQualifiedName()
+ " using access type " + accessTypeInfo.getDefaultAccessType()
);
return null;
} | [
"private",
"String",
"getType",
"(",
"String",
"propertyName",
",",
"String",
"explicitTargetEntity",
",",
"ElementKind",
"expectedElementKind",
")",
"{",
"for",
"(",
"Element",
"elem",
":",
"element",
".",
"getEnclosedElements",
"(",
")",
")",
"{",
"if",
"(",
... | Returns the entity type for a property.
@param propertyName The property name
@param explicitTargetEntity The explicitly specified target entity type or {@code null}.
@param expectedElementKind Determines property vs field access type
@return The entity type for this property or {@code null} if the property with the name and the matching access
type does not exist. | [
"Returns",
"the",
"entity",
"type",
"for",
"a",
"property",
"."
] | train | https://github.com/hibernate/hibernate-metamodelgen/blob/2c87b262bc03b1a5a541789fc00c54e0531a36b2/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaEntity.java#L301-L368 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java | LinkFactoryImpl.getClassToolTip | private String getClassToolTip(TypeElement typeElement, boolean isTypeLink) {
Configuration configuration = m_writer.configuration;
Utils utils = configuration.utils;
if (isTypeLink) {
return configuration.getText("doclet.Href_Type_Param_Title",
utils.getSimpleName(typeElement));
} else if (utils.isInterface(typeElement)){
return configuration.getText("doclet.Href_Interface_Title",
utils.getPackageName(utils.containingPackage(typeElement)));
} else if (utils.isAnnotationType(typeElement)) {
return configuration.getText("doclet.Href_Annotation_Title",
utils.getPackageName(utils.containingPackage(typeElement)));
} else if (utils.isEnum(typeElement)) {
return configuration.getText("doclet.Href_Enum_Title",
utils.getPackageName(utils.containingPackage(typeElement)));
} else {
return configuration.getText("doclet.Href_Class_Title",
utils.getPackageName(utils.containingPackage(typeElement)));
}
} | java | private String getClassToolTip(TypeElement typeElement, boolean isTypeLink) {
Configuration configuration = m_writer.configuration;
Utils utils = configuration.utils;
if (isTypeLink) {
return configuration.getText("doclet.Href_Type_Param_Title",
utils.getSimpleName(typeElement));
} else if (utils.isInterface(typeElement)){
return configuration.getText("doclet.Href_Interface_Title",
utils.getPackageName(utils.containingPackage(typeElement)));
} else if (utils.isAnnotationType(typeElement)) {
return configuration.getText("doclet.Href_Annotation_Title",
utils.getPackageName(utils.containingPackage(typeElement)));
} else if (utils.isEnum(typeElement)) {
return configuration.getText("doclet.Href_Enum_Title",
utils.getPackageName(utils.containingPackage(typeElement)));
} else {
return configuration.getText("doclet.Href_Class_Title",
utils.getPackageName(utils.containingPackage(typeElement)));
}
} | [
"private",
"String",
"getClassToolTip",
"(",
"TypeElement",
"typeElement",
",",
"boolean",
"isTypeLink",
")",
"{",
"Configuration",
"configuration",
"=",
"m_writer",
".",
"configuration",
";",
"Utils",
"utils",
"=",
"configuration",
".",
"utils",
";",
"if",
"(",
... | Given a class, return the appropriate tool tip.
@param typeElement the class to get the tool tip for.
@return the tool tip for the appropriate class. | [
"Given",
"a",
"class",
"return",
"the",
"appropriate",
"tool",
"tip",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java#L200-L219 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/DatasetFilterUtils.java | DatasetFilterUtils.survived | public static boolean survived(String topic, List<Pattern> blacklist, List<Pattern> whitelist) {
if (stringInPatterns(topic, blacklist)) {
return false;
}
return (whitelist.isEmpty() || stringInPatterns(topic, whitelist));
} | java | public static boolean survived(String topic, List<Pattern> blacklist, List<Pattern> whitelist) {
if (stringInPatterns(topic, blacklist)) {
return false;
}
return (whitelist.isEmpty() || stringInPatterns(topic, whitelist));
} | [
"public",
"static",
"boolean",
"survived",
"(",
"String",
"topic",
",",
"List",
"<",
"Pattern",
">",
"blacklist",
",",
"List",
"<",
"Pattern",
">",
"whitelist",
")",
"{",
"if",
"(",
"stringInPatterns",
"(",
"topic",
",",
"blacklist",
")",
")",
"{",
"retu... | A topic survives if (1) it doesn't match the blacklist, and
(2) either whitelist is empty, or it matches the whitelist.
Whitelist and blacklist use regex patterns (NOT glob patterns). | [
"A",
"topic",
"survives",
"if",
"(",
"1",
")",
"it",
"doesn",
"t",
"match",
"the",
"blacklist",
"and",
"(",
"2",
")",
"either",
"whitelist",
"is",
"empty",
"or",
"it",
"matches",
"the",
"whitelist",
".",
"Whitelist",
"and",
"blacklist",
"use",
"regex",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/DatasetFilterUtils.java#L82-L87 |
knightliao/disconf | disconf-core/src/main/java/com/baidu/disconf/core/common/zookeeper/ZookeeperMgr.java | ZookeeperMgr.writePersistentUrl | public void writePersistentUrl(String url, String value) throws Exception {
store.write(url, value);
} | java | public void writePersistentUrl(String url, String value) throws Exception {
store.write(url, value);
} | [
"public",
"void",
"writePersistentUrl",
"(",
"String",
"url",
",",
"String",
"value",
")",
"throws",
"Exception",
"{",
"store",
".",
"write",
"(",
"url",
",",
"value",
")",
";",
"}"
] | @return List<String>
@Description: 写持久化结点, 没有则新建, 存在则进行更新
@author liaoqiqi
@date 2013-6-14 | [
"@return",
"List<String",
">"
] | train | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-core/src/main/java/com/baidu/disconf/core/common/zookeeper/ZookeeperMgr.java#L163-L166 |
structurizr/java | structurizr-core/src/com/structurizr/model/StaticStructureElement.java | StaticStructureElement.delivers | @Nullable
public Relationship delivers(@Nonnull Person destination, String description) {
return delivers(destination, description, null);
} | java | @Nullable
public Relationship delivers(@Nonnull Person destination, String description) {
return delivers(destination, description, null);
} | [
"@",
"Nullable",
"public",
"Relationship",
"delivers",
"(",
"@",
"Nonnull",
"Person",
"destination",
",",
"String",
"description",
")",
"{",
"return",
"delivers",
"(",
"destination",
",",
"description",
",",
"null",
")",
";",
"}"
] | Adds a unidirectional relationship between this element and a person.
@param destination the target of the relationship
@param description a description of the relationship (e.g. "sends e-mail to")
@return the relationship that has just been created and added to the model | [
"Adds",
"a",
"unidirectional",
"relationship",
"between",
"this",
"element",
"and",
"a",
"person",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/StaticStructureElement.java#L139-L142 |
intuit/QuickBooks-V3-Java-SDK | ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/QueryResponseDeserializer.java | QueryResponseDeserializer.registerModulesForCustomFieldDef | private void registerModulesForCustomFieldDef(ObjectMapper objectMapper) {
SimpleModule simpleModule = new SimpleModule("CustomFieldDefinition", new Version(1, 0, 0, null));
simpleModule.addDeserializer(CustomFieldDefinition.class, new CustomFieldDefinitionDeserializer());
objectMapper.registerModule(simpleModule);
} | java | private void registerModulesForCustomFieldDef(ObjectMapper objectMapper) {
SimpleModule simpleModule = new SimpleModule("CustomFieldDefinition", new Version(1, 0, 0, null));
simpleModule.addDeserializer(CustomFieldDefinition.class, new CustomFieldDefinitionDeserializer());
objectMapper.registerModule(simpleModule);
} | [
"private",
"void",
"registerModulesForCustomFieldDef",
"(",
"ObjectMapper",
"objectMapper",
")",
"{",
"SimpleModule",
"simpleModule",
"=",
"new",
"SimpleModule",
"(",
"\"CustomFieldDefinition\"",
",",
"new",
"Version",
"(",
"1",
",",
"0",
",",
"0",
",",
"null",
")... | Method to add custom deserializer for CustomFieldDefinition
@param objectMapper the Jackson object mapper | [
"Method",
"to",
"add",
"custom",
"deserializer",
"for",
"CustomFieldDefinition"
] | train | https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/QueryResponseDeserializer.java#L156-L160 |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/ActionListener.java | ActionListener.bindActionListeners | public static void bindActionListeners(IActionTarget target, List<ActionListener> actionListeners) {
if (actionListeners != null) {
for (ActionListener actionListener : actionListeners) {
actionListener.bind(target);
}
}
} | java | public static void bindActionListeners(IActionTarget target, List<ActionListener> actionListeners) {
if (actionListeners != null) {
for (ActionListener actionListener : actionListeners) {
actionListener.bind(target);
}
}
} | [
"public",
"static",
"void",
"bindActionListeners",
"(",
"IActionTarget",
"target",
",",
"List",
"<",
"ActionListener",
">",
"actionListeners",
")",
"{",
"if",
"(",
"actionListeners",
"!=",
"null",
")",
"{",
"for",
"(",
"ActionListener",
"actionListener",
":",
"a... | Binds the action listeners to the specified target.
@param target The target to be bound to the created listeners.
@param actionListeners The action listeners to be bound. | [
"Binds",
"the",
"action",
"listeners",
"to",
"the",
"specified",
"target",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/controller/ActionListener.java#L57-L63 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java | SvgGraphicsContext.drawRectangle | public void drawRectangle(Object parent, String name, Bbox rectangle, ShapeStyle style) {
if (isAttached()) {
Element element = helper.createOrUpdateElement(parent, name, "rect", style);
Dom.setElementAttribute(element, "x", Double.toString(rectangle.getX()));
Dom.setElementAttribute(element, "y", Double.toString(rectangle.getY()));
Dom.setElementAttribute(element, "width", Double.toString(rectangle.getWidth()));
Dom.setElementAttribute(element, "height", Double.toString(rectangle.getHeight()));
}
} | java | public void drawRectangle(Object parent, String name, Bbox rectangle, ShapeStyle style) {
if (isAttached()) {
Element element = helper.createOrUpdateElement(parent, name, "rect", style);
Dom.setElementAttribute(element, "x", Double.toString(rectangle.getX()));
Dom.setElementAttribute(element, "y", Double.toString(rectangle.getY()));
Dom.setElementAttribute(element, "width", Double.toString(rectangle.getWidth()));
Dom.setElementAttribute(element, "height", Double.toString(rectangle.getHeight()));
}
} | [
"public",
"void",
"drawRectangle",
"(",
"Object",
"parent",
",",
"String",
"name",
",",
"Bbox",
"rectangle",
",",
"ShapeStyle",
"style",
")",
"{",
"if",
"(",
"isAttached",
"(",
")",
")",
"{",
"Element",
"element",
"=",
"helper",
".",
"createOrUpdateElement",... | Draw a rectangle onto the <code>GraphicsContext</code>.
@param parent
parent group object
@param name
The rectangle's name.
@param rectangle
The rectangle to be drawn. The bounding box's origin, is the rectangle's upper left corner on the
screen.
@param style
The styling object for the rectangle. | [
"Draw",
"a",
"rectangle",
"onto",
"the",
"<code",
">",
"GraphicsContext<",
"/",
"code",
">",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L339-L347 |
baratine/baratine | framework/src/main/java/com/caucho/v5/reflect/ReflectUtil.java | ReflectUtil.isMatch | public static boolean isMatch(Method javaMethod,
String name, Class<?> []param)
{
if (! javaMethod.getName().equals(name))
return false;
Class<?> []mparam = javaMethod.getParameterTypes();
return isMatch(mparam, param);
} | java | public static boolean isMatch(Method javaMethod,
String name, Class<?> []param)
{
if (! javaMethod.getName().equals(name))
return false;
Class<?> []mparam = javaMethod.getParameterTypes();
return isMatch(mparam, param);
} | [
"public",
"static",
"boolean",
"isMatch",
"(",
"Method",
"javaMethod",
",",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"param",
")",
"{",
"if",
"(",
"!",
"javaMethod",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"r... | Tests if an annotated method matches a name and parameter types. | [
"Tests",
"if",
"an",
"annotated",
"method",
"matches",
"a",
"name",
"and",
"parameter",
"types",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/reflect/ReflectUtil.java#L144-L153 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/InventoryNavigator.java | InventoryNavigator.searchManagedEntities | public ManagedEntity[] searchManagedEntities(boolean recurse) throws InvalidProperty, RuntimeFault, RemoteException {
String[][] typeinfo = new String[][]{new String[]{"ManagedEntity",}};
return searchManagedEntities(typeinfo, recurse);
} | java | public ManagedEntity[] searchManagedEntities(boolean recurse) throws InvalidProperty, RuntimeFault, RemoteException {
String[][] typeinfo = new String[][]{new String[]{"ManagedEntity",}};
return searchManagedEntities(typeinfo, recurse);
} | [
"public",
"ManagedEntity",
"[",
"]",
"searchManagedEntities",
"(",
"boolean",
"recurse",
")",
"throws",
"InvalidProperty",
",",
"RuntimeFault",
",",
"RemoteException",
"{",
"String",
"[",
"]",
"[",
"]",
"typeinfo",
"=",
"new",
"String",
"[",
"]",
"[",
"]",
"... | Retrieve container contents from specified parent recursively if requested.
@param recurse retrieve contents recursively from the root down
@throws RemoteException
@throws RuntimeFault
@throws InvalidProperty | [
"Retrieve",
"container",
"contents",
"from",
"specified",
"parent",
"recursively",
"if",
"requested",
"."
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/InventoryNavigator.java#L28-L31 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java | ElementFilter.opensIn | public static List<OpensDirective>
opensIn(Iterable<? extends Directive> directives) {
return listFilter(directives, DirectiveKind.OPENS, OpensDirective.class);
} | java | public static List<OpensDirective>
opensIn(Iterable<? extends Directive> directives) {
return listFilter(directives, DirectiveKind.OPENS, OpensDirective.class);
} | [
"public",
"static",
"List",
"<",
"OpensDirective",
">",
"opensIn",
"(",
"Iterable",
"<",
"?",
"extends",
"Directive",
">",
"directives",
")",
"{",
"return",
"listFilter",
"(",
"directives",
",",
"DirectiveKind",
".",
"OPENS",
",",
"OpensDirective",
".",
"class... | Returns a list of {@code opens} directives in {@code directives}.
@return a list of {@code opens} directives in {@code directives}
@param directives the directives to filter
@since 9 | [
"Returns",
"a",
"list",
"of",
"{"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L254-L257 |
liferay/com-liferay-commerce | commerce-api/src/main/java/com/liferay/commerce/model/CommerceCountryWrapper.java | CommerceCountryWrapper.getName | @Override
public String getName(String languageId, boolean useDefault) {
return _commerceCountry.getName(languageId, useDefault);
} | java | @Override
public String getName(String languageId, boolean useDefault) {
return _commerceCountry.getName(languageId, useDefault);
} | [
"@",
"Override",
"public",
"String",
"getName",
"(",
"String",
"languageId",
",",
"boolean",
"useDefault",
")",
"{",
"return",
"_commerceCountry",
".",
"getName",
"(",
"languageId",
",",
"useDefault",
")",
";",
"}"
] | Returns the localized name of this commerce country in the language, optionally using the default language if no localization exists for the requested language.
@param languageId the ID of the language
@param useDefault whether to use the default language if no localization exists for the requested language
@return the localized name of this commerce country | [
"Returns",
"the",
"localized",
"name",
"of",
"this",
"commerce",
"country",
"in",
"the",
"language",
"optionally",
"using",
"the",
"default",
"language",
"if",
"no",
"localization",
"exists",
"for",
"the",
"requested",
"language",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-api/src/main/java/com/liferay/commerce/model/CommerceCountryWrapper.java#L358-L361 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/message/netty/MessageBatch.java | MessageBatch.writeTaskMessage | private void writeTaskMessage(ChannelBufferOutputStream bout, TaskMessage message) throws Exception {
int payload_len = 0;
if (message.message() != null)
payload_len = message.message().length;
short type = message.get_type();
bout.writeShort(type);
int task_id = message.task();
if (task_id > Short.MAX_VALUE)
throw new RuntimeException("Task ID should not exceed " + Short.MAX_VALUE);
bout.writeShort((short) task_id);
bout.writeInt(payload_len);
if (payload_len > 0)
bout.write(message.message());
// LOG.info("Write one message taskid:{}, len:{}, data:{}", taskId
// , payload_len, JStormUtils.toPrintableString(message.message()) );
} | java | private void writeTaskMessage(ChannelBufferOutputStream bout, TaskMessage message) throws Exception {
int payload_len = 0;
if (message.message() != null)
payload_len = message.message().length;
short type = message.get_type();
bout.writeShort(type);
int task_id = message.task();
if (task_id > Short.MAX_VALUE)
throw new RuntimeException("Task ID should not exceed " + Short.MAX_VALUE);
bout.writeShort((short) task_id);
bout.writeInt(payload_len);
if (payload_len > 0)
bout.write(message.message());
// LOG.info("Write one message taskid:{}, len:{}, data:{}", taskId
// , payload_len, JStormUtils.toPrintableString(message.message()) );
} | [
"private",
"void",
"writeTaskMessage",
"(",
"ChannelBufferOutputStream",
"bout",
",",
"TaskMessage",
"message",
")",
"throws",
"Exception",
"{",
"int",
"payload_len",
"=",
"0",
";",
"if",
"(",
"message",
".",
"message",
"(",
")",
"!=",
"null",
")",
"payload_le... | write a TaskMessage into a stream
Each TaskMessage is encoded as: task ... short(2) len ... int(4) payload ... byte[] * | [
"write",
"a",
"TaskMessage",
"into",
"a",
"stream"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/message/netty/MessageBatch.java#L205-L224 |
StanKocken/EfficientAdapter | efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java | ViewHelper.setTextColor | public static void setTextColor(EfficientCacheView cacheView, int viewId, @ColorInt int color) {
View view = cacheView.findViewByIdEfficient(viewId);
if (view instanceof TextView) {
((TextView) view).setTextColor(color);
}
} | java | public static void setTextColor(EfficientCacheView cacheView, int viewId, @ColorInt int color) {
View view = cacheView.findViewByIdEfficient(viewId);
if (view instanceof TextView) {
((TextView) view).setTextColor(color);
}
} | [
"public",
"static",
"void",
"setTextColor",
"(",
"EfficientCacheView",
"cacheView",
",",
"int",
"viewId",
",",
"@",
"ColorInt",
"int",
"color",
")",
"{",
"View",
"view",
"=",
"cacheView",
".",
"findViewByIdEfficient",
"(",
"viewId",
")",
";",
"if",
"(",
"vie... | Equivalent to calling TextView.setTextColor
@param cacheView The cache of views to get the view from
@param viewId The id of the view whose text color should change
@param color The new color for the view | [
"Equivalent",
"to",
"calling",
"TextView",
".",
"setTextColor"
] | train | https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java#L143-L148 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java | ObjectUtils.shallowCopy | public static void shallowCopy(Object source, Object target) {
ObjectUtils.doShallowCopy(source, target, Boolean.TRUE);
} | java | public static void shallowCopy(Object source, Object target) {
ObjectUtils.doShallowCopy(source, target, Boolean.TRUE);
} | [
"public",
"static",
"void",
"shallowCopy",
"(",
"Object",
"source",
",",
"Object",
"target",
")",
"{",
"ObjectUtils",
".",
"doShallowCopy",
"(",
"source",
",",
"target",
",",
"Boolean",
".",
"TRUE",
")",
";",
"}"
] | Makes a shallow copy of the source object into the target one.
<p>
This method differs from {@link ReflectionUtils#shallowCopyFieldState(Object, Object)} this doesn't require
source and target objects to share the same class hierarchy.
@param source
the source object.
@param target
the target object. | [
"Makes",
"a",
"shallow",
"copy",
"of",
"the",
"source",
"object",
"into",
"the",
"target",
"one",
".",
"<p",
">",
"This",
"method",
"differs",
"from",
"{",
"@link",
"ReflectionUtils#shallowCopyFieldState",
"(",
"Object",
"Object",
")",
"}",
"this",
"doesn",
... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ObjectUtils.java#L116-L119 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.createOrUpdateWorkerPoolAsync | public Observable<WorkerPoolResourceInner> createOrUpdateWorkerPoolAsync(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) {
return createOrUpdateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | java | public Observable<WorkerPoolResourceInner> createOrUpdateWorkerPoolAsync(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) {
return createOrUpdateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).map(new Func1<ServiceResponse<WorkerPoolResourceInner>, WorkerPoolResourceInner>() {
@Override
public WorkerPoolResourceInner call(ServiceResponse<WorkerPoolResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkerPoolResourceInner",
">",
"createOrUpdateWorkerPoolAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"workerPoolName",
",",
"WorkerPoolResourceInner",
"workerPoolEnvelope",
")",
"{",
"return",
"createOrUpdat... | Create or update a worker pool.
Create or update a worker pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@param workerPoolEnvelope Properties of the worker pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Create",
"or",
"update",
"a",
"worker",
"pool",
".",
"Create",
"or",
"update",
"a",
"worker",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5221-L5228 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java | TypeEnter.DefaultConstructor | JCTree DefaultConstructor(TreeMaker make,
ClassSymbol c,
MethodSymbol baseInit,
List<Type> typarams,
List<Type> argtypes,
List<Type> thrown,
long flags,
boolean based) {
JCTree result;
if ((c.flags() & ENUM) != 0 &&
(types.supertype(c.type).tsym == syms.enumSym)) {
// constructors of true enums are private
flags = (flags & ~AccessFlags) | PRIVATE | GENERATEDCONSTR;
} else
flags |= (c.flags() & AccessFlags) | GENERATEDCONSTR;
if (c.name.isEmpty()) {
flags |= ANONCONSTR;
}
Type mType = new MethodType(argtypes, null, thrown, c);
Type initType = typarams.nonEmpty() ?
new ForAll(typarams, mType) :
mType;
MethodSymbol init = new MethodSymbol(flags, names.init,
initType, c);
init.params = createDefaultConstructorParams(make, baseInit, init,
argtypes, based);
List<JCVariableDecl> params = make.Params(argtypes, init);
List<JCStatement> stats = List.nil();
if (c.type != syms.objectType) {
stats = stats.prepend(SuperCall(make, typarams, params, based));
}
result = make.MethodDef(init, make.Block(0, stats));
return result;
} | java | JCTree DefaultConstructor(TreeMaker make,
ClassSymbol c,
MethodSymbol baseInit,
List<Type> typarams,
List<Type> argtypes,
List<Type> thrown,
long flags,
boolean based) {
JCTree result;
if ((c.flags() & ENUM) != 0 &&
(types.supertype(c.type).tsym == syms.enumSym)) {
// constructors of true enums are private
flags = (flags & ~AccessFlags) | PRIVATE | GENERATEDCONSTR;
} else
flags |= (c.flags() & AccessFlags) | GENERATEDCONSTR;
if (c.name.isEmpty()) {
flags |= ANONCONSTR;
}
Type mType = new MethodType(argtypes, null, thrown, c);
Type initType = typarams.nonEmpty() ?
new ForAll(typarams, mType) :
mType;
MethodSymbol init = new MethodSymbol(flags, names.init,
initType, c);
init.params = createDefaultConstructorParams(make, baseInit, init,
argtypes, based);
List<JCVariableDecl> params = make.Params(argtypes, init);
List<JCStatement> stats = List.nil();
if (c.type != syms.objectType) {
stats = stats.prepend(SuperCall(make, typarams, params, based));
}
result = make.MethodDef(init, make.Block(0, stats));
return result;
} | [
"JCTree",
"DefaultConstructor",
"(",
"TreeMaker",
"make",
",",
"ClassSymbol",
"c",
",",
"MethodSymbol",
"baseInit",
",",
"List",
"<",
"Type",
">",
"typarams",
",",
"List",
"<",
"Type",
">",
"argtypes",
",",
"List",
"<",
"Type",
">",
"thrown",
",",
"long",
... | Generate default constructor for given class. For classes different
from java.lang.Object, this is:
c(argtype_0 x_0, ..., argtype_n x_n) throws thrown {
super(x_0, ..., x_n)
}
or, if based == true:
c(argtype_0 x_0, ..., argtype_n x_n) throws thrown {
x_0.super(x_1, ..., x_n)
}
@param make The tree factory.
@param c The class owning the default constructor.
@param argtypes The parameter types of the constructor.
@param thrown The thrown exceptions of the constructor.
@param based Is first parameter a this$n? | [
"Generate",
"default",
"constructor",
"for",
"given",
"class",
".",
"For",
"classes",
"different",
"from",
"java",
".",
"lang",
".",
"Object",
"this",
"is",
":"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java#L1014-L1047 |
google/closure-templates | java/src/com/google/template/soy/internal/proto/JavaQualifiedNames.java | JavaQualifiedNames.getQualifiedName | public static String getQualifiedName(Descriptors.EnumDescriptor enumType, ProtoFlavor flavor) {
return getClassName(enumType, flavor).replace('$', '.');
} | java | public static String getQualifiedName(Descriptors.EnumDescriptor enumType, ProtoFlavor flavor) {
return getClassName(enumType, flavor).replace('$', '.');
} | [
"public",
"static",
"String",
"getQualifiedName",
"(",
"Descriptors",
".",
"EnumDescriptor",
"enumType",
",",
"ProtoFlavor",
"flavor",
")",
"{",
"return",
"getClassName",
"(",
"enumType",
",",
"flavor",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",... | Returns the fully-qualified name for the enum descriptor with the given flavor (uses '.' inner
class seperator). | [
"Returns",
"the",
"fully",
"-",
"qualified",
"name",
"for",
"the",
"enum",
"descriptor",
"with",
"the",
"given",
"flavor",
"(",
"uses",
".",
"inner",
"class",
"seperator",
")",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/proto/JavaQualifiedNames.java#L78-L80 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsInner.java | JobCredentialsInner.createOrUpdate | public JobCredentialInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).toBlocking().single().body();
} | java | public JobCredentialInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).toBlocking().single().body();
} | [
"public",
"JobCredentialInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
",",
"String",
"credentialName",
",",
"JobCredentialInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponse... | Creates or updates a job credential.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param credentialName The name of the credential.
@param parameters The requested job credential state.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the JobCredentialInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"job",
"credential",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsInner.java#L330-L332 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-core/src/main/java/com/ibm/cloud/objectstorage/http/timers/TimeoutThreadPoolBuilder.java | TimeoutThreadPoolBuilder.buildDefaultTimeoutThreadPool | public static ScheduledThreadPoolExecutor buildDefaultTimeoutThreadPool(final String name) {
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(5, getThreadFactory(name));
safeSetRemoveOnCancel(executor);
executor.setKeepAliveTime(5, TimeUnit.SECONDS);
executor.allowCoreThreadTimeOut(true);
return executor;
} | java | public static ScheduledThreadPoolExecutor buildDefaultTimeoutThreadPool(final String name) {
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(5, getThreadFactory(name));
safeSetRemoveOnCancel(executor);
executor.setKeepAliveTime(5, TimeUnit.SECONDS);
executor.allowCoreThreadTimeOut(true);
return executor;
} | [
"public",
"static",
"ScheduledThreadPoolExecutor",
"buildDefaultTimeoutThreadPool",
"(",
"final",
"String",
"name",
")",
"{",
"ScheduledThreadPoolExecutor",
"executor",
"=",
"new",
"ScheduledThreadPoolExecutor",
"(",
"5",
",",
"getThreadFactory",
"(",
"name",
")",
")",
... | Creates a {@link ScheduledThreadPoolExecutor} with custom name for the threads.
@param name the prefix to add to the thread name in ThreadFactory.
@return The default thread pool for request timeout and client execution timeout features. | [
"Creates",
"a",
"{",
"@link",
"ScheduledThreadPoolExecutor",
"}",
"with",
"custom",
"name",
"for",
"the",
"threads",
"."
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-core/src/main/java/com/ibm/cloud/objectstorage/http/timers/TimeoutThreadPoolBuilder.java#L38-L45 |
facebookarchive/hive-dwrf | hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java | DynamicByteArray.setText | public void setText(Text result, int offset, int length) {
result.clear();
result.set(data.getBytes(), offset, length);
} | java | public void setText(Text result, int offset, int length) {
result.clear();
result.set(data.getBytes(), offset, length);
} | [
"public",
"void",
"setText",
"(",
"Text",
"result",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"result",
".",
"clear",
"(",
")",
";",
"result",
".",
"set",
"(",
"data",
".",
"getBytes",
"(",
")",
",",
"offset",
",",
"length",
")",
";",
... | Set a text value from the bytes in this dynamic array.
@param result the value to set
@param offset the start of the bytes to copy
@param length the number of bytes to copy | [
"Set",
"a",
"text",
"value",
"from",
"the",
"bytes",
"in",
"this",
"dynamic",
"array",
"."
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java#L146-L149 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ScriptExecutionHistorysInner.java | ScriptExecutionHistorysInner.promoteAsync | public Observable<Void> promoteAsync(String resourceGroupName, String clusterName, String scriptExecutionId) {
return promoteWithServiceResponseAsync(resourceGroupName, clusterName, scriptExecutionId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> promoteAsync(String resourceGroupName, String clusterName, String scriptExecutionId) {
return promoteWithServiceResponseAsync(resourceGroupName, clusterName, scriptExecutionId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"promoteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"scriptExecutionId",
")",
"{",
"return",
"promoteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
",",
"s... | Promotes the specified ad-hoc script execution to a persisted script.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param scriptExecutionId The script execution Id
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Promotes",
"the",
"specified",
"ad",
"-",
"hoc",
"script",
"execution",
"to",
"a",
"persisted",
"script",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ScriptExecutionHistorysInner.java#L235-L242 |
heinrichreimer/material-drawer | library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerItem.java | DrawerItem.setTextMode | public DrawerItem setTextMode(int textMode) {
if (textMode != SINGLE_LINE && textMode != TWO_LINE && textMode != THREE_LINE) {
throw new IllegalArgumentException("Image mode must be either SINGLE_LINE, TWO_LINE or THREE_LINE.");
}
mTextMode = textMode;
notifyDataChanged();
return this;
} | java | public DrawerItem setTextMode(int textMode) {
if (textMode != SINGLE_LINE && textMode != TWO_LINE && textMode != THREE_LINE) {
throw new IllegalArgumentException("Image mode must be either SINGLE_LINE, TWO_LINE or THREE_LINE.");
}
mTextMode = textMode;
notifyDataChanged();
return this;
} | [
"public",
"DrawerItem",
"setTextMode",
"(",
"int",
"textMode",
")",
"{",
"if",
"(",
"textMode",
"!=",
"SINGLE_LINE",
"&&",
"textMode",
"!=",
"TWO_LINE",
"&&",
"textMode",
"!=",
"THREE_LINE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Image mod... | Sets a text mode to the drawer item
@param textMode Text mode to set | [
"Sets",
"a",
"text",
"mode",
"to",
"the",
"drawer",
"item"
] | train | https://github.com/heinrichreimer/material-drawer/blob/7c2406812d73f710ef8bb73d4a0f4bbef3b275ce/library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerItem.java#L414-L421 |
haifengl/smile | math/src/main/java/smile/math/Math.java | Math.pdist | public static void pdist(double[][] x, double[][] dist, boolean squared, boolean half) {
int n = x.length;
if (n < 100) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
double d = distance(x[i], x[j]);
dist[i][j] = d;
dist[j][i] = d;
}
}
} else {
int nprocs = Runtime.getRuntime().availableProcessors();
List<PdistTask> tasks = new ArrayList<>();
for (int i = 0; i < nprocs; i++) {
PdistTask task = new PdistTask(x, dist, nprocs, i, squared, half);
tasks.add(task);
}
ForkJoinPool.commonPool().invokeAll(tasks);
}
} | java | public static void pdist(double[][] x, double[][] dist, boolean squared, boolean half) {
int n = x.length;
if (n < 100) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
double d = distance(x[i], x[j]);
dist[i][j] = d;
dist[j][i] = d;
}
}
} else {
int nprocs = Runtime.getRuntime().availableProcessors();
List<PdistTask> tasks = new ArrayList<>();
for (int i = 0; i < nprocs; i++) {
PdistTask task = new PdistTask(x, dist, nprocs, i, squared, half);
tasks.add(task);
}
ForkJoinPool.commonPool().invokeAll(tasks);
}
} | [
"public",
"static",
"void",
"pdist",
"(",
"double",
"[",
"]",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"[",
"]",
"dist",
",",
"boolean",
"squared",
",",
"boolean",
"half",
")",
"{",
"int",
"n",
"=",
"x",
".",
"length",
";",
"if",
"(",
"n",
"<",
... | Pairwise distance between pairs of objects.
@param x Rows of x correspond to observations, and columns correspond to variables.
@param squared If true, compute the squared Euclidean distance.
@param half If true, only the lower half of dist will be referenced.
@param dist The distance matrix. | [
"Pairwise",
"distance",
"between",
"pairs",
"of",
"objects",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Math.java#L2135-L2155 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MoreLikeThis.java | MoreLikeThis.createQueue | private PriorityQueue<Object[]> createQueue(Map<String, Int> words) throws IOException
{
// have collected all words in doc and their freqs
int numDocs = ir.numDocs();
FreqQ res = new FreqQ(words.size()); // will order words by score
Iterator<String> it = words.keySet().iterator();
while (it.hasNext())
{ // for every word
String word = it.next();
int tf = words.get(word).x; // term freq in the source doc
if (minTermFreq > 0 && tf < minTermFreq)
{
continue; // filter out words that don't occur enough times in the source
}
// go through all the fields and find the largest document frequency
String topField = fieldNames[0];
int docFreq = 0;
for (int i = 0; i < fieldNames.length; i++)
{
int freq = ir.docFreq(new Term(fieldNames[i], word));
topField = (freq > docFreq) ? fieldNames[i] : topField; //NOSONAR
docFreq = (freq > docFreq) ? freq : docFreq;
}
if (minDocFreq > 0 && docFreq < minDocFreq)
{
continue; // filter out words that don't occur in enough docs
}
if (docFreq == 0)
{
continue; // index update problem?
}
float idf = similarity.idf(docFreq, numDocs);
float score = tf * idf;
// only really need 1st 3 entries, other ones are for troubleshooting
res.insertWithOverflow(new Object[]{word, // the word
topField, // the top field
new Float(score), // overall score
new Float(idf), // idf
new Integer(docFreq), // freq in all docs
new Integer(tf)});
}
return res;
} | java | private PriorityQueue<Object[]> createQueue(Map<String, Int> words) throws IOException
{
// have collected all words in doc and their freqs
int numDocs = ir.numDocs();
FreqQ res = new FreqQ(words.size()); // will order words by score
Iterator<String> it = words.keySet().iterator();
while (it.hasNext())
{ // for every word
String word = it.next();
int tf = words.get(word).x; // term freq in the source doc
if (minTermFreq > 0 && tf < minTermFreq)
{
continue; // filter out words that don't occur enough times in the source
}
// go through all the fields and find the largest document frequency
String topField = fieldNames[0];
int docFreq = 0;
for (int i = 0; i < fieldNames.length; i++)
{
int freq = ir.docFreq(new Term(fieldNames[i], word));
topField = (freq > docFreq) ? fieldNames[i] : topField; //NOSONAR
docFreq = (freq > docFreq) ? freq : docFreq;
}
if (minDocFreq > 0 && docFreq < minDocFreq)
{
continue; // filter out words that don't occur in enough docs
}
if (docFreq == 0)
{
continue; // index update problem?
}
float idf = similarity.idf(docFreq, numDocs);
float score = tf * idf;
// only really need 1st 3 entries, other ones are for troubleshooting
res.insertWithOverflow(new Object[]{word, // the word
topField, // the top field
new Float(score), // overall score
new Float(idf), // idf
new Integer(docFreq), // freq in all docs
new Integer(tf)});
}
return res;
} | [
"private",
"PriorityQueue",
"<",
"Object",
"[",
"]",
">",
"createQueue",
"(",
"Map",
"<",
"String",
",",
"Int",
">",
"words",
")",
"throws",
"IOException",
"{",
"// have collected all words in doc and their freqs",
"int",
"numDocs",
"=",
"ir",
".",
"numDocs",
"(... | Create a PriorityQueue<Object[]> from a word->tf map.
@param words a map of words keyed on the word(String) with Int objects as the values. | [
"Create",
"a",
"PriorityQueue<Object",
"[]",
">",
"from",
"a",
"word",
"-",
">",
"tf",
"map",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MoreLikeThis.java#L643-L692 |
petrbouda/joyrest | joyrest-core/src/main/java/org/joyrest/routing/matcher/RequestMatcher.java | RequestMatcher.matchConsumes | public static boolean matchConsumes(InternalRoute route, InternalRequest<?> request) {
if (route.getConsumes().contains(WILDCARD)) {
return true;
}
return route.getConsumes().contains(request.getContentType());
} | java | public static boolean matchConsumes(InternalRoute route, InternalRequest<?> request) {
if (route.getConsumes().contains(WILDCARD)) {
return true;
}
return route.getConsumes().contains(request.getContentType());
} | [
"public",
"static",
"boolean",
"matchConsumes",
"(",
"InternalRoute",
"route",
",",
"InternalRequest",
"<",
"?",
">",
"request",
")",
"{",
"if",
"(",
"route",
".",
"getConsumes",
"(",
")",
".",
"contains",
"(",
"WILDCARD",
")",
")",
"{",
"return",
"true",
... | Matches route consumes configurer and Content-Type header in an incoming provider
@param route route configurer
@param request incoming provider object
@return returns {@code true} if the given route has consumes Media-Type one of a Content-Type from an incoming provider | [
"Matches",
"route",
"consumes",
"configurer",
"and",
"Content",
"-",
"Type",
"header",
"in",
"an",
"incoming",
"provider"
] | train | https://github.com/petrbouda/joyrest/blob/58903f06fb7f0b8fdf1ef91318fb48a88bf970e0/joyrest-core/src/main/java/org/joyrest/routing/matcher/RequestMatcher.java#L81-L87 |
Nexmo/nexmo-java | src/main/java/com/nexmo/client/verify/VerifyClient.java | VerifyClient.advanceVerification | public ControlResponse advanceVerification(String requestId) throws IOException, NexmoClientException {
return this.control.execute(new ControlRequest(requestId, VerifyControlCommand.TRIGGER_NEXT_EVENT));
} | java | public ControlResponse advanceVerification(String requestId) throws IOException, NexmoClientException {
return this.control.execute(new ControlRequest(requestId, VerifyControlCommand.TRIGGER_NEXT_EVENT));
} | [
"public",
"ControlResponse",
"advanceVerification",
"(",
"String",
"requestId",
")",
"throws",
"IOException",
",",
"NexmoClientException",
"{",
"return",
"this",
".",
"control",
".",
"execute",
"(",
"new",
"ControlRequest",
"(",
"requestId",
",",
"VerifyControlCommand... | Advance a current verification request to the next stage in the process.
@param requestId The requestId of the ongoing verification request.
@return A {@link ControlResponse} representing the response from the API.
@throws IOException If an IO error occurred while making the request.
@throws NexmoClientException If the request failed for some reason. | [
"Advance",
"a",
"current",
"verification",
"request",
"to",
"the",
"next",
"stage",
"in",
"the",
"process",
"."
] | train | https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/verify/VerifyClient.java#L219-L221 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegmentFactory.java | SegmentFactory.createJcseg | public static ISegment createJcseg( int mode, Object...args ) throws JcsegException
{
Class<? extends ISegment> _clsname;
switch ( mode ) {
case JcsegTaskConfig.SIMPLE_MODE:
_clsname = SimpleSeg.class;
break;
case JcsegTaskConfig.COMPLEX_MODE:
_clsname = ComplexSeg.class;
break;
case JcsegTaskConfig.DETECT_MODE:
_clsname = DetectSeg.class;
break;
case JcsegTaskConfig.SEARCH_MODE:
_clsname = SearchSeg.class;
break;
case JcsegTaskConfig.DELIMITER_MODE:
_clsname = DelimiterSeg.class;
break;
case JcsegTaskConfig.NLP_MODE:
_clsname = NLPSeg.class;
break;
default:
throw new JcsegException("No Such Algorithm Excpetion");
}
Class<?>[] _paramtype = null;
if ( args.length == 2 ) {
_paramtype = new Class[]{JcsegTaskConfig.class, ADictionary.class};
} else if ( args.length == 3 ) {
_paramtype = new Class[]{Reader.class, JcsegTaskConfig.class, ADictionary.class};
} else {
throw new JcsegException("length of the arguments should be 2 or 3");
}
return createSegment(_clsname, _paramtype, args);
} | java | public static ISegment createJcseg( int mode, Object...args ) throws JcsegException
{
Class<? extends ISegment> _clsname;
switch ( mode ) {
case JcsegTaskConfig.SIMPLE_MODE:
_clsname = SimpleSeg.class;
break;
case JcsegTaskConfig.COMPLEX_MODE:
_clsname = ComplexSeg.class;
break;
case JcsegTaskConfig.DETECT_MODE:
_clsname = DetectSeg.class;
break;
case JcsegTaskConfig.SEARCH_MODE:
_clsname = SearchSeg.class;
break;
case JcsegTaskConfig.DELIMITER_MODE:
_clsname = DelimiterSeg.class;
break;
case JcsegTaskConfig.NLP_MODE:
_clsname = NLPSeg.class;
break;
default:
throw new JcsegException("No Such Algorithm Excpetion");
}
Class<?>[] _paramtype = null;
if ( args.length == 2 ) {
_paramtype = new Class[]{JcsegTaskConfig.class, ADictionary.class};
} else if ( args.length == 3 ) {
_paramtype = new Class[]{Reader.class, JcsegTaskConfig.class, ADictionary.class};
} else {
throw new JcsegException("length of the arguments should be 2 or 3");
}
return createSegment(_clsname, _paramtype, args);
} | [
"public",
"static",
"ISegment",
"createJcseg",
"(",
"int",
"mode",
",",
"Object",
"...",
"args",
")",
"throws",
"JcsegException",
"{",
"Class",
"<",
"?",
"extends",
"ISegment",
">",
"_clsname",
";",
"switch",
"(",
"mode",
")",
"{",
"case",
"JcsegTaskConfig",... | create the specified mode Jcseg instance
@param mode
@return ISegment
@throws JcsegException | [
"create",
"the",
"specified",
"mode",
"Jcseg",
"instance"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegmentFactory.java#L55-L91 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java | FormLayout.shiftComponentsVertically | private void shiftComponentsVertically(int rowIndex, boolean remove) {
final int offset = remove ? -1 : 1;
for (Object element : constraintMap.entrySet()) {
Map.Entry entry = (Map.Entry) element;
CellConstraints constraints = (CellConstraints) entry.getValue();
int y1 = constraints.gridY;
int h = constraints.gridHeight;
int y2 = y1 + h - 1;
if (y1 == rowIndex && remove) {
throw new IllegalStateException(
"The removed row " + rowIndex
+ " must not contain component origins.\n"
+ "Illegal component=" + entry.getKey());
} else if (y1 >= rowIndex) {
constraints.gridY += offset;
} else if (y2 >= rowIndex) {
constraints.gridHeight += offset;
}
}
} | java | private void shiftComponentsVertically(int rowIndex, boolean remove) {
final int offset = remove ? -1 : 1;
for (Object element : constraintMap.entrySet()) {
Map.Entry entry = (Map.Entry) element;
CellConstraints constraints = (CellConstraints) entry.getValue();
int y1 = constraints.gridY;
int h = constraints.gridHeight;
int y2 = y1 + h - 1;
if (y1 == rowIndex && remove) {
throw new IllegalStateException(
"The removed row " + rowIndex
+ " must not contain component origins.\n"
+ "Illegal component=" + entry.getKey());
} else if (y1 >= rowIndex) {
constraints.gridY += offset;
} else if (y2 >= rowIndex) {
constraints.gridHeight += offset;
}
}
} | [
"private",
"void",
"shiftComponentsVertically",
"(",
"int",
"rowIndex",
",",
"boolean",
"remove",
")",
"{",
"final",
"int",
"offset",
"=",
"remove",
"?",
"-",
"1",
":",
"1",
";",
"for",
"(",
"Object",
"element",
":",
"constraintMap",
".",
"entrySet",
"(",
... | Shifts components vertically, either to the bottom if a row has been inserted or to the top
if a row has been removed.
@param rowIndex index of the row to remove
@param remove true for remove, false for insert
@throws IllegalStateException if a removed column contains components | [
"Shifts",
"components",
"vertically",
"either",
"to",
"the",
"bottom",
"if",
"a",
"row",
"has",
"been",
"inserted",
"or",
"to",
"the",
"top",
"if",
"a",
"row",
"has",
"been",
"removed",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L681-L700 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/time/SchedulingSupport.java | SchedulingSupport.getPreviousIntervalStart | public static long getPreviousIntervalStart(long time, int intervalInMinutes, int offsetInMinutes) {
long interval = MINUTE_IN_MS * intervalInMinutes;
long offset = calculateOffsetInMs(intervalInMinutes, offsetInMinutes);
return (interval * ((time + LOCAL_UTC_OFFSET - offset) / (interval))) + offset - LOCAL_UTC_OFFSET;
} | java | public static long getPreviousIntervalStart(long time, int intervalInMinutes, int offsetInMinutes) {
long interval = MINUTE_IN_MS * intervalInMinutes;
long offset = calculateOffsetInMs(intervalInMinutes, offsetInMinutes);
return (interval * ((time + LOCAL_UTC_OFFSET - offset) / (interval))) + offset - LOCAL_UTC_OFFSET;
} | [
"public",
"static",
"long",
"getPreviousIntervalStart",
"(",
"long",
"time",
",",
"int",
"intervalInMinutes",
",",
"int",
"offsetInMinutes",
")",
"{",
"long",
"interval",
"=",
"MINUTE_IN_MS",
"*",
"intervalInMinutes",
";",
"long",
"offset",
"=",
"calculateOffsetInMs... | Determines the exact time an interval starts based on a time within the interval.
@param time time in millis
@param intervalInMinutes
@param offsetInMinutes
@return the exact time in milliseconds the interval begins local time | [
"Determines",
"the",
"exact",
"time",
"an",
"interval",
"starts",
"based",
"on",
"a",
"time",
"within",
"the",
"interval",
".",
"@param",
"time",
"time",
"in",
"millis",
"@param",
"intervalInMinutes",
"@param",
"offsetInMinutes"
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/time/SchedulingSupport.java#L86-L91 |
apache/incubator-gobblin | gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/CompactionJobConfigurator.java | CompactionJobConfigurator.configureInputAndOutputPaths | protected boolean configureInputAndOutputPaths(Job job, FileSystemDataset dataset) throws IOException {
boolean emptyDirectoryFlag = false;
String mrOutputBase = this.state.getProp(MRCompactor.COMPACTION_JOB_DIR);
CompactionPathParser parser = new CompactionPathParser(this.state);
CompactionPathParser.CompactionParserResult rst = parser.parse(dataset);
this.mrOutputPath = concatPaths(mrOutputBase, rst.getDatasetName(), rst.getDstSubDir(), rst.getTimeString());
log.info("Cleaning temporary MR output directory: " + mrOutputPath);
this.fs.delete(mrOutputPath, true);
this.mapReduceInputPaths = getGranularInputPaths(dataset.datasetRoot());
if (this.mapReduceInputPaths.isEmpty()) {
this.mapReduceInputPaths.add(dataset.datasetRoot());
emptyDirectoryFlag = true;
}
for (Path path : mapReduceInputPaths) {
FileInputFormat.addInputPath(job, path);
}
FileOutputFormat.setOutputPath(job, mrOutputPath);
return emptyDirectoryFlag;
} | java | protected boolean configureInputAndOutputPaths(Job job, FileSystemDataset dataset) throws IOException {
boolean emptyDirectoryFlag = false;
String mrOutputBase = this.state.getProp(MRCompactor.COMPACTION_JOB_DIR);
CompactionPathParser parser = new CompactionPathParser(this.state);
CompactionPathParser.CompactionParserResult rst = parser.parse(dataset);
this.mrOutputPath = concatPaths(mrOutputBase, rst.getDatasetName(), rst.getDstSubDir(), rst.getTimeString());
log.info("Cleaning temporary MR output directory: " + mrOutputPath);
this.fs.delete(mrOutputPath, true);
this.mapReduceInputPaths = getGranularInputPaths(dataset.datasetRoot());
if (this.mapReduceInputPaths.isEmpty()) {
this.mapReduceInputPaths.add(dataset.datasetRoot());
emptyDirectoryFlag = true;
}
for (Path path : mapReduceInputPaths) {
FileInputFormat.addInputPath(job, path);
}
FileOutputFormat.setOutputPath(job, mrOutputPath);
return emptyDirectoryFlag;
} | [
"protected",
"boolean",
"configureInputAndOutputPaths",
"(",
"Job",
"job",
",",
"FileSystemDataset",
"dataset",
")",
"throws",
"IOException",
"{",
"boolean",
"emptyDirectoryFlag",
"=",
"false",
";",
"String",
"mrOutputBase",
"=",
"this",
".",
"state",
".",
"getProp"... | Refer to MRCompactorAvroKeyDedupJobRunner#configureInputAndOutputPaths(Job).
@return false if no valid input paths present for MR job to process, where a path is valid if it is
a directory containing one or more files. | [
"Refer",
"to",
"MRCompactorAvroKeyDedupJobRunner#configureInputAndOutputPaths",
"(",
"Job",
")",
".",
"@return",
"false",
"if",
"no",
"valid",
"input",
"paths",
"present",
"for",
"MR",
"job",
"to",
"process",
"where",
"a",
"path",
"is",
"valid",
"if",
"it",
"is"... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/CompactionJobConfigurator.java#L233-L256 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getHierarchicalEntityChildAsync | public Observable<HierarchicalChildEntity> getHierarchicalEntityChildAsync(UUID appId, String versionId, UUID hEntityId, UUID hChildId) {
return getHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, hChildId).map(new Func1<ServiceResponse<HierarchicalChildEntity>, HierarchicalChildEntity>() {
@Override
public HierarchicalChildEntity call(ServiceResponse<HierarchicalChildEntity> response) {
return response.body();
}
});
} | java | public Observable<HierarchicalChildEntity> getHierarchicalEntityChildAsync(UUID appId, String versionId, UUID hEntityId, UUID hChildId) {
return getHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, hChildId).map(new Func1<ServiceResponse<HierarchicalChildEntity>, HierarchicalChildEntity>() {
@Override
public HierarchicalChildEntity call(ServiceResponse<HierarchicalChildEntity> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"HierarchicalChildEntity",
">",
"getHierarchicalEntityChildAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
",",
"UUID",
"hChildId",
")",
"{",
"return",
"getHierarchicalEntityChildWithServiceResponseAsync",
"... | Gets information about the hierarchical entity child model.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@param hChildId The hierarchical entity extractor child ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the HierarchicalChildEntity object | [
"Gets",
"information",
"about",
"the",
"hierarchical",
"entity",
"child",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6270-L6277 |
teatrove/teatrove | build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java | ClassDoc.getMatchingMethod | public MethodDoc getMatchingMethod(MethodDoc method, MethodFinder mf) {
MethodDoc md = getMatchingMethod(method);
if (md != null) {
if (mf.checkMethod(md)) {
return md;
}
}
return null;
} | java | public MethodDoc getMatchingMethod(MethodDoc method, MethodFinder mf) {
MethodDoc md = getMatchingMethod(method);
if (md != null) {
if (mf.checkMethod(md)) {
return md;
}
}
return null;
} | [
"public",
"MethodDoc",
"getMatchingMethod",
"(",
"MethodDoc",
"method",
",",
"MethodFinder",
"mf",
")",
"{",
"MethodDoc",
"md",
"=",
"getMatchingMethod",
"(",
"method",
")",
";",
"if",
"(",
"md",
"!=",
"null",
")",
"{",
"if",
"(",
"mf",
".",
"checkMethod",... | Get a MethodDoc in this ClassDoc with a name and signature
matching that of the specified MethodDoc and accepted by the
specified MethodFinder | [
"Get",
"a",
"MethodDoc",
"in",
"this",
"ClassDoc",
"with",
"a",
"name",
"and",
"signature",
"matching",
"that",
"of",
"the",
"specified",
"MethodDoc",
"and",
"accepted",
"by",
"the",
"specified",
"MethodFinder"
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java#L258-L268 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointObjectPropertiesAxiomImpl_CustomFieldSerializer.java | OWLDisjointObjectPropertiesAxiomImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLDisjointObjectPropertiesAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLDisjointObjectPropertiesAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLDisjointObjectPropertiesAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
... | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDisjointObjectPropertiesAxiomImpl_CustomFieldSerializer.java#L95-L98 |
dnsjava/dnsjava | org/xbill/DNS/Record.java | Record.newRecord | public static Record
newRecord(Name name, int type, int dclass) {
return newRecord(name, type, dclass, 0);
} | java | public static Record
newRecord(Name name, int type, int dclass) {
return newRecord(name, type, dclass, 0);
} | [
"public",
"static",
"Record",
"newRecord",
"(",
"Name",
"name",
",",
"int",
"type",
",",
"int",
"dclass",
")",
"{",
"return",
"newRecord",
"(",
"name",
",",
"type",
",",
"dclass",
",",
"0",
")",
";",
"}"
] | Creates a new empty record, with the given parameters. This method is
designed to create records that will be added to the QUERY section
of a message.
@param name The owner name of the record.
@param type The record's type.
@param dclass The record's class.
@return An object of a subclass of Record | [
"Creates",
"a",
"new",
"empty",
"record",
"with",
"the",
"given",
"parameters",
".",
"This",
"method",
"is",
"designed",
"to",
"create",
"records",
"that",
"will",
"be",
"added",
"to",
"the",
"QUERY",
"section",
"of",
"a",
"message",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Record.java#L170-L173 |
mgm-tp/jfunk | jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/FormInputHandler.java | FormInputHandler.dataKeyWithIndex | public FormInputHandler dataKeyWithIndex(final String theDataKey, final Integer theDataIndex) {
checkState(dataSet != null, "Cannot specify a data key. Please specify a DataSet first.");
Fields fields = new Fields(this);
fields.dataKey = theDataKey;
fields.dataIndex = theDataIndex;
return new FormInputHandler(fields);
} | java | public FormInputHandler dataKeyWithIndex(final String theDataKey, final Integer theDataIndex) {
checkState(dataSet != null, "Cannot specify a data key. Please specify a DataSet first.");
Fields fields = new Fields(this);
fields.dataKey = theDataKey;
fields.dataIndex = theDataIndex;
return new FormInputHandler(fields);
} | [
"public",
"FormInputHandler",
"dataKeyWithIndex",
"(",
"final",
"String",
"theDataKey",
",",
"final",
"Integer",
"theDataIndex",
")",
"{",
"checkState",
"(",
"dataSet",
"!=",
"null",
",",
"\"Cannot specify a data key. Please specify a DataSet first.\"",
")",
";",
"Fields"... | Creates a new {@link FormInputHandler} based on this {@link FormInputHandler} using the specified data key and the
specified index for retrieving the value from the {@link DataSet} associated with this {@link FormInputHandler}.
@param theDataKey
the data set key used to retrieve the value from the specified data set
@param theDataIndex
the index for retrieving the value from the specified data set
@return the new {@link FormInputHandler} instance | [
"Creates",
"a",
"new",
"{",
"@link",
"FormInputHandler",
"}",
"based",
"on",
"this",
"{",
"@link",
"FormInputHandler",
"}",
"using",
"the",
"specified",
"data",
"key",
"and",
"the",
"specified",
"index",
"for",
"retrieving",
"the",
"value",
"from",
"the",
"{... | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-web/src/main/java/com/mgmtp/jfunk/web/util/FormInputHandler.java#L292-L299 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java | MithraManager.executeTransactionalCommand | public <R> R executeTransactionalCommand(final TransactionalCommand<R> command, final int retryCount)
throws MithraBusinessException
{
return this.executeTransactionalCommand(command, new TransactionStyle(this.transactionTimeout, retryCount));
} | java | public <R> R executeTransactionalCommand(final TransactionalCommand<R> command, final int retryCount)
throws MithraBusinessException
{
return this.executeTransactionalCommand(command, new TransactionStyle(this.transactionTimeout, retryCount));
} | [
"public",
"<",
"R",
">",
"R",
"executeTransactionalCommand",
"(",
"final",
"TransactionalCommand",
"<",
"R",
">",
"command",
",",
"final",
"int",
"retryCount",
")",
"throws",
"MithraBusinessException",
"{",
"return",
"this",
".",
"executeTransactionalCommand",
"(",
... | executes the given transactional command with the custom number of retries
@param command
@param retryCount number of times to retry if the exception is retriable (e.g. deadlock)
@throws MithraBusinessException | [
"executes",
"the",
"given",
"transactional",
"command",
"with",
"the",
"custom",
"number",
"of",
"retries"
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java#L512-L516 |
VoltDB/voltdb | src/frontend/org/voltdb/importclient/kafka10/KafkaStreamImporter.java | KafkaStreamImporter.createConsumerRunner | private KafkaInternalConsumerRunner createConsumerRunner(Properties properties) throws Exception {
ClassLoader previous = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
try {
Consumer<ByteBuffer, ByteBuffer> consumer = new KafkaConsumer<>(properties);
return new KafkaInternalConsumerRunner(this, m_config, consumer);
} finally {
Thread.currentThread().setContextClassLoader(previous);
}
} | java | private KafkaInternalConsumerRunner createConsumerRunner(Properties properties) throws Exception {
ClassLoader previous = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
try {
Consumer<ByteBuffer, ByteBuffer> consumer = new KafkaConsumer<>(properties);
return new KafkaInternalConsumerRunner(this, m_config, consumer);
} finally {
Thread.currentThread().setContextClassLoader(previous);
}
} | [
"private",
"KafkaInternalConsumerRunner",
"createConsumerRunner",
"(",
"Properties",
"properties",
")",
"throws",
"Exception",
"{",
"ClassLoader",
"previous",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"Thread",
".",
... | Create a Kafka consumer and runner.
@param properties Kafka consumer properties
@throws Exception on error | [
"Create",
"a",
"Kafka",
"consumer",
"and",
"runner",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importclient/kafka10/KafkaStreamImporter.java#L72-L83 |
unbescape/unbescape | src/main/java/org/unbescape/xml/XmlEscape.java | XmlEscape.escapeXml11Minimal | public static void escapeXml11Minimal(final Reader reader, final Writer writer)
throws IOException {
escapeXml(reader, writer, XmlEscapeSymbols.XML11_SYMBOLS,
XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA,
XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT);
} | java | public static void escapeXml11Minimal(final Reader reader, final Writer writer)
throws IOException {
escapeXml(reader, writer, XmlEscapeSymbols.XML11_SYMBOLS,
XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA,
XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT);
} | [
"public",
"static",
"void",
"escapeXml11Minimal",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeXml",
"(",
"reader",
",",
"writer",
",",
"XmlEscapeSymbols",
".",
"XML11_SYMBOLS",
",",
"XmlEscapeType",... | <p>
Perform an XML 1.1 level 1 (only markup-significant chars) <strong>escape</strong> operation
on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 1</em> means this method will only escape the five markup-significant characters which
are <em>predefined</em> as Character Entity References in XML:
<tt><</tt>, <tt>></tt>, <tt>&</tt>, <tt>"</tt> and <tt>'</tt>.
</p>
<p>
This method calls {@link #escapeXml11(Reader, Writer, XmlEscapeType, XmlEscapeLevel)} with the following
preconfigured values:
</p>
<ul>
<li><tt>type</tt>:
{@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li>
<li><tt>level</tt>:
{@link org.unbescape.xml.XmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"an",
"XML",
"1",
".",
"1",
"level",
"1",
"(",
"only",
"markup",
"-",
"significant",
"chars",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"writing",... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1268-L1273 |
netty/netty | handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java | AbstractTrafficShapingHandler.configure | public void configure(long newWriteLimit, long newReadLimit) {
writeLimit = newWriteLimit;
readLimit = newReadLimit;
if (trafficCounter != null) {
trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano());
}
} | java | public void configure(long newWriteLimit, long newReadLimit) {
writeLimit = newWriteLimit;
readLimit = newReadLimit;
if (trafficCounter != null) {
trafficCounter.resetAccounting(TrafficCounter.milliSecondFromNano());
}
} | [
"public",
"void",
"configure",
"(",
"long",
"newWriteLimit",
",",
"long",
"newReadLimit",
")",
"{",
"writeLimit",
"=",
"newWriteLimit",
";",
"readLimit",
"=",
"newReadLimit",
";",
"if",
"(",
"trafficCounter",
"!=",
"null",
")",
"{",
"trafficCounter",
".",
"res... | Change the underlying limitations.
<p>Note the change will be taken as best effort, meaning
that all already scheduled traffics will not be
changed, but only applied to new traffics.</p>
<p>So the expected usage of this method is to be used not too often,
accordingly to the traffic shaping configuration.</p>
@param newWriteLimit The new write limit (in bytes)
@param newReadLimit The new read limit (in bytes) | [
"Change",
"the",
"underlying",
"limitations",
".",
"<p",
">",
"Note",
"the",
"change",
"will",
"be",
"taken",
"as",
"best",
"effort",
"meaning",
"that",
"all",
"already",
"scheduled",
"traffics",
"will",
"not",
"be",
"changed",
"but",
"only",
"applied",
"to"... | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/AbstractTrafficShapingHandler.java#L253-L259 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/conditions/Cnf.java | Cnf.getUnsatisfied | public static IConjunct getUnsatisfied( IConjunct condition, PropertySet properties)
{
Conjunction unsatisfied = new Conjunction();
for( Iterator<IDisjunct> disjuncts = condition.getDisjuncts();
disjuncts.hasNext();)
{
IDisjunct disjunct = disjuncts.next();
if( !disjunct.satisfied( properties))
{
unsatisfied.add( disjunct);
}
}
return unsatisfied;
} | java | public static IConjunct getUnsatisfied( IConjunct condition, PropertySet properties)
{
Conjunction unsatisfied = new Conjunction();
for( Iterator<IDisjunct> disjuncts = condition.getDisjuncts();
disjuncts.hasNext();)
{
IDisjunct disjunct = disjuncts.next();
if( !disjunct.satisfied( properties))
{
unsatisfied.add( disjunct);
}
}
return unsatisfied;
} | [
"public",
"static",
"IConjunct",
"getUnsatisfied",
"(",
"IConjunct",
"condition",
",",
"PropertySet",
"properties",
")",
"{",
"Conjunction",
"unsatisfied",
"=",
"new",
"Conjunction",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"IDisjunct",
">",
"disjuncts",
"=",... | Returns the part of the given condition unsatisfied by the given properties. | [
"Returns",
"the",
"part",
"of",
"the",
"given",
"condition",
"unsatisfied",
"by",
"the",
"given",
"properties",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/conditions/Cnf.java#L346-L360 |
EdwardRaff/JSAT | JSAT/src/jsat/distributions/discrete/UniformDiscrete.java | UniformDiscrete.setMinMax | public void setMinMax(int min, int max)
{
if(min >= max)
throw new IllegalArgumentException("The input minimum (" + min + ") must be less than the given max (" + max + ")");
this.min = min;
this.max = max;
} | java | public void setMinMax(int min, int max)
{
if(min >= max)
throw new IllegalArgumentException("The input minimum (" + min + ") must be less than the given max (" + max + ")");
this.min = min;
this.max = max;
} | [
"public",
"void",
"setMinMax",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"if",
"(",
"min",
">=",
"max",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The input minimum (\"",
"+",
"min",
"+",
"\") must be less than the given max (\"",
"+",
"max",... | Sets the minimum and maximum values at the same time, this is useful if
setting them one at a time may have caused a conflict with the previous
values
@param min the new minimum value to occur
@param max the new maximum value to occur | [
"Sets",
"the",
"minimum",
"and",
"maximum",
"values",
"at",
"the",
"same",
"time",
"this",
"is",
"useful",
"if",
"setting",
"them",
"one",
"at",
"a",
"time",
"may",
"have",
"caused",
"a",
"conflict",
"with",
"the",
"previous",
"values"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/discrete/UniformDiscrete.java#L55-L61 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java | JSONConverter.writeMBeanInfo | public void writeMBeanInfo(OutputStream out, MBeanInfoWrapper value) throws IOException {
// TODO: MBeanInfo has 2 sub-classes, Model*Support and Open*Support.
// How to handle them? "Open" has references to OpenTMBean*Info.
// Model has more convenience methods for retrieving individual
// items, and methods to set the descriptors.
// Same for subclasses of the various items.
writeStartObject(out);
if (USE_BASE64_FOR_MBEANINFO) {
writeSerializedField(out, OM_SERIALIZED, value.mbeanInfo);
writeStringField(out, OM_ATTRIBUTES_URL, value.attributesURL);
writeSerializedField(out, OM_ATTRIBUTES, value.attributeURLs);
writeSerializedField(out, OM_OPERATIONS, value.operationURLs);
return;
}
if (value.mbeanInfo.getClass() != MBeanInfo.class) {
writeSerializedField(out, OM_SERIALIZED, value.mbeanInfo);
}
writeStringField(out, OM_CLASSNAME, value.mbeanInfo.getClassName());
writeStringField(out, OM_DESCRIPTION, value.mbeanInfo.getDescription());
writeDescriptor(out, OM_DESCRIPTOR, value.mbeanInfo.getDescriptor());
writeAttributes(out, OM_ATTRIBUTES, value.mbeanInfo.getAttributes(), value.attributeURLs);
writeStringField(out, OM_ATTRIBUTES_URL, value.attributesURL);
writeConstructors(out, OM_CONSTRUCTORS, value.mbeanInfo.getConstructors());
writeNotifications(out, OM_NOTIFICATIONS, value.mbeanInfo.getNotifications());
writeOperations(out, OM_OPERATIONS, value.mbeanInfo.getOperations(), value.operationURLs);
writeEndObject(out);
} | java | public void writeMBeanInfo(OutputStream out, MBeanInfoWrapper value) throws IOException {
// TODO: MBeanInfo has 2 sub-classes, Model*Support and Open*Support.
// How to handle them? "Open" has references to OpenTMBean*Info.
// Model has more convenience methods for retrieving individual
// items, and methods to set the descriptors.
// Same for subclasses of the various items.
writeStartObject(out);
if (USE_BASE64_FOR_MBEANINFO) {
writeSerializedField(out, OM_SERIALIZED, value.mbeanInfo);
writeStringField(out, OM_ATTRIBUTES_URL, value.attributesURL);
writeSerializedField(out, OM_ATTRIBUTES, value.attributeURLs);
writeSerializedField(out, OM_OPERATIONS, value.operationURLs);
return;
}
if (value.mbeanInfo.getClass() != MBeanInfo.class) {
writeSerializedField(out, OM_SERIALIZED, value.mbeanInfo);
}
writeStringField(out, OM_CLASSNAME, value.mbeanInfo.getClassName());
writeStringField(out, OM_DESCRIPTION, value.mbeanInfo.getDescription());
writeDescriptor(out, OM_DESCRIPTOR, value.mbeanInfo.getDescriptor());
writeAttributes(out, OM_ATTRIBUTES, value.mbeanInfo.getAttributes(), value.attributeURLs);
writeStringField(out, OM_ATTRIBUTES_URL, value.attributesURL);
writeConstructors(out, OM_CONSTRUCTORS, value.mbeanInfo.getConstructors());
writeNotifications(out, OM_NOTIFICATIONS, value.mbeanInfo.getNotifications());
writeOperations(out, OM_OPERATIONS, value.mbeanInfo.getOperations(), value.operationURLs);
writeEndObject(out);
} | [
"public",
"void",
"writeMBeanInfo",
"(",
"OutputStream",
"out",
",",
"MBeanInfoWrapper",
"value",
")",
"throws",
"IOException",
"{",
"// TODO: MBeanInfo has 2 sub-classes, Model*Support and Open*Support.",
"// How to handle them? \"Open\" has references to OpenTMBean*Info.",
"// Model ... | Encode an MBeanInfoWrapper instance as JSON:
{
"className" : String,
"description" : String,
"descriptor" : Descriptor,
"attributes" : [ MBeanAttributeInfo* ],
"attributes_URL" : URL,
"constructors" : [ MBeanConstructorInfo* ],
"notifications" : [ MBeanNotificationInfo* ],
"operations" : [ MBeanOperationInfo* ]
}
Descriptor:
{
"names" : [ String* ],{
"values" : [ POJO* ]
}
MBeanAttributeInfo:
{
"name" : String,
"type" : String,
"description" : String,
"descriptor" : Descriptor,
"isIs" : Boolean,
"isReadable" : Boolean,
"isWritable" : Boolean,
"URL" : URL
}
MBeanConstructorInfo:
{
"name" : String,
"description" : String,
"descriptor" : Descriptor,
"signature" : [ MBeanParameterInfo* ]
}
MBeanParameterInfo:
{
"name" : String,
"type" : String,
"description" : String,
"descriptor" : Descriptor
}
MBeanNotificationInfo:
{
"name" : String,
"description" : String,
"descriptor" : Descriptor,
"notifTypes" [ String* ]
}
MBeanOperationInfo:
{
"name" : String,
"description" : String,
"descriptor" : Descriptor,
"impact" : Integer,
"returnType" : String,
"signature" : [ MBeanParameterInfo* ],
"URI" : URI
}
@param out The stream to write JSON to
@param value The MBeanInfoWrapper instance to encode.
The value and its members can't be null.
@throws IOException If an I/O error occurs
@see #readMBeanInfo(InputStream) | [
"Encode",
"an",
"MBeanInfoWrapper",
"instance",
"as",
"JSON",
":",
"{",
"className",
":",
"String",
"description",
":",
"String",
"descriptor",
":",
"Descriptor",
"attributes",
":",
"[",
"MBeanAttributeInfo",
"*",
"]",
"attributes_URL",
":",
"URL",
"constructors",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java#L1250-L1276 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsXmlContainerPageFactory.java | CmsXmlContainerPageFactory.createDocument | public static CmsXmlContainerPage createDocument(
CmsObject cms,
Locale locale,
String encoding,
CmsXmlContentDefinition contentDefinition) {
// create the XML content
CmsXmlContainerPage content = new CmsXmlContainerPage(cms, locale, encoding, contentDefinition);
// call prepare for use content handler and return the result
return (CmsXmlContainerPage)content.getHandler().prepareForUse(cms, content);
} | java | public static CmsXmlContainerPage createDocument(
CmsObject cms,
Locale locale,
String encoding,
CmsXmlContentDefinition contentDefinition) {
// create the XML content
CmsXmlContainerPage content = new CmsXmlContainerPage(cms, locale, encoding, contentDefinition);
// call prepare for use content handler and return the result
return (CmsXmlContainerPage)content.getHandler().prepareForUse(cms, content);
} | [
"public",
"static",
"CmsXmlContainerPage",
"createDocument",
"(",
"CmsObject",
"cms",
",",
"Locale",
"locale",
",",
"String",
"encoding",
",",
"CmsXmlContentDefinition",
"contentDefinition",
")",
"{",
"// create the XML content",
"CmsXmlContainerPage",
"content",
"=",
"ne... | Create a new instance of a container page based on the given content definition,
that will have one language node for the given locale all initialized with default values.<p>
The given encoding is used when marshalling the XML again later.<p>
@param cms the current users OpenCms content
@param locale the locale to generate the default content for
@param encoding the encoding to use when marshalling the XML content later
@param contentDefinition the content definition to create the content for
@return the created container page | [
"Create",
"a",
"new",
"instance",
"of",
"a",
"container",
"page",
"based",
"on",
"the",
"given",
"content",
"definition",
"that",
"will",
"have",
"one",
"language",
"node",
"for",
"the",
"given",
"locale",
"all",
"initialized",
"with",
"default",
"values",
"... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsXmlContainerPageFactory.java#L106-L116 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/LinkedList.java | LinkedList.insertAfter | public Entry insertAfter(Entry newEntry, Entry insertAfter)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "insertAfter", new Object[] { newEntry, insertAfter });
Entry insertedEntry = null;
//check that the params are not null, if either is, there is nothing to do.
if(newEntry != null &&
insertAfter != null)
{
//call the internal unsynchronized insert method
insertedEntry = insertAfter.forceInsertAfter(newEntry);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "insertAfter", insertedEntry);
return insertedEntry;
} | java | public Entry insertAfter(Entry newEntry, Entry insertAfter)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "insertAfter", new Object[] { newEntry, insertAfter });
Entry insertedEntry = null;
//check that the params are not null, if either is, there is nothing to do.
if(newEntry != null &&
insertAfter != null)
{
//call the internal unsynchronized insert method
insertedEntry = insertAfter.forceInsertAfter(newEntry);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "insertAfter", insertedEntry);
return insertedEntry;
} | [
"public",
"Entry",
"insertAfter",
"(",
"Entry",
"newEntry",
",",
"Entry",
"insertAfter",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"insertAfter\"",
",",
"new",
"Object",
"[",
"]",
"{",
"ne... | Synchronized. Insert an entry into the list after a given one. The
new entry must not already be in a list. The entry after which the new
one is to be inserted must be in this list.
@param newEntry The entry to be added.
@param insertAfter The entry after which the new one is to be inserted | [
"Synchronized",
".",
"Insert",
"an",
"entry",
"into",
"the",
"list",
"after",
"a",
"given",
"one",
".",
"The",
"new",
"entry",
"must",
"not",
"already",
"be",
"in",
"a",
"list",
".",
"The",
"entry",
"after",
"which",
"the",
"new",
"one",
"is",
"to",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/LinkedList.java#L248-L267 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLibTag.java | TagLibTag.setAttributeEvaluatorClassDefinition | public void setAttributeEvaluatorClassDefinition(String className, Identification id, Attributes attr) {
cdAttributeEvaluator = ClassDefinitionImpl.toClassDefinition(className, id, attr);
;
} | java | public void setAttributeEvaluatorClassDefinition(String className, Identification id, Attributes attr) {
cdAttributeEvaluator = ClassDefinitionImpl.toClassDefinition(className, id, attr);
;
} | [
"public",
"void",
"setAttributeEvaluatorClassDefinition",
"(",
"String",
"className",
",",
"Identification",
"id",
",",
"Attributes",
"attr",
")",
"{",
"cdAttributeEvaluator",
"=",
"ClassDefinitionImpl",
".",
"toClassDefinition",
"(",
"className",
",",
"id",
",",
"att... | Setzt den Namen der Klasse welche einen AttributeEvaluator implementiert.
@param value Name der AttributeEvaluator Klassse | [
"Setzt",
"den",
"Namen",
"der",
"Klasse",
"welche",
"einen",
"AttributeEvaluator",
"implementiert",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLibTag.java#L695-L699 |
reactor/reactor-netty | src/main/java/reactor/netty/tcp/TcpServer.java | TcpServer.doOnBind | public final TcpServer doOnBind(Consumer<? super ServerBootstrap> doOnBind) {
Objects.requireNonNull(doOnBind, "doOnBind");
return new TcpServerDoOn(this, doOnBind, null, null);
} | java | public final TcpServer doOnBind(Consumer<? super ServerBootstrap> doOnBind) {
Objects.requireNonNull(doOnBind, "doOnBind");
return new TcpServerDoOn(this, doOnBind, null, null);
} | [
"public",
"final",
"TcpServer",
"doOnBind",
"(",
"Consumer",
"<",
"?",
"super",
"ServerBootstrap",
">",
"doOnBind",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"doOnBind",
",",
"\"doOnBind\"",
")",
";",
"return",
"new",
"TcpServerDoOn",
"(",
"this",
",",
... | Setups a callback called when {@link io.netty.channel.ServerChannel} is about to
bind.
@param doOnBind a consumer observing server start event
@return a new {@link TcpServer} | [
"Setups",
"a",
"callback",
"called",
"when",
"{",
"@link",
"io",
".",
"netty",
".",
"channel",
".",
"ServerChannel",
"}",
"is",
"about",
"to",
"bind",
"."
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/tcp/TcpServer.java#L246-L250 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java | Blob.copyTo | public CopyWriter copyTo(BlobId targetBlob, BlobSourceOption... options) {
CopyRequest copyRequest =
CopyRequest.newBuilder()
.setSource(getBucket(), getName())
.setSourceOptions(toSourceOptions(this, options))
.setTarget(targetBlob)
.build();
return storage.copy(copyRequest);
} | java | public CopyWriter copyTo(BlobId targetBlob, BlobSourceOption... options) {
CopyRequest copyRequest =
CopyRequest.newBuilder()
.setSource(getBucket(), getName())
.setSourceOptions(toSourceOptions(this, options))
.setTarget(targetBlob)
.build();
return storage.copy(copyRequest);
} | [
"public",
"CopyWriter",
"copyTo",
"(",
"BlobId",
"targetBlob",
",",
"BlobSourceOption",
"...",
"options",
")",
"{",
"CopyRequest",
"copyRequest",
"=",
"CopyRequest",
".",
"newBuilder",
"(",
")",
".",
"setSource",
"(",
"getBucket",
"(",
")",
",",
"getName",
"("... | Sends a copy request for the current blob to the target blob. Possibly also some of the
metadata are copied (e.g. content-type).
<p>Example of copying the blob to a different bucket with a different name.
<pre>{@code
String bucketName = "my_unique_bucket";
String blobName = "copy_blob_name";
CopyWriter copyWriter = blob.copyTo(BlobId.of(bucketName, blobName));
Blob copiedBlob = copyWriter.getResult();
}</pre>
@param targetBlob target blob's id
@param options source blob options
@return a {@link CopyWriter} object that can be used to get information on the newly created
blob or to complete the copy if more than one RPC request is needed
@throws StorageException upon failure | [
"Sends",
"a",
"copy",
"request",
"for",
"the",
"current",
"blob",
"to",
"the",
"target",
"blob",
".",
"Possibly",
"also",
"some",
"of",
"the",
"metadata",
"are",
"copied",
"(",
"e",
".",
"g",
".",
"content",
"-",
"type",
")",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/Blob.java#L578-L586 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/util/PathPattern.java | PathPattern.matches | public boolean matches(List<String> path) {
if (nbAny == 0 && path.size() != nbWildcards)
return false;
if (path.size() < nbWildcards)
return false;
return check(path, 0, 0, nbWildcards, nbAny);
} | java | public boolean matches(List<String> path) {
if (nbAny == 0 && path.size() != nbWildcards)
return false;
if (path.size() < nbWildcards)
return false;
return check(path, 0, 0, nbWildcards, nbAny);
} | [
"public",
"boolean",
"matches",
"(",
"List",
"<",
"String",
">",
"path",
")",
"{",
"if",
"(",
"nbAny",
"==",
"0",
"&&",
"path",
".",
"size",
"(",
")",
"!=",
"nbWildcards",
")",
"return",
"false",
";",
"if",
"(",
"path",
".",
"size",
"(",
")",
"<"... | Return true if the given list of path elements is matching this pattern. | [
"Return",
"true",
"if",
"the",
"given",
"list",
"of",
"path",
"elements",
"is",
"matching",
"this",
"pattern",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/PathPattern.java#L46-L52 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/iterator/impl/Cifar10DataSetIterator.java | Cifar10DataSetIterator.getLabels | public static List<String> getLabels(boolean categories){
List<String> rawLabels = new Cifar10DataSetIterator(1).getLabels();
if(categories){
return rawLabels;
}
//Otherwise, convert to human-readable format, using 'words.txt' file
File baseDir = DL4JResources.getDirectory(ResourceType.DATASET, Cifar10Fetcher.LOCAL_CACHE_NAME);
File labelFile = new File(baseDir, Cifar10Fetcher.LABELS_FILENAME);
List<String> lines;
try {
lines = FileUtils.readLines(labelFile, StandardCharsets.UTF_8);
} catch (IOException e){
throw new RuntimeException("Error reading label file", e);
}
Map<String,String> map = new HashMap<>();
for(String line : lines){
String[] split = line.split("\t");
map.put(split[0], split[1]);
}
List<String> outLabels = new ArrayList<>(rawLabels.size());
for(String s : rawLabels){
String s2 = map.get(s);
Preconditions.checkState(s2 != null, "Label \"%s\" not found in labels.txt file");
outLabels.add(s2);
}
return outLabels;
} | java | public static List<String> getLabels(boolean categories){
List<String> rawLabels = new Cifar10DataSetIterator(1).getLabels();
if(categories){
return rawLabels;
}
//Otherwise, convert to human-readable format, using 'words.txt' file
File baseDir = DL4JResources.getDirectory(ResourceType.DATASET, Cifar10Fetcher.LOCAL_CACHE_NAME);
File labelFile = new File(baseDir, Cifar10Fetcher.LABELS_FILENAME);
List<String> lines;
try {
lines = FileUtils.readLines(labelFile, StandardCharsets.UTF_8);
} catch (IOException e){
throw new RuntimeException("Error reading label file", e);
}
Map<String,String> map = new HashMap<>();
for(String line : lines){
String[] split = line.split("\t");
map.put(split[0], split[1]);
}
List<String> outLabels = new ArrayList<>(rawLabels.size());
for(String s : rawLabels){
String s2 = map.get(s);
Preconditions.checkState(s2 != null, "Label \"%s\" not found in labels.txt file");
outLabels.add(s2);
}
return outLabels;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getLabels",
"(",
"boolean",
"categories",
")",
"{",
"List",
"<",
"String",
">",
"rawLabels",
"=",
"new",
"Cifar10DataSetIterator",
"(",
"1",
")",
".",
"getLabels",
"(",
")",
";",
"if",
"(",
"categories",
"... | Get the labels - either in "categories" (imagenet synsets format, "n01910747" or similar) or human-readable format,
such as "jellyfish"
@param categories If true: return category/synset format; false: return "human readable" label format
@return Labels | [
"Get",
"the",
"labels",
"-",
"either",
"in",
"categories",
"(",
"imagenet",
"synsets",
"format",
"n01910747",
"or",
"similar",
")",
"or",
"human",
"-",
"readable",
"format",
"such",
"as",
"jellyfish"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/iterator/impl/Cifar10DataSetIterator.java#L102-L131 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/AbstractRectangularShape1dfx.java | AbstractRectangularShape1dfx.maxXProperty | @Pure
public DoubleProperty maxXProperty() {
if (this.maxX == null) {
this.maxX = new SimpleDoubleProperty(this, MathFXAttributeNames.MAXIMUM_X) {
@Override
protected void invalidated() {
final double currentMax = get();
final double currentMin = getMinX();
if (currentMin > currentMax) {
// min-max constrain is broken
minXProperty().set(currentMax);
}
}
};
}
return this.maxX;
} | java | @Pure
public DoubleProperty maxXProperty() {
if (this.maxX == null) {
this.maxX = new SimpleDoubleProperty(this, MathFXAttributeNames.MAXIMUM_X) {
@Override
protected void invalidated() {
final double currentMax = get();
final double currentMin = getMinX();
if (currentMin > currentMax) {
// min-max constrain is broken
minXProperty().set(currentMax);
}
}
};
}
return this.maxX;
} | [
"@",
"Pure",
"public",
"DoubleProperty",
"maxXProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"maxX",
"==",
"null",
")",
"{",
"this",
".",
"maxX",
"=",
"new",
"SimpleDoubleProperty",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"MAXIMUM_X",
")",
"{",
... | Replies the property that is the maximum x coordinate of the box.
@return the maxX property. | [
"Replies",
"the",
"property",
"that",
"is",
"the",
"maximum",
"x",
"coordinate",
"of",
"the",
"box",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/AbstractRectangularShape1dfx.java#L181-L197 |
gitblit/fathom | fathom-mailer/src/main/java/fathom/mailer/Mailer.java | Mailer.newHtmlMailRequest | public MailRequest newHtmlMailRequest(String requestId, String subject, String body) {
return createMailRequest(requestId, true, subject, body);
} | java | public MailRequest newHtmlMailRequest(String requestId, String subject, String body) {
return createMailRequest(requestId, true, subject, body);
} | [
"public",
"MailRequest",
"newHtmlMailRequest",
"(",
"String",
"requestId",
",",
"String",
"subject",
",",
"String",
"body",
")",
"{",
"return",
"createMailRequest",
"(",
"requestId",
",",
"true",
",",
"subject",
",",
"body",
")",
";",
"}"
] | Creates an html MailRequest with the specified subject and body.
The request id is supplied.
@param requestId
@param subject
@param body
@return an html mail request | [
"Creates",
"an",
"html",
"MailRequest",
"with",
"the",
"specified",
"subject",
"and",
"body",
".",
"The",
"request",
"id",
"is",
"supplied",
"."
] | train | https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-mailer/src/main/java/fathom/mailer/Mailer.java#L135-L137 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/release/scm/git/GitCoordinator.java | GitCoordinator.pushDryRun | public void pushDryRun() throws Exception {
if (releaseAction.isCreateVcsTag()) {
if (scmManager.isTagExists(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), releaseAction.getTagUrl())) {
throw new Exception(String.format("Tag with name '%s' already exists", releaseAction.getTagUrl()));
}
}
String testTagName = releaseAction.getTagUrl() + "_test";
try {
scmManager.testPush(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), testTagName);
} catch (Exception e) {
throw new Exception(String.format("Failed while attempting push dry-run: %s", e.getMessage()), e);
} finally {
if (scmManager.isTagExists(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), testTagName)) {
scmManager.deleteLocalTag(testTagName);
}
}
} | java | public void pushDryRun() throws Exception {
if (releaseAction.isCreateVcsTag()) {
if (scmManager.isTagExists(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), releaseAction.getTagUrl())) {
throw new Exception(String.format("Tag with name '%s' already exists", releaseAction.getTagUrl()));
}
}
String testTagName = releaseAction.getTagUrl() + "_test";
try {
scmManager.testPush(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), testTagName);
} catch (Exception e) {
throw new Exception(String.format("Failed while attempting push dry-run: %s", e.getMessage()), e);
} finally {
if (scmManager.isTagExists(scmManager.getRemoteConfig(releaseAction.getTargetRemoteName()), testTagName)) {
scmManager.deleteLocalTag(testTagName);
}
}
} | [
"public",
"void",
"pushDryRun",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"releaseAction",
".",
"isCreateVcsTag",
"(",
")",
")",
"{",
"if",
"(",
"scmManager",
".",
"isTagExists",
"(",
"scmManager",
".",
"getRemoteConfig",
"(",
"releaseAction",
".",
"g... | This method uses the configured git credentials and repo, to test its validity.
In addition, in case the user requested creation of a new tag, it checks that
another tag with the same name doesn't exist | [
"This",
"method",
"uses",
"the",
"configured",
"git",
"credentials",
"and",
"repo",
"to",
"test",
"its",
"validity",
".",
"In",
"addition",
"in",
"case",
"the",
"user",
"requested",
"creation",
"of",
"a",
"new",
"tag",
"it",
"checks",
"that",
"another",
"t... | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/scm/git/GitCoordinator.java#L66-L83 |
morimekta/utils | io-util/src/main/java/net/morimekta/util/FileWatcher.java | FileWatcher.addWatcher | public void addWatcher(Path file, Listener watcher) {
if (file == null) throw new IllegalArgumentException("Null file argument");
if (watcher == null) throw new IllegalArgumentException("Null watcher argument");
synchronized (mutex) {
startWatchingInternal(file).add(() -> watcher);
}
} | java | public void addWatcher(Path file, Listener watcher) {
if (file == null) throw new IllegalArgumentException("Null file argument");
if (watcher == null) throw new IllegalArgumentException("Null watcher argument");
synchronized (mutex) {
startWatchingInternal(file).add(() -> watcher);
}
} | [
"public",
"void",
"addWatcher",
"(",
"Path",
"file",
",",
"Listener",
"watcher",
")",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null file argument\"",
")",
";",
"if",
"(",
"watcher",
"==",
"null",
")",
"... | Start watching file path and notify watcher for updates on that file.
@param file The file path to watch.
@param watcher The watcher to be notified. | [
"Start",
"watching",
"file",
"path",
"and",
"notify",
"watcher",
"for",
"updates",
"on",
"that",
"file",
"."
] | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/FileWatcher.java#L198-L204 |
pnikosis/materialish-progress | library/src/main/java/com/pnikosis/materialishprogress/ProgressWheel.java | ProgressWheel.onSizeChanged | @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
setupBounds(w, h);
setupPaints();
invalidate();
} | java | @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
setupBounds(w, h);
setupPaints();
invalidate();
} | [
"@",
"Override",
"protected",
"void",
"onSizeChanged",
"(",
"int",
"w",
",",
"int",
"h",
",",
"int",
"oldw",
",",
"int",
"oldh",
")",
"{",
"super",
".",
"onSizeChanged",
"(",
"w",
",",
"h",
",",
"oldw",
",",
"oldh",
")",
";",
"setupBounds",
"(",
"w... | Use onSizeChanged instead of onAttachedToWindow to get the dimensions of the view,
because this method is called after measuring the dimensions of MATCH_PARENT & WRAP_CONTENT.
Use this dimensions to setup the bounds and paints. | [
"Use",
"onSizeChanged",
"instead",
"of",
"onAttachedToWindow",
"to",
"get",
"the",
"dimensions",
"of",
"the",
"view",
"because",
"this",
"method",
"is",
"called",
"after",
"measuring",
"the",
"dimensions",
"of",
"MATCH_PARENT",
"&",
"WRAP_CONTENT",
".",
"Use",
"... | train | https://github.com/pnikosis/materialish-progress/blob/f82831e11c81a4385cdd5bf4ced93e5ecd93550d/library/src/main/java/com/pnikosis/materialishprogress/ProgressWheel.java#L161-L167 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/ItemListBox.java | ItemListBox.insertItem | public void insertItem (T item, int index, String label)
{
insertItem(label == null ? toLabel(item) : label, index);
_items.add(index, item);
} | java | public void insertItem (T item, int index, String label)
{
insertItem(label == null ? toLabel(item) : label, index);
_items.add(index, item);
} | [
"public",
"void",
"insertItem",
"(",
"T",
"item",
",",
"int",
"index",
",",
"String",
"label",
")",
"{",
"insertItem",
"(",
"label",
"==",
"null",
"?",
"toLabel",
"(",
"item",
")",
":",
"label",
",",
"index",
")",
";",
"_items",
".",
"add",
"(",
"i... | Inserts the supplied item into this list box at the specified position, using the specified
label if given. If no label is given, {@link #toLabel(Object)} is used to calculate it. | [
"Inserts",
"the",
"supplied",
"item",
"into",
"this",
"list",
"box",
"at",
"the",
"specified",
"position",
"using",
"the",
"specified",
"label",
"if",
"given",
".",
"If",
"no",
"label",
"is",
"given",
"{"
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/ItemListBox.java#L140-L144 |
stapler/stapler | groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/GroovyServerPageTearOff.java | GroovyServerPageTearOff.createDispatcher | public RequestDispatcher createDispatcher(Object it, String viewName) throws IOException {
GroovierJellyScript s = findScript(viewName);
if (s!=null) return new JellyRequestDispatcher(it,s);
return null;
} | java | public RequestDispatcher createDispatcher(Object it, String viewName) throws IOException {
GroovierJellyScript s = findScript(viewName);
if (s!=null) return new JellyRequestDispatcher(it,s);
return null;
} | [
"public",
"RequestDispatcher",
"createDispatcher",
"(",
"Object",
"it",
",",
"String",
"viewName",
")",
"throws",
"IOException",
"{",
"GroovierJellyScript",
"s",
"=",
"findScript",
"(",
"viewName",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"return",
"new",
... | Creates a {@link RequestDispatcher} that forwards to the jelly view, if available. | [
"Creates",
"a",
"{"
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/GroovyServerPageTearOff.java#L35-L39 |
pravega/pravega | controller/src/main/java/io/pravega/controller/server/AuthResourceRepresentation.java | AuthResourceRepresentation.ofStreamInScope | public static String ofStreamInScope(String scopeName, String streamName) {
Exceptions.checkNotNullOrEmpty(streamName, "streamName");
return String.format("%s/%s", ofStreamsInScope(scopeName), streamName);
} | java | public static String ofStreamInScope(String scopeName, String streamName) {
Exceptions.checkNotNullOrEmpty(streamName, "streamName");
return String.format("%s/%s", ofStreamsInScope(scopeName), streamName);
} | [
"public",
"static",
"String",
"ofStreamInScope",
"(",
"String",
"scopeName",
",",
"String",
"streamName",
")",
"{",
"Exceptions",
".",
"checkNotNullOrEmpty",
"(",
"streamName",
",",
"\"streamName\"",
")",
";",
"return",
"String",
".",
"format",
"(",
"\"%s/%s\"",
... | Creates a resource representation for use in authorization of actions pertaining to the specified stream within
the specified scope.
@param scopeName the name of the scope
@param streamName the name of the stream
@return a string representing the specified stream within the specified scope
@throws NullPointerException if {@code scopeName} or {@code streamName} are null
@throws IllegalArgumentException if {@code scopeName} or {@code streamName} are empty | [
"Creates",
"a",
"resource",
"representation",
"for",
"use",
"in",
"authorization",
"of",
"actions",
"pertaining",
"to",
"the",
"specified",
"stream",
"within",
"the",
"specified",
"scope",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/AuthResourceRepresentation.java#L77-L80 |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsSyncProducer.java | JmsSyncProducer.resolveDestinationName | private Destination resolveDestinationName(String name, Session session) throws JMSException {
if (endpointConfiguration.getDestinationResolver() != null) {
return endpointConfiguration.getDestinationResolver().resolveDestinationName(session, name, endpointConfiguration.isPubSubDomain());
}
return new DynamicDestinationResolver().resolveDestinationName(session, name, endpointConfiguration.isPubSubDomain());
} | java | private Destination resolveDestinationName(String name, Session session) throws JMSException {
if (endpointConfiguration.getDestinationResolver() != null) {
return endpointConfiguration.getDestinationResolver().resolveDestinationName(session, name, endpointConfiguration.isPubSubDomain());
}
return new DynamicDestinationResolver().resolveDestinationName(session, name, endpointConfiguration.isPubSubDomain());
} | [
"private",
"Destination",
"resolveDestinationName",
"(",
"String",
"name",
",",
"Session",
"session",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"endpointConfiguration",
".",
"getDestinationResolver",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"endpointConfigur... | Resolves the destination name from Jms session.
@param name
@param session
@return | [
"Resolves",
"the",
"destination",
"name",
"from",
"Jms",
"session",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsSyncProducer.java#L317-L323 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/notifications/ApptentiveNotificationCenter.java | ApptentiveNotificationCenter.addObserver | public synchronized void addObserver(String notification, ApptentiveNotificationObserver observer, boolean useWeakReference) {
final ApptentiveNotificationObserverList list = resolveObserverList(notification);
list.addObserver(observer, useWeakReference);
} | java | public synchronized void addObserver(String notification, ApptentiveNotificationObserver observer, boolean useWeakReference) {
final ApptentiveNotificationObserverList list = resolveObserverList(notification);
list.addObserver(observer, useWeakReference);
} | [
"public",
"synchronized",
"void",
"addObserver",
"(",
"String",
"notification",
",",
"ApptentiveNotificationObserver",
"observer",
",",
"boolean",
"useWeakReference",
")",
"{",
"final",
"ApptentiveNotificationObserverList",
"list",
"=",
"resolveObserverList",
"(",
"notifica... | Adds an entry to the receiver’s dispatch table with an observer.
@param useWeakReference - weak reference is used if <code>true</code> | [
"Adds",
"an",
"entry",
"to",
"the",
"receiver’s",
"dispatch",
"table",
"with",
"an",
"observer",
"."
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/notifications/ApptentiveNotificationCenter.java#L55-L58 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/mult/VectorVectorMult_ZDRM.java | VectorVectorMult_ZDRM.outerProd | public static void outerProd(ZMatrixRMaj x, ZMatrixRMaj y, ZMatrixRMaj A ) {
int m = A.numRows;
int n = A.numCols;
int index = 0;
for( int i = 0; i < m; i++ ) {
double realX = x.data[i*2];
double imagX = x.data[i*2+1];
int indexY = 0;
for( int j = 0; j < n; j++ ) {
double realY = y.data[indexY++];
double imagY = y.data[indexY++];
A.data[index++] = realX*realY - imagX*imagY;
A.data[index++] = realX*imagY + imagX*realY;
}
}
} | java | public static void outerProd(ZMatrixRMaj x, ZMatrixRMaj y, ZMatrixRMaj A ) {
int m = A.numRows;
int n = A.numCols;
int index = 0;
for( int i = 0; i < m; i++ ) {
double realX = x.data[i*2];
double imagX = x.data[i*2+1];
int indexY = 0;
for( int j = 0; j < n; j++ ) {
double realY = y.data[indexY++];
double imagY = y.data[indexY++];
A.data[index++] = realX*realY - imagX*imagY;
A.data[index++] = realX*imagY + imagX*realY;
}
}
} | [
"public",
"static",
"void",
"outerProd",
"(",
"ZMatrixRMaj",
"x",
",",
"ZMatrixRMaj",
"y",
",",
"ZMatrixRMaj",
"A",
")",
"{",
"int",
"m",
"=",
"A",
".",
"numRows",
";",
"int",
"n",
"=",
"A",
".",
"numCols",
";",
"int",
"index",
"=",
"0",
";",
"for"... | <p>
Sets A ∈ ℜ <sup>m × n</sup> equal to an outer product multiplication of the two
vectors. This is also known as a rank-1 operation.<br>
<br>
A = x * y<sup>T</sup>
where x ∈ ℜ <sup>m</sup> and y ∈ ℜ <sup>n</sup> are vectors.
</p>
<p>
Which is equivalent to: A<sub>ij</sub> = x<sub>i</sub>*y<sub>j</sub>
</p>
@param x A vector with m elements. Not modified.
@param y A vector with n elements. Not modified.
@param A A Matrix with m by n elements. Modified. | [
"<p",
">",
"Sets",
"A",
"&isin",
";",
"&real",
";",
"<sup",
">",
"m",
"×",
";",
"n<",
"/",
"sup",
">",
"equal",
"to",
"an",
"outer",
"product",
"multiplication",
"of",
"the",
"two",
"vectors",
".",
"This",
"is",
"also",
"known",
"as",
"a",
"ra... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/mult/VectorVectorMult_ZDRM.java#L129-L147 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/ExecutionStats.java | ExecutionStats.addEmailStats | public void addEmailStats(final InternetAddress[] recipients, final boolean storageUsed) {
this.storageUsed = storageUsed;
for (InternetAddress recipient: recipients) {
emailDests.add(recipient.getAddress());
}
} | java | public void addEmailStats(final InternetAddress[] recipients, final boolean storageUsed) {
this.storageUsed = storageUsed;
for (InternetAddress recipient: recipients) {
emailDests.add(recipient.getAddress());
}
} | [
"public",
"void",
"addEmailStats",
"(",
"final",
"InternetAddress",
"[",
"]",
"recipients",
",",
"final",
"boolean",
"storageUsed",
")",
"{",
"this",
".",
"storageUsed",
"=",
"storageUsed",
";",
"for",
"(",
"InternetAddress",
"recipient",
":",
"recipients",
")",... | Add statistics about sent emails.
@param recipients The list of recipients.
@param storageUsed If a remote storage was used. | [
"Add",
"statistics",
"about",
"sent",
"emails",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/ExecutionStats.java#L50-L55 |
jbundle/jbundle | thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/comp/JStatusbar.java | JStatusbar.showStatus | public void showStatus(String strMessage, ImageIcon icon, int iWarningLevel)
{
if (strMessage == null)
strMessage = Constants.BLANK;
if (m_textArea != null)
m_textArea.setText(strMessage);
if (iWarningLevel == Constants.WARNING)
{
m_textArea.setForeground(Color.RED);
m_textArea.setBackground(Color.PINK);
m_textArea.setOpaque(true);
}
else if (iWarningLevel == Constants.WAIT)
{
m_textArea.setForeground(Color.BLUE);
m_textArea.setBackground(Color.CYAN);
m_textArea.setOpaque(true);
}
else
{
m_textArea.setForeground(Color.BLACK);
m_textArea.setOpaque(false);
}
if (icon != null)
m_textArea.setIcon(icon);
else
m_textArea.setIcon(null);
} | java | public void showStatus(String strMessage, ImageIcon icon, int iWarningLevel)
{
if (strMessage == null)
strMessage = Constants.BLANK;
if (m_textArea != null)
m_textArea.setText(strMessage);
if (iWarningLevel == Constants.WARNING)
{
m_textArea.setForeground(Color.RED);
m_textArea.setBackground(Color.PINK);
m_textArea.setOpaque(true);
}
else if (iWarningLevel == Constants.WAIT)
{
m_textArea.setForeground(Color.BLUE);
m_textArea.setBackground(Color.CYAN);
m_textArea.setOpaque(true);
}
else
{
m_textArea.setForeground(Color.BLACK);
m_textArea.setOpaque(false);
}
if (icon != null)
m_textArea.setIcon(icon);
else
m_textArea.setIcon(null);
} | [
"public",
"void",
"showStatus",
"(",
"String",
"strMessage",
",",
"ImageIcon",
"icon",
",",
"int",
"iWarningLevel",
")",
"{",
"if",
"(",
"strMessage",
"==",
"null",
")",
"strMessage",
"=",
"Constants",
".",
"BLANK",
";",
"if",
"(",
"m_textArea",
"!=",
"nul... | Display the status text.
@param strMessage The message to display. | [
"Display",
"the",
"status",
"text",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/comp/JStatusbar.java#L69-L96 |
alipay/sofa-rpc | core/common/src/main/java/com/alipay/sofa/rpc/common/utils/ReflectUtils.java | ReflectUtils.getPropertyGetterMethod | public static Method getPropertyGetterMethod(Class clazz, String property) {
String methodName = "get" + property.substring(0, 1).toUpperCase() + property.substring(1);
Method method;
try {
method = clazz.getMethod(methodName);
} catch (NoSuchMethodException e) {
try {
methodName = "is" + property.substring(0, 1).toUpperCase() + property.substring(1);
method = clazz.getMethod(methodName);
} catch (NoSuchMethodException e1) {
throw new SofaRpcRuntimeException("No getter method for " + clazz.getName() + "#" + property, e);
}
}
return method;
} | java | public static Method getPropertyGetterMethod(Class clazz, String property) {
String methodName = "get" + property.substring(0, 1).toUpperCase() + property.substring(1);
Method method;
try {
method = clazz.getMethod(methodName);
} catch (NoSuchMethodException e) {
try {
methodName = "is" + property.substring(0, 1).toUpperCase() + property.substring(1);
method = clazz.getMethod(methodName);
} catch (NoSuchMethodException e1) {
throw new SofaRpcRuntimeException("No getter method for " + clazz.getName() + "#" + property, e);
}
}
return method;
} | [
"public",
"static",
"Method",
"getPropertyGetterMethod",
"(",
"Class",
"clazz",
",",
"String",
"property",
")",
"{",
"String",
"methodName",
"=",
"\"get\"",
"+",
"property",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
")",
"+",
"pro... | 得到get/is方法
@param clazz 类
@param property 属性
@return Method 方法对象 | [
"得到get",
"/",
"is方法"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/ReflectUtils.java#L142-L156 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_tcp_frontend_GET | public ArrayList<Long> serviceName_tcp_frontend_GET(String serviceName, Long defaultFarmId, String port, String zone) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/frontend";
StringBuilder sb = path(qPath, serviceName);
query(sb, "defaultFarmId", defaultFarmId);
query(sb, "port", port);
query(sb, "zone", zone);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> serviceName_tcp_frontend_GET(String serviceName, Long defaultFarmId, String port, String zone) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/frontend";
StringBuilder sb = path(qPath, serviceName);
query(sb, "defaultFarmId", defaultFarmId);
query(sb, "port", port);
query(sb, "zone", zone);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_tcp_frontend_GET",
"(",
"String",
"serviceName",
",",
"Long",
"defaultFarmId",
",",
"String",
"port",
",",
"String",
"zone",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{service... | TCP frontends for this iplb
REST: GET /ipLoadbalancing/{serviceName}/tcp/frontend
@param defaultFarmId [required] Filter the value of defaultFarmId property (=)
@param port [required] Filter the value of port property (like)
@param zone [required] Filter the value of zone property (=)
@param serviceName [required] The internal name of your IP load balancing | [
"TCP",
"frontends",
"for",
"this",
"iplb"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1475-L1483 |
Talend/tesb-rt-se | sam/sam-service-soap/src/main/java/org/talend/esb/sam/service/soap/MonitoringWebService.java | MonitoringWebService.throwFault | private static void throwFault(String code, String message, Throwable t) throws PutEventsFault {
if (LOG.isLoggable(Level.SEVERE)) {
LOG.log(Level.SEVERE, "Throw Fault " + code + " " + message, t);
}
FaultType faultType = new FaultType();
faultType.setFaultCode(code);
faultType.setFaultMessage(message);
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
t.printStackTrace(printWriter);
faultType.setStackTrace(stringWriter.toString());
throw new PutEventsFault(message, faultType, t);
} | java | private static void throwFault(String code, String message, Throwable t) throws PutEventsFault {
if (LOG.isLoggable(Level.SEVERE)) {
LOG.log(Level.SEVERE, "Throw Fault " + code + " " + message, t);
}
FaultType faultType = new FaultType();
faultType.setFaultCode(code);
faultType.setFaultMessage(message);
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
t.printStackTrace(printWriter);
faultType.setStackTrace(stringWriter.toString());
throw new PutEventsFault(message, faultType, t);
} | [
"private",
"static",
"void",
"throwFault",
"(",
"String",
"code",
",",
"String",
"message",
",",
"Throwable",
"t",
")",
"throws",
"PutEventsFault",
"{",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"SEVERE",
")",
")",
"{",
"LOG",
".",
"log",
... | Throw fault.
@param code the fault code
@param message the message
@param t the throwable type
@throws PutEventsFault | [
"Throw",
"fault",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/sam/sam-service-soap/src/main/java/org/talend/esb/sam/service/soap/MonitoringWebService.java#L91-L108 |
wisdom-framework/wisdom | framework/default-error-handler/src/main/java/org/wisdom/error/DefaultPageErrorHandler.java | DefaultPageErrorHandler.renderInternalError | private Result renderInternalError(Context context, Route route, Throwable e) {
Throwable localException;
// If the template is not there, just wrap the exception within a JSON Object.
if (internalerror == null) {
return internalServerError(e);
}
// Manage ITE
if (e instanceof InvocationTargetException) {
localException = ((InvocationTargetException) e).getTargetException();
} else {
localException = e;
}
// Retrieve the cause if any.
String cause;
StackTraceElement[] stack;
if (localException.getCause() != null) {
cause = localException.getCause().getMessage();
stack = localException.getCause().getStackTrace();
} else {
cause = localException.getMessage();
stack = localException.getStackTrace();
}
// Retrieve the file name.
String fileName = null;
int line = -1;
if (stack != null && stack.length != 0) {
fileName = stack[0].getFileName();
line = stack[0].getLineNumber();
}
// Remove iPOJO trace from the stack trace.
List<StackTraceElement> cleaned = StackTraceUtils.cleanup(stack);
// We are good to go !
return internalServerError(render(internalerror,
"route", route,
"context", context,
"exception", localException,
"message", localException.getMessage(),
"cause", cause,
"file", fileName,
"line", line,
"stack", cleaned));
} | java | private Result renderInternalError(Context context, Route route, Throwable e) {
Throwable localException;
// If the template is not there, just wrap the exception within a JSON Object.
if (internalerror == null) {
return internalServerError(e);
}
// Manage ITE
if (e instanceof InvocationTargetException) {
localException = ((InvocationTargetException) e).getTargetException();
} else {
localException = e;
}
// Retrieve the cause if any.
String cause;
StackTraceElement[] stack;
if (localException.getCause() != null) {
cause = localException.getCause().getMessage();
stack = localException.getCause().getStackTrace();
} else {
cause = localException.getMessage();
stack = localException.getStackTrace();
}
// Retrieve the file name.
String fileName = null;
int line = -1;
if (stack != null && stack.length != 0) {
fileName = stack[0].getFileName();
line = stack[0].getLineNumber();
}
// Remove iPOJO trace from the stack trace.
List<StackTraceElement> cleaned = StackTraceUtils.cleanup(stack);
// We are good to go !
return internalServerError(render(internalerror,
"route", route,
"context", context,
"exception", localException,
"message", localException.getMessage(),
"cause", cause,
"file", fileName,
"line", line,
"stack", cleaned));
} | [
"private",
"Result",
"renderInternalError",
"(",
"Context",
"context",
",",
"Route",
"route",
",",
"Throwable",
"e",
")",
"{",
"Throwable",
"localException",
";",
"// If the template is not there, just wrap the exception within a JSON Object.",
"if",
"(",
"internalerror",
"... | Generates the error page.
@param context the context.
@param route the route
@param e the thrown error
@return the HTTP result serving the error page | [
"Generates",
"the",
"error",
"page",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/default-error-handler/src/main/java/org/wisdom/error/DefaultPageErrorHandler.java#L153-L201 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/utilities/SQLUtilityImpl.java | SQLUtilityImpl.i_getLongString | @Override
protected String i_getLongString(ResultSet rs, int pos) throws SQLException {
String s = rs.getString(pos);
if (s != null) {
// It's a String-based datatype, so just return it.
return s;
} else {
// It may be a CLOB. If so, return the contents as a String.
try {
Clob c = rs.getClob(pos);
return c.getSubString(1, (int) c.length());
} catch (Throwable th) {
th.printStackTrace();
return null;
}
}
} | java | @Override
protected String i_getLongString(ResultSet rs, int pos) throws SQLException {
String s = rs.getString(pos);
if (s != null) {
// It's a String-based datatype, so just return it.
return s;
} else {
// It may be a CLOB. If so, return the contents as a String.
try {
Clob c = rs.getClob(pos);
return c.getSubString(1, (int) c.length());
} catch (Throwable th) {
th.printStackTrace();
return null;
}
}
} | [
"@",
"Override",
"protected",
"String",
"i_getLongString",
"(",
"ResultSet",
"rs",
",",
"int",
"pos",
")",
"throws",
"SQLException",
"{",
"String",
"s",
"=",
"rs",
".",
"getString",
"(",
"pos",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"// It's... | Get a long string, which could be a TEXT or CLOB type. (CLOBs require
special handling -- this method normalizes the reading of them) | [
"Get",
"a",
"long",
"string",
"which",
"could",
"be",
"a",
"TEXT",
"or",
"CLOB",
"type",
".",
"(",
"CLOBs",
"require",
"special",
"handling",
"--",
"this",
"method",
"normalizes",
"the",
"reading",
"of",
"them",
")"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/utilities/SQLUtilityImpl.java#L413-L429 |
alkacon/opencms-core | src/org/opencms/webdav/CmsWebdavServlet.java | CmsWebdavServlet.copyRange | protected IOException copyRange(Reader reader, PrintWriter writer) {
// Copy the input stream to the output stream
IOException exception = null;
char[] buffer = new char[m_input];
int len = buffer.length;
while (true) {
try {
len = reader.read(buffer);
if (len == -1) {
break;
}
writer.write(buffer, 0, len);
} catch (IOException e) {
exception = e;
len = -1;
break;
}
}
return exception;
} | java | protected IOException copyRange(Reader reader, PrintWriter writer) {
// Copy the input stream to the output stream
IOException exception = null;
char[] buffer = new char[m_input];
int len = buffer.length;
while (true) {
try {
len = reader.read(buffer);
if (len == -1) {
break;
}
writer.write(buffer, 0, len);
} catch (IOException e) {
exception = e;
len = -1;
break;
}
}
return exception;
} | [
"protected",
"IOException",
"copyRange",
"(",
"Reader",
"reader",
",",
"PrintWriter",
"writer",
")",
"{",
"// Copy the input stream to the output stream",
"IOException",
"exception",
"=",
"null",
";",
"char",
"[",
"]",
"buffer",
"=",
"new",
"char",
"[",
"m_input",
... | Copy the contents of the specified input stream to the specified
output stream, and ensure that both streams are closed before returning
(even in the face of an exception).<p>
@param reader the reader to read from
@param writer the writer to write to
@return the exception which occurred during processing | [
"Copy",
"the",
"contents",
"of",
"the",
"specified",
"input",
"stream",
"to",
"the",
"specified",
"output",
"stream",
"and",
"ensure",
"that",
"both",
"streams",
"are",
"closed",
"before",
"returning",
"(",
"even",
"in",
"the",
"face",
"of",
"an",
"exception... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/webdav/CmsWebdavServlet.java#L892-L912 |
arxanchain/java-common | src/main/java/com/arxanfintech/common/crypto/core/ECKey.java | ECKey.doSign | public ECDSASignature doSign(byte[] input) {
if (input.length != 32) {
throw new IllegalArgumentException("Expected 32 byte input to ECDSA signature, not " + input.length);
}
// No decryption of private key required.
if (privKey == null)
throw new MissingPrivateKeyException();
if (privKey instanceof BCECPrivateKey) {
ECDSASigner signer = new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest()));
ECPrivateKeyParameters privKeyParams = new ECPrivateKeyParameters(((BCECPrivateKey) privKey).getD(), CURVE);
signer.init(true, privKeyParams);
BigInteger[] components = signer.generateSignature(input);
return new ECDSASignature(components[0], components[1]).toCanonicalised();
} else {
try {
final Signature ecSig = ECSignatureFactory.getRawInstance(provider);
ecSig.initSign(privKey);
ecSig.update(input);
final byte[] derSignature = ecSig.sign();
return ECDSASignature.decodeFromDER(derSignature).toCanonicalised();
} catch (SignatureException | InvalidKeyException ex) {
throw new RuntimeException("ECKey signing error", ex);
}
}
} | java | public ECDSASignature doSign(byte[] input) {
if (input.length != 32) {
throw new IllegalArgumentException("Expected 32 byte input to ECDSA signature, not " + input.length);
}
// No decryption of private key required.
if (privKey == null)
throw new MissingPrivateKeyException();
if (privKey instanceof BCECPrivateKey) {
ECDSASigner signer = new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest()));
ECPrivateKeyParameters privKeyParams = new ECPrivateKeyParameters(((BCECPrivateKey) privKey).getD(), CURVE);
signer.init(true, privKeyParams);
BigInteger[] components = signer.generateSignature(input);
return new ECDSASignature(components[0], components[1]).toCanonicalised();
} else {
try {
final Signature ecSig = ECSignatureFactory.getRawInstance(provider);
ecSig.initSign(privKey);
ecSig.update(input);
final byte[] derSignature = ecSig.sign();
return ECDSASignature.decodeFromDER(derSignature).toCanonicalised();
} catch (SignatureException | InvalidKeyException ex) {
throw new RuntimeException("ECKey signing error", ex);
}
}
} | [
"public",
"ECDSASignature",
"doSign",
"(",
"byte",
"[",
"]",
"input",
")",
"{",
"if",
"(",
"input",
".",
"length",
"!=",
"32",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Expected 32 byte input to ECDSA signature, not \"",
"+",
"input",
".",
"l... | Signs the given hash and returns the R and S components as BigIntegers and
put them in ECDSASignature
@param input
to sign
@return ECDSASignature signature that contains the R and S components | [
"Signs",
"the",
"given",
"hash",
"and",
"returns",
"the",
"R",
"and",
"S",
"components",
"as",
"BigIntegers",
"and",
"put",
"them",
"in",
"ECDSASignature"
] | train | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L759-L783 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java | KernelResolverRepository.getPreferredVersion | private ProvisioningFeatureDefinition getPreferredVersion(String symbolicName, List<ProvisioningFeatureDefinition> featureList) {
Version preferredVersion = symbolicNameToPreferredVersion.get(symbolicName);
ProvisioningFeatureDefinition result = null;
if (preferredVersion != null) {
for (ProvisioningFeatureDefinition feature : featureList) {
if (preferredVersion.equals(feature.getVersion())) {
result = feature;
break;
}
}
}
if (result == null) {
result = featureList.iterator().next();
}
return result;
} | java | private ProvisioningFeatureDefinition getPreferredVersion(String symbolicName, List<ProvisioningFeatureDefinition> featureList) {
Version preferredVersion = symbolicNameToPreferredVersion.get(symbolicName);
ProvisioningFeatureDefinition result = null;
if (preferredVersion != null) {
for (ProvisioningFeatureDefinition feature : featureList) {
if (preferredVersion.equals(feature.getVersion())) {
result = feature;
break;
}
}
}
if (result == null) {
result = featureList.iterator().next();
}
return result;
} | [
"private",
"ProvisioningFeatureDefinition",
"getPreferredVersion",
"(",
"String",
"symbolicName",
",",
"List",
"<",
"ProvisioningFeatureDefinition",
">",
"featureList",
")",
"{",
"Version",
"preferredVersion",
"=",
"symbolicNameToPreferredVersion",
".",
"get",
"(",
"symboli... | Find the preferred version of a feature from the list of features
<p>
The decision is made by consulting {@link #symbolicNameToPreferredVersion} to find out whether the user has configured a preferred version. If so, look for a feature with
that version.
<p>
If no preferred version has been configured for this symbolic name, or if the preferred version cannot be found in the list, return the latest version.
@param symbolicName the symbolic name of the feature
@param featureList the list of features, which should all have the same symbolic name
@return the best feature from the list | [
"Find",
"the",
"preferred",
"version",
"of",
"a",
"feature",
"from",
"the",
"list",
"of",
"features",
"<p",
">",
"The",
"decision",
"is",
"made",
"by",
"consulting",
"{",
"@link",
"#symbolicNameToPreferredVersion",
"}",
"to",
"find",
"out",
"whether",
"the",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/internal/kernel/KernelResolverRepository.java#L352-L370 |
jenkinsci/jenkins | core/src/main/java/hudson/tasks/BuildWrapper.java | BuildWrapper.setUp | public Environment setUp( AbstractBuild build, Launcher launcher, BuildListener listener ) throws IOException, InterruptedException {
if (build instanceof Build)
return setUp((Build)build,launcher,listener);
else
throw new AssertionError("The plugin '" + this.getClass().getName() + "' still uses " +
"deprecated setUp(Build,Launcher,BuildListener) method. " +
"Update the plugin to use setUp(AbstractBuild, Launcher, BuildListener) instead.");
} | java | public Environment setUp( AbstractBuild build, Launcher launcher, BuildListener listener ) throws IOException, InterruptedException {
if (build instanceof Build)
return setUp((Build)build,launcher,listener);
else
throw new AssertionError("The plugin '" + this.getClass().getName() + "' still uses " +
"deprecated setUp(Build,Launcher,BuildListener) method. " +
"Update the plugin to use setUp(AbstractBuild, Launcher, BuildListener) instead.");
} | [
"public",
"Environment",
"setUp",
"(",
"AbstractBuild",
"build",
",",
"Launcher",
"launcher",
",",
"BuildListener",
"listener",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"build",
"instanceof",
"Build",
")",
"return",
"setUp",
"(",
... | Runs before the {@link Builder} runs (but after the checkout has occurred), and performs a set up.
@param build
The build in progress for which an {@link Environment} object is created.
Never null.
@param launcher
This launcher can be used to launch processes for this build.
If the build runs remotely, launcher will also run a job on that remote machine.
Never null.
@param listener
Can be used to send any message.
@return
non-null if the build can continue, null if there was an error
and the build needs to be aborted.
@throws IOException
terminates the build abnormally. Hudson will handle the exception
and reports a nice error message.
@since 1.150 | [
"Runs",
"before",
"the",
"{",
"@link",
"Builder",
"}",
"runs",
"(",
"but",
"after",
"the",
"checkout",
"has",
"occurred",
")",
"and",
"performs",
"a",
"set",
"up",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tasks/BuildWrapper.java#L140-L147 |
ozimov/cirneco | hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/date/IsDate.java | IsDate.hasYearMonthAndDay | public static Matcher<Date> hasYearMonthAndDay(final int year, final int month, final int day) {
return new IsDate(year, month, day);
} | java | public static Matcher<Date> hasYearMonthAndDay(final int year, final int month, final int day) {
return new IsDate(year, month, day);
} | [
"public",
"static",
"Matcher",
"<",
"Date",
">",
"hasYearMonthAndDay",
"(",
"final",
"int",
"year",
",",
"final",
"int",
"month",
",",
"final",
"int",
"day",
")",
"{",
"return",
"new",
"IsDate",
"(",
"year",
",",
"month",
",",
"day",
")",
";",
"}"
] | Creates a matcher that matches when the examined {@linkplain Date} has the given values <code>year</code>, <code>
id</code> and <code>day</code>. | [
"Creates",
"a",
"matcher",
"that",
"matches",
"when",
"the",
"examined",
"{"
] | train | https://github.com/ozimov/cirneco/blob/78ad782da0a2256634cfbebb2f97ed78c993b999/hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/date/IsDate.java#L71-L73 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/time/APSPSolver.java | APSPSolver.getDistanceBounds | public Bounds getDistanceBounds(TimePoint tpFrom, TimePoint tpTo) {
final long max = distance[tpFrom.getID()][tpTo.getID()];
final long min = -distance[tpTo.getID()][tpFrom.getID()];
return new Bounds(min, max);
} | java | public Bounds getDistanceBounds(TimePoint tpFrom, TimePoint tpTo) {
final long max = distance[tpFrom.getID()][tpTo.getID()];
final long min = -distance[tpTo.getID()][tpFrom.getID()];
return new Bounds(min, max);
} | [
"public",
"Bounds",
"getDistanceBounds",
"(",
"TimePoint",
"tpFrom",
",",
"TimePoint",
"tpTo",
")",
"{",
"final",
"long",
"max",
"=",
"distance",
"[",
"tpFrom",
".",
"getID",
"(",
")",
"]",
"[",
"tpTo",
".",
"getID",
"(",
")",
"]",
";",
"final",
"long"... | Gets the effective bounds between a pair of {@link TimePoint}s.
(After propagation, considering all constraints in the network) | [
"Gets",
"the",
"effective",
"bounds",
"between",
"a",
"pair",
"of",
"{"
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/time/APSPSolver.java#L1033-L1037 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/AjaxSlider.java | AjaxSlider.setAjaxSlideEvent | public void setAjaxSlideEvent(ISliderAjaxEvent ajaxSlideEvent)
{
this.ajaxEvents.put(SliderAjaxEvent.ajaxSlideEvent, ajaxSlideEvent);
setSlideEvent(new SliderAjaxJsScopeUiEvent(this, SliderAjaxEvent.ajaxSlideEvent));
} | java | public void setAjaxSlideEvent(ISliderAjaxEvent ajaxSlideEvent)
{
this.ajaxEvents.put(SliderAjaxEvent.ajaxSlideEvent, ajaxSlideEvent);
setSlideEvent(new SliderAjaxJsScopeUiEvent(this, SliderAjaxEvent.ajaxSlideEvent));
} | [
"public",
"void",
"setAjaxSlideEvent",
"(",
"ISliderAjaxEvent",
"ajaxSlideEvent",
")",
"{",
"this",
".",
"ajaxEvents",
".",
"put",
"(",
"SliderAjaxEvent",
".",
"ajaxSlideEvent",
",",
"ajaxSlideEvent",
")",
";",
"setSlideEvent",
"(",
"new",
"SliderAjaxJsScopeUiEvent",
... | Sets the call-back for the AJAX Slide Event.
@param ajaxSlideEvent
The ISliderAjaxEvent. | [
"Sets",
"the",
"call",
"-",
"back",
"for",
"the",
"AJAX",
"Slide",
"Event",
"."
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/AjaxSlider.java#L306-L310 |
rhuss/jolokia | agent/osgi/src/main/java/org/jolokia/osgi/util/LogHelper.java | LogHelper.logError | public static void logError(BundleContext pBundleContext, String pMessage, Throwable pThrowable) {
final ServiceReference lRef = pBundleContext.getServiceReference(LogService.class.getName());
if (lRef != null) {
try {
final LogService logService = (LogService) pBundleContext.getService(lRef);
if (logService != null) {
logService.log(LogService.LOG_ERROR, pMessage, pThrowable);
return;
}
} finally {
pBundleContext.ungetService(lRef);
}
}
System.err.println("Jolokia-Error: " + pMessage + " : " + pThrowable.getMessage());
} | java | public static void logError(BundleContext pBundleContext, String pMessage, Throwable pThrowable) {
final ServiceReference lRef = pBundleContext.getServiceReference(LogService.class.getName());
if (lRef != null) {
try {
final LogService logService = (LogService) pBundleContext.getService(lRef);
if (logService != null) {
logService.log(LogService.LOG_ERROR, pMessage, pThrowable);
return;
}
} finally {
pBundleContext.ungetService(lRef);
}
}
System.err.println("Jolokia-Error: " + pMessage + " : " + pThrowable.getMessage());
} | [
"public",
"static",
"void",
"logError",
"(",
"BundleContext",
"pBundleContext",
",",
"String",
"pMessage",
",",
"Throwable",
"pThrowable",
")",
"{",
"final",
"ServiceReference",
"lRef",
"=",
"pBundleContext",
".",
"getServiceReference",
"(",
"LogService",
".",
"clas... | Log error to a logging service (if available), otherwise log to std error
@param pBundleContext bundle context to lookup LogService
@param pMessage message to log
@param pThrowable an exception to log | [
"Log",
"error",
"to",
"a",
"logging",
"service",
"(",
"if",
"available",
")",
"otherwise",
"log",
"to",
"std",
"error"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/osgi/src/main/java/org/jolokia/osgi/util/LogHelper.java#L39-L54 |
alkacon/opencms-core | src/org/opencms/ui/login/CmsTokenValidator.java | CmsTokenValidator.clearToken | public static void clearToken(CmsObject cms, CmsUser user) throws CmsException {
user.getAdditionalInfo().remove(ADDINFO_KEY);
cms.writeUser(user);
} | java | public static void clearToken(CmsObject cms, CmsUser user) throws CmsException {
user.getAdditionalInfo().remove(ADDINFO_KEY);
cms.writeUser(user);
} | [
"public",
"static",
"void",
"clearToken",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
")",
"throws",
"CmsException",
"{",
"user",
".",
"getAdditionalInfo",
"(",
")",
".",
"remove",
"(",
"ADDINFO_KEY",
")",
";",
"cms",
".",
"writeUser",
"(",
"user",
")... | Removes an authorization token from the user's additional information.<p>
@param cms the CMS context
@param user the user
@throws CmsException if something goes wrong | [
"Removes",
"an",
"authorization",
"token",
"from",
"the",
"user",
"s",
"additional",
"information",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsTokenValidator.java#L65-L69 |
fuinorg/units4j | src/main/java/org/fuin/units4j/AssertDependencies.java | AssertDependencies.assertRules | public static final void assertRules(final File file, final File classesDir) {
Utils4J.checkNotNull("file", file);
Utils4J.checkNotNull("classesDir", classesDir);
Utils4J.checkValidFile(file);
Utils4J.checkValidDir(classesDir);
try {
final DependencyAnalyzer analyzer = new DependencyAnalyzer(file);
assertIntern(classesDir, analyzer);
} catch (final InvalidDependenciesDefinitionException ex) {
throw new RuntimeException(ex);
}
} | java | public static final void assertRules(final File file, final File classesDir) {
Utils4J.checkNotNull("file", file);
Utils4J.checkNotNull("classesDir", classesDir);
Utils4J.checkValidFile(file);
Utils4J.checkValidDir(classesDir);
try {
final DependencyAnalyzer analyzer = new DependencyAnalyzer(file);
assertIntern(classesDir, analyzer);
} catch (final InvalidDependenciesDefinitionException ex) {
throw new RuntimeException(ex);
}
} | [
"public",
"static",
"final",
"void",
"assertRules",
"(",
"final",
"File",
"file",
",",
"final",
"File",
"classesDir",
")",
"{",
"Utils4J",
".",
"checkNotNull",
"(",
"\"file\"",
",",
"file",
")",
";",
"Utils4J",
".",
"checkNotNull",
"(",
"\"classesDir\"",
","... | Asserts that a set of dependency rules is kept.
@param file
The XML rules file - Cannot be <code>null</code> and must be a valid file.
@param classesDir
Directory with the ".class" files to check - Cannot be <code>null</code> and must be a valid directory. | [
"Asserts",
"that",
"a",
"set",
"of",
"dependency",
"rules",
"is",
"kept",
"."
] | train | https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/AssertDependencies.java#L83-L94 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/scope/client/ClientCache.java | ClientCache.getInstance | public static Client getInstance(String cacheName, String appName, PageContext pc, Client existing, Log log) throws PageException {
if (appName != null && appName.startsWith("no-in-memory-cache-")) existing = null;
synchronized (token) {
StorageValue sv = _loadData(pc, cacheName, appName, "client", log);
if (sv != null) {
long time = sv.lastModified();
if (existing instanceof StorageScopeCache) {
if (((StorageScopeCache) existing).lastModified() >= time) return existing;
}
return new ClientCache(pc, cacheName, appName, sv.getValue(), time);
}
else if (existing != null) return existing;
ClientCache cc = new ClientCache(pc, cacheName, appName, new StructImpl(), 0);
cc.store(pc);
return cc;
}
} | java | public static Client getInstance(String cacheName, String appName, PageContext pc, Client existing, Log log) throws PageException {
if (appName != null && appName.startsWith("no-in-memory-cache-")) existing = null;
synchronized (token) {
StorageValue sv = _loadData(pc, cacheName, appName, "client", log);
if (sv != null) {
long time = sv.lastModified();
if (existing instanceof StorageScopeCache) {
if (((StorageScopeCache) existing).lastModified() >= time) return existing;
}
return new ClientCache(pc, cacheName, appName, sv.getValue(), time);
}
else if (existing != null) return existing;
ClientCache cc = new ClientCache(pc, cacheName, appName, new StructImpl(), 0);
cc.store(pc);
return cc;
}
} | [
"public",
"static",
"Client",
"getInstance",
"(",
"String",
"cacheName",
",",
"String",
"appName",
",",
"PageContext",
"pc",
",",
"Client",
"existing",
",",
"Log",
"log",
")",
"throws",
"PageException",
"{",
"if",
"(",
"appName",
"!=",
"null",
"&&",
"appName... | load an new instance of the client datasource scope
@param cacheName
@param appName
@param pc
@param log
@return client datasource scope
@throws PageException | [
"load",
"an",
"new",
"instance",
"of",
"the",
"client",
"datasource",
"scope"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/client/ClientCache.java#L65-L83 |
threerings/nenya | tools/src/main/java/com/threerings/cast/tools/xml/ClassRuleSet.java | ClassRuleSet.addRuleInstances | @Override
public void addRuleInstances (Digester digester)
{
// this creates the appropriate instance when we encounter a
// <class> tag
digester.addObjectCreate(_prefix + CLASS_PATH,
ComponentClass.class.getName());
// grab the attributes from the <class> tag
SetPropertyFieldsRule rule = new SetPropertyFieldsRule();
rule.addFieldParser("shadowColor", new FieldParser() {
public Object parse (String text) {
int[] values = StringUtil.parseIntArray(text);
return new Color(values[0], values[1], values[2], values[3]);
}
});
digester.addRule(_prefix + CLASS_PATH, rule);
// parse render priority overrides
String opath = _prefix + CLASS_PATH + "/override";
digester.addObjectCreate(opath, PriorityOverride.class.getName());
rule = new SetPropertyFieldsRule();
rule.addFieldParser("orients", new FieldParser() {
public Object parse (String text) {
String[] orients = StringUtil.parseStringArray(text);
ArrayIntSet oset = new ArrayIntSet();
for (String orient : orients) {
oset.add(DirectionUtil.fromShortString(orient));
}
return oset;
}
});
digester.addRule(opath, rule);
digester.addSetNext(opath, "addPriorityOverride",
PriorityOverride.class.getName());
} | java | @Override
public void addRuleInstances (Digester digester)
{
// this creates the appropriate instance when we encounter a
// <class> tag
digester.addObjectCreate(_prefix + CLASS_PATH,
ComponentClass.class.getName());
// grab the attributes from the <class> tag
SetPropertyFieldsRule rule = new SetPropertyFieldsRule();
rule.addFieldParser("shadowColor", new FieldParser() {
public Object parse (String text) {
int[] values = StringUtil.parseIntArray(text);
return new Color(values[0], values[1], values[2], values[3]);
}
});
digester.addRule(_prefix + CLASS_PATH, rule);
// parse render priority overrides
String opath = _prefix + CLASS_PATH + "/override";
digester.addObjectCreate(opath, PriorityOverride.class.getName());
rule = new SetPropertyFieldsRule();
rule.addFieldParser("orients", new FieldParser() {
public Object parse (String text) {
String[] orients = StringUtil.parseStringArray(text);
ArrayIntSet oset = new ArrayIntSet();
for (String orient : orients) {
oset.add(DirectionUtil.fromShortString(orient));
}
return oset;
}
});
digester.addRule(opath, rule);
digester.addSetNext(opath, "addPriorityOverride",
PriorityOverride.class.getName());
} | [
"@",
"Override",
"public",
"void",
"addRuleInstances",
"(",
"Digester",
"digester",
")",
"{",
"// this creates the appropriate instance when we encounter a",
"// <class> tag",
"digester",
".",
"addObjectCreate",
"(",
"_prefix",
"+",
"CLASS_PATH",
",",
"ComponentClass",
".",... | Adds the necessary rules to the digester to parse our classes. | [
"Adds",
"the",
"necessary",
"rules",
"to",
"the",
"digester",
"to",
"parse",
"our",
"classes",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/cast/tools/xml/ClassRuleSet.java#L70-L106 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/bolt/AmBaseBolt.java | AmBaseBolt.prepare | @SuppressWarnings("rawtypes")
@Override
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector)
{
super.prepare(stormConf, context, collector);
this.taskId = context.getThisComponentId() + "_" + context.getThisTaskId();
if (this.reloadConfig)
{
if (stormConf.containsKey(StormConfigGenerator.INIT_CONFIG_KEY))
{
String watchPath = stormConf.get(StormConfigGenerator.INIT_CONFIG_KEY).toString();
String logFormat = "Config reload watch start. : WatchPath={0}, Interval(Sec)={1}";
logger.info(MessageFormat.format(logFormat, watchPath, this.reloadConfigIntervalSec));
this.watcher = new ConfigFileWatcher(watchPath, this.reloadConfigIntervalSec);
this.watcher.init();
}
}
onPrepare(stormConf, context);
} | java | @SuppressWarnings("rawtypes")
@Override
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector)
{
super.prepare(stormConf, context, collector);
this.taskId = context.getThisComponentId() + "_" + context.getThisTaskId();
if (this.reloadConfig)
{
if (stormConf.containsKey(StormConfigGenerator.INIT_CONFIG_KEY))
{
String watchPath = stormConf.get(StormConfigGenerator.INIT_CONFIG_KEY).toString();
String logFormat = "Config reload watch start. : WatchPath={0}, Interval(Sec)={1}";
logger.info(MessageFormat.format(logFormat, watchPath, this.reloadConfigIntervalSec));
this.watcher = new ConfigFileWatcher(watchPath, this.reloadConfigIntervalSec);
this.watcher.init();
}
}
onPrepare(stormConf, context);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"@",
"Override",
"public",
"void",
"prepare",
"(",
"Map",
"stormConf",
",",
"TopologyContext",
"context",
",",
"OutputCollector",
"collector",
")",
"{",
"super",
".",
"prepare",
"(",
"stormConf",
",",
"context",... | Initialize method called after extracted for worker processes.<br>
<br>
Initialize task id.
@param stormConf Storm configuration
@param context Topology context
@param collector SpoutOutputCollector | [
"Initialize",
"method",
"called",
"after",
"extracted",
"for",
"worker",
"processes",
".",
"<br",
">",
"<br",
">",
"Initialize",
"task",
"id",
"."
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bolt/AmBaseBolt.java#L97-L119 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_templatesControl_name_relaunchValidation_POST | public void serviceName_templatesControl_name_relaunchValidation_POST(String serviceName, String name, String description, String message) throws IOException {
String qPath = "/sms/{serviceName}/templatesControl/{name}/relaunchValidation";
StringBuilder sb = path(qPath, serviceName, name);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "message", message);
exec(qPath, "POST", sb.toString(), o);
} | java | public void serviceName_templatesControl_name_relaunchValidation_POST(String serviceName, String name, String description, String message) throws IOException {
String qPath = "/sms/{serviceName}/templatesControl/{name}/relaunchValidation";
StringBuilder sb = path(qPath, serviceName, name);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "message", message);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"serviceName_templatesControl_name_relaunchValidation_POST",
"(",
"String",
"serviceName",
",",
"String",
"name",
",",
"String",
"description",
",",
"String",
"message",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sms/{serviceName}/tem... | Attempt a new validation after moderation refusal
REST: POST /sms/{serviceName}/templatesControl/{name}/relaunchValidation
@param description [required] Template description
@param message [required] Message pattern to be moderated. Use "#VALUE#" format for dynamic text area
@param serviceName [required] The internal name of your SMS offer
@param name [required] Name of the template | [
"Attempt",
"a",
"new",
"validation",
"after",
"moderation",
"refusal"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1649-L1656 |
atomix/atomix | utils/src/main/java/io/atomix/utils/config/ConfigMapper.java | ConfigMapper.map | protected <T> T map(Config config, Class<T> clazz) {
return map(config, null, null, clazz);
} | java | protected <T> T map(Config config, Class<T> clazz) {
return map(config, null, null, clazz);
} | [
"protected",
"<",
"T",
">",
"T",
"map",
"(",
"Config",
"config",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"map",
"(",
"config",
",",
"null",
",",
"null",
",",
"clazz",
")",
";",
"}"
] | Applies the given configuration to the given type.
@param config the configuration to apply
@param clazz the class to which to apply the configuration | [
"Applies",
"the",
"given",
"configuration",
"to",
"the",
"given",
"type",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/utils/src/main/java/io/atomix/utils/config/ConfigMapper.java#L133-L135 |
EdwardRaff/JSAT | JSAT/src/jsat/datatransform/AutoDeskewTransform.java | AutoDeskewTransform.updateStats | private void updateStats(final List<Double> lambdas, OnLineStatistics[][] stats, int indx, double val, double[] mins, double weight)
{
for (int k = 0; k < lambdas.size(); k++)
stats[k][indx].add(transform(val, lambdas.get(k), mins[indx]), weight);
} | java | private void updateStats(final List<Double> lambdas, OnLineStatistics[][] stats, int indx, double val, double[] mins, double weight)
{
for (int k = 0; k < lambdas.size(); k++)
stats[k][indx].add(transform(val, lambdas.get(k), mins[indx]), weight);
} | [
"private",
"void",
"updateStats",
"(",
"final",
"List",
"<",
"Double",
">",
"lambdas",
",",
"OnLineStatistics",
"[",
"]",
"[",
"]",
"stats",
",",
"int",
"indx",
",",
"double",
"val",
",",
"double",
"[",
"]",
"mins",
",",
"double",
"weight",
")",
"{",
... | Updates the online stats for each value of lambda
@param lambdas the list of lambda values
@param stats the array of statistics trackers
@param indx the feature index to add to
@param val the value at the given feature index
@param mins the minimum value array
@param weight the weight to the given update | [
"Updates",
"the",
"online",
"stats",
"for",
"each",
"value",
"of",
"lambda"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/datatransform/AutoDeskewTransform.java#L312-L316 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/internal/lang/Fields.java | Fields.findField | public static Field findField(TypeToken<?> classType, String fieldName) throws NoSuchFieldException {
return findField(classType, fieldName, Predicates.<Field>alwaysTrue());
} | java | public static Field findField(TypeToken<?> classType, String fieldName) throws NoSuchFieldException {
return findField(classType, fieldName, Predicates.<Field>alwaysTrue());
} | [
"public",
"static",
"Field",
"findField",
"(",
"TypeToken",
"<",
"?",
">",
"classType",
",",
"String",
"fieldName",
")",
"throws",
"NoSuchFieldException",
"{",
"return",
"findField",
"(",
"classType",
",",
"fieldName",
",",
"Predicates",
".",
"<",
"Field",
">"... | Find a {@link java.lang.reflect.Field} in the class hierarchy of the given type.
@param classType The leaf class to start with.
@param fieldName Name of the field.
@return A {@link java.lang.reflect.Field} if found.
@throws NoSuchFieldException If the field is not found. | [
"Find",
"a",
"{"
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/lang/Fields.java#L37-L39 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/repository/core/ext/service/result/converter/Optionals.java | Optionals.jdk8 | private static Object jdk8(final Class<?> type, final Object object) {
try {
// a bit faster than resolving it each time
if (jdk8OptionalFactory == null) {
lookupOptionalFactoryMethod(type);
}
return jdk8OptionalFactory.invoke(null, object);
} catch (Exception e) {
throw new IllegalStateException("Failed to instantiate jdk Optional", e);
}
} | java | private static Object jdk8(final Class<?> type, final Object object) {
try {
// a bit faster than resolving it each time
if (jdk8OptionalFactory == null) {
lookupOptionalFactoryMethod(type);
}
return jdk8OptionalFactory.invoke(null, object);
} catch (Exception e) {
throw new IllegalStateException("Failed to instantiate jdk Optional", e);
}
} | [
"private",
"static",
"Object",
"jdk8",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"Object",
"object",
")",
"{",
"try",
"{",
"// a bit faster than resolving it each time",
"if",
"(",
"jdk8OptionalFactory",
"==",
"null",
")",
"{",
"lookupOptionalF... | Only this will cause optional class loading and fail for earlier jdk.
@param object object for conversion
@return optional instance | [
"Only",
"this",
"will",
"cause",
"optional",
"class",
"loading",
"and",
"fail",
"for",
"earlier",
"jdk",
"."
] | train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/core/ext/service/result/converter/Optionals.java#L49-L59 |
rey5137/material | material/src/main/java/com/rey/material/widget/EditText.java | EditText.getOffsetForPosition | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public int getOffsetForPosition (float x, float y){
if (getLayout() == null) return -1;
final int line = getLineAtCoordinate(y);
final int offset = getOffsetAtCoordinate(line, x);
return offset;
} | java | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public int getOffsetForPosition (float x, float y){
if (getLayout() == null) return -1;
final int line = getLineAtCoordinate(y);
final int offset = getOffsetAtCoordinate(line, x);
return offset;
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"ICE_CREAM_SANDWICH",
")",
"public",
"int",
"getOffsetForPosition",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"if",
"(",
"getLayout",
"(",
")",
"==",
"null",
")",
"return",
"-",
"1",
";",
... | Get the character offset closest to the specified absolute position. A typical use case is to
pass the result of {@link android.view.MotionEvent#getX()} and {@link android.view.MotionEvent#getY()} to this method.
@param x The horizontal absolute position of a point on screen
@param y The vertical absolute position of a point on screen
@return the character offset for the character whose position is closest to the specified
position. Returns -1 if there is no layout. | [
"Get",
"the",
"character",
"offset",
"closest",
"to",
"the",
"specified",
"absolute",
"position",
".",
"A",
"typical",
"use",
"case",
"is",
"to",
"pass",
"the",
"result",
"of",
"{",
"@link",
"android",
".",
"view",
".",
"MotionEvent#getX",
"()",
"}",
"and"... | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L2099-L2105 |
biojava/biojava | biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureList.java | FeatureList.selectByUserData | public FeatureList selectByUserData(String key, Object value) {
FeatureList list = new FeatureList();
for (FeatureI f : this) {
Object o = f.userData().get(key);
if (o != null && o.equals(value)) {
list.add(f);
}
}
return list;
} | java | public FeatureList selectByUserData(String key, Object value) {
FeatureList list = new FeatureList();
for (FeatureI f : this) {
Object o = f.userData().get(key);
if (o != null && o.equals(value)) {
list.add(f);
}
}
return list;
} | [
"public",
"FeatureList",
"selectByUserData",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"FeatureList",
"list",
"=",
"new",
"FeatureList",
"(",
")",
";",
"for",
"(",
"FeatureI",
"f",
":",
"this",
")",
"{",
"Object",
"o",
"=",
"f",
".",
"use... | Create a list of all features that include the specified key/value pair in their userMap().
@param key The key to consider.
@param value The value to consider.
@return A list of features that include the key/value pair. | [
"Create",
"a",
"list",
"of",
"all",
"features",
"that",
"include",
"the",
"specified",
"key",
"/",
"value",
"pair",
"in",
"their",
"userMap",
"()",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureList.java#L319-L328 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/common/types/buildInfo/Env.java | Env.collectVariables | public void collectVariables(EnvVars env, Run build, TaskListener listener) {
EnvVars buildParameters = Utils.extractBuildParameters(build, listener);
if (buildParameters != null) {
env.putAll(buildParameters);
}
addAllWithFilter(envVars, env, filter.getPatternFilter());
Map<String, String> sysEnv = new HashMap<>();
Properties systemProperties = System.getProperties();
Enumeration<?> enumeration = systemProperties.propertyNames();
while (enumeration.hasMoreElements()) {
String propertyKey = (String) enumeration.nextElement();
sysEnv.put(propertyKey, systemProperties.getProperty(propertyKey));
}
addAllWithFilter(sysVars, sysEnv, filter.getPatternFilter());
} | java | public void collectVariables(EnvVars env, Run build, TaskListener listener) {
EnvVars buildParameters = Utils.extractBuildParameters(build, listener);
if (buildParameters != null) {
env.putAll(buildParameters);
}
addAllWithFilter(envVars, env, filter.getPatternFilter());
Map<String, String> sysEnv = new HashMap<>();
Properties systemProperties = System.getProperties();
Enumeration<?> enumeration = systemProperties.propertyNames();
while (enumeration.hasMoreElements()) {
String propertyKey = (String) enumeration.nextElement();
sysEnv.put(propertyKey, systemProperties.getProperty(propertyKey));
}
addAllWithFilter(sysVars, sysEnv, filter.getPatternFilter());
} | [
"public",
"void",
"collectVariables",
"(",
"EnvVars",
"env",
",",
"Run",
"build",
",",
"TaskListener",
"listener",
")",
"{",
"EnvVars",
"buildParameters",
"=",
"Utils",
".",
"extractBuildParameters",
"(",
"build",
",",
"listener",
")",
";",
"if",
"(",
"buildPa... | Collect environment variables and system properties under with filter constrains | [
"Collect",
"environment",
"variables",
"and",
"system",
"properties",
"under",
"with",
"filter",
"constrains"
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/types/buildInfo/Env.java#L36-L50 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java | JMElasticsearchSearchAndCount.searchAll | public SearchResponse searchAll(String index, String type,
QueryBuilder filterQueryBuilder) {
return searchAll(index, type, filterQueryBuilder, null);
} | java | public SearchResponse searchAll(String index, String type,
QueryBuilder filterQueryBuilder) {
return searchAll(index, type, filterQueryBuilder, null);
} | [
"public",
"SearchResponse",
"searchAll",
"(",
"String",
"index",
",",
"String",
"type",
",",
"QueryBuilder",
"filterQueryBuilder",
")",
"{",
"return",
"searchAll",
"(",
"index",
",",
"type",
",",
"filterQueryBuilder",
",",
"null",
")",
";",
"}"
] | Search all search response.
@param index the index
@param type the type
@param filterQueryBuilder the filter query builder
@return the search response | [
"Search",
"all",
"search",
"response",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java#L470-L473 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.